@openrouter/ai-sdk-provider 2.8.1 → 2.9.0
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 +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +19 -0
- package/dist/internal/index.d.ts +19 -0
- package/dist/internal/index.js +7 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +7 -7
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -184,6 +184,25 @@ type OpenRouterChatSettings = {
|
|
|
184
184
|
*/
|
|
185
185
|
echo_upstream_body?: boolean;
|
|
186
186
|
};
|
|
187
|
+
/**
|
|
188
|
+
* Structured-output options forwarded to OpenRouter's
|
|
189
|
+
* `response_format.json_schema` payload.
|
|
190
|
+
*
|
|
191
|
+
* Use this to opt out of strict mode for models whose providers don't
|
|
192
|
+
* advertise support for it (e.g. open-source models routed through
|
|
193
|
+
* non-OpenAI-compatible providers). When `strict` is left unset, the
|
|
194
|
+
* SDK defaults to `true` for backward compatibility.
|
|
195
|
+
*
|
|
196
|
+
* Only applies when a `responseFormat` with a `schema` is provided on
|
|
197
|
+
* the call site. Has no effect for `json_object` or text responses.
|
|
198
|
+
*/
|
|
199
|
+
structuredOutputs?: {
|
|
200
|
+
/**
|
|
201
|
+
* Whether to set `response_format.json_schema.strict` on the outbound
|
|
202
|
+
* request. Defaults to `true` when omitted.
|
|
203
|
+
*/
|
|
204
|
+
strict?: boolean;
|
|
205
|
+
};
|
|
187
206
|
/**
|
|
188
207
|
* Provider routing preferences to control request routing behavior
|
|
189
208
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -184,6 +184,25 @@ type OpenRouterChatSettings = {
|
|
|
184
184
|
*/
|
|
185
185
|
echo_upstream_body?: boolean;
|
|
186
186
|
};
|
|
187
|
+
/**
|
|
188
|
+
* Structured-output options forwarded to OpenRouter's
|
|
189
|
+
* `response_format.json_schema` payload.
|
|
190
|
+
*
|
|
191
|
+
* Use this to opt out of strict mode for models whose providers don't
|
|
192
|
+
* advertise support for it (e.g. open-source models routed through
|
|
193
|
+
* non-OpenAI-compatible providers). When `strict` is left unset, the
|
|
194
|
+
* SDK defaults to `true` for backward compatibility.
|
|
195
|
+
*
|
|
196
|
+
* Only applies when a `responseFormat` with a `schema` is provided on
|
|
197
|
+
* the call site. Has no effect for `json_object` or text responses.
|
|
198
|
+
*/
|
|
199
|
+
structuredOutputs?: {
|
|
200
|
+
/**
|
|
201
|
+
* Whether to set `response_format.json_schema.strict` on the outbound
|
|
202
|
+
* request. Defaults to `true` when omitted.
|
|
203
|
+
*/
|
|
204
|
+
strict?: boolean;
|
|
205
|
+
};
|
|
187
206
|
/**
|
|
188
207
|
* Provider routing preferences to control request routing behavior
|
|
189
208
|
*/
|
package/dist/index.js
CHANGED
|
@@ -3527,7 +3527,7 @@ var OpenRouterChatLanguageModel = class {
|
|
|
3527
3527
|
this.supportedUrls = {
|
|
3528
3528
|
"image/*": [
|
|
3529
3529
|
/^data:image\/[a-zA-Z]+;base64,/,
|
|
3530
|
-
/^https?:\/\/.+\.(jpg|jpeg|png|gif|webp)
|
|
3530
|
+
/^https?:\/\/.+\.(jpg|jpeg|png|gif|webp)(?:[?#].*)?$/i
|
|
3531
3531
|
],
|
|
3532
3532
|
// 'text/*': [/^data:text\//, /^https?:\/\/.+$/],
|
|
3533
3533
|
"application/*": [/^data:application\//, /^https?:\/\/.+$/]
|
|
@@ -3550,7 +3550,7 @@ var OpenRouterChatLanguageModel = class {
|
|
|
3550
3550
|
tools,
|
|
3551
3551
|
toolChoice
|
|
3552
3552
|
}) {
|
|
3553
|
-
var _a16, _b16;
|
|
3553
|
+
var _a16, _b16, _c, _d;
|
|
3554
3554
|
const baseArgs = __spreadValues(__spreadValues({
|
|
3555
3555
|
// model id:
|
|
3556
3556
|
model: this.modelId,
|
|
@@ -3573,8 +3573,8 @@ var OpenRouterChatLanguageModel = class {
|
|
|
3573
3573
|
type: "json_schema",
|
|
3574
3574
|
json_schema: __spreadValues({
|
|
3575
3575
|
schema: responseFormat.schema,
|
|
3576
|
-
strict: true,
|
|
3577
|
-
name: (
|
|
3576
|
+
strict: (_b16 = (_a16 = this.settings.structuredOutputs) == null ? void 0 : _a16.strict) != null ? _b16 : true,
|
|
3577
|
+
name: (_c = responseFormat.name) != null ? _c : "response"
|
|
3578
3578
|
}, responseFormat.description && {
|
|
3579
3579
|
description: responseFormat.description
|
|
3580
3580
|
})
|
|
@@ -3600,7 +3600,7 @@ var OpenRouterChatLanguageModel = class {
|
|
|
3600
3600
|
const mappedTools = [];
|
|
3601
3601
|
for (const tool2 of tools) {
|
|
3602
3602
|
if (tool2.type === "function") {
|
|
3603
|
-
const openrouterOptions = (
|
|
3603
|
+
const openrouterOptions = (_d = tool2.providerOptions) == null ? void 0 : _d.openrouter;
|
|
3604
3604
|
const eagerInputStreaming = openrouterOptions == null ? void 0 : openrouterOptions.eager_input_streaming;
|
|
3605
3605
|
mappedTools.push(__spreadValues({
|
|
3606
3606
|
type: "function",
|
|
@@ -4169,7 +4169,7 @@ var OpenRouterChatLanguageModel = class {
|
|
|
4169
4169
|
id: toolCall.id,
|
|
4170
4170
|
delta: (_s = toolCallDelta.function.arguments) != null ? _s : ""
|
|
4171
4171
|
});
|
|
4172
|
-
if (((_t = toolCall.function) == null ? void 0 : _t.name) != null && ((_u = toolCall.function) == null ? void 0 : _u.arguments) != null && isParsableJson(toolCall.function.arguments)) {
|
|
4172
|
+
if (!toolCall.sent && ((_t = toolCall.function) == null ? void 0 : _t.name) != null && ((_u = toolCall.function) == null ? void 0 : _u.arguments) != null && isParsableJson(toolCall.function.arguments)) {
|
|
4173
4173
|
controller.enqueue({
|
|
4174
4174
|
type: "tool-input-end",
|
|
4175
4175
|
id: toolCall.id
|
|
@@ -4475,7 +4475,7 @@ var OpenRouterCompletionLanguageModel = class {
|
|
|
4475
4475
|
this.supportedUrls = {
|
|
4476
4476
|
"image/*": [
|
|
4477
4477
|
/^data:image\/[a-zA-Z]+;base64,/,
|
|
4478
|
-
/^https?:\/\/.+\.(jpg|jpeg|png|gif|webp)
|
|
4478
|
+
/^https?:\/\/.+\.(jpg|jpeg|png|gif|webp)(?:[?#].*)?$/i
|
|
4479
4479
|
],
|
|
4480
4480
|
"text/*": [/^data:text\//, /^https?:\/\/.+$/],
|
|
4481
4481
|
"application/*": [/^data:application\//, /^https?:\/\/.+$/]
|
|
@@ -5101,7 +5101,7 @@ function withUserAgentSuffix2(headers, ...userAgentSuffixParts) {
|
|
|
5101
5101
|
}
|
|
5102
5102
|
|
|
5103
5103
|
// src/version.ts
|
|
5104
|
-
var VERSION2 = false ? "0.0.0-test" : "2.
|
|
5104
|
+
var VERSION2 = false ? "0.0.0-test" : "2.9.0";
|
|
5105
5105
|
|
|
5106
5106
|
// src/video/schemas.ts
|
|
5107
5107
|
var import_v411 = require("zod/v4");
|