@openrouter/sdk 0.13.38 → 0.13.39

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.
Files changed (46) hide show
  1. package/esm/lib/config.d.ts +2 -2
  2. package/esm/lib/config.js +2 -2
  3. package/esm/models/additionaltoolsitem.d.ts +117 -0
  4. package/esm/models/additionaltoolsitem.js +152 -0
  5. package/esm/models/applypatchservertool.d.ts +11 -2
  6. package/esm/models/applypatchservertool.js +9 -2
  7. package/esm/models/applypatchservertoolopenrouter.d.ts +9 -2
  8. package/esm/models/applypatchservertoolopenrouter.js +6 -1
  9. package/esm/models/codeinterpreterservertool.d.ts +10 -2
  10. package/esm/models/codeinterpreterservertool.js +9 -2
  11. package/esm/models/codexlocalshelltool.d.ts +11 -2
  12. package/esm/models/codexlocalshelltool.js +9 -2
  13. package/esm/models/computeruseservertool.d.ts +11 -3
  14. package/esm/models/computeruseservertool.js +9 -2
  15. package/esm/models/customtool.d.ts +11 -3
  16. package/esm/models/customtool.js +9 -2
  17. package/esm/models/filesearchservertool.d.ts +11 -3
  18. package/esm/models/filesearchservertool.js +10 -2
  19. package/esm/models/imagegenerationservertool.d.ts +11 -3
  20. package/esm/models/imagegenerationservertool.js +9 -2
  21. package/esm/models/index.d.ts +1 -0
  22. package/esm/models/index.js +1 -0
  23. package/esm/models/inputsunion.d.ts +5 -4
  24. package/esm/models/inputsunion.js +3 -0
  25. package/esm/models/legacywebsearchservertool.d.ts +11 -2
  26. package/esm/models/legacywebsearchservertool.js +9 -2
  27. package/esm/models/mcpservertool.d.ts +10 -2
  28. package/esm/models/mcpservertool.js +9 -2
  29. package/esm/models/openresponsesresult.d.ts +54 -2
  30. package/esm/models/openresponsesresult.js +26 -26
  31. package/esm/models/preview20250311websearchservertool.d.ts +11 -2
  32. package/esm/models/preview20250311websearchservertool.js +9 -2
  33. package/esm/models/previewwebsearchservertool.d.ts +11 -2
  34. package/esm/models/previewwebsearchservertool.js +9 -2
  35. package/esm/models/responsesrequest.d.ts +140 -12
  36. package/esm/models/responsesrequest.js +32 -32
  37. package/esm/models/shellservertool.d.ts +11 -2
  38. package/esm/models/shellservertool.js +9 -2
  39. package/esm/models/shellservertoolopenrouter.d.ts +9 -2
  40. package/esm/models/shellservertoolopenrouter.js +6 -1
  41. package/esm/models/websearchservertool.d.ts +11 -2
  42. package/esm/models/websearchservertool.js +9 -2
  43. package/esm/models/websearchservertoolopenrouter.d.ts +9 -2
  44. package/esm/models/websearchservertoolopenrouter.js +6 -1
  45. package/jsr.json +1 -1
  46. package/package.json +6 -6
