@openrouter/sdk 1.5.8 → 1.5.9

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.
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
50
50
  export declare const SDK_METADATA: {
51
51
  readonly language: "typescript";
52
52
  readonly openapiDocVersion: "1.0.0";
53
- readonly sdkVersion: "1.5.8";
53
+ readonly sdkVersion: "1.5.9";
54
54
  readonly genVersion: "2.948.4";
55
- readonly userAgent: "speakeasy-sdk/typescript 1.5.8 2.948.4 1.0.0 @openrouter/sdk";
55
+ readonly userAgent: "speakeasy-sdk/typescript 1.5.9 2.948.4 1.0.0 @openrouter/sdk";
56
56
  };
57
57
  //# sourceMappingURL=config.d.ts.map
package/esm/lib/config.js CHANGED
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
29
29
  export const SDK_METADATA = {
30
30
  language: "typescript",
31
31
  openapiDocVersion: "1.0.0",
32
- sdkVersion: "1.5.8",
32
+ sdkVersion: "1.5.9",
33
33
  genVersion: "2.948.4",
34
- userAgent: "speakeasy-sdk/typescript 1.5.8 2.948.4 1.0.0 @openrouter/sdk",
34
+ userAgent: "speakeasy-sdk/typescript 1.5.9 2.948.4 1.0.0 @openrouter/sdk",
35
35
  };
36
36
  //# sourceMappingURL=config.js.map
