Skip to content

Commit 55845d9

Browse files
authored
Merge pull request moe-mizrak#20 from slider23/patch-2
feat: timeout adjusting
2 parents b6a197e + 0aea2d3 commit 55845d9

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

.env.ci

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
APP_ENV=testing
22

33
OPENROUTER_API_KEY=
4-
OPENROUTER_API_ENDPOINT=
4+
OPENROUTER_API_ENDPOINT=
5+
OPENROUTER_API_TIMEOUT=

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
APP_ENV=local
22

33
OPENROUTER_API_KEY=
4-
OPENROUTER_API_ENDPOINT=
4+
OPENROUTER_API_ENDPOINT=
5+
OPENROUTER_API_TIMEOUT=

config/laravel-openrouter.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,14 @@
2424
| Default value is https://openrouter.ai/api/v1/ , which is the base URL for all requests.
2525
*/
2626
'api_endpoint' => env('OPENROUTER_API_ENDPOINT', 'https://openrouter.ai/api/v1/'),
27+
28+
/*
29+
|--------------------------------------------------------------------------
30+
| OpenRouter Timeout
31+
|--------------------------------------------------------------------------
32+
|
33+
| Request timeout in seconds. Increase value to 120 - 180 if you use long-thinking models like openai/o1
34+
|
35+
*/
36+
'api_timeout' => env('OPENROUTER_API_TIMEOUT', 20),
2737
];

src/OpenRouterServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ private function configureClient(): Client
116116
*/
117117
return new Client([
118118
'base_uri' => config('laravel-openrouter.api_endpoint'),
119-
'timeout' => self::DEFAULT_TIMEOUT,
119+
'timeout' => config('laravel-openrouter.api_timeout', self::DEFAULT_TIMEOUT),
120120
'handler' => $handlerStack,
121121
'headers' => [
122122
'Authorization' => 'Bearer ' . config('laravel-openrouter.api_key'),

0 commit comments

Comments
 (0)