@openrouter/sdk 0.13.38 → 0.13.40

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 (52) 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/agentmessageitem.d.ts +99 -0
  6. package/esm/models/agentmessageitem.js +101 -0
  7. package/esm/models/applypatchservertool.d.ts +11 -2
  8. package/esm/models/applypatchservertool.js +9 -2
  9. package/esm/models/applypatchservertoolopenrouter.d.ts +9 -2
  10. package/esm/models/applypatchservertoolopenrouter.js +6 -1
  11. package/esm/models/codeinterpreterservertool.d.ts +10 -2
  12. package/esm/models/codeinterpreterservertool.js +9 -2
  13. package/esm/models/codexlocalshelltool.d.ts +11 -2
  14. package/esm/models/codexlocalshelltool.js +9 -2
  15. package/esm/models/compactionitem.d.ts +4 -0
  16. package/esm/models/compactionitem.js +8 -3
  17. package/esm/models/computeruseservertool.d.ts +11 -3
  18. package/esm/models/computeruseservertool.js +9 -2
  19. package/esm/models/contextcompactionitem.d.ts +30 -0
  20. package/esm/models/contextcompactionitem.js +30 -0
  21. package/esm/models/customtool.d.ts +11 -3
  22. package/esm/models/customtool.js +9 -2
  23. package/esm/models/filesearchservertool.d.ts +11 -3
  24. package/esm/models/filesearchservertool.js +10 -2
  25. package/esm/models/imagegenerationservertool.d.ts +11 -3
  26. package/esm/models/imagegenerationservertool.js +9 -2
  27. package/esm/models/index.d.ts +3 -0
  28. package/esm/models/index.js +3 -0
  29. package/esm/models/inputsunion.d.ts +7 -4
  30. package/esm/models/inputsunion.js +9 -0
  31. package/esm/models/legacywebsearchservertool.d.ts +11 -2
  32. package/esm/models/legacywebsearchservertool.js +9 -2
  33. package/esm/models/mcpservertool.d.ts +10 -2
  34. package/esm/models/mcpservertool.js +9 -2
  35. package/esm/models/openresponsesresult.d.ts +54 -2
  36. package/esm/models/openresponsesresult.js +26 -26
  37. package/esm/models/preview20250311websearchservertool.d.ts +11 -2
  38. package/esm/models/preview20250311websearchservertool.js +9 -2
  39. package/esm/models/previewwebsearchservertool.d.ts +11 -2
  40. package/esm/models/previewwebsearchservertool.js +9 -2
  41. package/esm/models/responsesrequest.d.ts +140 -12
  42. package/esm/models/responsesrequest.js +32 -32
  43. package/esm/models/shellservertool.d.ts +11 -2
  44. package/esm/models/shellservertool.js +9 -2
  45. package/esm/models/shellservertoolopenrouter.d.ts +9 -2
  46. package/esm/models/shellservertoolopenrouter.js +6 -1
  47. package/esm/models/websearchservertool.d.ts +11 -2
  48. package/esm/models/websearchservertool.js +9 -2
  49. package/esm/models/websearchservertoolopenrouter.d.ts +9 -2
  50. package/esm/models/websearchservertoolopenrouter.js +6 -1
  51. package/jsr.json +1 -1
  52. package/package.json +6 -6
@@ -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 LegacyWebSearchServerToolType: {
10
+ readonly WebSearch: "web_search";
11
+ };
12
+ export type LegacyWebSearchServerToolType = ClosedEnum<typeof LegacyWebSearchServerToolType>;
8
13
  /**
9
14
  * Web search tool configuration
10
15
  */
@@ -22,13 +27,17 @@ export type LegacyWebSearchServerTool = {
22
27
  * Size of the search context for web search tools
23
28
  */
24
29
  searchContextSize?: SearchContextSizeEnum | undefined;
25
- type: "web_search";
30
+ type: LegacyWebSearchServerToolType;
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 LegacyWebSearchServerToolType$inboundSchema: z.ZodEnum<typeof LegacyWebSearchServerToolType>;
38
+ /** @internal */
39
+ export declare const LegacyWebSearchServerToolType$outboundSchema: z.ZodEnum<typeof LegacyWebSearchServerToolType>;
40
+ /** @internal */
32
41
  export declare const LegacyWebSearchServerTool$inboundSchema: z.ZodType<LegacyWebSearchServerTool, unknown>;
33
42
  /** @internal */
34
43
  export type LegacyWebSearchServerTool$Outbound = {
@@ -36,7 +45,7 @@ export type LegacyWebSearchServerTool$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";
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 LegacyWebSearchServerToolType = {
13
+ WebSearch: "web_search",
14
+ };
15
+ /** @internal */
16
+ export const LegacyWebSearchServerToolType$inboundSchema = z.enum(LegacyWebSearchServerToolType);
17
+ /** @internal */
18
+ export const LegacyWebSearchServerToolType$outboundSchema = LegacyWebSearchServerToolType$inboundSchema;
12
19
  /** @internal */
13
20
  export const LegacyWebSearchServerTool$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"),
25
+ type: LegacyWebSearchServerToolType$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 LegacyWebSearchServerTool$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"),
40
+ type: LegacyWebSearchServerToolType$outboundSchema,
34
41
  userLocation: z.nullable(WebSearchUserLocation$outboundSchema).optional(),
35
42
  }).transform((v) => {
36
43
  return remap$(v, {
@@ -37,6 +37,10 @@ export type RequireApproval = {
37
37
  never?: Never | undefined;
38
38
  };
39
39
  export type RequireApprovalUnion = RequireApproval | RequireApprovalAlways | RequireApprovalNever | any;
40
+ export declare const McpServerToolType: {
41
+ readonly Mcp: "mcp";
42
+ };
43
+ export type McpServerToolType = ClosedEnum<typeof McpServerToolType>;
40
44
  /**
41
45
  * MCP (Model Context Protocol) tool configuration
42
46
  */
@@ -51,7 +55,7 @@ export type McpServerTool = {
51
55
  serverDescription?: string | undefined;
52
56
  serverLabel: string;
53
57
  serverUrl?: string | undefined;
54
- type: "mcp";
58
+ type: McpServerToolType;
55
59
  };
56
60
  /** @internal */
57
61
  export declare const AllowedTools$inboundSchema: z.ZodType<AllowedTools, unknown>;
@@ -124,6 +128,10 @@ export declare const RequireApprovalUnion$outboundSchema: z.ZodType<RequireAppro
124
128
  export declare function requireApprovalUnionToJSON(requireApprovalUnion: RequireApprovalUnion): string;
125
129
  export declare function requireApprovalUnionFromJSON(jsonString: string): SafeParseResult<RequireApprovalUnion, SDKValidationError>;
126
130
  /** @internal */
131
+ export declare const McpServerToolType$inboundSchema: z.ZodEnum<typeof McpServerToolType>;
132
+ /** @internal */
133
+ export declare const McpServerToolType$outboundSchema: z.ZodEnum<typeof McpServerToolType>;
134
+ /** @internal */
127
135
  export declare const McpServerTool$inboundSchema: z.ZodType<McpServerTool, unknown>;
128
136
  /** @internal */
129
137
  export type McpServerTool$Outbound = {
@@ -137,7 +145,7 @@ export type McpServerTool$Outbound = {
137
145
  server_description?: string | undefined;
138
146
  server_label: string;
139
147
  server_url?: string | undefined;
140
- type: "mcp";
148
+ type: string;
141
149
  };
142
150
  /** @internal */
143
151
  export declare const McpServerTool$outboundSchema: z.ZodType<McpServerTool$Outbound, McpServerTool>;
@@ -22,6 +22,9 @@ export const RequireApprovalNever = {
22
22
  export const RequireApprovalAlways = {
23
23
  Always: "always",
24
24
  };
25
+ export const McpServerToolType = {
26
+ Mcp: "mcp",
27
+ };
25
28
  /** @internal */
26
29
  export const AllowedTools$inboundSchema = z
27
30
  .object({
@@ -161,6 +164,10 @@ export function requireApprovalUnionFromJSON(jsonString) {
161
164
  return safeParse(jsonString, (x) => RequireApprovalUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RequireApprovalUnion' from JSON`);
162
165
  }
163
166
  /** @internal */
167
+ export const McpServerToolType$inboundSchema = z.enum(McpServerToolType);
168
+ /** @internal */
169
+ export const McpServerToolType$outboundSchema = McpServerToolType$inboundSchema;
170
+ /** @internal */
164
171
  export const McpServerTool$inboundSchema = z
165
172
  .object({
166
173
  allowed_tools: z.nullable(z.union([
@@ -180,7 +187,7 @@ export const McpServerTool$inboundSchema = z
180
187
  server_description: z.string().optional(),
181
188
  server_label: z.string(),
182
189
  server_url: z.string().optional(),
183
- type: z.literal("mcp"),
190
+ type: McpServerToolType$inboundSchema,
184
191
  }).transform((v) => {
185
192
  return remap$(v, {
186
193
  "allowed_tools": "allowedTools",
@@ -210,7 +217,7 @@ export const McpServerTool$outboundSchema = z.object({
210
217
  serverDescription: z.string().optional(),
211
218
  serverLabel: z.string(),
212
219
  serverUrl: z.string().optional(),
213
- type: z.literal("mcp"),
220
+ type: McpServerToolType$outboundSchema,
214
221
  }).transform((v) => {
215
222
  return remap$(v, {
216
223
  allowedTools: "allowed_tools",
@@ -45,7 +45,33 @@ export type OpenResponsesResultToolFunction = {
45
45
  strict?: boolean | null | undefined;
46
46
  type: "function";
47
47
  };
48
- export type OpenResponsesResultToolUnion = OpenResponsesResultToolFunction | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | FileSearchServerTool | ComputerUseServerTool | CodeInterpreterServerTool | McpServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | CustomTool | discriminatedUnionTypes.Unknown<"type">;
48
+ export type OpenResponsesResultToolUnion = OpenResponsesResultToolFunction | (PreviewWebSearchServerTool & {
49
+ type: "web_search_preview";
50
+ }) | (Preview20250311WebSearchServerTool & {
51
+ type: "web_search_preview_2025_03_11";
52
+ }) | (LegacyWebSearchServerTool & {
53
+ type: "web_search";
54
+ }) | (WebSearchServerTool & {
55
+ type: "web_search_2025_08_26";
56
+ }) | (FileSearchServerTool & {
57
+ type: "file_search";
58
+ }) | (ComputerUseServerTool & {
59
+ type: "computer_use_preview";
60
+ }) | (CodeInterpreterServerTool & {
61
+ type: "code_interpreter";
62
+ }) | (McpServerTool & {
63
+ type: "mcp";
64
+ }) | (ImageGenerationServerTool & {
65
+ type: "image_generation";
66
+ }) | (CodexLocalShellTool & {
67
+ type: "local_shell";
68
+ }) | (ShellServerTool & {
69
+ type: "shell";
70
+ }) | (ApplyPatchServerTool & {
71
+ type: "apply_patch";
72
+ }) | (CustomTool & {
73
+ type: "custom";
74
+ }) | discriminatedUnionTypes.Unknown<"type">;
49
75
  /**
50
76
  * Complete non-streaming response from the Responses API
51
77
  */
@@ -89,7 +115,33 @@ export type OpenResponsesResult = {
89
115
  */
90
116
  text?: TextExtendedConfig | undefined;
91
117
  toolChoice: OpenAIResponsesToolChoiceUnion;
92
- tools: Array<OpenResponsesResultToolFunction | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | FileSearchServerTool | ComputerUseServerTool | CodeInterpreterServerTool | McpServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | CustomTool | discriminatedUnionTypes.Unknown<"type">>;
118
+ tools: Array<OpenResponsesResultToolFunction | (PreviewWebSearchServerTool & {
119
+ type: "web_search_preview";
120
+ }) | (Preview20250311WebSearchServerTool & {
121
+ type: "web_search_preview_2025_03_11";
122
+ }) | (LegacyWebSearchServerTool & {
123
+ type: "web_search";
124
+ }) | (WebSearchServerTool & {
125
+ type: "web_search_2025_08_26";
126
+ }) | (FileSearchServerTool & {
127
+ type: "file_search";
128
+ }) | (ComputerUseServerTool & {
129
+ type: "computer_use_preview";
130
+ }) | (CodeInterpreterServerTool & {
131
+ type: "code_interpreter";
132
+ }) | (McpServerTool & {
133
+ type: "mcp";
134
+ }) | (ImageGenerationServerTool & {
135
+ type: "image_generation";
136
+ }) | (CodexLocalShellTool & {
137
+ type: "local_shell";
138
+ }) | (ShellServerTool & {
139
+ type: "shell";
140
+ }) | (ApplyPatchServerTool & {
141
+ type: "apply_patch";
142
+ }) | (CustomTool & {
143
+ type: "custom";
144
+ }) | discriminatedUnionTypes.Unknown<"type">>;
93
145
  topLogprobs?: number | null | undefined;
94
146
  topP: number | null;
95
147
  truncation?: Truncation | null | undefined;
@@ -51,19 +51,19 @@ export function openResponsesResultToolFunctionFromJSON(jsonString) {
51
51
  /** @internal */
52
52
  export const OpenResponsesResultToolUnion$inboundSchema = discriminatedUnion("type", {
53
53
  function: z.lazy(() => OpenResponsesResultToolFunction$inboundSchema),
54
- web_search_preview: PreviewWebSearchServerTool$inboundSchema,
55
- web_search_preview_2025_03_11: Preview20250311WebSearchServerTool$inboundSchema,
56
- web_search: LegacyWebSearchServerTool$inboundSchema,
57
- web_search_2025_08_26: WebSearchServerTool$inboundSchema,
58
- file_search: FileSearchServerTool$inboundSchema,
59
- computer_use_preview: ComputerUseServerTool$inboundSchema,
60
- code_interpreter: CodeInterpreterServerTool$inboundSchema,
61
- mcp: McpServerTool$inboundSchema,
62
- image_generation: ImageGenerationServerTool$inboundSchema,
63
- local_shell: CodexLocalShellTool$inboundSchema,
64
- shell: ShellServerTool$inboundSchema,
65
- apply_patch: ApplyPatchServerTool$inboundSchema,
66
- custom: CustomTool$inboundSchema,
54
+ web_search_preview: PreviewWebSearchServerTool$inboundSchema.and(z.object({ type: z.literal("web_search_preview") })),
55
+ web_search_preview_2025_03_11: Preview20250311WebSearchServerTool$inboundSchema.and(z.object({ type: z.literal("web_search_preview_2025_03_11") })),
56
+ web_search: LegacyWebSearchServerTool$inboundSchema.and(z.object({ type: z.literal("web_search") })),
57
+ web_search_2025_08_26: WebSearchServerTool$inboundSchema.and(z.object({ type: z.literal("web_search_2025_08_26") })),
58
+ file_search: FileSearchServerTool$inboundSchema.and(z.object({ type: z.literal("file_search") })),
59
+ computer_use_preview: ComputerUseServerTool$inboundSchema.and(z.object({ type: z.literal("computer_use_preview") })),
60
+ code_interpreter: CodeInterpreterServerTool$inboundSchema.and(z.object({ type: z.literal("code_interpreter") })),
61
+ mcp: McpServerTool$inboundSchema.and(z.object({ type: z.literal("mcp") })),
62
+ image_generation: ImageGenerationServerTool$inboundSchema.and(z.object({ type: z.literal("image_generation") })),
63
+ local_shell: CodexLocalShellTool$inboundSchema.and(z.object({ type: z.literal("local_shell") })),
64
+ shell: ShellServerTool$inboundSchema.and(z.object({ type: z.literal("shell") })),
65
+ apply_patch: ApplyPatchServerTool$inboundSchema.and(z.object({ type: z.literal("apply_patch") })),
66
+ custom: CustomTool$inboundSchema.and(z.object({ type: z.literal("custom") })),
67
67
  });
68
68
  export function openResponsesResultToolUnionFromJSON(jsonString) {
69
69
  return safeParse(jsonString, (x) => OpenResponsesResultToolUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenResponsesResultToolUnion' from JSON`);
@@ -100,19 +100,19 @@ export const OpenResponsesResult$inboundSchema = z.object({
100
100
  tool_choice: OpenAIResponsesToolChoiceUnion$inboundSchema,
101
101
  tools: z.array(discriminatedUnion("type", {
102
102
  function: z.lazy(() => OpenResponsesResultToolFunction$inboundSchema),
103
- web_search_preview: PreviewWebSearchServerTool$inboundSchema,
104
- web_search_preview_2025_03_11: Preview20250311WebSearchServerTool$inboundSchema,
105
- web_search: LegacyWebSearchServerTool$inboundSchema,
106
- web_search_2025_08_26: WebSearchServerTool$inboundSchema,
107
- file_search: FileSearchServerTool$inboundSchema,
108
- computer_use_preview: ComputerUseServerTool$inboundSchema,
109
- code_interpreter: CodeInterpreterServerTool$inboundSchema,
110
- mcp: McpServerTool$inboundSchema,
111
- image_generation: ImageGenerationServerTool$inboundSchema,
112
- local_shell: CodexLocalShellTool$inboundSchema,
113
- shell: ShellServerTool$inboundSchema,
114
- apply_patch: ApplyPatchServerTool$inboundSchema,
115
- custom: CustomTool$inboundSchema,
103
+ web_search_preview: PreviewWebSearchServerTool$inboundSchema.and(z.object({ type: z.literal("web_search_preview") })),
104
+ web_search_preview_2025_03_11: Preview20250311WebSearchServerTool$inboundSchema.and(z.object({ type: z.literal("web_search_preview_2025_03_11") })),
105
+ web_search: LegacyWebSearchServerTool$inboundSchema.and(z.object({ type: z.literal("web_search") })),
106
+ web_search_2025_08_26: WebSearchServerTool$inboundSchema.and(z.object({ type: z.literal("web_search_2025_08_26") })),
107
+ file_search: FileSearchServerTool$inboundSchema.and(z.object({ type: z.literal("file_search") })),
108
+ computer_use_preview: ComputerUseServerTool$inboundSchema.and(z.object({ type: z.literal("computer_use_preview") })),
109
+ code_interpreter: CodeInterpreterServerTool$inboundSchema.and(z.object({ type: z.literal("code_interpreter") })),
110
+ mcp: McpServerTool$inboundSchema.and(z.object({ type: z.literal("mcp") })),
111
+ image_generation: ImageGenerationServerTool$inboundSchema.and(z.object({ type: z.literal("image_generation") })),
112
+ local_shell: CodexLocalShellTool$inboundSchema.and(z.object({ type: z.literal("local_shell") })),
113
+ shell: ShellServerTool$inboundSchema.and(z.object({ type: z.literal("shell") })),
114
+ apply_patch: ApplyPatchServerTool$inboundSchema.and(z.object({ type: z.literal("apply_patch") })),
115
+ custom: CustomTool$inboundSchema.and(z.object({ type: z.literal("custom") })),
116
116
  })),
117
117
  top_logprobs: z.nullable(z.int()).optional(),
118
118
  top_p: z.nullable(z.number()),
@@ -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 Preview20250311WebSearchServerToolType: {
10
+ readonly WebSearchPreview20250311: "web_search_preview_2025_03_11";
11
+ };
12
+ export type Preview20250311WebSearchServerToolType = ClosedEnum<typeof Preview20250311WebSearchServerToolType>;
8
13
  /**
9
14
  * Web search preview tool configuration (2025-03-11 version)
10
15
  */
@@ -22,10 +27,14 @@ export type Preview20250311WebSearchServerTool = {
22
27
  * Size of the search context for web search tools
23
28
  */
24
29
  searchContextSize?: SearchContextSizeEnum | undefined;
25
- type: "web_search_preview_2025_03_11";
30
+ type: Preview20250311WebSearchServerToolType;
26
31
  userLocation?: PreviewWebSearchUserLocation | null | undefined;
27
32
  };
28
33
  /** @internal */
34
+ export declare const Preview20250311WebSearchServerToolType$inboundSchema: z.ZodEnum<typeof Preview20250311WebSearchServerToolType>;
35
+ /** @internal */
36
+ export declare const Preview20250311WebSearchServerToolType$outboundSchema: z.ZodEnum<typeof Preview20250311WebSearchServerToolType>;
37
+ /** @internal */
29
38
  export declare const Preview20250311WebSearchServerTool$inboundSchema: z.ZodType<Preview20250311WebSearchServerTool, unknown>;
30
39
  /** @internal */
31
40
  export type Preview20250311WebSearchServerTool$Outbound = {
@@ -33,7 +42,7 @@ export type Preview20250311WebSearchServerTool$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_2025_03_11";
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 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;