@openrouter/ai-sdk-provider 2.1.3 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +17 -0
- package/dist/internal/index.d.ts +17 -0
- package/dist/internal/index.js +7 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +7 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -56,6 +56,12 @@ type IdModeration = 'moderation';
|
|
|
56
56
|
* @see https://openrouter.ai/docs/guides/features/plugins/response-healing
|
|
57
57
|
*/
|
|
58
58
|
type IdResponseHealing = 'response-healing';
|
|
59
|
+
/**
|
|
60
|
+
* Plugin identifier for auto-router model selection.
|
|
61
|
+
* Configures allowed models when using the openrouter/auto model.
|
|
62
|
+
* @see https://openrouter.ai/docs/guides/routing/routers/auto-router
|
|
63
|
+
*/
|
|
64
|
+
type IdAutoRouter = 'auto-router';
|
|
59
65
|
/**
|
|
60
66
|
* Search engine options for web search.
|
|
61
67
|
* Open enum - accepts known values or any string for forward compatibility.
|
|
@@ -147,6 +153,17 @@ type OpenRouterChatSettings = {
|
|
|
147
153
|
* @see https://openrouter.ai/docs/guides/features/plugins/response-healing
|
|
148
154
|
*/
|
|
149
155
|
id: IdResponseHealing;
|
|
156
|
+
} | {
|
|
157
|
+
/**
|
|
158
|
+
* Auto-router plugin - configures allowed models when using `openrouter/auto`.
|
|
159
|
+
*
|
|
160
|
+
* Use wildcard patterns to restrict which models the auto router can select from.
|
|
161
|
+
* When no `allowed_models` are specified, the auto router uses all supported models.
|
|
162
|
+
*
|
|
163
|
+
* @see https://openrouter.ai/docs/guides/routing/routers/auto-router
|
|
164
|
+
*/
|
|
165
|
+
id: IdAutoRouter;
|
|
166
|
+
allowed_models?: string[];
|
|
150
167
|
}>;
|
|
151
168
|
/**
|
|
152
169
|
* Built-in web search options for models that support native web search
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -56,6 +56,12 @@ type IdModeration = 'moderation';
|
|
|
56
56
|
* @see https://openrouter.ai/docs/guides/features/plugins/response-healing
|
|
57
57
|
*/
|
|
58
58
|
type IdResponseHealing = 'response-healing';
|
|
59
|
+
/**
|
|
60
|
+
* Plugin identifier for auto-router model selection.
|
|
61
|
+
* Configures allowed models when using the openrouter/auto model.
|
|
62
|
+
* @see https://openrouter.ai/docs/guides/routing/routers/auto-router
|
|
63
|
+
*/
|
|
64
|
+
type IdAutoRouter = 'auto-router';
|
|
59
65
|
/**
|
|
60
66
|
* Search engine options for web search.
|
|
61
67
|
* Open enum - accepts known values or any string for forward compatibility.
|
|
@@ -147,6 +153,17 @@ type OpenRouterChatSettings = {
|
|
|
147
153
|
* @see https://openrouter.ai/docs/guides/features/plugins/response-healing
|
|
148
154
|
*/
|
|
149
155
|
id: IdResponseHealing;
|
|
156
|
+
} | {
|
|
157
|
+
/**
|
|
158
|
+
* Auto-router plugin - configures allowed models when using `openrouter/auto`.
|
|
159
|
+
*
|
|
160
|
+
* Use wildcard patterns to restrict which models the auto router can select from.
|
|
161
|
+
* When no `allowed_models` are specified, the auto router uses all supported models.
|
|
162
|
+
*
|
|
163
|
+
* @see https://openrouter.ai/docs/guides/routing/routers/auto-router
|
|
164
|
+
*/
|
|
165
|
+
id: IdAutoRouter;
|
|
166
|
+
allowed_models?: string[];
|
|
150
167
|
}>;
|
|
151
168
|
/**
|
|
152
169
|
* Built-in web search options for models that support native web search
|
package/dist/internal/index.js
CHANGED
|
@@ -2504,10 +2504,15 @@ function convertToOpenRouterChatMessages(prompt) {
|
|
|
2504
2504
|
for (const { role, content, providerOptions } of prompt) {
|
|
2505
2505
|
switch (role) {
|
|
2506
2506
|
case "system": {
|
|
2507
|
+
const cacheControl = getCacheControl(providerOptions);
|
|
2507
2508
|
messages.push({
|
|
2508
2509
|
role: "system",
|
|
2509
|
-
content
|
|
2510
|
-
|
|
2510
|
+
content: [
|
|
2511
|
+
__spreadValues({
|
|
2512
|
+
type: "text",
|
|
2513
|
+
text: content
|
|
2514
|
+
}, cacheControl && { cache_control: cacheControl })
|
|
2515
|
+
]
|
|
2511
2516
|
});
|
|
2512
2517
|
break;
|
|
2513
2518
|
}
|