@openrouter/sdk 1.0.17 → 1.0.19

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.
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
49
49
  export declare const SDK_METADATA: {
50
50
  readonly language: "typescript";
51
51
  readonly openapiDocVersion: "1.0.0";
52
- readonly sdkVersion: "1.0.17";
52
+ readonly sdkVersion: "1.0.19";
53
53
  readonly genVersion: "2.914.0";
54
- readonly userAgent: "speakeasy-sdk/typescript 1.0.17 2.914.0 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 1.0.19 2.914.0 1.0.0 @openrouter/sdk";
55
55
  };
56
56
  //# sourceMappingURL=config.d.ts.map
package/esm/lib/config.js CHANGED
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
26
26
  export const SDK_METADATA = {
27
27
  language: "typescript",
28
28
  openapiDocVersion: "1.0.0",
29
- sdkVersion: "1.0.17",
29
+ sdkVersion: "1.0.19",
30
30
  genVersion: "2.914.0",
31
- userAgent: "speakeasy-sdk/typescript 1.0.17 2.914.0 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 1.0.19 2.914.0 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -43,10 +43,10 @@ export type AdditionalToolsItemTool = {
43
43
  [k: string]: any;
44
44
  } | undefined;
45
45
  };
46
- export declare const AdditionalToolsItemToolType: {
46
+ export declare const AdditionalToolsItemTypeFunction: {
47
47
  readonly Function: "function";
48
48
  };
49
- export type AdditionalToolsItemToolType = ClosedEnum<typeof AdditionalToolsItemToolType>;
49
+ export type AdditionalToolsItemTypeFunction = ClosedEnum<typeof AdditionalToolsItemTypeFunction>;
50
50
  /**
51
51
  * Function tool definition
52
52
  */
@@ -57,7 +57,7 @@ export type AdditionalToolsItemToolFunction = {
57
57
  [k: string]: any;
58
58
  } | null;
59
59
  strict?: boolean | null | undefined;
60
- type: AdditionalToolsItemToolType;
60
+ type: AdditionalToolsItemTypeFunction;
61
61
  };
62
62
  export type AdditionalToolsItemToolUnion = ComputerUseServerTool | NamespaceTool | AdditionalToolsItemToolFunction | FileSearchServerTool | CodeInterpreterServerTool | McpServerTool | CustomTool | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | AdvisorServerToolOpenRouter | SubagentServerToolOpenRouter | DatetimeServerTool | FilesServerTool | FusionServerToolOpenRouter | ImageGenerationServerToolOpenRouter | SearchModelsServerToolOpenRouter | WebFetchServerTool | WebSearchServerToolOpenRouter | ApplyPatchServerToolOpenRouter | BashServerTool | ShellServerToolOpenRouter | AdditionalToolsItemTool;
