@openrouter/ai-sdk-provider 1.2.1 → 1.2.3
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 -13
- package/dist/index.d.ts +17 -13
- package/dist/index.js +217 -103
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +217 -103
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +49 -45
- package/dist/internal/index.d.ts +49 -45
- package/dist/internal/index.js +214 -100
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +214 -100
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +11 -3
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
import { LanguageModelV2, LanguageModelV2CallOptions, LanguageModelV2Content, LanguageModelV2FinishReason, LanguageModelV2Usage, LanguageModelV2CallWarning, LanguageModelV2ResponseMetadata, SharedV2Headers, LanguageModelV2StreamPart } from '@ai-sdk/provider';
|
|
2
2
|
export { LanguageModelV2, LanguageModelV2Prompt } from '@ai-sdk/provider';
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
|
+
import * as models from '@openrouter/sdk/models';
|
|
5
|
+
|
|
6
|
+
declare enum ReasoningFormat {
|
|
7
|
+
Unknown = "unknown",
|
|
8
|
+
OpenAIResponsesV1 = "openai-responses-v1",
|
|
9
|
+
XAIResponsesV1 = "xai-responses-v1",
|
|
10
|
+
AnthropicClaudeV1 = "anthropic-claude-v1"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare enum ReasoningDetailType {
|
|
14
|
+
Summary = "reasoning.summary",
|
|
15
|
+
Encrypted = "reasoning.encrypted",
|
|
16
|
+
Text = "reasoning.text"
|
|
17
|
+
}
|
|
18
|
+
declare const ReasoningDetailUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
19
|
+
type: z.ZodLiteral<ReasoningDetailType.Summary>;
|
|
20
|
+
summary: z.ZodString;
|
|
21
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
format: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ReasoningFormat>>>;
|
|
23
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
|
+
type: z.ZodLiteral<ReasoningDetailType.Encrypted>;
|
|
26
|
+
data: z.ZodString;
|
|
27
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
format: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ReasoningFormat>>>;
|
|
29
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<ReasoningDetailType.Text>;
|
|
32
|
+
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
signature: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
|
+
format: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ReasoningFormat>>>;
|
|
36
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, z.core.$strip>]>;
|
|
38
|
+
type ReasoningDetailUnion = z.infer<typeof ReasoningDetailUnionSchema>;
|
|
4
39
|
|
|
5
40
|
type OpenRouterProviderOptions = {
|
|
6
41
|
models?: string[];
|
|
@@ -159,18 +194,21 @@ type OpenRouterChatSettings = {
|
|
|
159
194
|
*/
|
|
160
195
|
user?: string;
|
|
161
196
|
/**
|
|
162
|
-
*
|
|
197
|
+
* Plugin configurations for enabling various capabilities
|
|
163
198
|
*/
|
|
164
199
|
plugins?: Array<{
|
|
165
|
-
id:
|
|
166
|
-
/**
|
|
167
|
-
* Maximum number of search results to include (default: 5)
|
|
168
|
-
*/
|
|
200
|
+
id: models.IdWeb;
|
|
169
201
|
max_results?: number;
|
|
170
|
-
/**
|
|
171
|
-
* Custom search prompt to guide the search query
|
|
172
|
-
*/
|
|
173
202
|
search_prompt?: string;
|
|
203
|
+
engine?: models.Engine;
|
|
204
|
+
} | {
|
|
205
|
+
id: models.IdFileParser;
|
|
206
|
+
max_files?: number;
|
|
207
|
+
pdf?: {
|
|
208
|
+
engine?: models.PdfEngine;
|
|
209
|
+
};
|
|
210
|
+
} | {
|
|
211
|
+
id: models.IdModeration;
|
|
174
212
|
}>;
|
|
175
213
|
/**
|
|
176
214
|
* Built-in web search options for models that support native web search
|
|
@@ -204,7 +242,7 @@ type OpenRouterChatSettings = {
|
|
|
204
242
|
/**
|
|
205
243
|
* Control whether to use providers that may store data
|
|
206
244
|
*/
|
|
207
|
-
data_collection?:
|
|
245
|
+
data_collection?: models.DataCollection;
|
|
208
246
|
/**
|
|
209
247
|
* List of provider slugs to allow for this request
|
|
210
248
|
*/
|
|
@@ -216,11 +254,11 @@ type OpenRouterChatSettings = {
|
|
|
216
254
|
/**
|
|
217
255
|
* List of quantization levels to filter by (e.g. ["int4", "int8"])
|
|
218
256
|
*/
|
|
219
|
-
quantizations?: Array<
|
|
257
|
+
quantizations?: Array<models.Quantization>;
|
|
220
258
|
/**
|
|
221
259
|
* Sort providers by price, throughput, or latency
|
|
222
260
|
*/
|
|
223
|
-
sort?:
|
|
261
|
+
sort?: models.Sort;
|
|
224
262
|
/**
|
|
225
263
|
* Maximum pricing you want to pay for this request
|
|
226
264
|
*/
|
|
@@ -234,40 +272,6 @@ type OpenRouterChatSettings = {
|
|
|
234
272
|
};
|
|
235
273
|
} & OpenRouterSharedSettings;
|
|
236
274
|
|
|
237
|
-
declare enum ReasoningFormat {
|
|
238
|
-
Unknown = "unknown",
|
|
239
|
-
OpenAIResponsesV1 = "openai-responses-v1",
|
|
240
|
-
XAIResponsesV1 = "xai-responses-v1",
|
|
241
|
-
AnthropicClaudeV1 = "anthropic-claude-v1"
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
declare enum ReasoningDetailType {
|
|
245
|
-
Summary = "reasoning.summary",
|
|
246
|
-
Encrypted = "reasoning.encrypted",
|
|
247
|
-
Text = "reasoning.text"
|
|
248
|
-
}
|
|
249
|
-
declare const ReasoningDetailUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
250
|
-
type: z.ZodLiteral<ReasoningDetailType.Summary>;
|
|
251
|
-
summary: z.ZodString;
|
|
252
|
-
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
253
|
-
format: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ReasoningFormat>>>;
|
|
254
|
-
index: z.ZodOptional<z.ZodNumber>;
|
|
255
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
256
|
-
type: z.ZodLiteral<ReasoningDetailType.Encrypted>;
|
|
257
|
-
data: z.ZodString;
|
|
258
|
-
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
259
|
-
format: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ReasoningFormat>>>;
|
|
260
|
-
index: z.ZodOptional<z.ZodNumber>;
|
|
261
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
262
|
-
type: z.ZodLiteral<ReasoningDetailType.Text>;
|
|
263
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
264
|
-
signature: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
265
|
-
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
266
|
-
format: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ReasoningFormat>>>;
|
|
267
|
-
index: z.ZodOptional<z.ZodNumber>;
|
|
268
|
-
}, z.core.$strip>]>;
|
|
269
|
-
type ReasoningDetailUnion = z.infer<typeof ReasoningDetailUnionSchema>;
|
|
270
|
-
|
|
271
275
|
type OpenRouterChatConfig = {
|
|
272
276
|
provider: string;
|
|
273
277
|
compatibility: 'strict' | 'compatible';
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
import { LanguageModelV2, LanguageModelV2CallOptions, LanguageModelV2Content, LanguageModelV2FinishReason, LanguageModelV2Usage, LanguageModelV2CallWarning, LanguageModelV2ResponseMetadata, SharedV2Headers, LanguageModelV2StreamPart } from '@ai-sdk/provider';
|
|
2
2
|
export { LanguageModelV2, LanguageModelV2Prompt } from '@ai-sdk/provider';
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
|
+
import * as models from '@openrouter/sdk/models';
|
|
5
|
+
|
|
6
|
+
declare enum ReasoningFormat {
|
|
7
|
+
Unknown = "unknown",
|
|
8
|
+
OpenAIResponsesV1 = "openai-responses-v1",
|
|
9
|
+
XAIResponsesV1 = "xai-responses-v1",
|
|
10
|
+
AnthropicClaudeV1 = "anthropic-claude-v1"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare enum ReasoningDetailType {
|
|
14
|
+
Summary = "reasoning.summary",
|
|
15
|
+
Encrypted = "reasoning.encrypted",
|
|
16
|
+
Text = "reasoning.text"
|
|
17
|
+
}
|
|
18
|
+
declare const ReasoningDetailUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
19
|
+
type: z.ZodLiteral<ReasoningDetailType.Summary>;
|
|
20
|
+
summary: z.ZodString;
|
|
21
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
format: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ReasoningFormat>>>;
|
|
23
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
|
+
type: z.ZodLiteral<ReasoningDetailType.Encrypted>;
|
|
26
|
+
data: z.ZodString;
|
|
27
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
format: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ReasoningFormat>>>;
|
|
29
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<ReasoningDetailType.Text>;
|
|
32
|
+
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
signature: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
|
+
format: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ReasoningFormat>>>;
|
|
36
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, z.core.$strip>]>;
|
|
38
|
+
type ReasoningDetailUnion = z.infer<typeof ReasoningDetailUnionSchema>;
|
|
4
39
|
|
|
5
40
|
type OpenRouterProviderOptions = {
|
|
6
41
|
models?: string[];
|
|
@@ -159,18 +194,21 @@ type OpenRouterChatSettings = {
|
|
|
159
194
|
*/
|
|
160
195
|
user?: string;
|
|
161
196
|
/**
|
|
162
|
-
*
|
|
197
|
+
* Plugin configurations for enabling various capabilities
|
|
163
198
|
*/
|
|
164
199
|
plugins?: Array<{
|
|
165
|
-
id:
|
|
166
|
-
/**
|
|
167
|
-
* Maximum number of search results to include (default: 5)
|
|
168
|
-
*/
|
|
200
|
+
id: models.IdWeb;
|
|
169
201
|
max_results?: number;
|
|
170
|
-
/**
|
|
171
|
-
* Custom search prompt to guide the search query
|
|
172
|
-
*/
|
|
173
202
|
search_prompt?: string;
|
|
203
|
+
engine?: models.Engine;
|
|
204
|
+
} | {
|
|
205
|
+
id: models.IdFileParser;
|
|
206
|
+
max_files?: number;
|
|
207
|
+
pdf?: {
|
|
208
|
+
engine?: models.PdfEngine;
|
|
209
|
+
};
|
|
210
|
+
} | {
|
|
211
|
+
id: models.IdModeration;
|
|
174
212
|
}>;
|
|
175
213
|
/**
|
|
176
214
|
* Built-in web search options for models that support native web search
|
|
@@ -204,7 +242,7 @@ type OpenRouterChatSettings = {
|
|
|
204
242
|
/**
|
|
205
243
|
* Control whether to use providers that may store data
|
|
206
244
|
*/
|
|
207
|
-
data_collection?:
|
|
245
|
+
data_collection?: models.DataCollection;
|
|
208
246
|
/**
|
|
209
247
|
* List of provider slugs to allow for this request
|
|
210
248
|
*/
|
|
@@ -216,11 +254,11 @@ type OpenRouterChatSettings = {
|
|
|
216
254
|
/**
|
|
217
255
|
* List of quantization levels to filter by (e.g. ["int4", "int8"])
|
|
218
256
|
*/
|
|
219
|
-
quantizations?: Array<
|
|
257
|
+
quantizations?: Array<models.Quantization>;
|
|
220
258
|
/**
|
|
221
259
|
* Sort providers by price, throughput, or latency
|
|
222
260
|
*/
|
|
223
|
-
sort?:
|
|
261
|
+
sort?: models.Sort;
|
|
224
262
|
/**
|
|
225
263
|
* Maximum pricing you want to pay for this request
|
|
226
264
|
*/
|
|
@@ -234,40 +272,6 @@ type OpenRouterChatSettings = {
|
|
|
234
272
|
};
|
|
235
273
|
} & OpenRouterSharedSettings;
|
|
236
274
|
|
|
237
|
-
declare enum ReasoningFormat {
|
|
238
|
-
Unknown = "unknown",
|
|
239
|
-
OpenAIResponsesV1 = "openai-responses-v1",
|
|
240
|
-
XAIResponsesV1 = "xai-responses-v1",
|
|
241
|
-
AnthropicClaudeV1 = "anthropic-claude-v1"
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
declare enum ReasoningDetailType {
|
|
245
|
-
Summary = "reasoning.summary",
|
|
246
|
-
Encrypted = "reasoning.encrypted",
|
|
247
|
-
Text = "reasoning.text"
|
|
248
|
-
}
|
|
249
|
-
declare const ReasoningDetailUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
250
|
-
type: z.ZodLiteral<ReasoningDetailType.Summary>;
|
|
251
|
-
summary: z.ZodString;
|
|
252
|
-
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
253
|
-
format: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ReasoningFormat>>>;
|
|
254
|
-
index: z.ZodOptional<z.ZodNumber>;
|
|
255
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
256
|
-
type: z.ZodLiteral<ReasoningDetailType.Encrypted>;
|
|
257
|
-
data: z.ZodString;
|
|
258
|
-
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
259
|
-
format: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ReasoningFormat>>>;
|
|
260
|
-
index: z.ZodOptional<z.ZodNumber>;
|
|
261
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
262
|
-
type: z.ZodLiteral<ReasoningDetailType.Text>;
|
|
263
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
264
|
-
signature: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
265
|
-
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
266
|
-
format: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof ReasoningFormat>>>;
|
|
267
|
-
index: z.ZodOptional<z.ZodNumber>;
|
|
268
|
-
}, z.core.$strip>]>;
|
|
269
|
-
type ReasoningDetailUnion = z.infer<typeof ReasoningDetailUnionSchema>;
|
|
270
|
-
|
|
271
275
|
type OpenRouterChatConfig = {
|
|
272
276
|
provider: string;
|
|
273
277
|
compatibility: 'strict' | 'compatible';
|