@openrouter/ai-sdk-provider 1.2.0 → 1.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 +36 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +250 -155
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +250 -155
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +36 -0
- package/dist/internal/index.d.ts +36 -0
- package/dist/internal/index.js +218 -148
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +218 -148
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
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
|
+
import { z } from 'zod/v4';
|
|
3
4
|
|
|
4
5
|
type OpenRouterProviderOptions = {
|
|
5
6
|
models?: string[];
|
|
@@ -233,6 +234,40 @@ type OpenRouterChatSettings = {
|
|
|
233
234
|
};
|
|
234
235
|
} & OpenRouterSharedSettings;
|
|
235
236
|
|
|
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
|
+
|
|
236
271
|
type OpenRouterChatConfig = {
|
|
237
272
|
provider: string;
|
|
238
273
|
compatibility: 'strict' | 'compatible';
|
|
@@ -262,6 +297,7 @@ declare class OpenRouterChatLanguageModel implements LanguageModelV2 {
|
|
|
262
297
|
providerMetadata?: {
|
|
263
298
|
openrouter: {
|
|
264
299
|
provider: string;
|
|
300
|
+
reasoning_details?: ReasoningDetailUnion[];
|
|
265
301
|
usage: OpenRouterUsageAccounting;
|
|
266
302
|
};
|
|
267
303
|
};
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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
|
+
import { z } from 'zod/v4';
|
|
3
4
|
|
|
4
5
|
type OpenRouterProviderOptions = {
|
|
5
6
|
models?: string[];
|
|
@@ -233,6 +234,40 @@ type OpenRouterChatSettings = {
|
|
|
233
234
|
};
|
|
234
235
|
} & OpenRouterSharedSettings;
|
|
235
236
|
|
|
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
|
+
|
|
236
271
|
type OpenRouterChatConfig = {
|
|
237
272
|
provider: string;
|
|
238
273
|
compatibility: 'strict' | 'compatible';
|
|
@@ -262,6 +297,7 @@ declare class OpenRouterChatLanguageModel implements LanguageModelV2 {
|
|
|
262
297
|
providerMetadata?: {
|
|
263
298
|
openrouter: {
|
|
264
299
|
provider: string;
|
|
300
|
+
reasoning_details?: ReasoningDetailUnion[];
|
|
265
301
|
usage: OpenRouterUsageAccounting;
|
|
266
302
|
};
|
|
267
303
|
};
|