63
63
  export declare const TypeAdditionalTools: {
@@ -84,7 +84,7 @@ export type AdditionalToolsItemTool$Outbound = {
84
84
  export declare const AdditionalToolsItemTool$outboundSchema: z.ZodType<AdditionalToolsItemTool$Outbound, AdditionalToolsItemTool>;
85
85
  export declare function additionalToolsItemToolToJSON(additionalToolsItemTool: AdditionalToolsItemTool): string;
86
86
  /** @internal */
87
- export declare const AdditionalToolsItemToolType$outboundSchema: z.ZodEnum<typeof AdditionalToolsItemToolType>;
87
+ export declare const AdditionalToolsItemTypeFunction$outboundSchema: z.ZodEnum<typeof AdditionalToolsItemTypeFunction>;
88
88
  /** @internal */
89
89
  export type AdditionalToolsItemToolFunction$Outbound = {
90
90
  description?: string | null | undefined;
@@ -41,7 +41,7 @@ export const AdditionalToolsItemRole = {
41
41
  Developer: "developer",
42
42
  Tool: "tool",
43
43
  };
44
- export const AdditionalToolsItemToolType = {
44
+ export const AdditionalToolsItemTypeFunction = {
45
45
  Function: "function",
46
46
  };
47
47
  export const TypeAdditionalTools = {
@@ -65,14 +65,14 @@ export function additionalToolsItemToolToJSON(additionalToolsItemTool) {
65
65
  return JSON.stringify(AdditionalToolsItemTool$outboundSchema.parse(additionalToolsItemTool));
66
66
  }
67
67
  /** @internal */
68
- export const AdditionalToolsItemToolType$outboundSchema = z.enum(AdditionalToolsItemToolType);
68
+ export const AdditionalToolsItemTypeFunction$outboundSchema = z.enum(AdditionalToolsItemTypeFunction);
69
69
  /** @internal */
70
70
  export const AdditionalToolsItemToolFunction$outboundSchema = z.object({
71
71
  description: z.nullable(z.string()).optional(),
72
72
  name: z.string(),
73
73
  parameters: z.nullable(z.record(z.string(), z.any())),
74
74
  strict: z.nullable(z.boolean()).optional(),
75
- type: AdditionalToolsItemToolType$outboundSchema,
75
+ type: AdditionalToolsItemTypeFunction$outboundSchema,
76
76
  });
77
77
  export function additionalToolsItemToolFunctionToJSON(additionalToolsItemToolFunction) {
78
78
  return JSON.stringify(AdditionalToolsItemToolFunction$outboundSchema.parse(additionalToolsItemToolFunction));
@@ -377,6 +377,9 @@ export type ImageGenerationProviderPreferencesOptions = {
377
377
  venice?: {
378
378
  [k: string]: any;
379
379
  } | undefined;
380
+ voyageai?: {
381
+ [k: string]: any;
382
+ } | undefined;
380
383
  wafer?: {
381
384
  [k: string]: any;
382
385
  } | undefined;
@@ -812,6 +815,9 @@ export type ImageGenerationProviderPreferencesOptions$Outbound = {
812
815
  venice?: {
813
816
  [k: string]: any;
814
817
  } | undefined;
818
+ voyageai?: {
819
+ [k: string]: any;
820
+ } | undefined;
815
821
  wafer?: {
816
822
  [k: string]: any;
817
823
  } | undefined;
@@ -142,6 +142,7 @@ export const ImageGenerationProviderPreferencesOptions$outboundSchema = z.object
142
142
  ubicloud: z.record(z.string(), z.any()).optional(),
143
143
  upstage: z.record(z.string(), z.any()).optional(),
144
144
  venice: z.record(z.string(), z.any()).optional(),
145
+ voyageai: z.record(z.string(), z.any()).optional(),
145
146
  wafer: z.record(z.string(), z.any()).optional(),
146
147
  wandb: z.record(z.string(), z.any()).optional(),
147
148
  wandbLegacy: z.record(z.string(), z.any()).optional(),
@@ -301,6 +301,8 @@ export * from "./messagesmessageparam.js";
301
301
  export * from "./messagesoutputconfig.js";
302
302
  export * from "./messagesrequest.js";
303
303
  export * from "./messagessearchmodelsservertool.js";
304
+ export * from "./messagestooladditionblock.js";
305
+ export * from "./messagestoolremovalblock.js";
304
306
  export * from "./metadatalevel.js";
305
307
  export * from "./model.js";
306
308
  export * from "./modelarchitecture.js";
@@ -305,6 +305,8 @@ export * from "./messagesmessageparam.js";
305
305
  export * from "./messagesoutputconfig.js";
306
306
  export * from "./messagesrequest.js";
307
307
  export * from "./messagessearchmodelsservertool.js";
308
+ export * from "./messagestooladditionblock.js";
309
+ export * from "./messagestoolremovalblock.js";
308
310
  export * from "./metadatalevel.js";
309
311
  export * from "./model.js";
310
312
  export * from "./modelarchitecture.js";
@@ -7,12 +7,15 @@ import { AnthropicSearchResultBlockParam, AnthropicSearchResultBlockParam$Outbou
7
7
  import { AnthropicTextBlockParam, AnthropicTextBlockParam$Outbound } from "./anthropictextblockparam.js";
8
8
  import { AnthropicWebSearchResultBlockParam, AnthropicWebSearchResultBlockParam$Outbound } from "./anthropicwebsearchresultblockparam.js";
9
9
  import { MessagesAdvisorToolResultBlock, MessagesAdvisorToolResultBlock$Outbound } from "./messagesadvisortoolresultblock.js";
10
+ import { MessagesToolAdditionBlock, MessagesToolAdditionBlock$Outbound } from "./messagestooladditionblock.js";
11
+ import { MessagesToolRemovalBlock, MessagesToolRemovalBlock$Outbound } from "./messagestoolremovalblock.js";
10
12
  export type ContentCompaction = {
11
13
  /**
12
14
  * Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.
13
15
  */
14
16
  cacheControl?: AnthropicCacheControlDirective | undefined;
15
17
  content: string | null;
18
+ encryptedContent?: string | null | undefined;
16
19
  type: "compaction";
17
20
  };
18
21
  export declare const ErrorCode: {
@@ -86,8 +89,8 @@ export type ContentToolUse = {
86
89
  name: string;
87
90
  type: "tool_use";
88
91
  };
89
- export type MessagesMessageParamContentUnion4 = AnthropicTextBlockParam | AnthropicImageBlockParam | AnthropicDocumentBlockParam | ContentToolUse | ContentToolResult | ContentThinking | ContentRedactedThinking | ContentServerToolUse | ContentWebSearchToolResult | AnthropicSearchResultBlockParam | ContentCompaction | MessagesAdvisorToolResultBlock;
90
- export type MessagesMessageParamContentUnion5 = string | Array<AnthropicTextBlockParam | AnthropicImageBlockParam | AnthropicDocumentBlockParam | ContentToolUse | ContentToolResult | ContentThinking | ContentRedactedThinking | ContentServerToolUse | ContentWebSearchToolResult | AnthropicSearchResultBlockParam | ContentCompaction | MessagesAdvisorToolResultBlock>;
92
+ export type MessagesMessageParamContentUnion4 = AnthropicTextBlockParam | AnthropicImageBlockParam | AnthropicDocumentBlockParam | ContentToolUse | ContentToolResult | ContentThinking | ContentRedactedThinking | ContentServerToolUse | ContentWebSearchToolResult | AnthropicSearchResultBlockParam | ContentCompaction | MessagesAdvisorToolResultBlock | MessagesToolAdditionBlock | MessagesToolRemovalBlock;
93
+ export type MessagesMessageParamContentUnion5 = string | Array<AnthropicTextBlockParam | AnthropicImageBlockParam | AnthropicDocumentBlockParam | ContentToolUse | ContentToolResult | ContentThinking | ContentRedactedThinking | ContentServerToolUse | ContentWebSearchToolResult | AnthropicSearchResultBlockParam | ContentCompaction | MessagesAdvisorToolResultBlock | MessagesToolAdditionBlock | MessagesToolRemovalBlock>;
91
94
  export declare const MessagesMessageParamRole: {
92
95
  readonly User: "user";
93
96
  readonly Assistant: "assistant";
@@ -98,13 +101,14 @@ export type MessagesMessageParamRole = OpenEnum<typeof MessagesMessageParamRole>
98
101
  * Anthropic message with OpenRouter extensions
99
102
  */
100
103
  export type MessagesMessageParam = {
101
- content: string | Array<AnthropicTextBlockParam | AnthropicImageBlockParam | AnthropicDocumentBlockParam | ContentToolUse | ContentToolResult | ContentThinking | ContentRedactedThinking | ContentServerToolUse | ContentWebSearchToolResult | AnthropicSearchResultBlockParam | ContentCompaction | MessagesAdvisorToolResultBlock>;
104
+ content: string | Array<AnthropicTextBlockParam | AnthropicImageBlockParam | AnthropicDocumentBlockParam | ContentToolUse | ContentToolResult | ContentThinking | ContentRedactedThinking | ContentServerToolUse | ContentWebSearchToolResult | AnthropicSearchResultBlockParam | ContentCompaction | MessagesAdvisorToolResultBlock | MessagesToolAdditionBlock | MessagesToolRemovalBlock>;
102
105
  role: MessagesMessageParamRole;
103
106
  };
104
107
  /** @internal */
105
108
  export type ContentCompaction$Outbound = {
106
109
  cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
107
110
  content: string | null;
111
+ encrypted_content?: string | null | undefined;
108
112
  type: "compaction";
109
113
  };
110
114
  /** @internal */
@@ -206,12 +210,12 @@ export type ContentToolUse$Outbound = {
206
210
  export declare const ContentToolUse$outboundSchema: z.ZodType<ContentToolUse$Outbound, ContentToolUse>;
207
211
  export declare function contentToolUseToJSON(contentToolUse: ContentToolUse): string;
208
212
  /** @internal */
209
- export type MessagesMessageParamContentUnion4$Outbound = AnthropicTextBlockParam$Outbound | AnthropicImageBlockParam$Outbound | AnthropicDocumentBlockParam$Outbound | ContentToolUse$Outbound | ContentToolResult$Outbound | ContentThinking$Outbound | ContentRedactedThinking$Outbound | ContentServerToolUse$Outbound | ContentWebSearchToolResult$Outbound | AnthropicSearchResultBlockParam$Outbound | ContentCompaction$Outbound | MessagesAdvisorToolResultBlock$Outbound;
213
+ export type MessagesMessageParamContentUnion4$Outbound = AnthropicTextBlockParam$Outbound | AnthropicImageBlockParam$Outbound | AnthropicDocumentBlockParam$Outbound | ContentToolUse$Outbound | ContentToolResult$Outbound | ContentThinking$Outbound | ContentRedactedThinking$Outbound | ContentServerToolUse$Outbound | ContentWebSearchToolResult$Outbound | AnthropicSearchResultBlockParam$Outbound | ContentCompaction$Outbound | MessagesAdvisorToolResultBlock$Outbound | MessagesToolAdditionBlock$Outbound | MessagesToolRemovalBlock$Outbound;
210
214
  /** @internal */
211
215
  export declare const MessagesMessageParamContentUnion4$outboundSchema: z.ZodType<MessagesMessageParamContentUnion4$Outbound, MessagesMessageParamContentUnion4>;
212
216
  export declare function messagesMessageParamContentUnion4ToJSON(messagesMessageParamContentUnion4: MessagesMessageParamContentUnion4): string;
213
217
  /** @internal */
214
- export type MessagesMessageParamContentUnion5$Outbound = string | Array<AnthropicTextBlockParam$Outbound | AnthropicImageBlockParam$Outbound | AnthropicDocumentBlockParam$Outbound | ContentToolUse$Outbound | ContentToolResult$Outbound | ContentThinking$Outbound | ContentRedactedThinking$Outbound | ContentServerToolUse$Outbound | ContentWebSearchToolResult$Outbound | AnthropicSearchResultBlockParam$Outbound | ContentCompaction$Outbound | MessagesAdvisorToolResultBlock$Outbound>;
218
+ export type MessagesMessageParamContentUnion5$Outbound = string | Array<AnthropicTextBlockParam$Outbound | AnthropicImageBlockParam$Outbound | AnthropicDocumentBlockParam$Outbound | ContentToolUse$Outbound | ContentToolResult$Outbound | ContentThinking$Outbound | ContentRedactedThinking$Outbound | ContentServerToolUse$Outbound | ContentWebSearchToolResult$Outbound | AnthropicSearchResultBlockParam$Outbound | ContentCompaction$Outbound | MessagesAdvisorToolResultBlock$Outbound | MessagesToolAdditionBlock$Outbound | MessagesToolRemovalBlock$Outbound>;
215
219
  /** @internal */
216
220
  export declare const MessagesMessageParamContentUnion5$outboundSchema: z.ZodType<MessagesMessageParamContentUnion5$Outbound, MessagesMessageParamContentUnion5>;
217
221
  export declare function messagesMessageParamContentUnion5ToJSON(messagesMessageParamContentUnion5: MessagesMessageParamContentUnion5): string;
@@ -219,7 +223,7 @@ export declare function messagesMessageParamContentUnion5ToJSON(messagesMessageP
219
223
  export declare const MessagesMessageParamRole$outboundSchema: z.ZodType<string, MessagesMessageParamRole>;
220
224
  /** @internal */
221
225
  export type MessagesMessageParam$Outbound = {
222
- content: string | Array<AnthropicTextBlockParam$Outbound | AnthropicImageBlockParam$Outbound | AnthropicDocumentBlockParam$Outbound | ContentToolUse$Outbound | ContentToolResult$Outbound | ContentThinking$Outbound | ContentRedactedThinking$Outbound | ContentServerToolUse$Outbound | ContentWebSearchToolResult$Outbound | AnthropicSearchResultBlockParam$Outbound | ContentCompaction$Outbound | MessagesAdvisorToolResultBlock$Outbound>;
226
+ content: string | Array<AnthropicTextBlockParam$Outbound | AnthropicImageBlockParam$Outbound | AnthropicDocumentBlockParam$Outbound | ContentToolUse$Outbound | ContentToolResult$Outbound | ContentThinking$Outbound | ContentRedactedThinking$Outbound | ContentServerToolUse$Outbound | ContentWebSearchToolResult$Outbound | AnthropicSearchResultBlockParam$Outbound | ContentCompaction$Outbound | MessagesAdvisorToolResultBlock$Outbound | MessagesToolAdditionBlock$Outbound | MessagesToolRemovalBlock$Outbound>;
223
227
  role: string;
224
228
  };
225
229
  /** @internal */
@@ -12,6 +12,8 @@ import { AnthropicSearchResultBlockParam$outboundSchema, } from "./anthropicsear
12
12
  import { AnthropicTextBlockParam$outboundSchema, } from "./anthropictextblockparam.js";
13
13
  import { AnthropicWebSearchResultBlockParam$outboundSchema, } from "./anthropicwebsearchresultblockparam.js";
14
14
  import { MessagesAdvisorToolResultBlock$outboundSchema, } from "./messagesadvisortoolresultblock.js";
15
+ import { MessagesToolAdditionBlock$outboundSchema, } from "./messagestooladditionblock.js";
16
+ import { MessagesToolRemovalBlock$outboundSchema, } from "./messagestoolremovalblock.js";
15
17
  export const ErrorCode = {
16
18
  InvalidToolInput: "invalid_tool_input",
17
19
  Unavailable: "unavailable",
@@ -31,10 +33,12 @@ export const MessagesMessageParamRole = {
31
33
  export const ContentCompaction$outboundSchema = z.object({
32
34
  cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
33
35
  content: z.nullable(z.string()),
36
+ encryptedContent: z.nullable(z.string()).optional(),
34
37
  type: z.literal("compaction"),
35
38
  }).transform((v) => {
36
39
  return remap$(v, {
37
40
  cacheControl: "cache_control",
41
+ encryptedContent: "encrypted_content",
38
42
  });
39
43
  });
40
44
  export function contentCompactionToJSON(contentCompaction) {
@@ -207,6 +211,8 @@ export const MessagesMessageParamContentUnion4$outboundSchema = z.union([
207
211
  AnthropicSearchResultBlockParam$outboundSchema,
208
212
  z.lazy(() => ContentCompaction$outboundSchema),
209
213
  MessagesAdvisorToolResultBlock$outboundSchema,
214
+ MessagesToolAdditionBlock$outboundSchema,
215
+ MessagesToolRemovalBlock$outboundSchema,
210
216
  ]);
211
217
  export function messagesMessageParamContentUnion4ToJSON(messagesMessageParamContentUnion4) {
212
218
  return JSON.stringify(MessagesMessageParamContentUnion4$outboundSchema.parse(messagesMessageParamContentUnion4));
@@ -227,6 +233,8 @@ export const MessagesMessageParamContentUnion5$outboundSchema = z.union([
227
233
  AnthropicSearchResultBlockParam$outboundSchema,
228
234
  z.lazy(() => ContentCompaction$outboundSchema),
229
235
  MessagesAdvisorToolResultBlock$outboundSchema,
236
+ MessagesToolAdditionBlock$outboundSchema,
237
+ MessagesToolRemovalBlock$outboundSchema,
230
238
  ])),
231
239
  ]);
232
240
  export function messagesMessageParamContentUnion5ToJSON(messagesMessageParamContentUnion5) {
@@ -251,6 +259,8 @@ export const MessagesMessageParam$outboundSchema = z.object({
251
259
  AnthropicSearchResultBlockParam$outboundSchema,
252
260
  z.lazy(() => ContentCompaction$outboundSchema),
253
261
  MessagesAdvisorToolResultBlock$outboundSchema,
262
+ MessagesToolAdditionBlock$outboundSchema,
263
+ MessagesToolRemovalBlock$outboundSchema,
254
264
  ])),
255
265
  ]),
256
266
  role: MessagesMessageParamRole$outboundSchema,
@@ -241,6 +241,7 @@ export type ToolCustom = {
241
241
  * Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.
242
242
  */
243
243
  cacheControl?: AnthropicCacheControlDirective | undefined;
244
+ deferLoading?: boolean | undefined;
244
245
  description?: string | undefined;
245
246
  inputSchema: InputSchema;
246
247
  name: string;
@@ -570,6 +571,7 @@ export declare const ToolTypeCustom$outboundSchema: z.ZodEnum<typeof ToolTypeCus
570
571
  /** @internal */
571
572
  export type ToolCustom$Outbound = {
572
573
  cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
574
+ defer_loading?: boolean | undefined;
573
575
  description?: string | undefined;
574
576
  input_schema: InputSchema$Outbound;
575
577
  name: string;
@@ -484,6 +484,7 @@ export const ToolTypeCustom$outboundSchema = z
484
484
  /** @internal */
485
485
  export const ToolCustom$outboundSchema = z.object({
486
486
  cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
487
+ deferLoading: z.boolean().optional(),
487
488
  description: z.string().optional(),
488
489
  inputSchema: z.lazy(() => InputSchema$outboundSchema),
489
490
  name: z.string(),
@@ -491,6 +492,7 @@ export const ToolCustom$outboundSchema = z.object({
491
492
  }).transform((v) => {
492
493
  return remap$(v, {
493
494
  cacheControl: "cache_control",
495
+ deferLoading: "defer_loading",
494
496
  inputSchema: "input_schema",
495
497
  });
496
498
  });
@@ -0,0 +1,67 @@
1
+ import * as z from "zod/v4";
2
+ import { AnthropicCacheControlDirective, AnthropicCacheControlDirective$Outbound } from "./anthropiccachecontroldirective.js";
3
+ export type MessagesToolAdditionBlockToolMcpToolsetReference = {
4
+ serverName: string;
5
+ type: "mcp_toolset_reference";
6
+ };
7
+ export type MessagesToolAdditionBlockToolMcpToolReference = {
8
+ name: string;
9
+ serverName: string;
10
+ type: "mcp_tool_reference";
11
+ };
12
+ export type MessagesToolAdditionBlockToolToolReference = {
13
+ name: string;
14
+ type: "tool_reference";
15
+ };
16
+ export type MessagesToolAdditionBlockToolUnion = MessagesToolAdditionBlockToolToolReference | MessagesToolAdditionBlockToolMcpToolReference | MessagesToolAdditionBlockToolMcpToolsetReference;
17
+ /**
18
+ * Loads a previously deferred tool (declared in `tools` with `defer_loading: true`) mid-conversation without invalidating the prompt cache. Only valid in `role: "system"` messages. Not supported on Claude Sonnet 5 or models older than Claude Opus 4.8.
19
+ */
20
+ export type MessagesToolAdditionBlock = {
21
+ /**
22
+ * Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.
23
+ */
24
+ cacheControl?: AnthropicCacheControlDirective | undefined;
25
+ tool: MessagesToolAdditionBlockToolToolReference | MessagesToolAdditionBlockToolMcpToolReference | MessagesToolAdditionBlockToolMcpToolsetReference;
26
+ type: "tool_addition";
27
+ };
28
+ /** @internal */
29
+ export type MessagesToolAdditionBlockToolMcpToolsetReference$Outbound = {
30
+ server_name: string;
31
+ type: "mcp_toolset_reference";
32
+ };
33
+ /** @internal */
34
+ export declare const MessagesToolAdditionBlockToolMcpToolsetReference$outboundSchema: z.ZodType<MessagesToolAdditionBlockToolMcpToolsetReference$Outbound, MessagesToolAdditionBlockToolMcpToolsetReference>;
35
+ export declare function messagesToolAdditionBlockToolMcpToolsetReferenceToJSON(messagesToolAdditionBlockToolMcpToolsetReference: MessagesToolAdditionBlockToolMcpToolsetReference): string;
36
+ /** @internal */
37
+ export type MessagesToolAdditionBlockToolMcpToolReference$Outbound = {
38
+ name: string;
39
+ server_name: string;
40
+ type: "mcp_tool_reference";
41
+ };
42
+ /** @internal */
43
+ export declare const MessagesToolAdditionBlockToolMcpToolReference$outboundSchema: z.ZodType<MessagesToolAdditionBlockToolMcpToolReference$Outbound, MessagesToolAdditionBlockToolMcpToolReference>;
44
+ export declare function messagesToolAdditionBlockToolMcpToolReferenceToJSON(messagesToolAdditionBlockToolMcpToolReference: MessagesToolAdditionBlockToolMcpToolReference): string;
45
+ /** @internal */
46
+ export type MessagesToolAdditionBlockToolToolReference$Outbound = {
47
+ name: string;
48
+ type: "tool_reference";
49
+ };
50
+ /** @internal */
51
+ export declare const MessagesToolAdditionBlockToolToolReference$outboundSchema: z.ZodType<MessagesToolAdditionBlockToolToolReference$Outbound, MessagesToolAdditionBlockToolToolReference>;
52
+ export declare function messagesToolAdditionBlockToolToolReferenceToJSON(messagesToolAdditionBlockToolToolReference: MessagesToolAdditionBlockToolToolReference): string;
53
+ /** @internal */
54
+ export type MessagesToolAdditionBlockToolUnion$Outbound = MessagesToolAdditionBlockToolToolReference$Outbound | MessagesToolAdditionBlockToolMcpToolReference$Outbound | MessagesToolAdditionBlockToolMcpToolsetReference$Outbound;
55
+ /** @internal */
56
+ export declare const MessagesToolAdditionBlockToolUnion$outboundSchema: z.ZodType<MessagesToolAdditionBlockToolUnion$Outbound, MessagesToolAdditionBlockToolUnion>;
57
+ export declare function messagesToolAdditionBlockToolUnionToJSON(messagesToolAdditionBlockToolUnion: MessagesToolAdditionBlockToolUnion): string;
58
+ /** @internal */
59
+ export type MessagesToolAdditionBlock$Outbound = {
60
+ cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
61
+ tool: MessagesToolAdditionBlockToolToolReference$Outbound | MessagesToolAdditionBlockToolMcpToolReference$Outbound | MessagesToolAdditionBlockToolMcpToolsetReference$Outbound;
62
+ type: "tool_addition";
63
+ };
64
+ /** @internal */
65
+ export declare const MessagesToolAdditionBlock$outboundSchema: z.ZodType<MessagesToolAdditionBlock$Outbound, MessagesToolAdditionBlock>;
66
+ export declare function messagesToolAdditionBlockToJSON(messagesToolAdditionBlock: MessagesToolAdditionBlock): string;
67
+ //# sourceMappingURL=messagestooladditionblock.d.ts.map
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 51fa541db951
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { AnthropicCacheControlDirective$outboundSchema, } from "./anthropiccachecontroldirective.js";
8
+ /** @internal */
9
+ export const MessagesToolAdditionBlockToolMcpToolsetReference$outboundSchema = z.object({
10
+ serverName: z.string(),
11
+ type: z.literal("mcp_toolset_reference"),
12
+ }).transform((v) => {
13
+ return remap$(v, {
14
+ serverName: "server_name",
15
+ });
16
+ });
17
+ export function messagesToolAdditionBlockToolMcpToolsetReferenceToJSON(messagesToolAdditionBlockToolMcpToolsetReference) {
18
+ return JSON.stringify(MessagesToolAdditionBlockToolMcpToolsetReference$outboundSchema.parse(messagesToolAdditionBlockToolMcpToolsetReference));
19
+ }
20
+ /** @internal */
21
+ export const MessagesToolAdditionBlockToolMcpToolReference$outboundSchema = z.object({
22
+ name: z.string(),
23
+ serverName: z.string(),
24
+ type: z.literal("mcp_tool_reference"),
25
+ }).transform((v) => {
26
+ return remap$(v, {
27
+ serverName: "server_name",
28
+ });
29
+ });
30
+ export function messagesToolAdditionBlockToolMcpToolReferenceToJSON(messagesToolAdditionBlockToolMcpToolReference) {
31
+ return JSON.stringify(MessagesToolAdditionBlockToolMcpToolReference$outboundSchema.parse(messagesToolAdditionBlockToolMcpToolReference));
32
+ }
33
+ /** @internal */
34
+ export const MessagesToolAdditionBlockToolToolReference$outboundSchema = z.object({
35
+ name: z.string(),
36
+ type: z.literal("tool_reference"),
37
+ });
38
+ export function messagesToolAdditionBlockToolToolReferenceToJSON(messagesToolAdditionBlockToolToolReference) {
39
+ return JSON.stringify(MessagesToolAdditionBlockToolToolReference$outboundSchema.parse(messagesToolAdditionBlockToolToolReference));
40
+ }
41
+ /** @internal */
42
+ export const MessagesToolAdditionBlockToolUnion$outboundSchema = z.union([
43
+ z.lazy(() => MessagesToolAdditionBlockToolToolReference$outboundSchema),
44
+ z.lazy(() => MessagesToolAdditionBlockToolMcpToolReference$outboundSchema),
45
+ z.lazy(() => MessagesToolAdditionBlockToolMcpToolsetReference$outboundSchema),
46
+ ]);
47
+ export function messagesToolAdditionBlockToolUnionToJSON(messagesToolAdditionBlockToolUnion) {
48
+ return JSON.stringify(MessagesToolAdditionBlockToolUnion$outboundSchema.parse(messagesToolAdditionBlockToolUnion));
49
+ }
50
+ /** @internal */
51
+ export const MessagesToolAdditionBlock$outboundSchema = z.object({
52
+ cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
53
+ tool: z.union([
54
+ z.lazy(() => MessagesToolAdditionBlockToolToolReference$outboundSchema),
55
+ z.lazy(() => MessagesToolAdditionBlockToolMcpToolReference$outboundSchema),
56
+ z.lazy(() => MessagesToolAdditionBlockToolMcpToolsetReference$outboundSchema),
57
+ ]),
58
+ type: z.literal("tool_addition"),
59
+ }).transform((v) => {
60
+ return remap$(v, {
61
+ cacheControl: "cache_control",
62
+ });
63
+ });
64
+ export function messagesToolAdditionBlockToJSON(messagesToolAdditionBlock) {
65
+ return JSON.stringify(MessagesToolAdditionBlock$outboundSchema.parse(messagesToolAdditionBlock));
66
+ }
67
+ //# sourceMappingURL=messagestooladditionblock.js.map
@@ -0,0 +1,67 @@
1
+ import * as z from "zod/v4";
2
+ import { AnthropicCacheControlDirective, AnthropicCacheControlDirective$Outbound } from "./anthropiccachecontroldirective.js";
3
+ export type MessagesToolRemovalBlockToolMcpToolsetReference = {
4
+ serverName: string;
5
+ type: "mcp_toolset_reference";
6
+ };
7
+ export type MessagesToolRemovalBlockToolMcpToolReference = {
8
+ name: string;
9
+ serverName: string;
10
+ type: "mcp_tool_reference";
11
+ };
12
+ export type MessagesToolRemovalBlockToolToolReference = {
13
+ name: string;
14
+ type: "tool_reference";
15
+ };
16
+ export type MessagesToolRemovalBlockToolUnion = MessagesToolRemovalBlockToolToolReference | MessagesToolRemovalBlockToolMcpToolReference | MessagesToolRemovalBlockToolMcpToolsetReference;
17
+ /**
18
+ * Removes a tool from the conversation mid-conversation without invalidating the prompt cache. Only valid in `role: "system"` messages. Not supported on Claude Sonnet 5 or models older than Claude Opus 4.8.
19
+ */
20
+ export type MessagesToolRemovalBlock = {
21
+ /**
22
+ * Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.
23
+ */
24
+ cacheControl?: AnthropicCacheControlDirective | undefined;
25
+ tool: MessagesToolRemovalBlockToolToolReference | MessagesToolRemovalBlockToolMcpToolReference | MessagesToolRemovalBlockToolMcpToolsetReference;
26
+ type: "tool_removal";
27
+ };
28
+ /** @internal */
29
+ export type MessagesToolRemovalBlockToolMcpToolsetReference$Outbound = {
30
+ server_name: string;
31
+ type: "mcp_toolset_reference";
32
+ };
33
+ /** @internal */
34
+ export declare const MessagesToolRemovalBlockToolMcpToolsetReference$outboundSchema: z.ZodType<MessagesToolRemovalBlockToolMcpToolsetReference$Outbound, MessagesToolRemovalBlockToolMcpToolsetReference>;
35
+ export declare function messagesToolRemovalBlockToolMcpToolsetReferenceToJSON(messagesToolRemovalBlockToolMcpToolsetReference: MessagesToolRemovalBlockToolMcpToolsetReference): string;
36
+ /** @internal */
37
+ export type MessagesToolRemovalBlockToolMcpToolReference$Outbound = {
38
+ name: string;
39
+ server_name: string;
40
+ type: "mcp_tool_reference";
41
+ };
42
+ /** @internal */
43
+ export declare const MessagesToolRemovalBlockToolMcpToolReference$outboundSchema: z.ZodType<MessagesToolRemovalBlockToolMcpToolReference$Outbound, MessagesToolRemovalBlockToolMcpToolReference>;
44
+ export declare function messagesToolRemovalBlockToolMcpToolReferenceToJSON(messagesToolRemovalBlockToolMcpToolReference: MessagesToolRemovalBlockToolMcpToolReference): string;
45
+ /** @internal */
46
+ export type MessagesToolRemovalBlockToolToolReference$Outbound = {
47
+ name: string;
48
+ type: "tool_reference";
49
+ };
50
+ /** @internal */
51
+ export declare const MessagesToolRemovalBlockToolToolReference$outboundSchema: z.ZodType<MessagesToolRemovalBlockToolToolReference$Outbound, MessagesToolRemovalBlockToolToolReference>;
52
+ export declare function messagesToolRemovalBlockToolToolReferenceToJSON(messagesToolRemovalBlockToolToolReference: MessagesToolRemovalBlockToolToolReference): string;
53
+ /** @internal */
54
+ export type MessagesToolRemovalBlockToolUnion$Outbound = MessagesToolRemovalBlockToolToolReference$Outbound | MessagesToolRemovalBlockToolMcpToolReference$Outbound | MessagesToolRemovalBlockToolMcpToolsetReference$Outbound;
55
+ /** @internal */
56
+ export declare const MessagesToolRemovalBlockToolUnion$outboundSchema: z.ZodType<MessagesToolRemovalBlockToolUnion$Outbound, MessagesToolRemovalBlockToolUnion>;
57
+ export declare function messagesToolRemovalBlockToolUnionToJSON(messagesToolRemovalBlockToolUnion: MessagesToolRemovalBlockToolUnion): string;
58
+ /** @internal */
59
+ export type MessagesToolRemovalBlock$Outbound = {
60
+ cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
61
+ tool: MessagesToolRemovalBlockToolToolReference$Outbound | MessagesToolRemovalBlockToolMcpToolReference$Outbound | MessagesToolRemovalBlockToolMcpToolsetReference$Outbound;
62
+ type: "tool_removal";
63
+ };
64
+ /** @internal */
65
+ export declare const MessagesToolRemovalBlock$outboundSchema: z.ZodType<MessagesToolRemovalBlock$Outbound, MessagesToolRemovalBlock>;
66
+ export declare function messagesToolRemovalBlockToJSON(messagesToolRemovalBlock: MessagesToolRemovalBlock): string;
67
+ //# sourceMappingURL=messagestoolremovalblock.d.ts.map
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: dd4f25f389a0
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { AnthropicCacheControlDirective$outboundSchema, } from "./anthropiccachecontroldirective.js";
8
+ /** @internal */
9
+ export const MessagesToolRemovalBlockToolMcpToolsetReference$outboundSchema = z.object({
10
+ serverName: z.string(),
11
+ type: z.literal("mcp_toolset_reference"),
12
+ }).transform((v) => {
13
+ return remap$(v, {
14
+ serverName: "server_name",
15
+ });
16
+ });
17
+ export function messagesToolRemovalBlockToolMcpToolsetReferenceToJSON(messagesToolRemovalBlockToolMcpToolsetReference) {
18
+ return JSON.stringify(MessagesToolRemovalBlockToolMcpToolsetReference$outboundSchema.parse(messagesToolRemovalBlockToolMcpToolsetReference));
19
+ }
20
+ /** @internal */
21
+ export const MessagesToolRemovalBlockToolMcpToolReference$outboundSchema = z.object({
22
+ name: z.string(),
23
+ serverName: z.string(),
24
+ type: z.literal("mcp_tool_reference"),
25
+ }).transform((v) => {
26
+ return remap$(v, {
27
+ serverName: "server_name",
28
+ });
29
+ });
30
+ export function messagesToolRemovalBlockToolMcpToolReferenceToJSON(messagesToolRemovalBlockToolMcpToolReference) {
31
+ return JSON.stringify(MessagesToolRemovalBlockToolMcpToolReference$outboundSchema.parse(messagesToolRemovalBlockToolMcpToolReference));
32
+ }
33
+ /** @internal */
34
+ export const MessagesToolRemovalBlockToolToolReference$outboundSchema = z.object({
35
+ name: z.string(),
36
+ type: z.literal("tool_reference"),
37
+ });
38
+ export function messagesToolRemovalBlockToolToolReferenceToJSON(messagesToolRemovalBlockToolToolReference) {
39
+ return JSON.stringify(MessagesToolRemovalBlockToolToolReference$outboundSchema.parse(messagesToolRemovalBlockToolToolReference));
40
+ }
41
+ /** @internal */
42
+ export const MessagesToolRemovalBlockToolUnion$outboundSchema = z.union([
43
+ z.lazy(() => MessagesToolRemovalBlockToolToolReference$outboundSchema),
44
+ z.lazy(() => MessagesToolRemovalBlockToolMcpToolReference$outboundSchema),
45
+ z.lazy(() => MessagesToolRemovalBlockToolMcpToolsetReference$outboundSchema),
46
+ ]);
47
+ export function messagesToolRemovalBlockToolUnionToJSON(messagesToolRemovalBlockToolUnion) {
48
+ return JSON.stringify(MessagesToolRemovalBlockToolUnion$outboundSchema.parse(messagesToolRemovalBlockToolUnion));
49
+ }
50
+ /** @internal */
51
+ export const MessagesToolRemovalBlock$outboundSchema = z.object({
52
+ cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
53
+ tool: z.union([
54
+ z.lazy(() => MessagesToolRemovalBlockToolToolReference$outboundSchema),
55
+ z.lazy(() => MessagesToolRemovalBlockToolMcpToolReference$outboundSchema),
56
+ z.lazy(() => MessagesToolRemovalBlockToolMcpToolsetReference$outboundSchema),
57
+ ]),
58
+ type: z.literal("tool_removal"),
59
+ }).transform((v) => {
60
+ return remap$(v, {
61
+ cacheControl: "cache_control",
62
+ });
63
+ });
64
+ export function messagesToolRemovalBlockToJSON(messagesToolRemovalBlock) {
65
+ return JSON.stringify(MessagesToolRemovalBlock$outboundSchema.parse(messagesToolRemovalBlock));
66
+ }
67
+ //# sourceMappingURL=messagestoolremovalblock.js.map
@@ -60,6 +60,7 @@ export declare const ProviderName: {
60
60
  readonly Modular: "Modular";
61
61
  readonly MoonshotAI: "Moonshot AI";
62
62
  readonly Morph: "Morph";
63
+ readonly VoyageAIByMongoDB: "VoyageAI by MongoDB";
63
64
  readonly NCompass: "NCompass";
64
65
  readonly Nebius: "Nebius";
65
66
  readonly NexAGI: "Nex AGI";
@@ -63,6 +63,7 @@ export const ProviderName = {
63
63
  Modular: "Modular",
64
64
  MoonshotAI: "Moonshot AI",
65
65
  Morph: "Morph",
66
+ VoyageAIByMongoDB: "VoyageAI by MongoDB",
66
67
  NCompass: "NCompass",
67
68
  Nebius: "Nebius",
68
69
  NexAGI: "Nex AGI",
@@ -372,6 +372,9 @@ export type ProviderOptions = {
372
372
  venice?: {
373
373
  [k: string]: any;
374
374
  } | undefined;
375
+ voyageai?: {
376
+ [k: string]: any;
377
+ } | undefined;
375
378
  wafer?: {
376
379
  [k: string]: any;
377
380
  } | undefined;
@@ -762,6 +765,9 @@ export type ProviderOptions$Outbound = {
762
765
  venice?: {
763
766
  [k: string]: any;
764
767
  } | undefined;
768
+ voyageai?: {
769
+ [k: string]: any;
770
+ } | undefined;
765
771
  wafer?: {
766
772
  [k: string]: any;
767
773
  } | undefined;
@@ -129,6 +129,7 @@ export const ProviderOptions$outboundSchema = z.object({
129
129
  ubicloud: z.record(z.string(), z.any()).optional(),
130
130
  upstage: z.record(z.string(), z.any()).optional(),
131
131
  venice: z.record(z.string(), z.any()).optional(),
132
+ voyageai: z.record(z.string(), z.any()).optional(),
132
133
  wafer: z.record(z.string(), z.any()).optional(),
133
134
  wandb: z.record(z.string(), z.any()).optional(),
134
135
  wandbLegacy: z.record(z.string(), z.any()).optional(),
@@ -93,6 +93,7 @@ export declare const ProviderResponseProviderName: {
93
93
  readonly Modular: "Modular";
94
94
  readonly MoonshotAI: "Moonshot AI";
95
95
  readonly Morph: "Morph";
96
+ readonly VoyageAIByMongoDB: "VoyageAI by MongoDB";
96
97
  readonly NCompass: "NCompass";
97
98
  readonly Nebius: "Nebius";
98
99
  readonly NexAGI: "Nex AGI";
@@ -97,6 +97,7 @@ export const ProviderResponseProviderName = {
97
97
  Modular: "Modular",
98
98
  MoonshotAI: "Moonshot AI",
99
99
  Morph: "Morph",
100
+ VoyageAIByMongoDB: "VoyageAI by MongoDB",
100
101
  NCompass: "NCompass",
101
102
  Nebius: "Nebius",
102
103
  NexAGI: "Nex AGI",
@@ -393,6 +393,9 @@ export type VideoGenerationRequestOptions = {
393
393
  venice?: {
394
394
  [k: string]: any;
395
395
  } | undefined;
396
+ voyageai?: {
397
+ [k: string]: any;
398
+ } | undefined;
396
399
  wafer?: {
397
400
  [k: string]: any;
398
401
  } | undefined;
@@ -853,6 +856,9 @@ export type VideoGenerationRequestOptions$Outbound = {
853
856
  venice?: {
854
857
  [k: string]: any;
855
858
  } | undefined;
859
+ voyageai?: {
860
+ [k: string]: any;
861
+ } | undefined;
856
862
  wafer?: {
857
863
  [k: string]: any;
858
864
  } | undefined;
@@ -159,6 +159,7 @@ export const VideoGenerationRequestOptions$outboundSchema = z.object({
159
159
  ubicloud: z.record(z.string(), z.any()).optional(),
160
160
  upstage: z.record(z.string(), z.any()).optional(),
161
161
  venice: z.record(z.string(), z.any()).optional(),
162
+ voyageai: z.record(z.string(), z.any()).optional(),
162
163
  wafer: z.record(z.string(), z.any()).optional(),
163
164
  wandb: z.record(z.string(), z.any()).optional(),
164
165
  wandbLegacy: z.record(z.string(), z.any()).optional(),
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.0.17",
5
+ "version": "1.0.19",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "author": "OpenRouter",
5
5
  "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
6
6
  "keywords": [
@@ -73,15 +73,15 @@
73
73
  "lint": "eslint --cache --max-warnings=0 src",
74
74
  "build": "tsc",
75
75
  "prepublishOnly": "npm run build",
76
- "test:transit": "exit 0",
77
- "test:watch": "vitest --watch --project unit",
78
76
  "compile": "tsc",
79
77
  "postinstall": "node scripts/check-types.js || true",
80
- "typecheck": "tsc --noEmit",
81
- "typecheck:transit": "exit 0",
82
78
  "prepare": "npm run build",
79
+ "test:watch": "vitest --watch --project unit",
83
80
  "test": "vitest --run --project unit",
84
- "test:e2e": "vitest --run --project e2e"
81
+ "test:e2e": "vitest --run --project e2e",
82
+ "test:transit": "exit 0",
83
+ "typecheck": "tsc --noEmit",
84
+ "typecheck:transit": "exit 0"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {