You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Laravel package provides an easy-to-use interface for integrating **[OpenRouter](https://openrouter.ai/)** into your Laravel applications. **OpenRouter** is a unified interface for Large Language Models (LLMs) that allows you to interact with various **[AI models](https://openrouter.ai/docs#models)** through a single API.
13
+
This Laravel package provides an easy-to-use interface for integrating **[OpenRouter](https://openrouter.ai/)** into your Laravel applications. **OpenRouter** is a unified interface for Large Language Models (LLMs) that allows you to interact with various **[AI models](https://openrouter.ai/models)** through a single API.
14
14
15
15
## Table of Contents
16
16
@@ -87,7 +87,7 @@ OPENROUTER_API_REFERER=
87
87
> [!NOTE]
88
88
>
89
89
> -`OPENROUTER_API_ENDPOINT`: The endpoint URL for the **OpenRouter API** (default: https://openrouter.ai/api/v1/).
90
-
> -`OPENROUTER_API_KEY`: Your **API key** for accessing the OpenRouter API. You can obtain this key from the [OpenRouter dashboard](https://openrouter.ai/keys).
90
+
> -`OPENROUTER_API_KEY`: Your **API key** for accessing the OpenRouter API. You can obtain this key from the [OpenRouter dashboard](https://openrouter.ai/settings/keys).
91
91
> -`OPENROUTER_API_TIMEOUT`: Request timeout in seconds. Increase value to 120 - 180 if you use long-thinking models like openai/o1 (default: 20)
92
92
> -`OPENROUTER_API_TITLE`: Optional - Site URL for rankings on openrouter.ai
93
93
> -`OPENROUTER_API_REFERER`: Optional - Site referer for rankings on openrouter.ai
@@ -116,7 +116,7 @@ The [`ChatData`](src/DTO/ChatData.php) class is used to **encapsulate the data**
116
116
117
117
#### LLM Parameters
118
118
119
-
These properties control various aspects of the generated response (more [info](https://openrouter.ai/docs#parameters)):
119
+
These properties control various aspects of the generated response (more [info](https://openrouter.ai/docs/api-reference/parameters)):
120
120
121
121
-**max_tokens** (int|null): The maximum number of tokens that can be generated in the completion. Default is 1024.
122
122
-**temperature** (float|null): A value between 0 and 2 controlling the randomness of the output.
@@ -212,7 +212,7 @@ To send a chat request, create an instance of [`ChatData`](src/DTO/ChatData.php)
212
212
213
213
```php
214
214
$content = 'Tell me a story about a rogue AI that falls in love with its creator.'; // Your desired prompt or content
215
-
$model = 'mistralai/mistral-7b-instruct:free'; // The OpenRouter model you want to use (https://openrouter.ai/docs#models)
215
+
$model = 'mistralai/mistral-7b-instruct:free'; // The OpenRouter model you want to use (https://openrouter.ai/models)
(Please also refer to [OpenRouter Document Structured Output](https://openrouter.ai/docs/structured-outputs) for models supporting structured output, also for more details)
455
+
(Please also refer to [OpenRouter Document Structured Output](https://openrouter.ai/docs/features/structured-outputs) for models supporting structured output, also for more details)
456
456
457
457
If you want to receive the response in a structured format, you can specify the `type` property for `response_format` ([ResponseFormatData](src/DTO/ResponseFormatData.php)) as `json_object` in the [`ChatData`](src/DTO/ChatData.php) object.
458
458
@@ -538,7 +538,7 @@ To retrieve the cost of a generation, first make a `chat request` and obtain the
538
538
539
539
```php
540
540
$content = 'Tell me a story about a rogue AI that falls in love with its creator.'; // Your desired prompt or content
541
-
$model = 'mistralai/mistral-7b-instruct:free'; // The OpenRouter model you want to use (https://openrouter.ai/docs#models)
541
+
$model = 'mistralai/mistral-7b-instruct:free'; // The OpenRouter model you want to use (https://openrouter.ai/models)
542
542
$messageData = new MessageData(
543
543
content: $content,
544
544
role : RoleType::USER,
@@ -580,7 +580,7 @@ Similarly, to send a chat request, create an instance of [`ChatData`](src/DTO/Ch
580
580
581
581
```php
582
582
$content = 'Tell me a story about a rogue AI that falls in love with its creator.'; // Your desired prompt or content
583
-
$model = 'mistralai/mistral-7b-instruct:free'; // The OpenRouter model you want to use (https://openrouter.ai/docs#models)
583
+
$model = 'mistralai/mistral-7b-instruct:free'; // The OpenRouter model you want to use (https://openrouter.ai/models)
584
584
$messageData = new MessageData(
585
585
content: $content,
586
586
role : RoleType::USER,
@@ -603,7 +603,7 @@ Similarly, to retrieve the cost of a generation, create a `chat request` to obta
603
603
604
604
```php
605
605
$content = 'Tell me a story about a rogue AI that falls in love with its creator.';
606
-
$model = 'mistralai/mistral-7b-instruct:free'; // The OpenRouter model you want to use (https://openrouter.ai/docs#models)
606
+
$model = 'mistralai/mistral-7b-instruct:free'; // The OpenRouter model you want to use (https://openrouter.ai/models)
0 commit comments