@@ -9,13 +9,20 @@ import { PreviewWebSearchUserLocation$inboundSchema, PreviewWebSearchUserLocatio
9
9
  import { SearchContextSizeEnum$inboundSchema, SearchContextSizeEnum$outboundSchema, } from "./searchcontextsizeenum.js";
10
10
  import { WebSearchDomainFilter$inboundSchema, WebSearchDomainFilter$outboundSchema, } from "./websearchdomainfilter.js";
11
11
  import { WebSearchEngineEnum$inboundSchema, WebSearchEngineEnum$outboundSchema, } from "./websearchengineenum.js";
12
+ export const Preview20250311WebSearchServerToolType = {
13
+ WebSearchPreview20250311: "web_search_preview_2025_03_11",
14
+ };
15
+ /** @internal */
16
+ export const Preview20250311WebSearchServerToolType$inboundSchema = z.enum(Preview20250311WebSearchServerToolType);
17
+ /** @internal */
18
+ export const Preview20250311WebSearchServerToolType$outboundSchema = Preview20250311WebSearchServerToolType$inboundSchema;
12
19
  /** @internal */
13
20
  export const Preview20250311WebSearchServerTool$inboundSchema = z.object({
14
21
  engine: WebSearchEngineEnum$inboundSchema.optional(),
15
22
  filters: z.nullable(WebSearchDomainFilter$inboundSchema).optional(),
16
23
  max_results: z.int().optional(),
17
24
  search_context_size: SearchContextSizeEnum$inboundSchema.optional(),
18
- type: z.literal("web_search_preview_2025_03_11"),
25
+ type: Preview20250311WebSearchServerToolType$inboundSchema,
19
26
  user_location: z.nullable(PreviewWebSearchUserLocation$inboundSchema)
20
27
  .optional(),
21
28
  }).transform((v) => {
@@ -31,7 +38,7 @@ export const Preview20250311WebSearchServerTool$outboundSchema = z.object({
31
38
  filters: z.nullable(WebSearchDomainFilter$outboundSchema).optional(),
32
39
  maxResults: z.int().optional(),
33
40
  searchContextSize: SearchContextSizeEnum$outboundSchema.optional(),
34
- type: z.literal("web_search_preview_2025_03_11"),
41
+ type: Preview20250311WebSearchServerToolType$outboundSchema,
35
42
  userLocation: z.nullable(PreviewWebSearchUserLocation$outboundSchema)
36
43
  .optional(),
37
44
  }).transform((v) => {
@@ -1,10 +1,15 @@
1
1
  import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../types/enums.js";
2
3
  import { Result as SafeParseResult } from "../types/fp.js";
3
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
5
  import { PreviewWebSearchUserLocation, PreviewWebSearchUserLocation$Outbound } from "./previewwebsearchuserlocation.js";
5
6
  import { SearchContextSizeEnum } from "./searchcontextsizeenum.js";
6
7
  import { WebSearchDomainFilter, WebSearchDomainFilter$Outbound } from "./websearchdomainfilter.js";
7
8
  import { WebSearchEngineEnum } from "./websearchengineenum.js";
9
+ export declare const PreviewWebSearchServerToolType: {
10
+ readonly WebSearchPreview: "web_search_preview";
11
+ };
12
+ export type PreviewWebSearchServerToolType = ClosedEnum<typeof PreviewWebSearchServerToolType>;
8
13
  /**
9
14
  * Web search preview tool configuration
10
15
  */
@@ -22,10 +27,14 @@ export type PreviewWebSearchServerTool = {
22
27
  * Size of the search context for web search tools
23
28
  */
24
29
  searchContextSize?: SearchContextSizeEnum | undefined;
25
- type: "web_search_preview";
30
+ type: PreviewWebSearchServerToolType;
26
31
  userLocation?: PreviewWebSearchUserLocation | null | undefined;
27
32
  };
28
33
  /** @internal */
34
+ export declare const PreviewWebSearchServerToolType$inboundSchema: z.ZodEnum<typeof PreviewWebSearchServerToolType>;
35
+ /** @internal */
36
+ export declare const PreviewWebSearchServerToolType$outboundSchema: z.ZodEnum<typeof PreviewWebSearchServerToolType>;
37
+ /** @internal */
29
38
  export declare const PreviewWebSearchServerTool$inboundSchema: z.ZodType<PreviewWebSearchServerTool, unknown>;
30
39
  /** @internal */
31
40
  export type PreviewWebSearchServerTool$Outbound = {
@@ -33,7 +42,7 @@ export type PreviewWebSearchServerTool$Outbound = {
33
42
  filters?: WebSearchDomainFilter$Outbound | null | undefined;
34
43
  max_results?: number | undefined;
35
44
  search_context_size?: string | undefined;
36
- type: "web_search_preview";
45
+ type: string;
37
46
  user_location?: PreviewWebSearchUserLocation$Outbound | null | undefined;
38
47
  };
39
48
  /** @internal */
@@ -9,13 +9,20 @@ import { PreviewWebSearchUserLocation$inboundSchema, PreviewWebSearchUserLocatio
9
9
  import { SearchContextSizeEnum$inboundSchema, SearchContextSizeEnum$outboundSchema, } from "./searchcontextsizeenum.js";
10
10
  import { WebSearchDomainFilter$inboundSchema, WebSearchDomainFilter$outboundSchema, } from "./websearchdomainfilter.js";
11
11
  import { WebSearchEngineEnum$inboundSchema, WebSearchEngineEnum$outboundSchema, } from "./websearchengineenum.js";
12
+ export const PreviewWebSearchServerToolType = {
13
+ WebSearchPreview: "web_search_preview",
14
+ };
15
+ /** @internal */
16
+ export const PreviewWebSearchServerToolType$inboundSchema = z.enum(PreviewWebSearchServerToolType);
17
+ /** @internal */
18
+ export const PreviewWebSearchServerToolType$outboundSchema = PreviewWebSearchServerToolType$inboundSchema;
12
19
  /** @internal */
13
20
  export const PreviewWebSearchServerTool$inboundSchema = z.object({
14
21
  engine: WebSearchEngineEnum$inboundSchema.optional(),
15
22
  filters: z.nullable(WebSearchDomainFilter$inboundSchema).optional(),
16
23
  max_results: z.int().optional(),
17
24
  search_context_size: SearchContextSizeEnum$inboundSchema.optional(),
18
- type: z.literal("web_search_preview"),
25
+ type: PreviewWebSearchServerToolType$inboundSchema,
19
26
  user_location: z.nullable(PreviewWebSearchUserLocation$inboundSchema)
20
27
  .optional(),
21
28
  }).transform((v) => {
@@ -31,7 +38,7 @@ export const PreviewWebSearchServerTool$outboundSchema = z.object({
31
38
  filters: z.nullable(WebSearchDomainFilter$outboundSchema).optional(),
32
39
  maxResults: z.int().optional(),
33
40
  searchContextSize: SearchContextSizeEnum$outboundSchema.optional(),
34
- type: z.literal("web_search_preview"),
41
+ type: PreviewWebSearchServerToolType$outboundSchema,
35
42
  userLocation: z.nullable(PreviewWebSearchUserLocation$outboundSchema)
36
43
  .optional(),
37
44
  }).transform((v) => {
@@ -70,7 +70,33 @@ export type ResponsesRequestToolFunction = {
70
70
  strict?: boolean | null | undefined;
71
71
  type: "function";
72
72
  };
73
- export type ResponsesRequestToolUnion = ResponsesRequestToolFunction | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | FileSearchServerTool | ComputerUseServerTool | CodeInterpreterServerTool | McpServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | CustomTool | (AdvisorServerToolOpenRouter & {
73
+ export type ResponsesRequestToolUnion = ResponsesRequestToolFunction | (PreviewWebSearchServerTool & {
74
+ type: "web_search_preview";
75
+ }) | (Preview20250311WebSearchServerTool & {
76
+ type: "web_search_preview_2025_03_11";
77
+ }) | (LegacyWebSearchServerTool & {
78
+ type: "web_search";
79
+ }) | (WebSearchServerTool & {
80
+ type: "web_search_2025_08_26";
81
+ }) | (FileSearchServerTool & {
82
+ type: "file_search";
83
+ }) | (ComputerUseServerTool & {
84
+ type: "computer_use_preview";
85
+ }) | (CodeInterpreterServerTool & {
86
+ type: "code_interpreter";
87
+ }) | (McpServerTool & {
88
+ type: "mcp";
89
+ }) | (ImageGenerationServerTool & {
90
+ type: "image_generation";
91
+ }) | (CodexLocalShellTool & {
92
+ type: "local_shell";
93
+ }) | (ShellServerTool & {
94
+ type: "shell";
95
+ }) | (ApplyPatchServerTool & {
96
+ type: "apply_patch";
97
+ }) | (CustomTool & {
98
+ type: "custom";
99
+ }) | (AdvisorServerToolOpenRouter & {
74
100
  type: "openrouter:advisor";
75
101
  }) | (SubagentServerToolOpenRouter & {
76
102
  type: "openrouter:subagent";
@@ -86,9 +112,15 @@ export type ResponsesRequestToolUnion = ResponsesRequestToolFunction | PreviewWe
86
112
  type: "openrouter:experimental__search_models";
87
113
  }) | (WebFetchServerTool & {
88
114
  type: "openrouter:web_fetch";
89
- }) | WebSearchServerToolOpenRouter | ApplyPatchServerToolOpenRouter | (BashServerTool & {
115
+ }) | (WebSearchServerToolOpenRouter & {
116
+ type: "openrouter:web_search";
117
+ }) | (ApplyPatchServerToolOpenRouter & {
118
+ type: "openrouter:apply_patch";
119
+ }) | (BashServerTool & {
90
120
  type: "openrouter:bash";
91
- }) | ShellServerToolOpenRouter;
121
+ }) | (ShellServerToolOpenRouter & {
122
+ type: "openrouter:shell";
123
+ });
92
124
  /**
93
125
  * Request schema for Responses endpoint
94
126
  */
@@ -168,7 +200,33 @@ export type ResponsesRequest = {
168
200
  */
169
201
  text?: TextExtendedConfig | undefined;
170
202
  toolChoice?: OpenAIResponsesToolChoiceUnion | undefined;
171
- tools?: Array<ResponsesRequestToolFunction | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | FileSearchServerTool | ComputerUseServerTool | CodeInterpreterServerTool | McpServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | CustomTool | (AdvisorServerToolOpenRouter & {
203
+ tools?: Array<ResponsesRequestToolFunction | (PreviewWebSearchServerTool & {
204
+ type: "web_search_preview";
205
+ }) | (Preview20250311WebSearchServerTool & {
206
+ type: "web_search_preview_2025_03_11";
207
+ }) | (LegacyWebSearchServerTool & {
208
+ type: "web_search";
209
+ }) | (WebSearchServerTool & {
210
+ type: "web_search_2025_08_26";
211
+ }) | (FileSearchServerTool & {
212
+ type: "file_search";
213
+ }) | (ComputerUseServerTool & {
214
+ type: "computer_use_preview";
215
+ }) | (CodeInterpreterServerTool & {
216
+ type: "code_interpreter";
217
+ }) | (McpServerTool & {
218
+ type: "mcp";
219
+ }) | (ImageGenerationServerTool & {
220
+ type: "image_generation";
221
+ }) | (CodexLocalShellTool & {
222
+ type: "local_shell";
223
+ }) | (ShellServerTool & {
224
+ type: "shell";
225
+ }) | (ApplyPatchServerTool & {
226
+ type: "apply_patch";
227
+ }) | (CustomTool & {
228
+ type: "custom";
229
+ }) | (AdvisorServerToolOpenRouter & {
172
230
  type: "openrouter:advisor";
173
231
  }) | (SubagentServerToolOpenRouter & {
174
232
  type: "openrouter:subagent";
@@ -184,9 +242,15 @@ export type ResponsesRequest = {
184
242
  type: "openrouter:experimental__search_models";
185
243
  }) | (WebFetchServerTool & {
186
244
  type: "openrouter:web_fetch";
187
- }) | WebSearchServerToolOpenRouter | ApplyPatchServerToolOpenRouter | (BashServerTool & {
245
+ }) | (WebSearchServerToolOpenRouter & {
246
+ type: "openrouter:web_search";
247
+ }) | (ApplyPatchServerToolOpenRouter & {
248
+ type: "openrouter:apply_patch";
249
+ }) | (BashServerTool & {
188
250
  type: "openrouter:bash";
189
- }) | ShellServerToolOpenRouter> | undefined;
251
+ }) | (ShellServerToolOpenRouter & {
252
+ type: "openrouter:shell";
253
+ })> | undefined;
190
254
  topK?: number | undefined;
191
255
  topLogprobs?: number | null | undefined;
192
256
  topP?: number | null | undefined;
@@ -221,7 +285,33 @@ export type ResponsesRequestToolFunction$Outbound = {
221
285
  export declare const ResponsesRequestToolFunction$outboundSchema: z.ZodType<ResponsesRequestToolFunction$Outbound, ResponsesRequestToolFunction>;
222
286
  export declare function responsesRequestToolFunctionToJSON(responsesRequestToolFunction: ResponsesRequestToolFunction): string;
223
287
  /** @internal */
224
- export type ResponsesRequestToolUnion$Outbound = ResponsesRequestToolFunction$Outbound | PreviewWebSearchServerTool$Outbound | Preview20250311WebSearchServerTool$Outbound | LegacyWebSearchServerTool$Outbound | WebSearchServerTool$Outbound | FileSearchServerTool$Outbound | ComputerUseServerTool$Outbound | CodeInterpreterServerTool$Outbound | McpServerTool$Outbound | ImageGenerationServerTool$Outbound | CodexLocalShellTool$Outbound | ShellServerTool$Outbound | ApplyPatchServerTool$Outbound | CustomTool$Outbound | (AdvisorServerToolOpenRouter$Outbound & {
288
+ export type ResponsesRequestToolUnion$Outbound = ResponsesRequestToolFunction$Outbound | (PreviewWebSearchServerTool$Outbound & {
289
+ type: "web_search_preview";
290
+ }) | (Preview20250311WebSearchServerTool$Outbound & {
291
+ type: "web_search_preview_2025_03_11";
292
+ }) | (LegacyWebSearchServerTool$Outbound & {
293
+ type: "web_search";
294
+ }) | (WebSearchServerTool$Outbound & {
295
+ type: "web_search_2025_08_26";
296
+ }) | (FileSearchServerTool$Outbound & {
297
+ type: "file_search";
298
+ }) | (ComputerUseServerTool$Outbound & {
299
+ type: "computer_use_preview";
300
+ }) | (CodeInterpreterServerTool$Outbound & {
301
+ type: "code_interpreter";
302
+ }) | (McpServerTool$Outbound & {
303
+ type: "mcp";
304
+ }) | (ImageGenerationServerTool$Outbound & {
305
+ type: "image_generation";
306
+ }) | (CodexLocalShellTool$Outbound & {
307
+ type: "local_shell";
308
+ }) | (ShellServerTool$Outbound & {
309
+ type: "shell";
310
+ }) | (ApplyPatchServerTool$Outbound & {
311
+ type: "apply_patch";
312
+ }) | (CustomTool$Outbound & {
313
+ type: "custom";
314
+ }) | (AdvisorServerToolOpenRouter$Outbound & {
225
315
  type: "openrouter:advisor";
226
316
  }) | (SubagentServerToolOpenRouter$Outbound & {
227
317
  type: "openrouter:subagent";
@@ -237,9 +327,15 @@ export type ResponsesRequestToolUnion$Outbound = ResponsesRequestToolFunction$Ou
237
327
  type: "openrouter:experimental__search_models";
238
328
  }) | (WebFetchServerTool$Outbound & {
239
329
  type: "openrouter:web_fetch";
240
- }) | WebSearchServerToolOpenRouter$Outbound | ApplyPatchServerToolOpenRouter$Outbound | (BashServerTool$Outbound & {
330
+ }) | (WebSearchServerToolOpenRouter$Outbound & {
331
+ type: "openrouter:web_search";
332
+ }) | (ApplyPatchServerToolOpenRouter$Outbound & {
333
+ type: "openrouter:apply_patch";
334
+ }) | (BashServerTool$Outbound & {
241
335
  type: "openrouter:bash";
242
- }) | ShellServerToolOpenRouter$Outbound;
336
+ }) | (ShellServerToolOpenRouter$Outbound & {
337
+ type: "openrouter:shell";
338
+ });
243
339
  /** @internal */
244
340
  export declare const ResponsesRequestToolUnion$outboundSchema: z.ZodType<ResponsesRequestToolUnion$Outbound, ResponsesRequestToolUnion>;
245
341
  export declare function responsesRequestToolUnionToJSON(responsesRequestToolUnion: ResponsesRequestToolUnion): string;
@@ -281,7 +377,33 @@ export type ResponsesRequest$Outbound = {
281
377
  temperature?: number | null | undefined;
282
378
  text?: TextExtendedConfig$Outbound | undefined;
283
379
  tool_choice?: OpenAIResponsesToolChoiceUnion$Outbound | undefined;
284
- tools?: Array<ResponsesRequestToolFunction$Outbound | PreviewWebSearchServerTool$Outbound | Preview20250311WebSearchServerTool$Outbound | LegacyWebSearchServerTool$Outbound | WebSearchServerTool$Outbound | FileSearchServerTool$Outbound | ComputerUseServerTool$Outbound | CodeInterpreterServerTool$Outbound | McpServerTool$Outbound | ImageGenerationServerTool$Outbound | CodexLocalShellTool$Outbound | ShellServerTool$Outbound | ApplyPatchServerTool$Outbound | CustomTool$Outbound | (AdvisorServerToolOpenRouter$Outbound & {
380
+ tools?: Array<ResponsesRequestToolFunction$Outbound | (PreviewWebSearchServerTool$Outbound & {
381
+ type: "web_search_preview";
382
+ }) | (Preview20250311WebSearchServerTool$Outbound & {
383
+ type: "web_search_preview_2025_03_11";
384
+ }) | (LegacyWebSearchServerTool$Outbound & {
385
+ type: "web_search";
386
+ }) | (WebSearchServerTool$Outbound & {
387
+ type: "web_search_2025_08_26";
388
+ }) | (FileSearchServerTool$Outbound & {
389
+ type: "file_search";
390
+ }) | (ComputerUseServerTool$Outbound & {
391
+ type: "computer_use_preview";
392
+ }) | (CodeInterpreterServerTool$Outbound & {
393
+ type: "code_interpreter";
394
+ }) | (McpServerTool$Outbound & {
395
+ type: "mcp";
396
+ }) | (ImageGenerationServerTool$Outbound & {
397
+ type: "image_generation";
398
+ }) | (CodexLocalShellTool$Outbound & {
399
+ type: "local_shell";
400
+ }) | (ShellServerTool$Outbound & {
401
+ type: "shell";
402
+ }) | (ApplyPatchServerTool$Outbound & {
403
+ type: "apply_patch";
404
+ }) | (CustomTool$Outbound & {
405
+ type: "custom";
406
+ }) | (AdvisorServerToolOpenRouter$Outbound & {
285
407
  type: "openrouter:advisor";
286
408
  }) | (SubagentServerToolOpenRouter$Outbound & {
287
409
  type: "openrouter:subagent";
@@ -297,9 +419,15 @@ export type ResponsesRequest$Outbound = {
297
419
  type: "openrouter:experimental__search_models";
298
420
  }) | (WebFetchServerTool$Outbound & {
299
421
  type: "openrouter:web_fetch";
300
- }) | WebSearchServerToolOpenRouter$Outbound | ApplyPatchServerToolOpenRouter$Outbound | (BashServerTool$Outbound & {
422
+ }) | (WebSearchServerToolOpenRouter$Outbound & {
423
+ type: "openrouter:web_search";
424
+ }) | (ApplyPatchServerToolOpenRouter$Outbound & {
425
+ type: "openrouter:apply_patch";
426
+ }) | (BashServerTool$Outbound & {
301
427
  type: "openrouter:bash";
302
- }) | ShellServerToolOpenRouter$Outbound> | undefined;
428
+ }) | (ShellServerToolOpenRouter$Outbound & {
429
+ type: "openrouter:shell";
430
+ })> | undefined;
303
431
  top_k?: number | undefined;
304
432
  top_logprobs?: number | null | undefined;
305
433
  top_p?: number | null | undefined;
@@ -92,19 +92,19 @@ export function responsesRequestToolFunctionToJSON(responsesRequestToolFunction)
92
92
  /** @internal */
93
93
  export const ResponsesRequestToolUnion$outboundSchema = z.union([
94
94
  z.lazy(() => ResponsesRequestToolFunction$outboundSchema),
95
- PreviewWebSearchServerTool$outboundSchema,
96
- Preview20250311WebSearchServerTool$outboundSchema,
97
- LegacyWebSearchServerTool$outboundSchema,
98
- WebSearchServerTool$outboundSchema,
99
- FileSearchServerTool$outboundSchema,
100
- ComputerUseServerTool$outboundSchema,
101
- CodeInterpreterServerTool$outboundSchema,
102
- McpServerTool$outboundSchema,
103
- ImageGenerationServerTool$outboundSchema,
104
- CodexLocalShellTool$outboundSchema,
105
- ShellServerTool$outboundSchema,
106
- ApplyPatchServerTool$outboundSchema,
107
- CustomTool$outboundSchema,
95
+ PreviewWebSearchServerTool$outboundSchema.and(z.object({ type: z.literal("web_search_preview") })),
96
+ Preview20250311WebSearchServerTool$outboundSchema.and(z.object({ type: z.literal("web_search_preview_2025_03_11") })),
97
+ LegacyWebSearchServerTool$outboundSchema.and(z.object({ type: z.literal("web_search") })),
98
+ WebSearchServerTool$outboundSchema.and(z.object({ type: z.literal("web_search_2025_08_26") })),
99
+ FileSearchServerTool$outboundSchema.and(z.object({ type: z.literal("file_search") })),
100
+ ComputerUseServerTool$outboundSchema.and(z.object({ type: z.literal("computer_use_preview") })),
101
+ CodeInterpreterServerTool$outboundSchema.and(z.object({ type: z.literal("code_interpreter") })),
102
+ McpServerTool$outboundSchema.and(z.object({ type: z.literal("mcp") })),
103
+ ImageGenerationServerTool$outboundSchema.and(z.object({ type: z.literal("image_generation") })),
104
+ CodexLocalShellTool$outboundSchema.and(z.object({ type: z.literal("local_shell") })),
105
+ ShellServerTool$outboundSchema.and(z.object({ type: z.literal("shell") })),
106
+ ApplyPatchServerTool$outboundSchema.and(z.object({ type: z.literal("apply_patch") })),
107
+ CustomTool$outboundSchema.and(z.object({ type: z.literal("custom") })),
108
108
  AdvisorServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:advisor") })),
109
109
  SubagentServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:subagent") })),
110
110
  DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
@@ -113,10 +113,10 @@ export const ResponsesRequestToolUnion$outboundSchema = z.union([
113
113
  ImageGenerationServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
114
114
  ChatSearchModelsServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
115
115
  WebFetchServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:web_fetch") })),
116
- WebSearchServerToolOpenRouter$outboundSchema,
117
- ApplyPatchServerToolOpenRouter$outboundSchema,
116
+ WebSearchServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:web_search") })),
117
+ ApplyPatchServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:apply_patch") })),
118
118
  BashServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:bash") })),
119
- ShellServerToolOpenRouter$outboundSchema,
119
+ ShellServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:shell") })),
120
120
  ]);
121
121
  export function responsesRequestToolUnionToJSON(responsesRequestToolUnion) {
122
122
  return JSON.stringify(ResponsesRequestToolUnion$outboundSchema.parse(responsesRequestToolUnion));
@@ -168,19 +168,19 @@ export const ResponsesRequest$outboundSchema = z.object({
168
168
  toolChoice: OpenAIResponsesToolChoiceUnion$outboundSchema.optional(),
169
169
  tools: z.array(z.union([
170
170
  z.lazy(() => ResponsesRequestToolFunction$outboundSchema),
171
- PreviewWebSearchServerTool$outboundSchema,
172
- Preview20250311WebSearchServerTool$outboundSchema,
173
- LegacyWebSearchServerTool$outboundSchema,
174
- WebSearchServerTool$outboundSchema,
175
- FileSearchServerTool$outboundSchema,
176
- ComputerUseServerTool$outboundSchema,
177
- CodeInterpreterServerTool$outboundSchema,
178
- McpServerTool$outboundSchema,
179
- ImageGenerationServerTool$outboundSchema,
180
- CodexLocalShellTool$outboundSchema,
181
- ShellServerTool$outboundSchema,
182
- ApplyPatchServerTool$outboundSchema,
183
- CustomTool$outboundSchema,
171
+ PreviewWebSearchServerTool$outboundSchema.and(z.object({ type: z.literal("web_search_preview") })),
172
+ Preview20250311WebSearchServerTool$outboundSchema.and(z.object({ type: z.literal("web_search_preview_2025_03_11") })),
173
+ LegacyWebSearchServerTool$outboundSchema.and(z.object({ type: z.literal("web_search") })),
174
+ WebSearchServerTool$outboundSchema.and(z.object({ type: z.literal("web_search_2025_08_26") })),
175
+ FileSearchServerTool$outboundSchema.and(z.object({ type: z.literal("file_search") })),
176
+ ComputerUseServerTool$outboundSchema.and(z.object({ type: z.literal("computer_use_preview") })),
177
+ CodeInterpreterServerTool$outboundSchema.and(z.object({ type: z.literal("code_interpreter") })),
178
+ McpServerTool$outboundSchema.and(z.object({ type: z.literal("mcp") })),
179
+ ImageGenerationServerTool$outboundSchema.and(z.object({ type: z.literal("image_generation") })),
180
+ CodexLocalShellTool$outboundSchema.and(z.object({ type: z.literal("local_shell") })),
181
+ ShellServerTool$outboundSchema.and(z.object({ type: z.literal("shell") })),
182
+ ApplyPatchServerTool$outboundSchema.and(z.object({ type: z.literal("apply_patch") })),
183
+ CustomTool$outboundSchema.and(z.object({ type: z.literal("custom") })),
184
184
  AdvisorServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:advisor") })),
185
185
  SubagentServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:subagent") })),
186
186
  DatetimeServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:datetime") })),
@@ -189,10 +189,10 @@ export const ResponsesRequest$outboundSchema = z.object({
189
189
  ImageGenerationServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:image_generation") })),
190
190
  ChatSearchModelsServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:experimental__search_models") })),
191
191
  WebFetchServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:web_fetch") })),
192
- WebSearchServerToolOpenRouter$outboundSchema,
193
- ApplyPatchServerToolOpenRouter$outboundSchema,
192
+ WebSearchServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:web_search") })),
193
+ ApplyPatchServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:apply_patch") })),
194
194
  BashServerTool$outboundSchema.and(z.object({ type: z.literal("openrouter:bash") })),
195
- ShellServerToolOpenRouter$outboundSchema,
195
+ ShellServerToolOpenRouter$outboundSchema.and(z.object({ type: z.literal("openrouter:shell") })),
196
196
  ])).optional(),
197
197
  topK: z.int().optional(),
198
198
  topLogprobs: z.nullable(z.int()).optional(),
@@ -1,17 +1,26 @@
1
1
  import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../types/enums.js";
2
3
  import { Result as SafeParseResult } from "../types/fp.js";
3
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
+ export declare const ShellServerToolType: {
6
+ readonly Shell: "shell";
7
+ };
8
+ export type ShellServerToolType = ClosedEnum<typeof ShellServerToolType>;
4
9
  /**
5
10
  * Shell tool configuration
6
11
  */
7
12
  export type ShellServerTool = {
8
- type: "shell";
13
+ type: ShellServerToolType;
9
14
  };
10
15
  /** @internal */
16
+ export declare const ShellServerToolType$inboundSchema: z.ZodEnum<typeof ShellServerToolType>;
17
+ /** @internal */
18
+ export declare const ShellServerToolType$outboundSchema: z.ZodEnum<typeof ShellServerToolType>;
19
+ /** @internal */
11
20
  export declare const ShellServerTool$inboundSchema: z.ZodType<ShellServerTool, unknown>;
12
21
  /** @internal */
13
22
  export type ShellServerTool$Outbound = {
14
- type: "shell";
23
+ type: string;
15
24
  };
16
25
  /** @internal */
17
26
  export declare const ShellServerTool$outboundSchema: z.ZodType<ShellServerTool$Outbound, ShellServerTool>;
@@ -4,13 +4,20 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { safeParse } from "../lib/schemas.js";
7
+ export const ShellServerToolType = {
8
+ Shell: "shell",
9
+ };
10
+ /** @internal */
11
+ export const ShellServerToolType$inboundSchema = z.enum(ShellServerToolType);
12
+ /** @internal */
13
+ export const ShellServerToolType$outboundSchema = ShellServerToolType$inboundSchema;
7
14
  /** @internal */
8
15
  export const ShellServerTool$inboundSchema = z.object({
9
- type: z.literal("shell"),
16
+ type: ShellServerToolType$inboundSchema,
10
17
  });
11
18
  /** @internal */
12
19
  export const ShellServerTool$outboundSchema = z.object({
13
- type: z.literal("shell"),
20
+ type: ShellServerToolType$outboundSchema,
14
21
  });
15
22
  export function shellServerToolToJSON(shellServerTool) {
16
23
  return JSON.stringify(ShellServerTool$outboundSchema.parse(shellServerTool));
@@ -1,5 +1,10 @@
1
1
  import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../types/enums.js";
2
3
  import { ShellServerToolConfig, ShellServerToolConfig$Outbound } from "./shellservertoolconfig.js";
4
+ export declare const ShellServerToolOpenRouterType: {
5
+ readonly OpenrouterShell: "openrouter:shell";
6
+ };
7
+ export type ShellServerToolOpenRouterType = ClosedEnum<typeof ShellServerToolOpenRouterType>;
3
8
  /**
4
9
  * OpenRouter built-in server tool: runs shell commands server-side in a sandboxed container (a sandbox-backed clone of OpenAI's hosted shell tool)
5
10
  */
@@ -8,12 +13,14 @@ export type ShellServerToolOpenRouter = {
8
13
  * Configuration for the openrouter:shell server tool
9
14
  */
10
15
  parameters?: ShellServerToolConfig | undefined;
11
- type: "openrouter:shell";
16
+ type: ShellServerToolOpenRouterType;
12
17
  };
13
18
  /** @internal */
19
+ export declare const ShellServerToolOpenRouterType$outboundSchema: z.ZodEnum<typeof ShellServerToolOpenRouterType>;
20
+ /** @internal */
14
21
  export type ShellServerToolOpenRouter$Outbound = {
15
22
  parameters?: ShellServerToolConfig$Outbound | undefined;
16
- type: "openrouter:shell";
23
+ type: string;
17
24
  };
18
25
  /** @internal */
19
26
  export declare const ShellServerToolOpenRouter$outboundSchema: z.ZodType<ShellServerToolOpenRouter$Outbound, ShellServerToolOpenRouter>;
@@ -4,10 +4,15 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { ShellServerToolConfig$outboundSchema, } from "./shellservertoolconfig.js";
7
+ export const ShellServerToolOpenRouterType = {
8
+ OpenrouterShell: "openrouter:shell",
9
+ };
10
+ /** @internal */
11
+ export const ShellServerToolOpenRouterType$outboundSchema = z.enum(ShellServerToolOpenRouterType);
7
12
  /** @internal */
8
13
  export const ShellServerToolOpenRouter$outboundSchema = z.object({
9
14
  parameters: ShellServerToolConfig$outboundSchema.optional(),
10
- type: z.literal("openrouter:shell"),
15
+ type: ShellServerToolOpenRouterType$outboundSchema,
11
16
  });
12
17
  export function shellServerToolOpenRouterToJSON(shellServerToolOpenRouter) {
13
18
  return JSON.stringify(ShellServerToolOpenRouter$outboundSchema.parse(shellServerToolOpenRouter));
@@ -1,10 +1,15 @@
1
1
  import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../types/enums.js";
2
3
  import { Result as SafeParseResult } from "../types/fp.js";
3
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
5
  import { SearchContextSizeEnum } from "./searchcontextsizeenum.js";
5
6
  import { WebSearchDomainFilter, WebSearchDomainFilter$Outbound } from "./websearchdomainfilter.js";
6
7
  import { WebSearchEngineEnum } from "./websearchengineenum.js";
7
8
  import { WebSearchUserLocation, WebSearchUserLocation$Outbound } from "./websearchuserlocation.js";
9
+ export declare const WebSearchServerToolType: {
10
+ readonly WebSearch20250826: "web_search_2025_08_26";
11
+ };
12
+ export type WebSearchServerToolType = ClosedEnum<typeof WebSearchServerToolType>;
8
13
  /**
9
14
  * Web search tool configuration (2025-08-26 version)
10
15
  */
@@ -22,13 +27,17 @@ export type WebSearchServerTool = {
22
27
  * Size of the search context for web search tools
23
28
  */
24
29
  searchContextSize?: SearchContextSizeEnum | undefined;
25
- type: "web_search_2025_08_26";
30
+ type: WebSearchServerToolType;
26
31
  /**
27
32
  * User location information for web search
28
33
  */
29
34
  userLocation?: WebSearchUserLocation | null | undefined;
30
35
  };
31
36
  /** @internal */
37
+ export declare const WebSearchServerToolType$inboundSchema: z.ZodEnum<typeof WebSearchServerToolType>;
38
+ /** @internal */
39
+ export declare const WebSearchServerToolType$outboundSchema: z.ZodEnum<typeof WebSearchServerToolType>;
40
+ /** @internal */
32
41
  export declare const WebSearchServerTool$inboundSchema: z.ZodType<WebSearchServerTool, unknown>;
33
42
  /** @internal */
34
43
  export type WebSearchServerTool$Outbound = {
@@ -36,7 +45,7 @@ export type WebSearchServerTool$Outbound = {
36
45
  filters?: WebSearchDomainFilter$Outbound | null | undefined;
37
46
  max_results?: number | undefined;
38
47
  search_context_size?: string | undefined;
39
- type: "web_search_2025_08_26";
48
+ type: string;
40
49
  user_location?: WebSearchUserLocation$Outbound | null | undefined;
41
50
  };
42
51
  /** @internal */
@@ -9,13 +9,20 @@ import { SearchContextSizeEnum$inboundSchema, SearchContextSizeEnum$outboundSche
9
9
  import { WebSearchDomainFilter$inboundSchema, WebSearchDomainFilter$outboundSchema, } from "./websearchdomainfilter.js";
10
10
  import { WebSearchEngineEnum$inboundSchema, WebSearchEngineEnum$outboundSchema, } from "./websearchengineenum.js";
11
11
  import { WebSearchUserLocation$inboundSchema, WebSearchUserLocation$outboundSchema, } from "./websearchuserlocation.js";
12
+ export const WebSearchServerToolType = {
13
+ WebSearch20250826: "web_search_2025_08_26",
14
+ };
15
+ /** @internal */
16
+ export const WebSearchServerToolType$inboundSchema = z.enum(WebSearchServerToolType);
17
+ /** @internal */
18
+ export const WebSearchServerToolType$outboundSchema = WebSearchServerToolType$inboundSchema;
12
19
  /** @internal */
13
20
  export const WebSearchServerTool$inboundSchema = z.object({
14
21
  engine: WebSearchEngineEnum$inboundSchema.optional(),
15
22
  filters: z.nullable(WebSearchDomainFilter$inboundSchema).optional(),
16
23
  max_results: z.int().optional(),
17
24
  search_context_size: SearchContextSizeEnum$inboundSchema.optional(),
18
- type: z.literal("web_search_2025_08_26"),
25
+ type: WebSearchServerToolType$inboundSchema,
19
26
  user_location: z.nullable(WebSearchUserLocation$inboundSchema).optional(),
20
27
  }).transform((v) => {
21
28
  return remap$(v, {
@@ -30,7 +37,7 @@ export const WebSearchServerTool$outboundSchema = z.object({
30
37
  filters: z.nullable(WebSearchDomainFilter$outboundSchema).optional(),
31
38
  maxResults: z.int().optional(),
32
39
  searchContextSize: SearchContextSizeEnum$outboundSchema.optional(),
33
- type: z.literal("web_search_2025_08_26"),
40
+ type: WebSearchServerToolType$outboundSchema,
34
41
  userLocation: z.nullable(WebSearchUserLocation$outboundSchema).optional(),
35
42
  }).transform((v) => {
36
43
  return remap$(v, {
@@ -1,5 +1,10 @@
1
1
  import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../types/enums.js";
2
3
  import { WebSearchServerToolConfig, WebSearchServerToolConfig$Outbound } from "./websearchservertoolconfig.js";
4
+ export declare const WebSearchServerToolOpenRouterType: {
5
+ readonly OpenrouterWebSearch: "openrouter:web_search";
6
+ };
7
+ export type WebSearchServerToolOpenRouterType = ClosedEnum<typeof WebSearchServerToolOpenRouterType>;
3
8
  /**
4
9
  * OpenRouter built-in server tool: searches the web for current information
5
10
  */
@@ -8,12 +13,14 @@ export type WebSearchServerToolOpenRouter = {
8
13
  * Configuration for the openrouter:web_search server tool
9
14
  */
10
15
  parameters?: WebSearchServerToolConfig | undefined;
11
- type: "openrouter:web_search";
16
+ type: WebSearchServerToolOpenRouterType;
12
17
  };
13
18
  /** @internal */
19
+ export declare const WebSearchServerToolOpenRouterType$outboundSchema: z.ZodEnum<typeof WebSearchServerToolOpenRouterType>;
20
+ /** @internal */
14
21
  export type WebSearchServerToolOpenRouter$Outbound = {
15
22
  parameters?: WebSearchServerToolConfig$Outbound | undefined;
16
- type: "openrouter:web_search";
23
+ type: string;
17
24
  };
18
25
  /** @internal */
19
26
  export declare const WebSearchServerToolOpenRouter$outboundSchema: z.ZodType<WebSearchServerToolOpenRouter$Outbound, WebSearchServerToolOpenRouter>;
@@ -4,10 +4,15 @@
4
4
  */
5
5
  import * as z from "zod/v4";
6
6
  import { WebSearchServerToolConfig$outboundSchema, } from "./websearchservertoolconfig.js";
7
+ export const WebSearchServerToolOpenRouterType = {
8
+ OpenrouterWebSearch: "openrouter:web_search",
9
+ };
10
+ /** @internal */
11
+ export const WebSearchServerToolOpenRouterType$outboundSchema = z.enum(WebSearchServerToolOpenRouterType);
7
12
  /** @internal */
8
13
  export const WebSearchServerToolOpenRouter$outboundSchema = z.object({
9
14
  parameters: WebSearchServerToolConfig$outboundSchema.optional(),
10
- type: z.literal("openrouter:web_search"),
15
+ type: WebSearchServerToolOpenRouterType$outboundSchema,
11
16
  });
12
17
  export function webSearchServerToolOpenRouterToJSON(webSearchServerToolOpenRouter) {
13
18
  return JSON.stringify(WebSearchServerToolOpenRouter$outboundSchema.parse(webSearchServerToolOpenRouter));
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.13.38",
5
+ "version": "0.13.39",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",