Skip to content

Commit

Permalink
Merge pull request #20 from slider23/patch-2
Browse files Browse the repository at this point in the history
feat: timeout adjusting
  • Loading branch information
moe-mizrak authored Sep 17, 2024
2 parents b6a197e + 0aea2d3 commit 55845d9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .env.ci
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
APP_ENV=testing

OPENROUTER_API_KEY=
OPENROUTER_API_ENDPOINT=
OPENROUTER_API_ENDPOINT=
OPENROUTER_API_TIMEOUT=
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
APP_ENV=local

OPENROUTER_API_KEY=
OPENROUTER_API_ENDPOINT=
OPENROUTER_API_ENDPOINT=
OPENROUTER_API_TIMEOUT=
10 changes: 10 additions & 0 deletions config/laravel-openrouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,14 @@
| Default value is https://openrouter.ai/api/v1/ , which is the base URL for all requests.
*/
'api_endpoint' => env('OPENROUTER_API_ENDPOINT', 'https://openrouter.ai/api/v1/'),

/*
|--------------------------------------------------------------------------
| OpenRouter Timeout
|--------------------------------------------------------------------------
|
| Request timeout in seconds. Increase value to 120 - 180 if you use long-thinking models like openai/o1
|
*/
'api_timeout' => env('OPENROUTER_API_TIMEOUT', 20),
];
2 changes: 1 addition & 1 deletion src/OpenRouterServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private function configureClient(): Client
*/
return new Client([
'base_uri' => config('laravel-openrouter.api_endpoint'),
'timeout' => self::DEFAULT_TIMEOUT,
'timeout' => config('laravel-openrouter.api_timeout', self::DEFAULT_TIMEOUT),
'handler' => $handlerStack,
'headers' => [
'Authorization' => 'Bearer ' . config('laravel-openrouter.api_key'),
Expand Down

0 comments on commit 55845d9

Please sign in to comment.