@openrouter/ai-sdk-provider 1.0.0-beta.6 → 1.0.0-beta.7
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/README.md +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -2
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +12 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +12 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenRouter Provider for Vercel AI SDK
|
|
2
2
|
|
|
3
|
-
The [OpenRouter](https://openrouter.ai/) provider for the [Vercel AI SDK](https://sdk.vercel.ai/docs) gives access to over 300 large language
|
|
3
|
+
The [OpenRouter](https://openrouter.ai/) provider for the [Vercel AI SDK](https://sdk.vercel.ai/docs) gives access to over 300 large language models on the OpenRouter chat and completion APIs.
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
@@ -126,7 +126,7 @@ await streamText({
|
|
|
126
126
|
{
|
|
127
127
|
role: 'system',
|
|
128
128
|
content:
|
|
129
|
-
'You are a podcast summary assistant. You are detail
|
|
129
|
+
'You are a podcast summary assistant. You are detail-oriented and critical about the content.',
|
|
130
130
|
},
|
|
131
131
|
{
|
|
132
132
|
role: 'user',
|
package/dist/index.d.mts
CHANGED
|
@@ -21,7 +21,7 @@ type OpenRouterChatSettings = {
|
|
|
21
21
|
/**
|
|
22
22
|
Return the log probabilities of the tokens. Including logprobs will increase
|
|
23
23
|
the response size and can slow down response times. However, it can
|
|
24
|
-
be useful to better
|
|
24
|
+
be useful to understand better how the model is behaving.
|
|
25
25
|
|
|
26
26
|
Setting to true will return the log probabilities of the tokens that
|
|
27
27
|
were generated.
|
|
@@ -277,7 +277,7 @@ declare class OpenRouter {
|
|
|
277
277
|
*/
|
|
278
278
|
readonly baseURL: string;
|
|
279
279
|
/**
|
|
280
|
-
API key that is being
|
|
280
|
+
API key that is being sent using the `Authorization` header.
|
|
281
281
|
It defaults to the `OPENROUTER_API_KEY` environment variable.
|
|
282
282
|
*/
|
|
283
283
|
readonly apiKey?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ type OpenRouterChatSettings = {
|
|
|
21
21
|
/**
|
|
22
22
|
Return the log probabilities of the tokens. Including logprobs will increase
|
|
23
23
|
the response size and can slow down response times. However, it can
|
|
24
|
-
be useful to better
|
|
24
|
+
be useful to understand better how the model is behaving.
|
|
25
25
|
|
|
26
26
|
Setting to true will return the log probabilities of the tokens that
|
|
27
27
|
were generated.
|
|
@@ -277,7 +277,7 @@ declare class OpenRouter {
|
|
|
277
277
|
*/
|
|
278
278
|
readonly baseURL: string;
|
|
279
279
|
/**
|
|
280
|
-
API key that is being
|
|
280
|
+
API key that is being sent using the `Authorization` header.
|
|
281
281
|
It defaults to the `OPENROUTER_API_KEY` environment variable.
|
|
282
282
|
*/
|
|
283
283
|
readonly apiKey?: string;
|
package/dist/index.js
CHANGED
|
@@ -1355,6 +1355,7 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1355
1355
|
tools,
|
|
1356
1356
|
toolChoice
|
|
1357
1357
|
}) {
|
|
1358
|
+
var _a15;
|
|
1358
1359
|
const baseArgs = __spreadValues(__spreadValues({
|
|
1359
1360
|
// model id:
|
|
1360
1361
|
model: this.modelId,
|
|
@@ -1382,9 +1383,18 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1382
1383
|
reasoning: this.settings.reasoning,
|
|
1383
1384
|
usage: this.settings.usage
|
|
1384
1385
|
}, this.config.extraBody), this.settings.extraBody);
|
|
1385
|
-
if ((responseFormat == null ? void 0 : responseFormat.type) === "json") {
|
|
1386
|
+
if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
|
|
1386
1387
|
return __spreadProps(__spreadValues({}, baseArgs), {
|
|
1387
|
-
response_format: {
|
|
1388
|
+
response_format: {
|
|
1389
|
+
type: "json_schema",
|
|
1390
|
+
json_schema: __spreadValues({
|
|
1391
|
+
schema: responseFormat.schema,
|
|
1392
|
+
strict: true,
|
|
1393
|
+
name: (_a15 = responseFormat.name) != null ? _a15 : "response"
|
|
1394
|
+
}, responseFormat.description && {
|
|
1395
|
+
description: responseFormat.description
|
|
1396
|
+
})
|
|
1397
|
+
}
|
|
1388
1398
|
});
|
|
1389
1399
|
}
|
|
1390
1400
|
if (tools && tools.length > 0) {
|