@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 CHANGED
@@ -21,6 +21,12 @@ type IdModeration = 'moderation';
21
21
  * @see https://openrouter.ai/docs/guides/features/plugins/response-healing
22
22
  */
23
23
  type IdResponseHealing = 'response-healing';
24
+ /**
25
+ * Plugin identifier for auto-router model selection.
26
+ * Configures allowed models when using the openrouter/auto model.
27
+ * @see https://openrouter.ai/docs/guides/routing/routers/auto-router
28
+ */
29
+ type IdAutoRouter = 'auto-router';
24
30
  /**
25
31
  * Search engine options for web search.
26
32
  * Open enum - accepts known values or any string for forward compatibility.
@@ -112,6 +118,17 @@ type OpenRouterChatSettings = {
112
118
  * @see https://openrouter.ai/docs/guides/features/plugins/response-healing
113
119
  */
114
120
  id: IdResponseHealing;
121
+ } | {
122
+ /**
123
+ * Auto-router plugin - configures allowed models when using `openrouter/auto`.
124
+ *
125
+ * Use wildcard patterns to restrict which models the auto router can select from.
126
+ * When no `allowed_models` are specified, the auto router uses all supported models.
127
+ *
128
+ * @see https://openrouter.ai/docs/guides/routing/routers/auto-router
129
+ */
130
+ id: IdAutoRouter;
131
+ allowed_models?: string[];
115
132
  }>;
116
133
  /**
117
134
  * Built-in web search options for models that support native web search
package/dist/index.d.ts CHANGED
@@ -21,6 +21,12 @@ type IdModeration = 'moderation';
21
21
  * @see https://openrouter.ai/docs/guides/features/plugins/response-healing
22
22
  */
23
23
  type IdResponseHealing = 'response-healing';
24
+ /**
25
+ * Plugin identifier for auto-router model selection.
26
+ * Configures allowed models when using the openrouter/auto model.
27
+ * @see https://openrouter.ai/docs/guides/routing/routers/auto-router
28
+ */
29
+ type IdAutoRouter = 'auto-router';
24
30
  /**
25
31
  * Search engine options for web search.
26
32
  * Open enum - accepts known values or any string for forward compatibility.
@@ -112,6 +118,17 @@ type OpenRouterChatSettings = {
112
118
  * @see https://openrouter.ai/docs/guides/features/plugins/response-healing
113
119
  */
114
120
  id: IdResponseHealing;
121
+ } | {
122
+ /**
123
+ * Auto-router plugin - configures allowed models when using `openrouter/auto`.
124
+ *
125
+ * Use wildcard patterns to restrict which models the auto router can select from.
126
+ * When no `allowed_models` are specified, the auto router uses all supported models.
127
+ *
128
+ * @see https://openrouter.ai/docs/guides/routing/routers/auto-router
129
+ */
130
+ id: IdAutoRouter;
131
+ allowed_models?: string[];
115
132
  }>;
116
133
  /**
117
134
  * Built-in web search options for models that support native web search
package/dist/index.js CHANGED
@@ -2538,10 +2538,15 @@ function convertToOpenRouterChatMessages(prompt) {
2538
2538
  for (const { role, content, providerOptions } of prompt) {
2539
2539
  switch (role) {
2540
2540
  case "system": {
2541
+ const cacheControl = getCacheControl(providerOptions);
2541
2542
  messages.push({
2542
2543
  role: "system",
2543
- content,
2544
- cache_control: getCacheControl(providerOptions)
2544
+ content: [
2545
+ __spreadValues({
2546
+ type: "text",
2547
+ text: content
2548
+ }, cacheControl && { cache_control: cacheControl })
2549
+ ]
2545
2550
  });
2546
2551
  break;
2547
2552
  }
@@ -4521,7 +4526,7 @@ function withUserAgentSuffix2(headers, ...userAgentSuffixParts) {
4521
4526
  }
4522
4527
 
4523
4528
  // src/version.ts
4524
- var VERSION2 = false ? "0.0.0-test" : "2.1.3";
4529
+ var VERSION2 = false ? "0.0.0-test" : "2.2.1";
4525
4530
 
4526
4531
  // src/provider.ts
4527
4532
  function createOpenRouter(options = {}) {