@@ -0,0 +1,204 @@
1
+ import * as z from "zod/v4";
2
+ import { ClosedEnum } from "../types/enums.js";
3
+ import { AnthropicAllowedCallers } from "./anthropicallowedcallers.js";
4
+ import { AnthropicCacheControlDirective, AnthropicCacheControlDirective$Outbound } from "./anthropiccachecontroldirective.js";
5
+ import { AnthropicWebSearchToolUserLocation, AnthropicWebSearchToolUserLocation$Outbound } from "./anthropicwebsearchtooluserlocation.js";
6
+ export declare const AnthropicToolUnionNameWebSearch2: {
7
+ readonly WebSearch: "web_search";
8
+ };
9
+ export type AnthropicToolUnionNameWebSearch2 = ClosedEnum<typeof AnthropicToolUnionNameWebSearch2>;
10
+ export declare const AnthropicToolUnionTypeWebSearch20260209: {
11
+ readonly WebSearch20260209: "web_search_20260209";
12
+ };
13
+ export type AnthropicToolUnionTypeWebSearch20260209 = ClosedEnum<typeof AnthropicToolUnionTypeWebSearch20260209>;
14
+ export type AnthropicToolUnionWebSearch20260209 = {
15
+ allowedCallers?: Array<AnthropicAllowedCallers> | undefined;
16
+ allowedDomains?: Array<string> | null | undefined;
17
+ blockedDomains?: Array<string> | null | undefined;
18
+ /**
19
+ * 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.
20
+ */
21
+ cacheControl?: AnthropicCacheControlDirective | undefined;
22
+ maxUses?: number | null | undefined;
23
+ name: AnthropicToolUnionNameWebSearch2;
24
+ type: AnthropicToolUnionTypeWebSearch20260209;
25
+ userLocation?: AnthropicWebSearchToolUserLocation | null | undefined;
26
+ };
27
+ export declare const AnthropicToolUnionNameWebSearch1: {
28
+ readonly WebSearch: "web_search";
29
+ };
30
+ export type AnthropicToolUnionNameWebSearch1 = ClosedEnum<typeof AnthropicToolUnionNameWebSearch1>;
31
+ export declare const AnthropicToolUnionTypeWebSearch20250305: {
32
+ readonly WebSearch20250305: "web_search_20250305";
33
+ };
34
+ export type AnthropicToolUnionTypeWebSearch20250305 = ClosedEnum<typeof AnthropicToolUnionTypeWebSearch20250305>;
35
+ export type AnthropicToolUnionWebSearch20250305 = {
36
+ allowedDomains?: Array<string> | null | undefined;
37
+ blockedDomains?: Array<string> | null | undefined;
38
+ /**
39
+ * 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.
40
+ */
41
+ cacheControl?: AnthropicCacheControlDirective | undefined;
42
+ maxUses?: number | null | undefined;
43
+ name: AnthropicToolUnionNameWebSearch1;
44
+ type: AnthropicToolUnionTypeWebSearch20250305;
45
+ userLocation?: AnthropicWebSearchToolUserLocation | null | undefined;
46
+ };
47
+ export declare const AnthropicToolUnionNameStrReplaceEditor: {
48
+ readonly StrReplaceEditor: "str_replace_editor";
49
+ };
50
+ export type AnthropicToolUnionNameStrReplaceEditor = ClosedEnum<typeof AnthropicToolUnionNameStrReplaceEditor>;
51
+ export declare const AnthropicToolUnionTypeTextEditor20250124: {
52
+ readonly TextEditor20250124: "text_editor_20250124";
53
+ };
54
+ export type AnthropicToolUnionTypeTextEditor20250124 = ClosedEnum<typeof AnthropicToolUnionTypeTextEditor20250124>;
55
+ export type AnthropicToolUnionTextEditor20250124 = {
56
+ /**
57
+ * 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.
58
+ */
59
+ cacheControl?: AnthropicCacheControlDirective | undefined;
60
+ name: AnthropicToolUnionNameStrReplaceEditor;
61
+ type: AnthropicToolUnionTypeTextEditor20250124;
62
+ };
63
+ export declare const AnthropicToolUnionNameBash: {
64
+ readonly Bash: "bash";
65
+ };
66
+ export type AnthropicToolUnionNameBash = ClosedEnum<typeof AnthropicToolUnionNameBash>;
67
+ export declare const AnthropicToolUnionTypeBash20250124: {
68
+ readonly Bash20250124: "bash_20250124";
69
+ };
70
+ export type AnthropicToolUnionTypeBash20250124 = ClosedEnum<typeof AnthropicToolUnionTypeBash20250124>;
71
+ export type AnthropicToolUnionBash20250124 = {
72
+ /**
73
+ * 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.
74
+ */
75
+ cacheControl?: AnthropicCacheControlDirective | undefined;
76
+ name: AnthropicToolUnionNameBash;
77
+ type: AnthropicToolUnionTypeBash20250124;
78
+ };
79
+ export declare const TypeObject: {
80
+ readonly Object: "object";
81
+ };
82
+ export type TypeObject = ClosedEnum<typeof TypeObject>;
83
+ export type AnthropicToolUnionInputSchema = {
84
+ properties?: any | undefined;
85
+ required?: Array<string> | null | undefined;
86
+ type: TypeObject;
87
+ additionalProperties?: {
88
+ [k: string]: any;
89
+ } | undefined;
90
+ };
91
+ export declare const AnthropicToolUnionTypeCustom: {
92
+ readonly Custom: "custom";
93
+ };
94
+ export type AnthropicToolUnionTypeCustom = ClosedEnum<typeof AnthropicToolUnionTypeCustom>;
95
+ export type AnthropicToolUnionCustom = {
96
+ /**
97
+ * 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.
98
+ */
99
+ cacheControl?: AnthropicCacheControlDirective | undefined;
100
+ deferLoading?: boolean | undefined;
101
+ description?: string | undefined;
102
+ inputSchema: AnthropicToolUnionInputSchema;
103
+ name: string;
104
+ strict?: boolean | undefined;
105
+ type?: AnthropicToolUnionTypeCustom | undefined;
106
+ };
107
+ /**
108
+ * An Anthropic tool definition: a client-defined tool with a JSON Schema `input_schema`, or a server tool (bash, text editor, web search).
109
+ */
110
+ export type AnthropicToolUnion = AnthropicToolUnionCustom | AnthropicToolUnionBash20250124 | AnthropicToolUnionTextEditor20250124 | AnthropicToolUnionWebSearch20250305 | AnthropicToolUnionWebSearch20260209;
111
+ /** @internal */
112
+ export declare const AnthropicToolUnionNameWebSearch2$outboundSchema: z.ZodEnum<typeof AnthropicToolUnionNameWebSearch2>;
113
+ /** @internal */
114
+ export declare const AnthropicToolUnionTypeWebSearch20260209$outboundSchema: z.ZodEnum<typeof AnthropicToolUnionTypeWebSearch20260209>;
115
+ /** @internal */
116
+ export type AnthropicToolUnionWebSearch20260209$Outbound = {
117
+ allowed_callers?: Array<string> | undefined;
118
+ allowed_domains?: Array<string> | null | undefined;
119
+ blocked_domains?: Array<string> | null | undefined;
120
+ cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
121
+ max_uses?: number | null | undefined;
122
+ name: string;
123
+ type: string;
124
+ user_location?: AnthropicWebSearchToolUserLocation$Outbound | null | undefined;
125
+ };
126
+ /** @internal */
127
+ export declare const AnthropicToolUnionWebSearch20260209$outboundSchema: z.ZodType<AnthropicToolUnionWebSearch20260209$Outbound, AnthropicToolUnionWebSearch20260209>;
128
+ export declare function anthropicToolUnionWebSearch20260209ToJSON(anthropicToolUnionWebSearch20260209: AnthropicToolUnionWebSearch20260209): string;
129
+ /** @internal */
130
+ export declare const AnthropicToolUnionNameWebSearch1$outboundSchema: z.ZodEnum<typeof AnthropicToolUnionNameWebSearch1>;
131
+ /** @internal */
132
+ export declare const AnthropicToolUnionTypeWebSearch20250305$outboundSchema: z.ZodEnum<typeof AnthropicToolUnionTypeWebSearch20250305>;
133
+ /** @internal */
134
+ export type AnthropicToolUnionWebSearch20250305$Outbound = {
135
+ allowed_domains?: Array<string> | null | undefined;
136
+ blocked_domains?: Array<string> | null | undefined;
137
+ cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
138
+ max_uses?: number | null | undefined;
139
+ name: string;
140
+ type: string;
141
+ user_location?: AnthropicWebSearchToolUserLocation$Outbound | null | undefined;
142
+ };
143
+ /** @internal */
144
+ export declare const AnthropicToolUnionWebSearch20250305$outboundSchema: z.ZodType<AnthropicToolUnionWebSearch20250305$Outbound, AnthropicToolUnionWebSearch20250305>;
145
+ export declare function anthropicToolUnionWebSearch20250305ToJSON(anthropicToolUnionWebSearch20250305: AnthropicToolUnionWebSearch20250305): string;
146
+ /** @internal */
147
+ export declare const AnthropicToolUnionNameStrReplaceEditor$outboundSchema: z.ZodEnum<typeof AnthropicToolUnionNameStrReplaceEditor>;
148
+ /** @internal */
149
+ export declare const AnthropicToolUnionTypeTextEditor20250124$outboundSchema: z.ZodEnum<typeof AnthropicToolUnionTypeTextEditor20250124>;
150
+ /** @internal */
151
+ export type AnthropicToolUnionTextEditor20250124$Outbound = {
152
+ cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
153
+ name: string;
154
+ type: string;
155
+ };
156
+ /** @internal */
157
+ export declare const AnthropicToolUnionTextEditor20250124$outboundSchema: z.ZodType<AnthropicToolUnionTextEditor20250124$Outbound, AnthropicToolUnionTextEditor20250124>;
158
+ export declare function anthropicToolUnionTextEditor20250124ToJSON(anthropicToolUnionTextEditor20250124: AnthropicToolUnionTextEditor20250124): string;
159
+ /** @internal */
160
+ export declare const AnthropicToolUnionNameBash$outboundSchema: z.ZodEnum<typeof AnthropicToolUnionNameBash>;
161
+ /** @internal */
162
+ export declare const AnthropicToolUnionTypeBash20250124$outboundSchema: z.ZodEnum<typeof AnthropicToolUnionTypeBash20250124>;
163
+ /** @internal */
164
+ export type AnthropicToolUnionBash20250124$Outbound = {
165
+ cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
166
+ name: string;
167
+ type: string;
168
+ };
169
+ /** @internal */
170
+ export declare const AnthropicToolUnionBash20250124$outboundSchema: z.ZodType<AnthropicToolUnionBash20250124$Outbound, AnthropicToolUnionBash20250124>;
171
+ export declare function anthropicToolUnionBash20250124ToJSON(anthropicToolUnionBash20250124: AnthropicToolUnionBash20250124): string;
172
+ /** @internal */
173
+ export declare const TypeObject$outboundSchema: z.ZodEnum<typeof TypeObject>;
174
+ /** @internal */
175
+ export type AnthropicToolUnionInputSchema$Outbound = {
176
+ properties?: any | undefined;
177
+ required?: Array<string> | null | undefined;
178
+ type: string;
179
+ [additionalProperties: string]: unknown;
180
+ };
181
+ /** @internal */
182
+ export declare const AnthropicToolUnionInputSchema$outboundSchema: z.ZodType<AnthropicToolUnionInputSchema$Outbound, AnthropicToolUnionInputSchema>;
183
+ export declare function anthropicToolUnionInputSchemaToJSON(anthropicToolUnionInputSchema: AnthropicToolUnionInputSchema): string;
184
+ /** @internal */
185
+ export declare const AnthropicToolUnionTypeCustom$outboundSchema: z.ZodEnum<typeof AnthropicToolUnionTypeCustom>;
186
+ /** @internal */
187
+ export type AnthropicToolUnionCustom$Outbound = {
188
+ cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
189
+ defer_loading?: boolean | undefined;
190
+ description?: string | undefined;
191
+ input_schema: AnthropicToolUnionInputSchema$Outbound;
192
+ name: string;
193
+ strict?: boolean | undefined;
194
+ type?: string | undefined;
195
+ };
196
+ /** @internal */
197
+ export declare const AnthropicToolUnionCustom$outboundSchema: z.ZodType<AnthropicToolUnionCustom$Outbound, AnthropicToolUnionCustom>;
198
+ export declare function anthropicToolUnionCustomToJSON(anthropicToolUnionCustom: AnthropicToolUnionCustom): string;
199
+ /** @internal */
200
+ export type AnthropicToolUnion$Outbound = AnthropicToolUnionCustom$Outbound | AnthropicToolUnionBash20250124$Outbound | AnthropicToolUnionTextEditor20250124$Outbound | AnthropicToolUnionWebSearch20250305$Outbound | AnthropicToolUnionWebSearch20260209$Outbound;
201
+ /** @internal */
202
+ export declare const AnthropicToolUnion$outboundSchema: z.ZodType<AnthropicToolUnion$Outbound, AnthropicToolUnion>;
203
+ export declare function anthropicToolUnionToJSON(anthropicToolUnion: AnthropicToolUnion): string;
204
+ //# sourceMappingURL=anthropictoolunion.d.ts.map
@@ -0,0 +1,179 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 90dd45a22854
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { AnthropicAllowedCallers$outboundSchema, } from "./anthropicallowedcallers.js";
8
+ import { AnthropicCacheControlDirective$outboundSchema, } from "./anthropiccachecontroldirective.js";
9
+ import { AnthropicWebSearchToolUserLocation$outboundSchema, } from "./anthropicwebsearchtooluserlocation.js";
10
+ export const AnthropicToolUnionNameWebSearch2 = {
11
+ WebSearch: "web_search",
12
+ };
13
+ export const AnthropicToolUnionTypeWebSearch20260209 = {
14
+ WebSearch20260209: "web_search_20260209",
15
+ };
16
+ export const AnthropicToolUnionNameWebSearch1 = {
17
+ WebSearch: "web_search",
18
+ };
19
+ export const AnthropicToolUnionTypeWebSearch20250305 = {
20
+ WebSearch20250305: "web_search_20250305",
21
+ };
22
+ export const AnthropicToolUnionNameStrReplaceEditor = {
23
+ StrReplaceEditor: "str_replace_editor",
24
+ };
25
+ export const AnthropicToolUnionTypeTextEditor20250124 = {
26
+ TextEditor20250124: "text_editor_20250124",
27
+ };
28
+ export const AnthropicToolUnionNameBash = {
29
+ Bash: "bash",
30
+ };
31
+ export const AnthropicToolUnionTypeBash20250124 = {
32
+ Bash20250124: "bash_20250124",
33
+ };
34
+ export const TypeObject = {
35
+ Object: "object",
36
+ };
37
+ export const AnthropicToolUnionTypeCustom = {
38
+ Custom: "custom",
39
+ };
40
+ /** @internal */
41
+ export const AnthropicToolUnionNameWebSearch2$outboundSchema = z.enum(AnthropicToolUnionNameWebSearch2);
42
+ /** @internal */
43
+ export const AnthropicToolUnionTypeWebSearch20260209$outboundSchema = z.enum(AnthropicToolUnionTypeWebSearch20260209);
44
+ /** @internal */
45
+ export const AnthropicToolUnionWebSearch20260209$outboundSchema = z.object({
46
+ allowedCallers: z.array(AnthropicAllowedCallers$outboundSchema).optional(),
47
+ allowedDomains: z.nullable(z.array(z.string())).optional(),
48
+ blockedDomains: z.nullable(z.array(z.string())).optional(),
49
+ cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
50
+ maxUses: z.nullable(z.int()).optional(),
51
+ name: AnthropicToolUnionNameWebSearch2$outboundSchema,
52
+ type: AnthropicToolUnionTypeWebSearch20260209$outboundSchema,
53
+ userLocation: z.nullable(AnthropicWebSearchToolUserLocation$outboundSchema)
54
+ .optional(),
55
+ }).transform((v) => {
56
+ return remap$(v, {
57
+ allowedCallers: "allowed_callers",
58
+ allowedDomains: "allowed_domains",
59
+ blockedDomains: "blocked_domains",
60
+ cacheControl: "cache_control",
61
+ maxUses: "max_uses",
62
+ userLocation: "user_location",
63
+ });
64
+ });
65
+ export function anthropicToolUnionWebSearch20260209ToJSON(anthropicToolUnionWebSearch20260209) {
66
+ return JSON.stringify(AnthropicToolUnionWebSearch20260209$outboundSchema.parse(anthropicToolUnionWebSearch20260209));
67
+ }
68
+ /** @internal */
69
+ export const AnthropicToolUnionNameWebSearch1$outboundSchema = z.enum(AnthropicToolUnionNameWebSearch1);
70
+ /** @internal */
71
+ export const AnthropicToolUnionTypeWebSearch20250305$outboundSchema = z.enum(AnthropicToolUnionTypeWebSearch20250305);
72
+ /** @internal */
73
+ export const AnthropicToolUnionWebSearch20250305$outboundSchema = z.object({
74
+ allowedDomains: z.nullable(z.array(z.string())).optional(),
75
+ blockedDomains: z.nullable(z.array(z.string())).optional(),
76
+ cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
77
+ maxUses: z.nullable(z.int()).optional(),
78
+ name: AnthropicToolUnionNameWebSearch1$outboundSchema,
79
+ type: AnthropicToolUnionTypeWebSearch20250305$outboundSchema,
80
+ userLocation: z.nullable(AnthropicWebSearchToolUserLocation$outboundSchema)
81
+ .optional(),
82
+ }).transform((v) => {
83
+ return remap$(v, {
84
+ allowedDomains: "allowed_domains",
85
+ blockedDomains: "blocked_domains",
86
+ cacheControl: "cache_control",
87
+ maxUses: "max_uses",
88
+ userLocation: "user_location",
89
+ });
90
+ });
91
+ export function anthropicToolUnionWebSearch20250305ToJSON(anthropicToolUnionWebSearch20250305) {
92
+ return JSON.stringify(AnthropicToolUnionWebSearch20250305$outboundSchema.parse(anthropicToolUnionWebSearch20250305));
93
+ }
94
+ /** @internal */
95
+ export const AnthropicToolUnionNameStrReplaceEditor$outboundSchema = z.enum(AnthropicToolUnionNameStrReplaceEditor);
96
+ /** @internal */
97
+ export const AnthropicToolUnionTypeTextEditor20250124$outboundSchema = z.enum(AnthropicToolUnionTypeTextEditor20250124);
98
+ /** @internal */
99
+ export const AnthropicToolUnionTextEditor20250124$outboundSchema = z.object({
100
+ cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
101
+ name: AnthropicToolUnionNameStrReplaceEditor$outboundSchema,
102
+ type: AnthropicToolUnionTypeTextEditor20250124$outboundSchema,
103
+ }).transform((v) => {
104
+ return remap$(v, {
105
+ cacheControl: "cache_control",
106
+ });
107
+ });
108
+ export function anthropicToolUnionTextEditor20250124ToJSON(anthropicToolUnionTextEditor20250124) {
109
+ return JSON.stringify(AnthropicToolUnionTextEditor20250124$outboundSchema.parse(anthropicToolUnionTextEditor20250124));
110
+ }
111
+ /** @internal */
112
+ export const AnthropicToolUnionNameBash$outboundSchema = z.enum(AnthropicToolUnionNameBash);
113
+ /** @internal */
114
+ export const AnthropicToolUnionTypeBash20250124$outboundSchema = z.enum(AnthropicToolUnionTypeBash20250124);
115
+ /** @internal */
116
+ export const AnthropicToolUnionBash20250124$outboundSchema = z.object({
117
+ cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
118
+ name: AnthropicToolUnionNameBash$outboundSchema,
119
+ type: AnthropicToolUnionTypeBash20250124$outboundSchema,
120
+ }).transform((v) => {
121
+ return remap$(v, {
122
+ cacheControl: "cache_control",
123
+ });
124
+ });
125
+ export function anthropicToolUnionBash20250124ToJSON(anthropicToolUnionBash20250124) {
126
+ return JSON.stringify(AnthropicToolUnionBash20250124$outboundSchema.parse(anthropicToolUnionBash20250124));
127
+ }
128
+ /** @internal */
129
+ export const TypeObject$outboundSchema = z.enum(TypeObject);
130
+ /** @internal */
131
+ export const AnthropicToolUnionInputSchema$outboundSchema = z.object({
132
+ properties: z.any().optional(),
133
+ required: z.nullable(z.array(z.string())).optional(),
134
+ type: TypeObject$outboundSchema,
135
+ additionalProperties: z.record(z.string(), z.any()).optional(),
136
+ }).transform((v) => {
137
+ return {
138
+ ...v.additionalProperties,
139
+ ...remap$(v, {
140
+ additionalProperties: null,
141
+ }),
142
+ };
143
+ });
144
+ export function anthropicToolUnionInputSchemaToJSON(anthropicToolUnionInputSchema) {
145
+ return JSON.stringify(AnthropicToolUnionInputSchema$outboundSchema.parse(anthropicToolUnionInputSchema));
146
+ }
147
+ /** @internal */
148
+ export const AnthropicToolUnionTypeCustom$outboundSchema = z.enum(AnthropicToolUnionTypeCustom);
149
+ /** @internal */
150
+ export const AnthropicToolUnionCustom$outboundSchema = z.object({
151
+ cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
152
+ deferLoading: z.boolean().optional(),
153
+ description: z.string().optional(),
154
+ inputSchema: z.lazy(() => AnthropicToolUnionInputSchema$outboundSchema),
155
+ name: z.string(),
156
+ strict: z.boolean().optional(),
157
+ type: AnthropicToolUnionTypeCustom$outboundSchema.optional(),
158
+ }).transform((v) => {
159
+ return remap$(v, {
160
+ cacheControl: "cache_control",
161
+ deferLoading: "defer_loading",
162
+ inputSchema: "input_schema",
163
+ });
164
+ });
165
+ export function anthropicToolUnionCustomToJSON(anthropicToolUnionCustom) {
166
+ return JSON.stringify(AnthropicToolUnionCustom$outboundSchema.parse(anthropicToolUnionCustom));
167
+ }
168
+ /** @internal */
169
+ export const AnthropicToolUnion$outboundSchema = z.union([
170
+ z.lazy(() => AnthropicToolUnionCustom$outboundSchema),
171
+ z.lazy(() => AnthropicToolUnionBash20250124$outboundSchema),
172
+ z.lazy(() => AnthropicToolUnionTextEditor20250124$outboundSchema),
173
+ z.lazy(() => AnthropicToolUnionWebSearch20250305$outboundSchema),
174
+ z.lazy(() => AnthropicToolUnionWebSearch20260209$outboundSchema),
175
+ ]);
176
+ export function anthropicToolUnionToJSON(anthropicToolUnion) {
177
+ return JSON.stringify(AnthropicToolUnion$outboundSchema.parse(anthropicToolUnion));
178
+ }
179
+ //# sourceMappingURL=anthropictoolunion.js.map
@@ -106,6 +106,7 @@ export * from "./anthropictoolsearchresulterror.js";
106
106
  export * from "./anthropictoolsearchtoolbm25.js";
107
107
  export * from "./anthropictoolsearchtoolregex.js";
108
108
  export * from "./anthropictoolsearchtoolresult.js";
109
+ export * from "./anthropictoolunion.js";
109
110
  export * from "./anthropictooluseblock.js";
110
111
  export * from "./anthropictooluseskeep.js";
111
112
  export * from "./anthropictoolusestrigger.js";
@@ -110,6 +110,7 @@ export * from "./anthropictoolsearchresulterror.js";
110
110
  export * from "./anthropictoolsearchtoolbm25.js";
111
111
  export * from "./anthropictoolsearchtoolregex.js";
112
112
  export * from "./anthropictoolsearchtoolresult.js";
113
+ export * from "./anthropictoolunion.js";
113
114
  export * from "./anthropictooluseblock.js";
114
115
  export * from "./anthropictooluseskeep.js";
115
116
  export * from "./anthropictoolusestrigger.js";
@@ -165,14 +165,14 @@ export type ToolAdvisor20260301 = {
165
165
  name: NameAdvisor;
166
166
  type: TypeAdvisor20260301;
167
167
  };
168
- export declare const NameWebSearch2: {
168
+ export declare const MessagesRequestNameWebSearch2: {
169
169
  readonly WebSearch: "web_search";
170
170
  };
171
- export type NameWebSearch2 = ClosedEnum<typeof NameWebSearch2>;
172
- export declare const TypeWebSearch20260209: {
171
+ export type MessagesRequestNameWebSearch2 = ClosedEnum<typeof MessagesRequestNameWebSearch2>;
172
+ export declare const ToolTypeWebSearch20260209: {
173
173
  readonly WebSearch20260209: "web_search_20260209";
174
174
  };
175
- export type TypeWebSearch20260209 = ClosedEnum<typeof TypeWebSearch20260209>;
175
+ export type ToolTypeWebSearch20260209 = ClosedEnum<typeof ToolTypeWebSearch20260209>;
176
176
  export type ToolWebSearch20260209 = {
177
177
  allowedCallers?: Array<AnthropicAllowedCallers> | undefined;
178
178
  allowedDomains?: Array<string> | null | undefined;
@@ -182,18 +182,18 @@ export type ToolWebSearch20260209 = {
182
182
  */
183
183
  cacheControl?: AnthropicCacheControlDirective | undefined;
184
184
  maxUses?: number | null | undefined;
185
- name: NameWebSearch2;
186
- type: TypeWebSearch20260209;
185
+ name: MessagesRequestNameWebSearch2;
186
+ type: ToolTypeWebSearch20260209;
187
187
  userLocation?: AnthropicWebSearchToolUserLocation | null | undefined;
188
188
  };
189
- export declare const NameWebSearch1: {
189
+ export declare const MessagesRequestNameWebSearch1: {
190
190
  readonly WebSearch: "web_search";
191
191
  };
192
- export type NameWebSearch1 = ClosedEnum<typeof NameWebSearch1>;
193
- export declare const TypeWebSearch20250305: {
192
+ export type MessagesRequestNameWebSearch1 = ClosedEnum<typeof MessagesRequestNameWebSearch1>;
193
+ export declare const ToolTypeWebSearch20250305: {
194
194
  readonly WebSearch20250305: "web_search_20250305";
195
195
  };
196
- export type TypeWebSearch20250305 = ClosedEnum<typeof TypeWebSearch20250305>;
196
+ export type ToolTypeWebSearch20250305 = ClosedEnum<typeof ToolTypeWebSearch20250305>;
197
197
  export type ToolWebSearch20250305 = {
198
198
  allowedDomains?: Array<string> | null | undefined;
199
199
  blockedDomains?: Array<string> | null | undefined;
@@ -202,43 +202,43 @@ export type ToolWebSearch20250305 = {
202
202
  */
203
203
  cacheControl?: AnthropicCacheControlDirective | undefined;
204
204
  maxUses?: number | null | undefined;
205
- name: NameWebSearch1;
206
- type: TypeWebSearch20250305;
205
+ name: MessagesRequestNameWebSearch1;
206
+ type: ToolTypeWebSearch20250305;
207
207
  userLocation?: AnthropicWebSearchToolUserLocation | null | undefined;
208
208
  };
209
- export declare const NameStrReplaceEditor: {
209
+ export declare const MessagesRequestNameStrReplaceEditor: {
210
210
  readonly StrReplaceEditor: "str_replace_editor";
211
211
  };
212
- export type NameStrReplaceEditor = ClosedEnum<typeof NameStrReplaceEditor>;
213
- export declare const TypeTextEditor20250124: {
212
+ export type MessagesRequestNameStrReplaceEditor = ClosedEnum<typeof MessagesRequestNameStrReplaceEditor>;
213
+ export declare const ToolTypeTextEditor20250124: {
214
214
  readonly TextEditor20250124: "text_editor_20250124";
215
215
  };
216
- export type TypeTextEditor20250124 = ClosedEnum<typeof TypeTextEditor20250124>;
216
+ export type ToolTypeTextEditor20250124 = ClosedEnum<typeof ToolTypeTextEditor20250124>;
217
217
  export type ToolTextEditor20250124 = {
218
218
  /**
219
219
  * 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.
220
220
  */
221
221
  cacheControl?: AnthropicCacheControlDirective | undefined;
222
- name: NameStrReplaceEditor;
223
- type: TypeTextEditor20250124;
222
+ name: MessagesRequestNameStrReplaceEditor;
223
+ type: ToolTypeTextEditor20250124;
224
224
  };
225
- export declare const NameBash: {
225
+ export declare const MessagesRequestNameBash: {
226
226
  readonly Bash: "bash";
227
227
  };
228
- export type NameBash = ClosedEnum<typeof NameBash>;
229
- export declare const TypeBash20250124: {
228
+ export type MessagesRequestNameBash = ClosedEnum<typeof MessagesRequestNameBash>;
229
+ export declare const ToolTypeBash20250124: {
230
230
  readonly Bash20250124: "bash_20250124";
231
231
  };
232
- export type TypeBash20250124 = ClosedEnum<typeof TypeBash20250124>;
232
+ export type ToolTypeBash20250124 = ClosedEnum<typeof ToolTypeBash20250124>;
233
233
  export type ToolBash20250124 = {
234
234
  /**
235
235
  * 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.
236
236
  */
237
237
  cacheControl?: AnthropicCacheControlDirective | undefined;
238
- name: NameBash;
239
- type: TypeBash20250124;
238
+ name: MessagesRequestNameBash;
239
+ type: ToolTypeBash20250124;
240
240
  };
241
- export type InputSchema = {
241
+ export type MessagesRequestInputSchema = {
242
242
  properties?: any | undefined;
243
243
  required?: Array<string> | null | undefined;
244
244
  type?: string | undefined;
@@ -257,7 +257,7 @@ export type ToolCustom = {
257
257
  cacheControl?: AnthropicCacheControlDirective | undefined;
258
258
  deferLoading?: boolean | undefined;
259
259
  description?: string | undefined;
260
- inputSchema: InputSchema;
260
+ inputSchema: MessagesRequestInputSchema;
261
261
  name: string;
262
262
  strict?: boolean | undefined;
263
263
  type?: ToolTypeCustom | undefined;
@@ -525,9 +525,9 @@ export type ToolAdvisor20260301$Outbound = {
525
525
  export declare const ToolAdvisor20260301$outboundSchema: z.ZodType<ToolAdvisor20260301$Outbound, ToolAdvisor20260301>;
526
526
  export declare function toolAdvisor20260301ToJSON(toolAdvisor20260301: ToolAdvisor20260301): string;
527
527
  /** @internal */
528
- export declare const NameWebSearch2$outboundSchema: z.ZodEnum<typeof NameWebSearch2>;
528
+ export declare const MessagesRequestNameWebSearch2$outboundSchema: z.ZodEnum<typeof MessagesRequestNameWebSearch2>;
529
529
  /** @internal */
530
- export declare const TypeWebSearch20260209$outboundSchema: z.ZodEnum<typeof TypeWebSearch20260209>;
530
+ export declare const ToolTypeWebSearch20260209$outboundSchema: z.ZodEnum<typeof ToolTypeWebSearch20260209>;
531
531
  /** @internal */
532
532
  export type ToolWebSearch20260209$Outbound = {
533
533
  allowed_callers?: Array<string> | undefined;
@@ -543,9 +543,9 @@ export type ToolWebSearch20260209$Outbound = {
543
543
  export declare const ToolWebSearch20260209$outboundSchema: z.ZodType<ToolWebSearch20260209$Outbound, ToolWebSearch20260209>;
544
544
  export declare function toolWebSearch20260209ToJSON(toolWebSearch20260209: ToolWebSearch20260209): string;
545
545
  /** @internal */
546
- export declare const NameWebSearch1$outboundSchema: z.ZodEnum<typeof NameWebSearch1>;
546
+ export declare const MessagesRequestNameWebSearch1$outboundSchema: z.ZodEnum<typeof MessagesRequestNameWebSearch1>;
547
547
  /** @internal */
548
- export declare const TypeWebSearch20250305$outboundSchema: z.ZodEnum<typeof TypeWebSearch20250305>;
548
+ export declare const ToolTypeWebSearch20250305$outboundSchema: z.ZodEnum<typeof ToolTypeWebSearch20250305>;
549
549
  /** @internal */
550
550
  export type ToolWebSearch20250305$Outbound = {
551
551
  allowed_domains?: Array<string> | null | undefined;
@@ -560,9 +560,9 @@ export type ToolWebSearch20250305$Outbound = {
560
560
  export declare const ToolWebSearch20250305$outboundSchema: z.ZodType<ToolWebSearch20250305$Outbound, ToolWebSearch20250305>;
561
561
  export declare function toolWebSearch20250305ToJSON(toolWebSearch20250305: ToolWebSearch20250305): string;
562
562
  /** @internal */
563
- export declare const NameStrReplaceEditor$outboundSchema: z.ZodEnum<typeof NameStrReplaceEditor>;
563
+ export declare const MessagesRequestNameStrReplaceEditor$outboundSchema: z.ZodEnum<typeof MessagesRequestNameStrReplaceEditor>;
564
564
  /** @internal */
565
- export declare const TypeTextEditor20250124$outboundSchema: z.ZodEnum<typeof TypeTextEditor20250124>;
565
+ export declare const ToolTypeTextEditor20250124$outboundSchema: z.ZodEnum<typeof ToolTypeTextEditor20250124>;
566
566
  /** @internal */
567
567
  export type ToolTextEditor20250124$Outbound = {
568
568
  cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
@@ -573,9 +573,9 @@ export type ToolTextEditor20250124$Outbound = {
573
573
  export declare const ToolTextEditor20250124$outboundSchema: z.ZodType<ToolTextEditor20250124$Outbound, ToolTextEditor20250124>;
574
574
  export declare function toolTextEditor20250124ToJSON(toolTextEditor20250124: ToolTextEditor20250124): string;
575
575
  /** @internal */
576
- export declare const NameBash$outboundSchema: z.ZodEnum<typeof NameBash>;
576
+ export declare const MessagesRequestNameBash$outboundSchema: z.ZodEnum<typeof MessagesRequestNameBash>;
577
577
  /** @internal */
578
- export declare const TypeBash20250124$outboundSchema: z.ZodEnum<typeof TypeBash20250124>;
578
+ export declare const ToolTypeBash20250124$outboundSchema: z.ZodEnum<typeof ToolTypeBash20250124>;
579
579
  /** @internal */
580
580
  export type ToolBash20250124$Outbound = {
581
581
  cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
@@ -586,15 +586,15 @@ export type ToolBash20250124$Outbound = {
586
586
  export declare const ToolBash20250124$outboundSchema: z.ZodType<ToolBash20250124$Outbound, ToolBash20250124>;
587
587
  export declare function toolBash20250124ToJSON(toolBash20250124: ToolBash20250124): string;
588
588
  /** @internal */
589
- export type InputSchema$Outbound = {
589
+ export type MessagesRequestInputSchema$Outbound = {
590
590
  properties?: any | undefined;
591
591
  required?: Array<string> | null | undefined;
592
592
  type: string;
593
593
  [additionalProperties: string]: unknown;
594
594
  };
595
595
  /** @internal */
596
- export declare const InputSchema$outboundSchema: z.ZodType<InputSchema$Outbound, InputSchema>;
597
- export declare function inputSchemaToJSON(inputSchema: InputSchema): string;
596
+ export declare const MessagesRequestInputSchema$outboundSchema: z.ZodType<MessagesRequestInputSchema$Outbound, MessagesRequestInputSchema>;
597
+ export declare function messagesRequestInputSchemaToJSON(messagesRequestInputSchema: MessagesRequestInputSchema): string;
598
598
  /** @internal */
599
599
  export declare const ToolTypeCustom$outboundSchema: z.ZodEnum<typeof ToolTypeCustom>;
600
600
  /** @internal */
@@ -602,7 +602,7 @@ export type ToolCustom$Outbound = {
602
602
  cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
603
603
  defer_loading?: boolean | undefined;
604
604
  description?: string | undefined;
605
- input_schema: InputSchema$Outbound;
605
+ input_schema: MessagesRequestInputSchema$Outbound;
606
606
  name: string;
607
607
  strict?: boolean | undefined;
608
608
  type?: string | undefined;
@@ -70,28 +70,28 @@ export const NameAdvisor = {
70
70
  export const TypeAdvisor20260301 = {
71
71
  Advisor20260301: "advisor_20260301",
72
72
  };
73
- export const NameWebSearch2 = {
73
+ export const MessagesRequestNameWebSearch2 = {
74
74
  WebSearch: "web_search",
75
75
  };
76
- export const TypeWebSearch20260209 = {
76
+ export const ToolTypeWebSearch20260209 = {
77
77
  WebSearch20260209: "web_search_20260209",
78
78
  };
79
- export const NameWebSearch1 = {
79
+ export const MessagesRequestNameWebSearch1 = {
80
80
  WebSearch: "web_search",
81
81
  };
82
- export const TypeWebSearch20250305 = {
82
+ export const ToolTypeWebSearch20250305 = {
83
83
  WebSearch20250305: "web_search_20250305",
84
84
  };
85
- export const NameStrReplaceEditor = {
85
+ export const MessagesRequestNameStrReplaceEditor = {
86
86
  StrReplaceEditor: "str_replace_editor",
87
87
  };
88
- export const TypeTextEditor20250124 = {
88
+ export const ToolTypeTextEditor20250124 = {
89
89
  TextEditor20250124: "text_editor_20250124",
90
90
  };
91
- export const NameBash = {
91
+ export const MessagesRequestNameBash = {
92
92
  Bash: "bash",
93
93
  };
94
- export const TypeBash20250124 = {
94
+ export const ToolTypeBash20250124 = {
95
95
  Bash20250124: "bash_20250124",
96
96
  };
97
97
  export const ToolTypeCustom = {
@@ -402,10 +402,9 @@ export function toolAdvisor20260301ToJSON(toolAdvisor20260301) {
402
402
  return JSON.stringify(ToolAdvisor20260301$outboundSchema.parse(toolAdvisor20260301));
403
403
  }
404
404
  /** @internal */
405
- export const NameWebSearch2$outboundSchema = z
406
- .enum(NameWebSearch2);
405
+ export const MessagesRequestNameWebSearch2$outboundSchema = z.enum(MessagesRequestNameWebSearch2);
407
406
  /** @internal */
408
- export const TypeWebSearch20260209$outboundSchema = z.enum(TypeWebSearch20260209);
407
+ export const ToolTypeWebSearch20260209$outboundSchema = z.enum(ToolTypeWebSearch20260209);
409
408
  /** @internal */
410
409
  export const ToolWebSearch20260209$outboundSchema = z.object({
411
410
  allowedCallers: z.array(AnthropicAllowedCallers$outboundSchema).optional(),
@@ -413,8 +412,8 @@ export const ToolWebSearch20260209$outboundSchema = z.object({
413
412
  blockedDomains: z.nullable(z.array(z.string())).optional(),
414
413
  cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
415
414
  maxUses: z.nullable(z.int()).optional(),
416
- name: NameWebSearch2$outboundSchema,
417
- type: TypeWebSearch20260209$outboundSchema,
415
+ name: MessagesRequestNameWebSearch2$outboundSchema,
416
+ type: ToolTypeWebSearch20260209$outboundSchema,
418
417
  userLocation: z.nullable(AnthropicWebSearchToolUserLocation$outboundSchema)
419
418
  .optional(),
420
419
  }).transform((v) => {
@@ -431,18 +430,17 @@ export function toolWebSearch20260209ToJSON(toolWebSearch20260209) {
431
430
  return JSON.stringify(ToolWebSearch20260209$outboundSchema.parse(toolWebSearch20260209));
432
431
  }
433
432
  /** @internal */
434
- export const NameWebSearch1$outboundSchema = z
435
- .enum(NameWebSearch1);
433
+ export const MessagesRequestNameWebSearch1$outboundSchema = z.enum(MessagesRequestNameWebSearch1);
436
434
  /** @internal */
437
- export const TypeWebSearch20250305$outboundSchema = z.enum(TypeWebSearch20250305);
435
+ export const ToolTypeWebSearch20250305$outboundSchema = z.enum(ToolTypeWebSearch20250305);
438
436
  /** @internal */
439
437
  export const ToolWebSearch20250305$outboundSchema = z.object({
440
438
  allowedDomains: z.nullable(z.array(z.string())).optional(),
441
439
  blockedDomains: z.nullable(z.array(z.string())).optional(),
442
440
  cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
443
441
  maxUses: z.nullable(z.int()).optional(),
444
- name: NameWebSearch1$outboundSchema,
445
- type: TypeWebSearch20250305$outboundSchema,
442
+ name: MessagesRequestNameWebSearch1$outboundSchema,
443
+ type: ToolTypeWebSearch20250305$outboundSchema,
446
444
  userLocation: z.nullable(AnthropicWebSearchToolUserLocation$outboundSchema)
447
445
  .optional(),
448
446
  }).transform((v) => {
@@ -458,14 +456,14 @@ export function toolWebSearch20250305ToJSON(toolWebSearch20250305) {
458
456
  return JSON.stringify(ToolWebSearch20250305$outboundSchema.parse(toolWebSearch20250305));
459
457
  }
460
458
  /** @internal */
461
- export const NameStrReplaceEditor$outboundSchema = z.enum(NameStrReplaceEditor);
459
+ export const MessagesRequestNameStrReplaceEditor$outboundSchema = z.enum(MessagesRequestNameStrReplaceEditor);
462
460
  /** @internal */
463
- export const TypeTextEditor20250124$outboundSchema = z.enum(TypeTextEditor20250124);
461
+ export const ToolTypeTextEditor20250124$outboundSchema = z.enum(ToolTypeTextEditor20250124);
464
462
  /** @internal */
465
463
  export const ToolTextEditor20250124$outboundSchema = z.object({
466
464
  cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
467
- name: NameStrReplaceEditor$outboundSchema,
468
- type: TypeTextEditor20250124$outboundSchema,
465
+ name: MessagesRequestNameStrReplaceEditor$outboundSchema,
466
+ type: ToolTypeTextEditor20250124$outboundSchema,
469
467
  }).transform((v) => {
470
468
  return remap$(v, {
471
469
  cacheControl: "cache_control",
@@ -475,14 +473,14 @@ export function toolTextEditor20250124ToJSON(toolTextEditor20250124) {
475
473
  return JSON.stringify(ToolTextEditor20250124$outboundSchema.parse(toolTextEditor20250124));
476
474
  }
477
475
  /** @internal */
478
- export const NameBash$outboundSchema = z.enum(NameBash);
476
+ export const MessagesRequestNameBash$outboundSchema = z.enum(MessagesRequestNameBash);
479
477
  /** @internal */
480
- export const TypeBash20250124$outboundSchema = z.enum(TypeBash20250124);
478
+ export const ToolTypeBash20250124$outboundSchema = z.enum(ToolTypeBash20250124);
481
479
  /** @internal */
482
480
  export const ToolBash20250124$outboundSchema = z.object({
483
481
  cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
484
- name: NameBash$outboundSchema,
485
- type: TypeBash20250124$outboundSchema,
482
+ name: MessagesRequestNameBash$outboundSchema,
483
+ type: ToolTypeBash20250124$outboundSchema,
486
484
  }).transform((v) => {
487
485
  return remap$(v, {
488
486
  cacheControl: "cache_control",
@@ -492,7 +490,7 @@ export function toolBash20250124ToJSON(toolBash20250124) {
492
490
  return JSON.stringify(ToolBash20250124$outboundSchema.parse(toolBash20250124));
493
491
  }
494
492
  /** @internal */
495
- export const InputSchema$outboundSchema = z.object({
493
+ export const MessagesRequestInputSchema$outboundSchema = z.object({
496
494
  properties: z.any().optional(),
497
495
  required: z.nullable(z.array(z.string())).optional(),
498
496
  type: z.string().default("object"),
@@ -505,8 +503,8 @@ export const InputSchema$outboundSchema = z.object({
505
503
  }),
506
504
  };
507
505
  });
508
- export function inputSchemaToJSON(inputSchema) {
509
- return JSON.stringify(InputSchema$outboundSchema.parse(inputSchema));
506
+ export function messagesRequestInputSchemaToJSON(messagesRequestInputSchema) {
507
+ return JSON.stringify(MessagesRequestInputSchema$outboundSchema.parse(messagesRequestInputSchema));
510
508
  }
511
509
  /** @internal */
512
510
  export const ToolTypeCustom$outboundSchema = z
@@ -516,7 +514,7 @@ export const ToolCustom$outboundSchema = z.object({
516
514
  cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
517
515
  deferLoading: z.boolean().optional(),
518
516
  description: z.string().optional(),
519
- inputSchema: z.lazy(() => InputSchema$outboundSchema),
517
+ inputSchema: z.lazy(() => MessagesRequestInputSchema$outboundSchema),
520
518
  name: z.string(),
521
519
  strict: z.boolean().optional(),
522
520
  type: ToolTypeCustom$outboundSchema.optional(),
@@ -1,5 +1,13 @@
1
1
  import * as z from "zod/v4";
2
2
  import { AnthropicCacheControlDirective, AnthropicCacheControlDirective$Outbound } from "./anthropiccachecontroldirective.js";
3
+ import { AnthropicToolUnion, AnthropicToolUnion$Outbound } from "./anthropictoolunion.js";
4
+ export type ToolToolDefinition = {
5
+ /**
6
+ * An Anthropic tool definition: a client-defined tool with a JSON Schema `input_schema`, or a server tool (bash, text editor, web search).
7
+ */
8
+ definition: AnthropicToolUnion;
9
+ type: "tool_definition";
10
+ };
3
11
  export type MessagesToolAdditionBlockToolMcpToolsetReference = {
4
12
  serverName: string;
5
13
  type: "mcp_toolset_reference";
@@ -13,19 +21,27 @@ export type MessagesToolAdditionBlockToolToolReference = {
13
21
  name: string;
14
22
  type: "tool_reference";
15
23
  };
16
- export type MessagesToolAdditionBlockToolUnion = MessagesToolAdditionBlockToolToolReference | MessagesToolAdditionBlockToolMcpToolReference | MessagesToolAdditionBlockToolMcpToolsetReference;
24
+ export type MessagesToolAdditionBlockToolUnion = MessagesToolAdditionBlockToolToolReference | MessagesToolAdditionBlockToolMcpToolReference | MessagesToolAdditionBlockToolMcpToolsetReference | ToolToolDefinition;
17
25
  /**
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.
26
+ * Adds a tool mid-conversation without invalidating the prompt cache: either a previously deferred tool (declared in `tools` with `defer_loading: true`, referenced by name) or a full inline `tool_definition`. Only valid in `role: "system"` messages. Not supported on Claude Sonnet 5 or models older than Claude Opus 4.8.
19
27
  */
20
28
  export type MessagesToolAdditionBlock = {
21
29
  /**
22
30
  * 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
31
  */
24
32
  cacheControl?: AnthropicCacheControlDirective | undefined;
25
- tool: MessagesToolAdditionBlockToolToolReference | MessagesToolAdditionBlockToolMcpToolReference | MessagesToolAdditionBlockToolMcpToolsetReference;
33
+ tool: MessagesToolAdditionBlockToolToolReference | MessagesToolAdditionBlockToolMcpToolReference | MessagesToolAdditionBlockToolMcpToolsetReference | ToolToolDefinition;
26
34
  type: "tool_addition";
27
35
  };
28
36
  /** @internal */
37
+ export type ToolToolDefinition$Outbound = {
38
+ definition: AnthropicToolUnion$Outbound;
39
+ type: "tool_definition";
40
+ };
41
+ /** @internal */
42
+ export declare const ToolToolDefinition$outboundSchema: z.ZodType<ToolToolDefinition$Outbound, ToolToolDefinition>;
43
+ export declare function toolToolDefinitionToJSON(toolToolDefinition: ToolToolDefinition): string;
44
+ /** @internal */
29
45
  export type MessagesToolAdditionBlockToolMcpToolsetReference$Outbound = {
30
46
  server_name: string;
31
47
  type: "mcp_toolset_reference";
@@ -51,14 +67,14 @@ export type MessagesToolAdditionBlockToolToolReference$Outbound = {
51
67
  export declare const MessagesToolAdditionBlockToolToolReference$outboundSchema: z.ZodType<MessagesToolAdditionBlockToolToolReference$Outbound, MessagesToolAdditionBlockToolToolReference>;
52
68
  export declare function messagesToolAdditionBlockToolToolReferenceToJSON(messagesToolAdditionBlockToolToolReference: MessagesToolAdditionBlockToolToolReference): string;
53
69
  /** @internal */
54
- export type MessagesToolAdditionBlockToolUnion$Outbound = MessagesToolAdditionBlockToolToolReference$Outbound | MessagesToolAdditionBlockToolMcpToolReference$Outbound | MessagesToolAdditionBlockToolMcpToolsetReference$Outbound;
70
+ export type MessagesToolAdditionBlockToolUnion$Outbound = MessagesToolAdditionBlockToolToolReference$Outbound | MessagesToolAdditionBlockToolMcpToolReference$Outbound | MessagesToolAdditionBlockToolMcpToolsetReference$Outbound | ToolToolDefinition$Outbound;
55
71
  /** @internal */
56
72
  export declare const MessagesToolAdditionBlockToolUnion$outboundSchema: z.ZodType<MessagesToolAdditionBlockToolUnion$Outbound, MessagesToolAdditionBlockToolUnion>;
57
73
  export declare function messagesToolAdditionBlockToolUnionToJSON(messagesToolAdditionBlockToolUnion: MessagesToolAdditionBlockToolUnion): string;
58
74
  /** @internal */
59
75
  export type MessagesToolAdditionBlock$Outbound = {
60
76
  cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
61
- tool: MessagesToolAdditionBlockToolToolReference$Outbound | MessagesToolAdditionBlockToolMcpToolReference$Outbound | MessagesToolAdditionBlockToolMcpToolsetReference$Outbound;
77
+ tool: MessagesToolAdditionBlockToolToolReference$Outbound | MessagesToolAdditionBlockToolMcpToolReference$Outbound | MessagesToolAdditionBlockToolMcpToolsetReference$Outbound | ToolToolDefinition$Outbound;
62
78
  type: "tool_addition";
63
79
  };
64
80
  /** @internal */
@@ -5,6 +5,15 @@
5
5
  import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
7
  import { AnthropicCacheControlDirective$outboundSchema, } from "./anthropiccachecontroldirective.js";
8
+ import { AnthropicToolUnion$outboundSchema, } from "./anthropictoolunion.js";
9
+ /** @internal */
10
+ export const ToolToolDefinition$outboundSchema = z.object({
11
+ definition: AnthropicToolUnion$outboundSchema,
12
+ type: z.literal("tool_definition"),
13
+ });
14
+ export function toolToolDefinitionToJSON(toolToolDefinition) {
15
+ return JSON.stringify(ToolToolDefinition$outboundSchema.parse(toolToolDefinition));
16
+ }
8
17
  /** @internal */
9
18
  export const MessagesToolAdditionBlockToolMcpToolsetReference$outboundSchema = z.object({
10
19
  serverName: z.string(),
@@ -43,6 +52,7 @@ export const MessagesToolAdditionBlockToolUnion$outboundSchema = z.union([
43
52
  z.lazy(() => MessagesToolAdditionBlockToolToolReference$outboundSchema),
44
53
  z.lazy(() => MessagesToolAdditionBlockToolMcpToolReference$outboundSchema),
45
54
  z.lazy(() => MessagesToolAdditionBlockToolMcpToolsetReference$outboundSchema),
55
+ z.lazy(() => ToolToolDefinition$outboundSchema),
46
56
  ]);
47
57
  export function messagesToolAdditionBlockToolUnionToJSON(messagesToolAdditionBlockToolUnion) {
48
58
  return JSON.stringify(MessagesToolAdditionBlockToolUnion$outboundSchema.parse(messagesToolAdditionBlockToolUnion));
@@ -54,6 +64,7 @@ export const MessagesToolAdditionBlock$outboundSchema = z.object({
54
64
  z.lazy(() => MessagesToolAdditionBlockToolToolReference$outboundSchema),
55
65
  z.lazy(() => MessagesToolAdditionBlockToolMcpToolReference$outboundSchema),
56
66
  z.lazy(() => MessagesToolAdditionBlockToolMcpToolsetReference$outboundSchema),
67
+ z.lazy(() => ToolToolDefinition$outboundSchema),
57
68
  ]),
58
69
  type: z.literal("tool_addition"),
59
70
  }).transform((v) => {
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.5.8",
5
+ "version": "1.5.9",
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.5.8",
3
+ "version": "1.5.9",
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 && node scripts/unbarrel-imports.js",
75
75
  "prepublishOnly": "npm run build",
76
- "typecheck:transit": "exit 0",
77
- "prepare": "npm run build",
78
76
  "test:e2e": "vitest --run --project e2e",
79
77
  "test:transit": "exit 0",
80
78
  "test:watch": "vitest --watch --project unit",
79
+ "typecheck": "tsc --noEmit",
80
+ "typecheck:transit": "exit 0",
81
81
  "compile": "tsc && node scripts/unbarrel-imports.js",
82
82
  "postinstall": "node scripts/check-types.js || true",
83
- "test": "vitest --run --project unit",
84
- "typecheck": "tsc --noEmit"
83
+ "prepare": "npm run build",
84
+ "test": "vitest --run --project unit"
85
85
  },
86
86
  "peerDependencies": {
87
87