@effect/ai-anthropic 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/Generated.ts CHANGED
@@ -19,9 +19,15 @@ export class Model extends S.Union(
19
19
  S.Literal("claude-3-7-sonnet-20250219"),
20
20
  S.Literal("claude-3-5-haiku-latest"),
21
21
  S.Literal("claude-3-5-haiku-20241022"),
22
+ S.Literal("claude-sonnet-4-20250514"),
23
+ S.Literal("claude-sonnet-4-0"),
24
+ S.Literal("claude-4-sonnet-20250514"),
22
25
  S.Literal("claude-3-5-sonnet-latest"),
23
26
  S.Literal("claude-3-5-sonnet-20241022"),
24
27
  S.Literal("claude-3-5-sonnet-20240620"),
28
+ S.Literal("claude-opus-4-0"),
29
+ S.Literal("claude-opus-4-20250514"),
30
+ S.Literal("claude-4-opus-20250514"),
25
31
  S.Literal("claude-3-opus-latest"),
26
32
  S.Literal("claude-3-opus-20240229"),
27
33
  S.Literal("claude-3-sonnet-20240229"),
@@ -30,45 +36,95 @@ export class Model extends S.Union(
30
36
  S.Literal("claude-2.0")
31
37
  ) {}
32
38
 
33
- export class InputMessageRole extends S.Literal("user", "assistant") {}
34
-
35
39
  export class CacheControlEphemeralType extends S.Literal("ephemeral") {}
36
40
 
37
41
  export class CacheControlEphemeral extends S.Struct({
38
42
  "type": CacheControlEphemeralType
39
43
  }) {}
40
44
 
45
+ export class RequestServerToolUseBlockName extends S.Literal("web_search") {}
46
+
47
+ export class RequestServerToolUseBlockType extends S.Literal("server_tool_use") {}
48
+
49
+ export class RequestServerToolUseBlock extends S.Struct({
50
+ "cache_control": S.optionalWith(S.Union(CacheControlEphemeral, S.Null), { nullable: true }),
51
+ "id": S.String.pipe(S.pattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
52
+ "input": S.Record({ key: S.String, value: S.Unknown }),
53
+ "name": RequestServerToolUseBlockName,
54
+ "type": RequestServerToolUseBlockType
55
+ }) {}
56
+
57
+ export class RequestWebSearchResultBlockType extends S.Literal("web_search_result") {}
58
+
59
+ export class RequestWebSearchResultBlock extends S.Struct({
60
+ "encrypted_content": S.String,
61
+ "page_age": S.optionalWith(S.Union(S.String, S.Null), { nullable: true }),
62
+ "title": S.String,
63
+ "type": RequestWebSearchResultBlockType,
64
+ "url": S.String
65
+ }) {}
66
+
67
+ export class WebSearchToolResultErrorCode
68
+ extends S.Literal("invalid_tool_input", "unavailable", "max_uses_exceeded", "too_many_requests", "query_too_long")
69
+ {}
70
+
71
+ export class RequestWebSearchToolResultErrorType extends S.Literal("web_search_tool_result_error") {}
72
+
73
+ export class RequestWebSearchToolResultError extends S.Struct({
74
+ "error_code": WebSearchToolResultErrorCode,
75
+ "type": RequestWebSearchToolResultErrorType
76
+ }) {}
77
+
78
+ export class RequestWebSearchToolResultBlockType extends S.Literal("web_search_tool_result") {}
79
+
80
+ export class RequestWebSearchToolResultBlock extends S.Struct({
81
+ "cache_control": S.optionalWith(S.Union(CacheControlEphemeral, S.Null), { nullable: true }),
82
+ "content": S.Union(S.Array(RequestWebSearchResultBlock), RequestWebSearchToolResultError),
83
+ "tool_use_id": S.String.pipe(S.pattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
84
+ "type": RequestWebSearchToolResultBlockType
85
+ }) {}
86
+
41
87
  export class RequestCharLocationCitationType extends S.Literal("char_location") {}
42
88
 
43
89
  export class RequestCharLocationCitation extends S.Struct({
44
- "type": RequestCharLocationCitationType,
45
90
  "cited_text": S.String,
46
91
  "document_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
47
92
  "document_title": S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null),
93
+ "end_char_index": S.Int,
48
94
  "start_char_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
49
- "end_char_index": S.Int
95
+ "type": RequestCharLocationCitationType
50
96
  }) {}
51
97
 
52
98
  export class RequestPageLocationCitationType extends S.Literal("page_location") {}
53
99
 
54
100
  export class RequestPageLocationCitation extends S.Struct({
55
- "type": RequestPageLocationCitationType,
56
101
  "cited_text": S.String,
57
102
  "document_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
58
103
  "document_title": S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null),
104
+ "end_page_number": S.Int,
59
105
  "start_page_number": S.Int.pipe(S.greaterThanOrEqualTo(1)),
60
- "end_page_number": S.Int
106
+ "type": RequestPageLocationCitationType
61
107
  }) {}
62
108
 
63
109
  export class RequestContentBlockLocationCitationType extends S.Literal("content_block_location") {}
64
110
 
65
111
  export class RequestContentBlockLocationCitation extends S.Struct({
66
- "type": RequestContentBlockLocationCitationType,
67
112
  "cited_text": S.String,
68
113
  "document_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
69
114
  "document_title": S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null),
115
+ "end_block_index": S.Int,
70
116
  "start_block_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
71
- "end_block_index": S.Int
117
+ "type": RequestContentBlockLocationCitationType
118
+ }) {}
119
+
120
+ export class RequestWebSearchResultLocationCitationType extends S.Literal("web_search_result_location") {}
121
+
122
+ export class RequestWebSearchResultLocationCitation extends S.Struct({
123
+ "cited_text": S.String,
124
+ "encrypted_index": S.String,
125
+ "title": S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null),
126
+ "type": RequestWebSearchResultLocationCitationType,
127
+ "url": S.String.pipe(S.minLength(1), S.maxLength(2048))
72
128
  }) {}
73
129
 
74
130
  export class RequestTextBlockType extends S.Literal("text") {}
@@ -77,7 +133,14 @@ export class RequestTextBlock extends S.Struct({
77
133
  "cache_control": S.optionalWith(S.Union(CacheControlEphemeral, S.Null), { nullable: true }),
78
134
  "citations": S.optionalWith(
79
135
  S.Union(
80
- S.Array(S.Union(RequestCharLocationCitation, RequestPageLocationCitation, RequestContentBlockLocationCitation)),
136
+ S.Array(
137
+ S.Union(
138
+ RequestCharLocationCitation,
139
+ RequestPageLocationCitation,
140
+ RequestContentBlockLocationCitation,
141
+ RequestWebSearchResultLocationCitation
142
+ )
143
+ ),
81
144
  S.Null
82
145
  ),
83
146
  { nullable: true }
@@ -86,16 +149,14 @@ export class RequestTextBlock extends S.Struct({
86
149
  "type": RequestTextBlockType
87
150
  }) {}
88
151
 
89
- export class RequestImageBlockType extends S.Literal("image") {}
152
+ export class Base64ImageSourceMediaType extends S.Literal("image/jpeg", "image/png", "image/gif", "image/webp") {}
90
153
 
91
154
  export class Base64ImageSourceType extends S.Literal("base64") {}
92
155
 
93
- export class Base64ImageSourceMediaType extends S.Literal("image/jpeg", "image/png", "image/gif", "image/webp") {}
94
-
95
156
  export class Base64ImageSource extends S.Struct({
96
- "type": Base64ImageSourceType,
157
+ "data": S.String,
97
158
  "media_type": Base64ImageSourceMediaType,
98
- "data": S.String
159
+ "type": Base64ImageSourceType
99
160
  }) {}
100
161
 
101
162
  export class URLImageSourceType extends S.Literal("url") {}
@@ -105,61 +166,65 @@ export class URLImageSource extends S.Struct({
105
166
  "url": S.String
106
167
  }) {}
107
168
 
169
+ export class RequestImageBlockType extends S.Literal("image") {}
170
+
108
171
  export class RequestImageBlock extends S.Struct({
109
172
  "cache_control": S.optionalWith(S.Union(CacheControlEphemeral, S.Null), { nullable: true }),
110
- "type": RequestImageBlockType,
111
- "source": S.Union(Base64ImageSource, URLImageSource)
173
+ "source": S.Union(Base64ImageSource, URLImageSource),
174
+ "type": RequestImageBlockType
112
175
  }) {}
113
176
 
114
177
  export class RequestToolUseBlockType extends S.Literal("tool_use") {}
115
178
 
116
179
  export class RequestToolUseBlock extends S.Struct({
117
180
  "cache_control": S.optionalWith(S.Union(CacheControlEphemeral, S.Null), { nullable: true }),
118
- "type": RequestToolUseBlockType,
119
181
  "id": S.String.pipe(S.pattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
120
- "name": S.String.pipe(S.minLength(1), S.maxLength(64), S.pattern(new RegExp("^[a-zA-Z0-9_-]{1,64}$"))),
121
- "input": S.Record({ key: S.String, value: S.Unknown })
182
+ "input": S.Record({ key: S.String, value: S.Unknown }),
183
+ "name": S.String.pipe(S.minLength(1), S.maxLength(200)),
184
+ "type": RequestToolUseBlockType
122
185
  }) {}
123
186
 
124
187
  export class RequestToolResultBlockType extends S.Literal("tool_result") {}
125
188
 
126
189
  export class RequestToolResultBlock extends S.Struct({
127
190
  "cache_control": S.optionalWith(S.Union(CacheControlEphemeral, S.Null), { nullable: true }),
128
- "type": RequestToolResultBlockType,
129
- "tool_use_id": S.String.pipe(S.pattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
130
- "is_error": S.optionalWith(S.Boolean, { nullable: true }),
131
191
  "content": S.optionalWith(S.Union(S.String, S.Array(S.Union(RequestTextBlock, RequestImageBlock))), {
132
192
  nullable: true
133
- })
193
+ }),
194
+ "is_error": S.optionalWith(S.Boolean, { nullable: true }),
195
+ "tool_use_id": S.String.pipe(S.pattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
196
+ "type": RequestToolResultBlockType
134
197
  }) {}
135
198
 
136
- export class RequestDocumentBlockType extends S.Literal("document") {}
137
-
138
- export class Base64PDFSourceType extends S.Literal("base64") {}
199
+ export class RequestCitationsConfig extends S.Struct({
200
+ "enabled": S.optionalWith(S.Boolean, { nullable: true })
201
+ }) {}
139
202
 
140
203
  export class Base64PDFSourceMediaType extends S.Literal("application/pdf") {}
141
204
 
205
+ export class Base64PDFSourceType extends S.Literal("base64") {}
206
+
142
207
  export class Base64PDFSource extends S.Struct({
143
- "type": Base64PDFSourceType,
208
+ "data": S.String,
144
209
  "media_type": Base64PDFSourceMediaType,
145
- "data": S.String
210
+ "type": Base64PDFSourceType
146
211
  }) {}
147
212
 
148
- export class PlainTextSourceType extends S.Literal("text") {}
149
-
150
213
  export class PlainTextSourceMediaType extends S.Literal("text/plain") {}
151
214
 
215
+ export class PlainTextSourceType extends S.Literal("text") {}
216
+
152
217
  export class PlainTextSource extends S.Struct({
153
- "type": PlainTextSourceType,
218
+ "data": S.String,
154
219
  "media_type": PlainTextSourceMediaType,
155
- "data": S.String
220
+ "type": PlainTextSourceType
156
221
  }) {}
157
222
 
158
223
  export class ContentBlockSourceType extends S.Literal("content") {}
159
224
 
160
225
  export class ContentBlockSource extends S.Struct({
161
- "type": ContentBlockSourceType,
162
- "content": S.Union(S.String, S.Array(S.Union(RequestTextBlock, RequestImageBlock)))
226
+ "content": S.Union(S.String, S.Array(S.Union(RequestTextBlock, RequestImageBlock))),
227
+ "type": ContentBlockSourceType
163
228
  }) {}
164
229
 
165
230
  export class URLPDFSourceType extends S.Literal("url") {}
@@ -169,35 +234,35 @@ export class URLPDFSource extends S.Struct({
169
234
  "url": S.String
170
235
  }) {}
171
236
 
172
- export class RequestCitationsConfig extends S.Struct({
173
- "enabled": S.optionalWith(S.Boolean, { nullable: true })
174
- }) {}
237
+ export class RequestDocumentBlockType extends S.Literal("document") {}
175
238
 
176
239
  export class RequestDocumentBlock extends S.Struct({
177
240
  "cache_control": S.optionalWith(S.Union(CacheControlEphemeral, S.Null), { nullable: true }),
178
- "type": RequestDocumentBlockType,
241
+ "citations": S.optionalWith(RequestCitationsConfig, { nullable: true }),
242
+ "context": S.optionalWith(S.Union(S.String.pipe(S.minLength(1)), S.Null), { nullable: true }),
179
243
  "source": S.Union(Base64PDFSource, PlainTextSource, ContentBlockSource, URLPDFSource),
180
244
  "title": S.optionalWith(S.Union(S.String.pipe(S.minLength(1), S.maxLength(500)), S.Null), { nullable: true }),
181
- "context": S.optionalWith(S.Union(S.String.pipe(S.minLength(1)), S.Null), { nullable: true }),
182
- "citations": S.optionalWith(RequestCitationsConfig, { nullable: true })
245
+ "type": RequestDocumentBlockType
183
246
  }) {}
184
247
 
185
248
  export class RequestThinkingBlockType extends S.Literal("thinking") {}
186
249
 
187
250
  export class RequestThinkingBlock extends S.Struct({
188
- "type": RequestThinkingBlockType,
251
+ "signature": S.String,
189
252
  "thinking": S.String,
190
- "signature": S.String
253
+ "type": RequestThinkingBlockType
191
254
  }) {}
192
255
 
193
256
  export class RequestRedactedThinkingBlockType extends S.Literal("redacted_thinking") {}
194
257
 
195
258
  export class RequestRedactedThinkingBlock extends S.Struct({
196
- "type": RequestRedactedThinkingBlockType,
197
- "data": S.String
259
+ "data": S.String,
260
+ "type": RequestRedactedThinkingBlockType
198
261
  }) {}
199
262
 
200
263
  export class InputContentBlock extends S.Union(
264
+ RequestServerToolUseBlock,
265
+ RequestWebSearchToolResultBlock,
201
266
  RequestTextBlock,
202
267
  RequestImageBlock,
203
268
  RequestToolUseBlock,
@@ -207,20 +272,24 @@ export class InputContentBlock extends S.Union(
207
272
  RequestRedactedThinkingBlock
208
273
  ) {}
209
274
 
275
+ export class InputMessageRole extends S.Literal("user", "assistant") {}
276
+
210
277
  export class InputMessage extends S.Struct({
211
- "role": InputMessageRole,
212
- "content": S.Union(S.String, S.Array(InputContentBlock))
278
+ "content": S.Union(S.String, S.Array(InputContentBlock)),
279
+ "role": InputMessageRole
213
280
  }) {}
214
281
 
215
282
  export class Metadata extends S.Struct({
216
283
  "user_id": S.optionalWith(S.Union(S.String.pipe(S.maxLength(256)), S.Null), { nullable: true })
217
284
  }) {}
218
285
 
286
+ export class CreateMessageParamsServiceTier extends S.Literal("auto", "standard_only") {}
287
+
219
288
  export class ThinkingConfigEnabledType extends S.Literal("enabled") {}
220
289
 
221
290
  export class ThinkingConfigEnabled extends S.Struct({
222
- "type": ThinkingConfigEnabledType,
223
- "budget_tokens": S.Int.pipe(S.greaterThanOrEqualTo(1024))
291
+ "budget_tokens": S.Int.pipe(S.greaterThanOrEqualTo(1024)),
292
+ "type": ThinkingConfigEnabledType
224
293
  }) {}
225
294
 
226
295
  export class ThinkingConfigDisabledType extends S.Literal("disabled") {}
@@ -234,23 +303,23 @@ export class ThinkingConfigParam extends S.Union(ThinkingConfigEnabled, Thinking
234
303
  export class ToolChoiceAutoType extends S.Literal("auto") {}
235
304
 
236
305
  export class ToolChoiceAuto extends S.Struct({
237
- "type": ToolChoiceAutoType,
238
- "disable_parallel_tool_use": S.optionalWith(S.Boolean, { nullable: true })
306
+ "disable_parallel_tool_use": S.optionalWith(S.Boolean, { nullable: true }),
307
+ "type": ToolChoiceAutoType
239
308
  }) {}
240
309
 
241
310
  export class ToolChoiceAnyType extends S.Literal("any") {}
242
311
 
243
312
  export class ToolChoiceAny extends S.Struct({
244
- "type": ToolChoiceAnyType,
245
- "disable_parallel_tool_use": S.optionalWith(S.Boolean, { nullable: true })
313
+ "disable_parallel_tool_use": S.optionalWith(S.Boolean, { nullable: true }),
314
+ "type": ToolChoiceAnyType
246
315
  }) {}
247
316
 
248
317
  export class ToolChoiceToolType extends S.Literal("tool") {}
249
318
 
250
319
  export class ToolChoiceTool extends S.Struct({
251
- "type": ToolChoiceToolType,
320
+ "disable_parallel_tool_use": S.optionalWith(S.Boolean, { nullable: true }),
252
321
  "name": S.String,
253
- "disable_parallel_tool_use": S.optionalWith(S.Boolean, { nullable: true })
322
+ "type": ToolChoiceToolType
254
323
  }) {}
255
324
 
256
325
  export class ToolChoiceNoneType extends S.Literal("none") {}
@@ -261,52 +330,94 @@ export class ToolChoiceNone extends S.Struct({
261
330
 
262
331
  export class ToolChoice extends S.Union(ToolChoiceAuto, ToolChoiceAny, ToolChoiceTool, ToolChoiceNone) {}
263
332
 
333
+ export class ToolTypeEnum extends S.Literal("custom") {}
334
+
264
335
  export class InputSchemaType extends S.Literal("object") {}
265
336
 
266
337
  export class InputSchema extends S.Struct({
267
- "type": InputSchemaType,
268
- "properties": S.optionalWith(S.Union(S.Record({ key: S.String, value: S.Unknown }), S.Null), { nullable: true })
338
+ "properties": S.optionalWith(S.Union(S.Record({ key: S.String, value: S.Unknown }), S.Null), { nullable: true }),
339
+ "required": S.optionalWith(S.Union(S.Array(S.String), S.Null), { nullable: true }),
340
+ "type": InputSchemaType
269
341
  }) {}
270
342
 
271
343
  export class Tool extends S.Struct({
344
+ "type": S.optionalWith(S.Union(S.Null, ToolTypeEnum), { nullable: true }),
272
345
  "description": S.optionalWith(S.String, { nullable: true }),
273
346
  "name": S.String.pipe(S.minLength(1), S.maxLength(64), S.pattern(new RegExp("^[a-zA-Z0-9_-]{1,64}$"))),
274
347
  "input_schema": InputSchema,
275
348
  "cache_control": S.optionalWith(S.Union(CacheControlEphemeral, S.Null), { nullable: true })
276
349
  }) {}
277
350
 
278
- export class BashTool20250124Type extends S.Literal("bash_20250124") {}
279
-
280
351
  export class BashTool20250124Name extends S.Literal("bash") {}
281
352
 
353
+ export class BashTool20250124Type extends S.Literal("bash_20250124") {}
354
+
282
355
  export class BashTool20250124 extends S.Struct({
283
356
  "cache_control": S.optionalWith(S.Union(CacheControlEphemeral, S.Null), { nullable: true }),
284
- "type": BashTool20250124Type,
285
- "name": BashTool20250124Name
357
+ "name": BashTool20250124Name,
358
+ "type": BashTool20250124Type
286
359
  }) {}
287
360
 
288
- export class TextEditor20250124Type extends S.Literal("text_editor_20250124") {}
289
-
290
361
  export class TextEditor20250124Name extends S.Literal("str_replace_editor") {}
291
362
 
363
+ export class TextEditor20250124Type extends S.Literal("text_editor_20250124") {}
364
+
292
365
  export class TextEditor20250124 extends S.Struct({
293
366
  "cache_control": S.optionalWith(S.Union(CacheControlEphemeral, S.Null), { nullable: true }),
294
- "type": TextEditor20250124Type,
295
- "name": TextEditor20250124Name
367
+ "name": TextEditor20250124Name,
368
+ "type": TextEditor20250124Type
369
+ }) {}
370
+
371
+ export class TextEditor20250429Name extends S.Literal("str_replace_based_edit_tool") {}
372
+
373
+ export class TextEditor20250429Type extends S.Literal("text_editor_20250429") {}
374
+
375
+ export class TextEditor20250429 extends S.Struct({
376
+ "cache_control": S.optionalWith(S.Union(CacheControlEphemeral, S.Null), { nullable: true }),
377
+ "name": TextEditor20250429Name,
378
+ "type": TextEditor20250429Type
379
+ }) {}
380
+
381
+ export class WebSearchTool20250305Name extends S.Literal("web_search") {}
382
+
383
+ export class WebSearchTool20250305Type extends S.Literal("web_search_20250305") {}
384
+
385
+ export class UserLocationType extends S.Literal("approximate") {}
386
+
387
+ export class UserLocation extends S.Struct({
388
+ "city": S.optionalWith(S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null), { nullable: true }),
389
+ "country": S.optionalWith(S.Union(S.String.pipe(S.minLength(2), S.maxLength(2)), S.Null), { nullable: true }),
390
+ "region": S.optionalWith(S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null), { nullable: true }),
391
+ "timezone": S.optionalWith(S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null), { nullable: true }),
392
+ "type": UserLocationType
393
+ }) {}
394
+
395
+ export class WebSearchTool20250305 extends S.Struct({
396
+ "allowed_domains": S.optionalWith(S.Union(S.Array(S.String), S.Null), { nullable: true }),
397
+ "blocked_domains": S.optionalWith(S.Union(S.Array(S.String), S.Null), { nullable: true }),
398
+ "cache_control": S.optionalWith(S.Union(CacheControlEphemeral, S.Null), { nullable: true }),
399
+ "max_uses": S.optionalWith(S.Union(S.Int.pipe(S.greaterThan(0)), S.Null), { nullable: true }),
400
+ "name": WebSearchTool20250305Name,
401
+ "type": WebSearchTool20250305Type,
402
+ "user_location": S.optionalWith(S.Union(UserLocation, S.Null), { nullable: true })
296
403
  }) {}
297
404
 
298
405
  export class CreateMessageParams extends S.Class<CreateMessageParams>("CreateMessageParams")({
299
- "model": Model,
406
+ "model": S.Union(S.String, Model),
300
407
  "messages": S.Array(InputMessage),
301
408
  "max_tokens": S.Int.pipe(S.greaterThanOrEqualTo(1)),
302
409
  "metadata": S.optionalWith(Metadata, { nullable: true }),
410
+ "service_tier": S.optionalWith(CreateMessageParamsServiceTier, { nullable: true }),
303
411
  "stop_sequences": S.optionalWith(S.Array(S.String), { nullable: true }),
304
412
  "stream": S.optionalWith(S.Boolean, { nullable: true }),
305
413
  "system": S.optionalWith(S.Union(S.String, S.Array(RequestTextBlock)), { nullable: true }),
306
414
  "temperature": S.optionalWith(S.Number.pipe(S.greaterThanOrEqualTo(0), S.lessThanOrEqualTo(1)), { nullable: true }),
307
415
  "thinking": S.optionalWith(ThinkingConfigParam, { nullable: true }),
308
416
  "tool_choice": S.optionalWith(ToolChoice, { nullable: true }),
309
- "tools": S.optionalWith(S.Array(S.Union(Tool, BashTool20250124, TextEditor20250124)), { nullable: true }),
417
+ "tools": S.optionalWith(
418
+ S.Array(S.Union(Tool, BashTool20250124, TextEditor20250124, TextEditor20250429, WebSearchTool20250305)),
419
+ { nullable: true }
420
+ ),
310
421
  "top_k": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(0)), { nullable: true }),
311
422
  "top_p": S.optionalWith(S.Number.pipe(S.greaterThanOrEqualTo(0), S.lessThanOrEqualTo(1)), { nullable: true })
312
423
  }) {}
@@ -315,194 +426,234 @@ export class MessageType extends S.Literal("message") {}
315
426
 
316
427
  export class MessageRole extends S.Literal("assistant") {}
317
428
 
318
- export class ResponseTextBlockType extends S.Literal("text") {}
319
-
320
429
  export class ResponseCharLocationCitationType extends S.Literal("char_location") {}
321
430
 
322
431
  export class ResponseCharLocationCitation extends S.Struct({
323
- "type": ResponseCharLocationCitationType.pipe(
324
- S.propertySignature,
325
- S.withConstructorDefault(() => "char_location" as const)
326
- ),
327
432
  "cited_text": S.String,
328
433
  "document_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
329
434
  "document_title": S.Union(S.String, S.Null),
435
+ "end_char_index": S.Int,
330
436
  "start_char_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
331
- "end_char_index": S.Int
437
+ "type": ResponseCharLocationCitationType
332
438
  }) {}
333
439
 
334
440
  export class ResponsePageLocationCitationType extends S.Literal("page_location") {}
335
441
 
336
442
  export class ResponsePageLocationCitation extends S.Struct({
337
- "type": ResponsePageLocationCitationType.pipe(
338
- S.propertySignature,
339
- S.withConstructorDefault(() => "page_location" as const)
340
- ),
341
443
  "cited_text": S.String,
342
444
  "document_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
343
445
  "document_title": S.Union(S.String, S.Null),
446
+ "end_page_number": S.Int,
344
447
  "start_page_number": S.Int.pipe(S.greaterThanOrEqualTo(1)),
345
- "end_page_number": S.Int
448
+ "type": ResponsePageLocationCitationType
346
449
  }) {}
347
450
 
348
451
  export class ResponseContentBlockLocationCitationType extends S.Literal("content_block_location") {}
349
452
 
350
453
  export class ResponseContentBlockLocationCitation extends S.Struct({
351
- "type": ResponseContentBlockLocationCitationType.pipe(
352
- S.propertySignature,
353
- S.withConstructorDefault(() => "content_block_location" as const)
354
- ),
355
454
  "cited_text": S.String,
356
455
  "document_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
357
456
  "document_title": S.Union(S.String, S.Null),
457
+ "end_block_index": S.Int,
358
458
  "start_block_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
359
- "end_block_index": S.Int
459
+ "type": ResponseContentBlockLocationCitationType
360
460
  }) {}
361
461
 
462
+ export class ResponseWebSearchResultLocationCitationType extends S.Literal("web_search_result_location") {}
463
+
464
+ export class ResponseWebSearchResultLocationCitation extends S.Struct({
465
+ "cited_text": S.String,
466
+ "encrypted_index": S.String,
467
+ "title": S.Union(S.String, S.Null),
468
+ "type": ResponseWebSearchResultLocationCitationType,
469
+ "url": S.String
470
+ }) {}
471
+
472
+ export class ResponseTextBlockType extends S.Literal("text") {}
473
+
362
474
  export class ResponseTextBlock extends S.Struct({
363
- "type": ResponseTextBlockType.pipe(S.propertySignature, S.withConstructorDefault(() => "text" as const)),
475
+ "citations": S.NullOr(
476
+ S.Union(
477
+ S.Array(
478
+ S.Union(
479
+ ResponseCharLocationCitation,
480
+ ResponsePageLocationCitation,
481
+ ResponseContentBlockLocationCitation,
482
+ ResponseWebSearchResultLocationCitation
483
+ )
484
+ ),
485
+ S.Null
486
+ )
487
+ ),
364
488
  "text": S.String.pipe(S.minLength(0), S.maxLength(5000000)),
365
- "citations": S.optionalWith(
366
- S.NullOr(
367
- S.Union(
368
- S.Array(
369
- S.Union(ResponseCharLocationCitation, ResponsePageLocationCitation, ResponseContentBlockLocationCitation)
370
- ),
371
- S.Null
372
- )
373
- ),
374
- { default: () => null }
375
- )
489
+ "type": ResponseTextBlockType
376
490
  }) {}
377
491
 
378
492
  export class ResponseToolUseBlockType extends S.Literal("tool_use") {}
379
493
 
380
494
  export class ResponseToolUseBlock extends S.Struct({
381
- "type": ResponseToolUseBlockType.pipe(S.propertySignature, S.withConstructorDefault(() => "tool_use" as const)),
382
495
  "id": S.String.pipe(S.pattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
496
+ "input": S.Record({ key: S.String, value: S.Unknown }),
383
497
  "name": S.String.pipe(S.minLength(1)),
384
- "input": S.Record({ key: S.String, value: S.Unknown })
498
+ "type": ResponseToolUseBlockType
499
+ }) {}
500
+
501
+ export class ResponseServerToolUseBlockName extends S.Literal("web_search") {}
502
+
503
+ export class ResponseServerToolUseBlockType extends S.Literal("server_tool_use") {}
504
+
505
+ export class ResponseServerToolUseBlock extends S.Struct({
506
+ "id": S.String.pipe(S.pattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
507
+ "input": S.Record({ key: S.String, value: S.Unknown }),
508
+ "name": ResponseServerToolUseBlockName,
509
+ "type": ResponseServerToolUseBlockType
510
+ }) {}
511
+
512
+ export class ResponseWebSearchToolResultErrorType extends S.Literal("web_search_tool_result_error") {}
513
+
514
+ export class ResponseWebSearchToolResultError extends S.Struct({
515
+ "error_code": WebSearchToolResultErrorCode,
516
+ "type": ResponseWebSearchToolResultErrorType
517
+ }) {}
518
+
519
+ export class ResponseWebSearchResultBlockType extends S.Literal("web_search_result") {}
520
+
521
+ export class ResponseWebSearchResultBlock extends S.Struct({
522
+ "encrypted_content": S.String,
523
+ "page_age": S.NullOr(S.Union(S.String, S.Null)),
524
+ "title": S.String,
525
+ "type": ResponseWebSearchResultBlockType,
526
+ "url": S.String
527
+ }) {}
528
+
529
+ export class ResponseWebSearchToolResultBlockType extends S.Literal("web_search_tool_result") {}
530
+
531
+ export class ResponseWebSearchToolResultBlock extends S.Struct({
532
+ "content": S.Union(ResponseWebSearchToolResultError, S.Array(ResponseWebSearchResultBlock)),
533
+ "tool_use_id": S.String.pipe(S.pattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
534
+ "type": ResponseWebSearchToolResultBlockType
385
535
  }) {}
386
536
 
387
537
  export class ResponseThinkingBlockType extends S.Literal("thinking") {}
388
538
 
389
539
  export class ResponseThinkingBlock extends S.Struct({
390
- "type": ResponseThinkingBlockType.pipe(S.propertySignature, S.withConstructorDefault(() => "thinking" as const)),
540
+ "signature": S.String,
391
541
  "thinking": S.String,
392
- "signature": S.String
542
+ "type": ResponseThinkingBlockType
393
543
  }) {}
394
544
 
395
545
  export class ResponseRedactedThinkingBlockType extends S.Literal("redacted_thinking") {}
396
546
 
397
547
  export class ResponseRedactedThinkingBlock extends S.Struct({
398
- "type": ResponseRedactedThinkingBlockType.pipe(
399
- S.propertySignature,
400
- S.withConstructorDefault(() => "redacted_thinking" as const)
401
- ),
402
- "data": S.String
548
+ "data": S.String,
549
+ "type": ResponseRedactedThinkingBlockType
403
550
  }) {}
404
551
 
405
- export class ContentBlock
406
- extends S.Union(ResponseTextBlock, ResponseToolUseBlock, ResponseThinkingBlock, ResponseRedactedThinkingBlock)
552
+ export class ContentBlock extends S.Union(
553
+ ResponseTextBlock,
554
+ ResponseToolUseBlock,
555
+ ResponseServerToolUseBlock,
556
+ ResponseWebSearchToolResultBlock,
557
+ ResponseThinkingBlock,
558
+ ResponseRedactedThinkingBlock
559
+ ) {}
560
+
561
+ export class StopReason
562
+ extends S.Literal("end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn", "refusal")
407
563
  {}
408
564
 
409
- export class MessageStopReasonEnum extends S.Literal("end_turn", "max_tokens", "stop_sequence", "tool_use") {}
565
+ export class ServerToolUsage extends S.Struct({
566
+ "web_search_requests": S.Int.pipe(S.greaterThanOrEqualTo(0))
567
+ }) {}
568
+
569
+ export class UsageServiceTierEnum extends S.Literal("standard", "priority", "batch") {}
410
570
 
411
571
  export class Usage extends S.Struct({
572
+ "cache_creation_input_tokens": S.NullOr(S.Union(S.Int.pipe(S.greaterThanOrEqualTo(0)), S.Null)),
573
+ "cache_read_input_tokens": S.NullOr(S.Union(S.Int.pipe(S.greaterThanOrEqualTo(0)), S.Null)),
412
574
  "input_tokens": S.Int.pipe(S.greaterThanOrEqualTo(0)),
413
- "cache_creation_input_tokens": S.optionalWith(S.NullOr(S.Union(S.Int.pipe(S.greaterThanOrEqualTo(0)), S.Null)), {
414
- default: () => null
415
- }),
416
- "cache_read_input_tokens": S.optionalWith(S.NullOr(S.Union(S.Int.pipe(S.greaterThanOrEqualTo(0)), S.Null)), {
417
- default: () => null
418
- }),
419
- "output_tokens": S.Int.pipe(S.greaterThanOrEqualTo(0))
575
+ "output_tokens": S.Int.pipe(S.greaterThanOrEqualTo(0)),
576
+ "server_tool_use": S.NullOr(S.Union(ServerToolUsage, S.Null)),
577
+ "service_tier": S.NullOr(S.Union(UsageServiceTierEnum, S.Null))
420
578
  }) {}
421
579
 
422
580
  export class Message extends S.Class<Message>("Message")({
423
581
  "id": S.String,
424
- "type": MessageType.pipe(S.propertySignature, S.withConstructorDefault(() => "message" as const)),
425
- "role": MessageRole.pipe(S.propertySignature, S.withConstructorDefault(() => "assistant" as const)),
582
+ "type": MessageType,
583
+ "role": MessageRole,
426
584
  "content": S.Array(ContentBlock),
427
- "model": Model,
428
- "stop_reason": S.Union(MessageStopReasonEnum, S.Null),
429
- "stop_sequence": S.optionalWith(S.NullOr(S.Union(S.String, S.Null)), { default: () => null }),
585
+ "model": S.Union(S.String, Model),
586
+ "stop_reason": S.Union(StopReason, S.Null),
587
+ "stop_sequence": S.NullOr(S.Union(S.String, S.Null)),
430
588
  "usage": Usage
431
589
  }) {}
432
590
 
433
- export class ErrorResponseType extends S.Literal("error") {}
434
-
435
591
  export class InvalidRequestErrorType extends S.Literal("invalid_request_error") {}
436
592
 
437
593
  export class InvalidRequestError extends S.Struct({
438
- "type": InvalidRequestErrorType.pipe(
439
- S.propertySignature,
440
- S.withConstructorDefault(() => "invalid_request_error" as const)
441
- ),
442
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Invalid request" as const))
594
+ "message": S.String,
595
+ "type": InvalidRequestErrorType
443
596
  }) {}
444
597
 
445
598
  export class AuthenticationErrorType extends S.Literal("authentication_error") {}
446
599
 
447
600
  export class AuthenticationError extends S.Struct({
448
- "type": AuthenticationErrorType.pipe(
449
- S.propertySignature,
450
- S.withConstructorDefault(() => "authentication_error" as const)
451
- ),
452
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Authentication error" as const))
601
+ "message": S.String,
602
+ "type": AuthenticationErrorType
453
603
  }) {}
454
604
 
455
605
  export class BillingErrorType extends S.Literal("billing_error") {}
456
606
 
457
607
  export class BillingError extends S.Struct({
458
- "type": BillingErrorType.pipe(S.propertySignature, S.withConstructorDefault(() => "billing_error" as const)),
459
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Billing error" as const))
608
+ "message": S.String,
609
+ "type": BillingErrorType
460
610
  }) {}
461
611
 
462
612
  export class PermissionErrorType extends S.Literal("permission_error") {}
463
613
 
464
614
  export class PermissionError extends S.Struct({
465
- "type": PermissionErrorType.pipe(S.propertySignature, S.withConstructorDefault(() => "permission_error" as const)),
466
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Permission denied" as const))
615
+ "message": S.String,
616
+ "type": PermissionErrorType
467
617
  }) {}
468
618
 
469
619
  export class NotFoundErrorType extends S.Literal("not_found_error") {}
470
620
 
471
621
  export class NotFoundError extends S.Struct({
472
- "type": NotFoundErrorType.pipe(S.propertySignature, S.withConstructorDefault(() => "not_found_error" as const)),
473
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Not found" as const))
622
+ "message": S.String,
623
+ "type": NotFoundErrorType
474
624
  }) {}
475
625
 
476
626
  export class RateLimitErrorType extends S.Literal("rate_limit_error") {}
477
627
 
478
628
  export class RateLimitError extends S.Struct({
479
- "type": RateLimitErrorType.pipe(S.propertySignature, S.withConstructorDefault(() => "rate_limit_error" as const)),
480
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Rate limited" as const))
629
+ "message": S.String,
630
+ "type": RateLimitErrorType
481
631
  }) {}
482
632
 
483
633
  export class GatewayTimeoutErrorType extends S.Literal("timeout_error") {}
484
634
 
485
635
  export class GatewayTimeoutError extends S.Struct({
486
- "type": GatewayTimeoutErrorType.pipe(S.propertySignature, S.withConstructorDefault(() => "timeout_error" as const)),
487
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Request timeout" as const))
636
+ "message": S.String,
637
+ "type": GatewayTimeoutErrorType
488
638
  }) {}
489
639
 
490
640
  export class APIErrorType extends S.Literal("api_error") {}
491
641
 
492
642
  export class APIError extends S.Struct({
493
- "type": APIErrorType.pipe(S.propertySignature, S.withConstructorDefault(() => "api_error" as const)),
494
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Internal server error" as const))
643
+ "message": S.String,
644
+ "type": APIErrorType
495
645
  }) {}
496
646
 
497
647
  export class OverloadedErrorType extends S.Literal("overloaded_error") {}
498
648
 
499
649
  export class OverloadedError extends S.Struct({
500
- "type": OverloadedErrorType.pipe(S.propertySignature, S.withConstructorDefault(() => "overloaded_error" as const)),
501
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Overloaded" as const))
650
+ "message": S.String,
651
+ "type": OverloadedErrorType
502
652
  }) {}
503
653
 
654
+ export class ErrorResponseType extends S.Literal("error") {}
655
+
504
656
  export class ErrorResponse extends S.Class<ErrorResponse>("ErrorResponse")({
505
- "type": ErrorResponseType.pipe(S.propertySignature, S.withConstructorDefault(() => "error" as const)),
506
657
  "error": S.Union(
507
658
  InvalidRequestError,
508
659
  AuthenticationError,
@@ -513,15 +664,17 @@ export class ErrorResponse extends S.Class<ErrorResponse>("ErrorResponse")({
513
664
  GatewayTimeoutError,
514
665
  APIError,
515
666
  OverloadedError
516
- )
667
+ ),
668
+ "type": ErrorResponseType
517
669
  }) {}
518
670
 
519
671
  export class CompletePostParams extends S.Struct({
520
- "anthropic-version": S.optionalWith(S.String, { nullable: true })
672
+ "anthropic-version": S.optionalWith(S.String, { nullable: true }),
673
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true })
521
674
  }) {}
522
675
 
523
676
  export class CompletionRequest extends S.Class<CompletionRequest>("CompletionRequest")({
524
- "model": Model,
677
+ "model": S.Union(S.String, Model),
525
678
  "prompt": S.String.pipe(S.minLength(1)),
526
679
  "max_tokens_to_sample": S.Int.pipe(S.greaterThanOrEqualTo(1)),
527
680
  "stop_sequences": S.optionalWith(S.Array(S.String), { nullable: true }),
@@ -535,85 +688,81 @@ export class CompletionRequest extends S.Class<CompletionRequest>("CompletionReq
535
688
  export class CompletionResponseType extends S.Literal("completion") {}
536
689
 
537
690
  export class CompletionResponse extends S.Class<CompletionResponse>("CompletionResponse")({
538
- "type": CompletionResponseType.pipe(S.propertySignature, S.withConstructorDefault(() => "completion" as const)),
539
- "id": S.String,
540
691
  "completion": S.String,
692
+ "id": S.String,
693
+ "model": S.Union(S.String, Model),
541
694
  "stop_reason": S.Union(S.String, S.Null),
542
- "model": Model
695
+ "type": CompletionResponseType
543
696
  }) {}
544
697
 
545
698
  export class ModelsListParams extends S.Struct({
546
699
  "before_id": S.optionalWith(S.String, { nullable: true }),
547
700
  "after_id": S.optionalWith(S.String, { nullable: true }),
548
- "limit": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(1000)), {
549
- nullable: true,
550
- default: () => 20 as const
551
- }),
701
+ "limit": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(1000)), { nullable: true }),
552
702
  "anthropic-version": S.optionalWith(S.String, { nullable: true }),
553
- "x-api-key": S.optionalWith(S.String, { nullable: true })
703
+ "x-api-key": S.optionalWith(S.String, { nullable: true }),
704
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true })
554
705
  }) {}
555
706
 
556
707
  export class ModelInfoType extends S.Literal("model") {}
557
708
 
558
709
  export class ModelInfo extends S.Struct({
559
- "type": ModelInfoType.pipe(S.propertySignature, S.withConstructorDefault(() => "model" as const)),
560
- "id": S.String,
710
+ "created_at": S.String,
561
711
  "display_name": S.String,
562
- "created_at": S.String
712
+ "id": S.String,
713
+ "type": ModelInfoType
563
714
  }) {}
564
715
 
565
716
  export class ListResponseModelInfo extends S.Class<ListResponseModelInfo>("ListResponseModelInfo")({
566
717
  "data": S.Array(ModelInfo),
567
- "has_more": S.Boolean,
568
718
  "first_id": S.Union(S.String, S.Null),
719
+ "has_more": S.Boolean,
569
720
  "last_id": S.Union(S.String, S.Null)
570
721
  }) {}
571
722
 
572
723
  export class ModelsGetParams extends S.Struct({
573
724
  "anthropic-version": S.optionalWith(S.String, { nullable: true }),
574
- "x-api-key": S.optionalWith(S.String, { nullable: true })
725
+ "x-api-key": S.optionalWith(S.String, { nullable: true }),
726
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true })
575
727
  }) {}
576
728
 
577
729
  export class MessageBatchesListParams extends S.Struct({
578
730
  "before_id": S.optionalWith(S.String, { nullable: true }),
579
731
  "after_id": S.optionalWith(S.String, { nullable: true }),
580
- "limit": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(1000)), {
581
- nullable: true,
582
- default: () => 20 as const
583
- }),
732
+ "limit": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(1000)), { nullable: true }),
584
733
  "anthropic-version": S.optionalWith(S.String, { nullable: true }),
585
734
  "x-api-key": S.optionalWith(S.String, { nullable: true })
586
735
  }) {}
587
736
 
588
- export class MessageBatchType extends S.Literal("message_batch") {}
589
-
590
737
  export class MessageBatchProcessingStatus extends S.Literal("in_progress", "canceling", "ended") {}
591
738
 
592
739
  export class RequestCounts extends S.Struct({
593
- "processing": S.Int.pipe(S.propertySignature, S.withConstructorDefault(() => 0 as const)),
594
- "succeeded": S.Int.pipe(S.propertySignature, S.withConstructorDefault(() => 0 as const)),
595
- "errored": S.Int.pipe(S.propertySignature, S.withConstructorDefault(() => 0 as const)),
596
- "canceled": S.Int.pipe(S.propertySignature, S.withConstructorDefault(() => 0 as const)),
597
- "expired": S.Int.pipe(S.propertySignature, S.withConstructorDefault(() => 0 as const))
740
+ "canceled": S.Int,
741
+ "errored": S.Int,
742
+ "expired": S.Int,
743
+ "processing": S.Int,
744
+ "succeeded": S.Int
598
745
  }) {}
599
746
 
747
+ export class MessageBatchType extends S.Literal("message_batch") {}
748
+
600
749
  export class MessageBatch extends S.Struct({
750
+ "archived_at": S.Union(S.String, S.Null),
751
+ "cancel_initiated_at": S.Union(S.String, S.Null),
752
+ "created_at": S.String,
753
+ "ended_at": S.Union(S.String, S.Null),
754
+ "expires_at": S.String,
601
755
  "id": S.String,
602
- "type": MessageBatchType.pipe(S.propertySignature, S.withConstructorDefault(() => "message_batch" as const)),
603
756
  "processing_status": MessageBatchProcessingStatus,
604
757
  "request_counts": RequestCounts,
605
- "ended_at": S.Union(S.String, S.Null),
606
- "created_at": S.String,
607
- "expires_at": S.String,
608
- "archived_at": S.Union(S.String, S.Null),
609
- "cancel_initiated_at": S.Union(S.String, S.Null),
610
- "results_url": S.Union(S.String, S.Null)
758
+ "results_url": S.Union(S.String, S.Null),
759
+ "type": MessageBatchType
611
760
  }) {}
612
761
 
613
762
  export class ListResponseMessageBatch extends S.Class<ListResponseMessageBatch>("ListResponseMessageBatch")({
614
763
  "data": S.Array(MessageBatch),
615
- "has_more": S.Boolean,
616
764
  "first_id": S.Union(S.String, S.Null),
765
+ "has_more": S.Boolean,
617
766
  "last_id": S.Union(S.String, S.Null)
618
767
  }) {}
619
768
 
@@ -644,10 +793,7 @@ export class DeleteMessageBatchResponseType extends S.Literal("message_batch_del
644
793
 
645
794
  export class DeleteMessageBatchResponse extends S.Class<DeleteMessageBatchResponse>("DeleteMessageBatchResponse")({
646
795
  "id": S.String,
647
- "type": DeleteMessageBatchResponseType.pipe(
648
- S.propertySignature,
649
- S.withConstructorDefault(() => "message_batch_deleted" as const)
650
- )
796
+ "type": DeleteMessageBatchResponseType
651
797
  }) {}
652
798
 
653
799
  export class MessageBatchesCancelParams extends S.Struct({
@@ -664,62 +810,224 @@ export class MessagesCountTokensPostParams extends S.Struct({
664
810
  }) {}
665
811
 
666
812
  export class CountMessageTokensParams extends S.Class<CountMessageTokensParams>("CountMessageTokensParams")({
667
- "tool_choice": S.optionalWith(ToolChoice, { nullable: true }),
668
- "tools": S.optionalWith(S.Array(S.Union(Tool, BashTool20250124, TextEditor20250124)), { nullable: true }),
669
813
  "messages": S.Array(InputMessage),
814
+ "model": S.Union(S.String, Model),
670
815
  "system": S.optionalWith(S.Union(S.String, S.Array(RequestTextBlock)), { nullable: true }),
671
816
  "thinking": S.optionalWith(ThinkingConfigParam, { nullable: true }),
672
- "model": Model
817
+ "tool_choice": S.optionalWith(ToolChoice, { nullable: true }),
818
+ "tools": S.optionalWith(
819
+ S.Array(S.Union(Tool, BashTool20250124, TextEditor20250124, TextEditor20250429, WebSearchTool20250305)),
820
+ { nullable: true }
821
+ )
673
822
  }) {}
674
823
 
675
824
  export class CountMessageTokensResponse extends S.Class<CountMessageTokensResponse>("CountMessageTokensResponse")({
676
825
  "input_tokens": S.Int
677
826
  }) {}
678
827
 
828
+ export class ListFilesV1FilesGetParams extends S.Struct({
829
+ "before_id": S.optionalWith(S.String, { nullable: true }),
830
+ "after_id": S.optionalWith(S.String, { nullable: true }),
831
+ "limit": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(1000)), { nullable: true }),
832
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true }),
833
+ "anthropic-version": S.optionalWith(S.String, { nullable: true }),
834
+ "x-api-key": S.optionalWith(S.String, { nullable: true })
835
+ }) {}
836
+
837
+ export class FileMetadataSchemaType extends S.Literal("file") {}
838
+
839
+ export class FileMetadataSchema extends S.Struct({
840
+ "created_at": S.String,
841
+ "downloadable": S.optionalWith(S.Boolean, { nullable: true }),
842
+ "filename": S.String.pipe(S.minLength(1), S.maxLength(500)),
843
+ "id": S.String,
844
+ "mime_type": S.String.pipe(S.minLength(1), S.maxLength(255)),
845
+ "size_bytes": S.Int.pipe(S.greaterThanOrEqualTo(0)),
846
+ "type": FileMetadataSchemaType
847
+ }) {}
848
+
849
+ export class FileListResponse extends S.Class<FileListResponse>("FileListResponse")({
850
+ "data": S.Array(FileMetadataSchema),
851
+ "first_id": S.optionalWith(S.Union(S.String, S.Null), { nullable: true }),
852
+ "has_more": S.optionalWith(S.Boolean, { nullable: true }),
853
+ "last_id": S.optionalWith(S.Union(S.String, S.Null), { nullable: true })
854
+ }) {}
855
+
856
+ export class UploadFileV1FilesPostParams extends S.Struct({
857
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true }),
858
+ "anthropic-version": S.optionalWith(S.String, { nullable: true })
859
+ }) {}
860
+
861
+ export class GetFileMetadataV1FilesFileIdGetParams extends S.Struct({
862
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true }),
863
+ "anthropic-version": S.optionalWith(S.String, { nullable: true }),
864
+ "x-api-key": S.optionalWith(S.String, { nullable: true })
865
+ }) {}
866
+
867
+ export class DeleteFileV1FilesFileIdDeleteParams extends S.Struct({
868
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true }),
869
+ "anthropic-version": S.optionalWith(S.String, { nullable: true }),
870
+ "x-api-key": S.optionalWith(S.String, { nullable: true })
871
+ }) {}
872
+
873
+ export class FileDeleteResponseType extends S.Literal("file_deleted") {}
874
+
875
+ export class FileDeleteResponse extends S.Class<FileDeleteResponse>("FileDeleteResponse")({
876
+ "id": S.String,
877
+ "type": S.optionalWith(FileDeleteResponseType, { nullable: true })
878
+ }) {}
879
+
880
+ export class DownloadFileV1FilesFileIdContentGetParams extends S.Struct({
881
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true }),
882
+ "anthropic-version": S.optionalWith(S.String, { nullable: true }),
883
+ "x-api-key": S.optionalWith(S.String, { nullable: true })
884
+ }) {}
885
+
679
886
  export class BetaMessagesPostParams extends S.Struct({
680
887
  "anthropic-beta": S.optionalWith(S.String, { nullable: true }),
681
888
  "anthropic-version": S.optionalWith(S.String, { nullable: true })
682
889
  }) {}
683
890
 
684
- export class BetaInputMessageRole extends S.Literal("user", "assistant") {}
891
+ export class BetaCacheControlEphemeralTtl extends S.Literal("5m", "1h") {}
685
892
 
686
893
  export class BetaCacheControlEphemeralType extends S.Literal("ephemeral") {}
687
894
 
688
895
  export class BetaCacheControlEphemeral extends S.Struct({
896
+ "ttl": S.optionalWith(BetaCacheControlEphemeralTtl, { nullable: true }),
689
897
  "type": BetaCacheControlEphemeralType
690
898
  }) {}
691
899
 
900
+ export class BetaRequestServerToolUseBlockName extends S.Literal("web_search", "code_execution") {}
901
+
902
+ export class BetaRequestServerToolUseBlockType extends S.Literal("server_tool_use") {}
903
+
904
+ export class BetaRequestServerToolUseBlock extends S.Struct({
905
+ "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
906
+ "id": S.String.pipe(S.pattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
907
+ "input": S.Record({ key: S.String, value: S.Unknown }),
908
+ "name": BetaRequestServerToolUseBlockName,
909
+ "type": BetaRequestServerToolUseBlockType
910
+ }) {}
911
+
912
+ export class BetaRequestWebSearchResultBlockType extends S.Literal("web_search_result") {}
913
+
914
+ export class BetaRequestWebSearchResultBlock extends S.Struct({
915
+ "encrypted_content": S.String,
916
+ "page_age": S.optionalWith(S.Union(S.String, S.Null), { nullable: true }),
917
+ "title": S.String,
918
+ "type": BetaRequestWebSearchResultBlockType,
919
+ "url": S.String
920
+ }) {}
921
+
922
+ export class BetaWebSearchToolResultErrorCode
923
+ extends S.Literal("invalid_tool_input", "unavailable", "max_uses_exceeded", "too_many_requests", "query_too_long")
924
+ {}
925
+
926
+ export class BetaRequestWebSearchToolResultErrorType extends S.Literal("web_search_tool_result_error") {}
927
+
928
+ export class BetaRequestWebSearchToolResultError extends S.Struct({
929
+ "error_code": BetaWebSearchToolResultErrorCode,
930
+ "type": BetaRequestWebSearchToolResultErrorType
931
+ }) {}
932
+
933
+ export class BetaRequestWebSearchToolResultBlockType extends S.Literal("web_search_tool_result") {}
934
+
935
+ export class BetaRequestWebSearchToolResultBlock extends S.Struct({
936
+ "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
937
+ "content": S.Union(S.Array(BetaRequestWebSearchResultBlock), BetaRequestWebSearchToolResultError),
938
+ "tool_use_id": S.String.pipe(S.pattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
939
+ "type": BetaRequestWebSearchToolResultBlockType
940
+ }) {}
941
+
942
+ export class BetaCodeExecutionToolResultErrorCode
943
+ extends S.Literal("invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded")
944
+ {}
945
+
946
+ export class BetaRequestCodeExecutionToolResultErrorType extends S.Literal("code_execution_tool_result_error") {}
947
+
948
+ export class BetaRequestCodeExecutionToolResultError extends S.Struct({
949
+ "error_code": BetaCodeExecutionToolResultErrorCode,
950
+ "type": BetaRequestCodeExecutionToolResultErrorType
951
+ }) {}
952
+
953
+ export class BetaRequestCodeExecutionOutputBlockType extends S.Literal("code_execution_output") {}
954
+
955
+ export class BetaRequestCodeExecutionOutputBlock extends S.Struct({
956
+ "file_id": S.String,
957
+ "type": BetaRequestCodeExecutionOutputBlockType
958
+ }) {}
959
+
960
+ export class BetaRequestCodeExecutionResultBlockType extends S.Literal("code_execution_result") {}
961
+
962
+ export class BetaRequestCodeExecutionResultBlock extends S.Struct({
963
+ "content": S.Array(BetaRequestCodeExecutionOutputBlock),
964
+ "return_code": S.Int,
965
+ "stderr": S.String,
966
+ "stdout": S.String,
967
+ "type": BetaRequestCodeExecutionResultBlockType
968
+ }) {}
969
+
970
+ export class BetaRequestCodeExecutionToolResultBlockType extends S.Literal("code_execution_tool_result") {}
971
+
972
+ export class BetaRequestCodeExecutionToolResultBlock extends S.Struct({
973
+ "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
974
+ "content": S.Union(BetaRequestCodeExecutionToolResultError, BetaRequestCodeExecutionResultBlock),
975
+ "tool_use_id": S.String.pipe(S.pattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
976
+ "type": BetaRequestCodeExecutionToolResultBlockType
977
+ }) {}
978
+
979
+ export class BetaRequestMCPToolUseBlockType extends S.Literal("mcp_tool_use") {}
980
+
981
+ export class BetaRequestMCPToolUseBlock extends S.Struct({
982
+ "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
983
+ "id": S.String.pipe(S.pattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
984
+ "input": S.Record({ key: S.String, value: S.Unknown }),
985
+ "name": S.String,
986
+ "server_name": S.String,
987
+ "type": BetaRequestMCPToolUseBlockType
988
+ }) {}
989
+
692
990
  export class BetaRequestCharLocationCitationType extends S.Literal("char_location") {}
693
991
 
694
992
  export class BetaRequestCharLocationCitation extends S.Struct({
695
- "type": BetaRequestCharLocationCitationType,
696
993
  "cited_text": S.String,
697
994
  "document_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
698
995
  "document_title": S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null),
996
+ "end_char_index": S.Int,
699
997
  "start_char_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
700
- "end_char_index": S.Int
998
+ "type": BetaRequestCharLocationCitationType
701
999
  }) {}
702
1000
 
703
1001
  export class BetaRequestPageLocationCitationType extends S.Literal("page_location") {}
704
1002
 
705
1003
  export class BetaRequestPageLocationCitation extends S.Struct({
706
- "type": BetaRequestPageLocationCitationType,
707
1004
  "cited_text": S.String,
708
1005
  "document_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
709
1006
  "document_title": S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null),
1007
+ "end_page_number": S.Int,
710
1008
  "start_page_number": S.Int.pipe(S.greaterThanOrEqualTo(1)),
711
- "end_page_number": S.Int
1009
+ "type": BetaRequestPageLocationCitationType
712
1010
  }) {}
713
1011
 
714
1012
  export class BetaRequestContentBlockLocationCitationType extends S.Literal("content_block_location") {}
715
1013
 
716
1014
  export class BetaRequestContentBlockLocationCitation extends S.Struct({
717
- "type": BetaRequestContentBlockLocationCitationType,
718
1015
  "cited_text": S.String,
719
1016
  "document_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
720
1017
  "document_title": S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null),
1018
+ "end_block_index": S.Int,
721
1019
  "start_block_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
722
- "end_block_index": S.Int
1020
+ "type": BetaRequestContentBlockLocationCitationType
1021
+ }) {}
1022
+
1023
+ export class BetaRequestWebSearchResultLocationCitationType extends S.Literal("web_search_result_location") {}
1024
+
1025
+ export class BetaRequestWebSearchResultLocationCitation extends S.Struct({
1026
+ "cited_text": S.String,
1027
+ "encrypted_index": S.String,
1028
+ "title": S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null),
1029
+ "type": BetaRequestWebSearchResultLocationCitationType,
1030
+ "url": S.String.pipe(S.minLength(1), S.maxLength(2048))
723
1031
  }) {}
724
1032
 
725
1033
  export class BetaRequestTextBlockType extends S.Literal("text") {}
@@ -732,7 +1040,8 @@ export class BetaRequestTextBlock extends S.Struct({
732
1040
  S.Union(
733
1041
  BetaRequestCharLocationCitation,
734
1042
  BetaRequestPageLocationCitation,
735
- BetaRequestContentBlockLocationCitation
1043
+ BetaRequestContentBlockLocationCitation,
1044
+ BetaRequestWebSearchResultLocationCitation
736
1045
  )
737
1046
  ),
738
1047
  S.Null
@@ -743,16 +1052,24 @@ export class BetaRequestTextBlock extends S.Struct({
743
1052
  "type": BetaRequestTextBlockType
744
1053
  }) {}
745
1054
 
746
- export class BetaRequestImageBlockType extends S.Literal("image") {}
1055
+ export class BetaRequestMCPToolResultBlockType extends S.Literal("mcp_tool_result") {}
747
1056
 
748
- export class BetaBase64ImageSourceType extends S.Literal("base64") {}
1057
+ export class BetaRequestMCPToolResultBlock extends S.Struct({
1058
+ "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
1059
+ "content": S.optionalWith(S.Union(S.String, S.Array(BetaRequestTextBlock)), { nullable: true }),
1060
+ "is_error": S.optionalWith(S.Boolean, { nullable: true }),
1061
+ "tool_use_id": S.String.pipe(S.pattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
1062
+ "type": BetaRequestMCPToolResultBlockType
1063
+ }) {}
749
1064
 
750
1065
  export class BetaBase64ImageSourceMediaType extends S.Literal("image/jpeg", "image/png", "image/gif", "image/webp") {}
751
1066
 
1067
+ export class BetaBase64ImageSourceType extends S.Literal("base64") {}
1068
+
752
1069
  export class BetaBase64ImageSource extends S.Struct({
753
- "type": BetaBase64ImageSourceType,
1070
+ "data": S.String,
754
1071
  "media_type": BetaBase64ImageSourceMediaType,
755
- "data": S.String
1072
+ "type": BetaBase64ImageSourceType
756
1073
  }) {}
757
1074
 
758
1075
  export class BetaURLImageSourceType extends S.Literal("url") {}
@@ -762,61 +1079,72 @@ export class BetaURLImageSource extends S.Struct({
762
1079
  "url": S.String
763
1080
  }) {}
764
1081
 
1082
+ export class BetaFileImageSourceType extends S.Literal("file") {}
1083
+
1084
+ export class BetaFileImageSource extends S.Struct({
1085
+ "file_id": S.String,
1086
+ "type": BetaFileImageSourceType
1087
+ }) {}
1088
+
1089
+ export class BetaRequestImageBlockType extends S.Literal("image") {}
1090
+
765
1091
  export class BetaRequestImageBlock extends S.Struct({
766
1092
  "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
767
- "type": BetaRequestImageBlockType,
768
- "source": S.Union(BetaBase64ImageSource, BetaURLImageSource)
1093
+ "source": S.Union(BetaBase64ImageSource, BetaURLImageSource, BetaFileImageSource),
1094
+ "type": BetaRequestImageBlockType
769
1095
  }) {}
770
1096
 
771
1097
  export class BetaRequestToolUseBlockType extends S.Literal("tool_use") {}
772
1098
 
773
1099
  export class BetaRequestToolUseBlock extends S.Struct({
774
1100
  "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
775
- "type": BetaRequestToolUseBlockType,
776
1101
  "id": S.String.pipe(S.pattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
777
- "name": S.String.pipe(S.minLength(1), S.maxLength(64), S.pattern(new RegExp("^[a-zA-Z0-9_-]{1,64}$"))),
778
- "input": S.Record({ key: S.String, value: S.Unknown })
1102
+ "input": S.Record({ key: S.String, value: S.Unknown }),
1103
+ "name": S.String.pipe(S.minLength(1), S.maxLength(200)),
1104
+ "type": BetaRequestToolUseBlockType
779
1105
  }) {}
780
1106
 
781
1107
  export class BetaRequestToolResultBlockType extends S.Literal("tool_result") {}
782
1108
 
783
1109
  export class BetaRequestToolResultBlock extends S.Struct({
784
1110
  "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
785
- "type": BetaRequestToolResultBlockType,
786
- "tool_use_id": S.String.pipe(S.pattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
787
- "is_error": S.optionalWith(S.Boolean, { nullable: true }),
788
1111
  "content": S.optionalWith(S.Union(S.String, S.Array(S.Union(BetaRequestTextBlock, BetaRequestImageBlock))), {
789
1112
  nullable: true
790
- })
1113
+ }),
1114
+ "is_error": S.optionalWith(S.Boolean, { nullable: true }),
1115
+ "tool_use_id": S.String.pipe(S.pattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
1116
+ "type": BetaRequestToolResultBlockType
791
1117
  }) {}
792
1118
 
793
- export class BetaRequestDocumentBlockType extends S.Literal("document") {}
794
-
795
- export class BetaBase64PDFSourceType extends S.Literal("base64") {}
1119
+ export class BetaRequestCitationsConfig extends S.Struct({
1120
+ "enabled": S.optionalWith(S.Boolean, { nullable: true })
1121
+ }) {}
796
1122
 
797
1123
  export class BetaBase64PDFSourceMediaType extends S.Literal("application/pdf") {}
798
1124
 
1125
+ export class BetaBase64PDFSourceType extends S.Literal("base64") {}
1126
+
799
1127
  export class BetaBase64PDFSource extends S.Struct({
800
- "type": BetaBase64PDFSourceType,
1128
+ "data": S.String,
801
1129
  "media_type": BetaBase64PDFSourceMediaType,
802
- "data": S.String
1130
+ "type": BetaBase64PDFSourceType
803
1131
  }) {}
804
1132
 
805
- export class BetaPlainTextSourceType extends S.Literal("text") {}
806
-
807
1133
  export class BetaPlainTextSourceMediaType extends S.Literal("text/plain") {}
808
1134
 
1135
+ export class BetaPlainTextSourceType extends S.Literal("text") {}
1136
+
809
1137
  export class BetaPlainTextSource extends S.Struct({
810
- "type": BetaPlainTextSourceType,
1138
+ "data": S.String,
811
1139
  "media_type": BetaPlainTextSourceMediaType,
812
- "data": S.String
1140
+ "type": BetaPlainTextSourceType
813
1141
  }) {}
814
1142
 
815
1143
  export class BetaContentBlockSourceType extends S.Literal("content") {}
816
1144
 
817
1145
  export class BetaContentBlockSource extends S.Struct({
818
- "type": BetaContentBlockSourceType,
819
- "content": S.Union(S.String, S.Array(S.Union(BetaRequestTextBlock, BetaRequestImageBlock)))
1146
+ "content": S.Union(S.String, S.Array(S.Union(BetaRequestTextBlock, BetaRequestImageBlock))),
1147
+ "type": BetaContentBlockSourceType
820
1148
  }) {}
821
1149
 
822
1150
  export class BetaURLPDFSourceType extends S.Literal("url") {}
@@ -826,58 +1154,102 @@ export class BetaURLPDFSource extends S.Struct({
826
1154
  "url": S.String
827
1155
  }) {}
828
1156
 
829
- export class BetaRequestCitationsConfig extends S.Struct({
830
- "enabled": S.optionalWith(S.Boolean, { nullable: true })
1157
+ export class BetaFileDocumentSourceType extends S.Literal("file") {}
1158
+
1159
+ export class BetaFileDocumentSource extends S.Struct({
1160
+ "file_id": S.String,
1161
+ "type": BetaFileDocumentSourceType
831
1162
  }) {}
832
1163
 
1164
+ export class BetaRequestDocumentBlockType extends S.Literal("document") {}
1165
+
833
1166
  export class BetaRequestDocumentBlock extends S.Struct({
834
1167
  "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
835
- "type": BetaRequestDocumentBlockType,
836
- "source": S.Union(BetaBase64PDFSource, BetaPlainTextSource, BetaContentBlockSource, BetaURLPDFSource),
837
- "title": S.optionalWith(S.Union(S.String.pipe(S.minLength(1), S.maxLength(500)), S.Null), { nullable: true }),
1168
+ "citations": S.optionalWith(BetaRequestCitationsConfig, { nullable: true }),
838
1169
  "context": S.optionalWith(S.Union(S.String.pipe(S.minLength(1)), S.Null), { nullable: true }),
839
- "citations": S.optionalWith(BetaRequestCitationsConfig, { nullable: true })
1170
+ "source": S.Union(
1171
+ BetaBase64PDFSource,
1172
+ BetaPlainTextSource,
1173
+ BetaContentBlockSource,
1174
+ BetaURLPDFSource,
1175
+ BetaFileDocumentSource
1176
+ ),
1177
+ "title": S.optionalWith(S.Union(S.String.pipe(S.minLength(1), S.maxLength(500)), S.Null), { nullable: true }),
1178
+ "type": BetaRequestDocumentBlockType
840
1179
  }) {}
841
1180
 
842
1181
  export class BetaRequestThinkingBlockType extends S.Literal("thinking") {}
843
1182
 
844
1183
  export class BetaRequestThinkingBlock extends S.Struct({
845
- "type": BetaRequestThinkingBlockType,
1184
+ "signature": S.String,
846
1185
  "thinking": S.String,
847
- "signature": S.String
1186
+ "type": BetaRequestThinkingBlockType
848
1187
  }) {}
849
1188
 
850
1189
  export class BetaRequestRedactedThinkingBlockType extends S.Literal("redacted_thinking") {}
851
1190
 
852
1191
  export class BetaRequestRedactedThinkingBlock extends S.Struct({
853
- "type": BetaRequestRedactedThinkingBlockType,
854
- "data": S.String
1192
+ "data": S.String,
1193
+ "type": BetaRequestRedactedThinkingBlockType
1194
+ }) {}
1195
+
1196
+ export class BetaRequestContainerUploadBlockType extends S.Literal("container_upload") {}
1197
+
1198
+ export class BetaRequestContainerUploadBlock extends S.Struct({
1199
+ "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
1200
+ "file_id": S.String,
1201
+ "type": BetaRequestContainerUploadBlockType
855
1202
  }) {}
856
1203
 
857
1204
  export class BetaInputContentBlock extends S.Union(
1205
+ BetaRequestServerToolUseBlock,
1206
+ BetaRequestWebSearchToolResultBlock,
1207
+ BetaRequestCodeExecutionToolResultBlock,
1208
+ BetaRequestMCPToolUseBlock,
1209
+ BetaRequestMCPToolResultBlock,
858
1210
  BetaRequestTextBlock,
859
1211
  BetaRequestImageBlock,
860
1212
  BetaRequestToolUseBlock,
861
1213
  BetaRequestToolResultBlock,
862
1214
  BetaRequestDocumentBlock,
863
1215
  BetaRequestThinkingBlock,
864
- BetaRequestRedactedThinkingBlock
1216
+ BetaRequestRedactedThinkingBlock,
1217
+ BetaRequestContainerUploadBlock
865
1218
  ) {}
866
1219
 
1220
+ export class BetaInputMessageRole extends S.Literal("user", "assistant") {}
1221
+
867
1222
  export class BetaInputMessage extends S.Struct({
868
- "role": BetaInputMessageRole,
869
- "content": S.Union(S.String, S.Array(BetaInputContentBlock))
1223
+ "content": S.Union(S.String, S.Array(BetaInputContentBlock)),
1224
+ "role": BetaInputMessageRole
1225
+ }) {}
1226
+
1227
+ export class BetaRequestMCPServerToolConfiguration extends S.Struct({
1228
+ "allowed_tools": S.optionalWith(S.Union(S.Array(S.String), S.Null), { nullable: true }),
1229
+ "enabled": S.optionalWith(S.Union(S.Boolean, S.Null), { nullable: true })
1230
+ }) {}
1231
+
1232
+ export class BetaRequestMCPServerURLDefinitionType extends S.Literal("url") {}
1233
+
1234
+ export class BetaRequestMCPServerURLDefinition extends S.Struct({
1235
+ "authorization_token": S.optionalWith(S.Union(S.String, S.Null), { nullable: true }),
1236
+ "name": S.String,
1237
+ "tool_configuration": S.optionalWith(S.Union(BetaRequestMCPServerToolConfiguration, S.Null), { nullable: true }),
1238
+ "type": BetaRequestMCPServerURLDefinitionType,
1239
+ "url": S.String
870
1240
  }) {}
871
1241
 
872
1242
  export class BetaMetadata extends S.Struct({
873
1243
  "user_id": S.optionalWith(S.Union(S.String.pipe(S.maxLength(256)), S.Null), { nullable: true })
874
1244
  }) {}
875
1245
 
1246
+ export class BetaCreateMessageParamsServiceTier extends S.Literal("auto", "standard_only") {}
1247
+
876
1248
  export class BetaThinkingConfigEnabledType extends S.Literal("enabled") {}
877
1249
 
878
1250
  export class BetaThinkingConfigEnabled extends S.Struct({
879
- "type": BetaThinkingConfigEnabledType,
880
- "budget_tokens": S.Int.pipe(S.greaterThanOrEqualTo(1024))
1251
+ "budget_tokens": S.Int.pipe(S.greaterThanOrEqualTo(1024)),
1252
+ "type": BetaThinkingConfigEnabledType
881
1253
  }) {}
882
1254
 
883
1255
  export class BetaThinkingConfigDisabledType extends S.Literal("disabled") {}
@@ -891,23 +1263,23 @@ export class BetaThinkingConfigParam extends S.Union(BetaThinkingConfigEnabled,
891
1263
  export class BetaToolChoiceAutoType extends S.Literal("auto") {}
892
1264
 
893
1265
  export class BetaToolChoiceAuto extends S.Struct({
894
- "type": BetaToolChoiceAutoType,
895
- "disable_parallel_tool_use": S.optionalWith(S.Boolean, { nullable: true })
1266
+ "disable_parallel_tool_use": S.optionalWith(S.Boolean, { nullable: true }),
1267
+ "type": BetaToolChoiceAutoType
896
1268
  }) {}
897
1269
 
898
1270
  export class BetaToolChoiceAnyType extends S.Literal("any") {}
899
1271
 
900
1272
  export class BetaToolChoiceAny extends S.Struct({
901
- "type": BetaToolChoiceAnyType,
902
- "disable_parallel_tool_use": S.optionalWith(S.Boolean, { nullable: true })
1273
+ "disable_parallel_tool_use": S.optionalWith(S.Boolean, { nullable: true }),
1274
+ "type": BetaToolChoiceAnyType
903
1275
  }) {}
904
1276
 
905
1277
  export class BetaToolChoiceToolType extends S.Literal("tool") {}
906
1278
 
907
1279
  export class BetaToolChoiceTool extends S.Struct({
908
- "type": BetaToolChoiceToolType,
1280
+ "disable_parallel_tool_use": S.optionalWith(S.Boolean, { nullable: true }),
909
1281
  "name": S.String,
910
- "disable_parallel_tool_use": S.optionalWith(S.Boolean, { nullable: true })
1282
+ "type": BetaToolChoiceToolType
911
1283
  }) {}
912
1284
 
913
1285
  export class BetaToolChoiceNoneType extends S.Literal("none") {}
@@ -925,8 +1297,9 @@ export class BetaToolTypeEnum extends S.Literal("custom") {}
925
1297
  export class BetaInputSchemaType extends S.Literal("object") {}
926
1298
 
927
1299
  export class BetaInputSchema extends S.Struct({
928
- "type": BetaInputSchemaType,
929
- "properties": S.optionalWith(S.Union(S.Record({ key: S.String, value: S.Unknown }), S.Null), { nullable: true })
1300
+ "properties": S.optionalWith(S.Union(S.Record({ key: S.String, value: S.Unknown }), S.Null), { nullable: true }),
1301
+ "required": S.optionalWith(S.Union(S.Array(S.String), S.Null), { nullable: true }),
1302
+ "type": BetaInputSchemaType
930
1303
  }) {}
931
1304
 
932
1305
  export class BetaTool extends S.Struct({
@@ -937,77 +1310,124 @@ export class BetaTool extends S.Struct({
937
1310
  "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true })
938
1311
  }) {}
939
1312
 
940
- export class BetaComputerUseTool20241022Type extends S.Literal("computer_20241022") {}
941
-
942
1313
  export class BetaComputerUseTool20241022Name extends S.Literal("computer") {}
943
1314
 
1315
+ export class BetaComputerUseTool20241022Type extends S.Literal("computer_20241022") {}
1316
+
944
1317
  export class BetaComputerUseTool20241022 extends S.Struct({
945
1318
  "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
946
- "type": BetaComputerUseTool20241022Type,
947
- "name": BetaComputerUseTool20241022Name,
948
1319
  "display_height_px": S.Int.pipe(S.greaterThanOrEqualTo(1)),
1320
+ "display_number": S.optionalWith(S.Union(S.Int.pipe(S.greaterThanOrEqualTo(0)), S.Null), { nullable: true }),
949
1321
  "display_width_px": S.Int.pipe(S.greaterThanOrEqualTo(1)),
950
- "display_number": S.optionalWith(S.Union(S.Int.pipe(S.greaterThanOrEqualTo(0)), S.Null), { nullable: true })
1322
+ "name": BetaComputerUseTool20241022Name,
1323
+ "type": BetaComputerUseTool20241022Type
951
1324
  }) {}
952
1325
 
953
- export class BetaBashTool20241022Type extends S.Literal("bash_20241022") {}
954
-
955
1326
  export class BetaBashTool20241022Name extends S.Literal("bash") {}
956
1327
 
1328
+ export class BetaBashTool20241022Type extends S.Literal("bash_20241022") {}
1329
+
957
1330
  export class BetaBashTool20241022 extends S.Struct({
958
1331
  "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
959
- "type": BetaBashTool20241022Type,
960
- "name": BetaBashTool20241022Name
1332
+ "name": BetaBashTool20241022Name,
1333
+ "type": BetaBashTool20241022Type
961
1334
  }) {}
962
1335
 
963
- export class BetaTextEditor20241022Type extends S.Literal("text_editor_20241022") {}
964
-
965
1336
  export class BetaTextEditor20241022Name extends S.Literal("str_replace_editor") {}
966
1337
 
1338
+ export class BetaTextEditor20241022Type extends S.Literal("text_editor_20241022") {}
1339
+
967
1340
  export class BetaTextEditor20241022 extends S.Struct({
968
1341
  "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
969
- "type": BetaTextEditor20241022Type,
970
- "name": BetaTextEditor20241022Name
1342
+ "name": BetaTextEditor20241022Name,
1343
+ "type": BetaTextEditor20241022Type
971
1344
  }) {}
972
1345
 
973
- export class BetaComputerUseTool20250124Type extends S.Literal("computer_20250124") {}
974
-
975
1346
  export class BetaComputerUseTool20250124Name extends S.Literal("computer") {}
976
1347
 
1348
+ export class BetaComputerUseTool20250124Type extends S.Literal("computer_20250124") {}
1349
+
977
1350
  export class BetaComputerUseTool20250124 extends S.Struct({
978
1351
  "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
979
- "type": BetaComputerUseTool20250124Type,
980
- "name": BetaComputerUseTool20250124Name,
981
1352
  "display_height_px": S.Int.pipe(S.greaterThanOrEqualTo(1)),
1353
+ "display_number": S.optionalWith(S.Union(S.Int.pipe(S.greaterThanOrEqualTo(0)), S.Null), { nullable: true }),
982
1354
  "display_width_px": S.Int.pipe(S.greaterThanOrEqualTo(1)),
983
- "display_number": S.optionalWith(S.Union(S.Int.pipe(S.greaterThanOrEqualTo(0)), S.Null), { nullable: true })
1355
+ "name": BetaComputerUseTool20250124Name,
1356
+ "type": BetaComputerUseTool20250124Type
984
1357
  }) {}
985
1358
 
986
- export class BetaBashTool20250124Type extends S.Literal("bash_20250124") {}
987
-
988
1359
  export class BetaBashTool20250124Name extends S.Literal("bash") {}
989
1360
 
1361
+ export class BetaBashTool20250124Type extends S.Literal("bash_20250124") {}
1362
+
990
1363
  export class BetaBashTool20250124 extends S.Struct({
991
1364
  "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
992
- "type": BetaBashTool20250124Type,
993
- "name": BetaBashTool20250124Name
1365
+ "name": BetaBashTool20250124Name,
1366
+ "type": BetaBashTool20250124Type
994
1367
  }) {}
995
1368
 
996
- export class BetaTextEditor20250124Type extends S.Literal("text_editor_20250124") {}
997
-
998
1369
  export class BetaTextEditor20250124Name extends S.Literal("str_replace_editor") {}
999
1370
 
1371
+ export class BetaTextEditor20250124Type extends S.Literal("text_editor_20250124") {}
1372
+
1000
1373
  export class BetaTextEditor20250124 extends S.Struct({
1001
1374
  "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
1002
- "type": BetaTextEditor20250124Type,
1003
- "name": BetaTextEditor20250124Name
1375
+ "name": BetaTextEditor20250124Name,
1376
+ "type": BetaTextEditor20250124Type
1377
+ }) {}
1378
+
1379
+ export class BetaTextEditor20250429Name extends S.Literal("str_replace_based_edit_tool") {}
1380
+
1381
+ export class BetaTextEditor20250429Type extends S.Literal("text_editor_20250429") {}
1382
+
1383
+ export class BetaTextEditor20250429 extends S.Struct({
1384
+ "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
1385
+ "name": BetaTextEditor20250429Name,
1386
+ "type": BetaTextEditor20250429Type
1387
+ }) {}
1388
+
1389
+ export class BetaWebSearchTool20250305Name extends S.Literal("web_search") {}
1390
+
1391
+ export class BetaWebSearchTool20250305Type extends S.Literal("web_search_20250305") {}
1392
+
1393
+ export class BetaUserLocationType extends S.Literal("approximate") {}
1394
+
1395
+ export class BetaUserLocation extends S.Struct({
1396
+ "city": S.optionalWith(S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null), { nullable: true }),
1397
+ "country": S.optionalWith(S.Union(S.String.pipe(S.minLength(2), S.maxLength(2)), S.Null), { nullable: true }),
1398
+ "region": S.optionalWith(S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null), { nullable: true }),
1399
+ "timezone": S.optionalWith(S.Union(S.String.pipe(S.minLength(1), S.maxLength(255)), S.Null), { nullable: true }),
1400
+ "type": BetaUserLocationType
1401
+ }) {}
1402
+
1403
+ export class BetaWebSearchTool20250305 extends S.Struct({
1404
+ "allowed_domains": S.optionalWith(S.Union(S.Array(S.String), S.Null), { nullable: true }),
1405
+ "blocked_domains": S.optionalWith(S.Union(S.Array(S.String), S.Null), { nullable: true }),
1406
+ "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
1407
+ "max_uses": S.optionalWith(S.Union(S.Int.pipe(S.greaterThan(0)), S.Null), { nullable: true }),
1408
+ "name": BetaWebSearchTool20250305Name,
1409
+ "type": BetaWebSearchTool20250305Type,
1410
+ "user_location": S.optionalWith(S.Union(BetaUserLocation, S.Null), { nullable: true })
1411
+ }) {}
1412
+
1413
+ export class BetaCodeExecutionTool20250522Name extends S.Literal("code_execution") {}
1414
+
1415
+ export class BetaCodeExecutionTool20250522Type extends S.Literal("code_execution_20250522") {}
1416
+
1417
+ export class BetaCodeExecutionTool20250522 extends S.Struct({
1418
+ "cache_control": S.optionalWith(S.Union(BetaCacheControlEphemeral, S.Null), { nullable: true }),
1419
+ "name": BetaCodeExecutionTool20250522Name,
1420
+ "type": BetaCodeExecutionTool20250522Type
1004
1421
  }) {}
1005
1422
 
1006
1423
  export class BetaCreateMessageParams extends S.Class<BetaCreateMessageParams>("BetaCreateMessageParams")({
1007
- "model": Model,
1424
+ "model": S.Union(S.String, Model),
1008
1425
  "messages": S.Array(BetaInputMessage),
1426
+ "container": S.optionalWith(S.Union(S.String, S.Null), { nullable: true }),
1009
1427
  "max_tokens": S.Int.pipe(S.greaterThanOrEqualTo(1)),
1428
+ "mcp_servers": S.optionalWith(S.Array(BetaRequestMCPServerURLDefinition).pipe(S.maxItems(20)), { nullable: true }),
1010
1429
  "metadata": S.optionalWith(BetaMetadata, { nullable: true }),
1430
+ "service_tier": S.optionalWith(BetaCreateMessageParamsServiceTier, { nullable: true }),
1011
1431
  "stop_sequences": S.optionalWith(S.Array(S.String), { nullable: true }),
1012
1432
  "stream": S.optionalWith(S.Boolean, { nullable: true }),
1013
1433
  "system": S.optionalWith(S.Union(S.String, S.Array(BetaRequestTextBlock)), { nullable: true }),
@@ -1023,7 +1443,10 @@ export class BetaCreateMessageParams extends S.Class<BetaCreateMessageParams>("B
1023
1443
  BetaTextEditor20241022,
1024
1444
  BetaComputerUseTool20250124,
1025
1445
  BetaBashTool20250124,
1026
- BetaTextEditor20250124
1446
+ BetaTextEditor20250124,
1447
+ BetaTextEditor20250429,
1448
+ BetaWebSearchTool20250305,
1449
+ BetaCodeExecutionTool20250522
1027
1450
  )
1028
1451
  ),
1029
1452
  { nullable: true }
@@ -1036,210 +1459,308 @@ export class BetaMessageType extends S.Literal("message") {}
1036
1459
 
1037
1460
  export class BetaMessageRole extends S.Literal("assistant") {}
1038
1461
 
1039
- export class BetaResponseTextBlockType extends S.Literal("text") {}
1040
-
1041
1462
  export class BetaResponseCharLocationCitationType extends S.Literal("char_location") {}
1042
1463
 
1043
1464
  export class BetaResponseCharLocationCitation extends S.Struct({
1044
- "type": BetaResponseCharLocationCitationType.pipe(
1045
- S.propertySignature,
1046
- S.withConstructorDefault(() => "char_location" as const)
1047
- ),
1048
1465
  "cited_text": S.String,
1049
1466
  "document_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
1050
1467
  "document_title": S.Union(S.String, S.Null),
1468
+ "end_char_index": S.Int,
1051
1469
  "start_char_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
1052
- "end_char_index": S.Int
1470
+ "type": BetaResponseCharLocationCitationType
1053
1471
  }) {}
1054
1472
 
1055
1473
  export class BetaResponsePageLocationCitationType extends S.Literal("page_location") {}
1056
1474
 
1057
1475
  export class BetaResponsePageLocationCitation extends S.Struct({
1058
- "type": BetaResponsePageLocationCitationType.pipe(
1059
- S.propertySignature,
1060
- S.withConstructorDefault(() => "page_location" as const)
1061
- ),
1062
1476
  "cited_text": S.String,
1063
1477
  "document_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
1064
1478
  "document_title": S.Union(S.String, S.Null),
1479
+ "end_page_number": S.Int,
1065
1480
  "start_page_number": S.Int.pipe(S.greaterThanOrEqualTo(1)),
1066
- "end_page_number": S.Int
1481
+ "type": BetaResponsePageLocationCitationType
1067
1482
  }) {}
1068
1483
 
1069
1484
  export class BetaResponseContentBlockLocationCitationType extends S.Literal("content_block_location") {}
1070
1485
 
1071
1486
  export class BetaResponseContentBlockLocationCitation extends S.Struct({
1072
- "type": BetaResponseContentBlockLocationCitationType.pipe(
1073
- S.propertySignature,
1074
- S.withConstructorDefault(() => "content_block_location" as const)
1075
- ),
1076
1487
  "cited_text": S.String,
1077
1488
  "document_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
1078
1489
  "document_title": S.Union(S.String, S.Null),
1490
+ "end_block_index": S.Int,
1079
1491
  "start_block_index": S.Int.pipe(S.greaterThanOrEqualTo(0)),
1080
- "end_block_index": S.Int
1492
+ "type": BetaResponseContentBlockLocationCitationType
1081
1493
  }) {}
1082
1494
 
1495
+ export class BetaResponseWebSearchResultLocationCitationType extends S.Literal("web_search_result_location") {}
1496
+
1497
+ export class BetaResponseWebSearchResultLocationCitation extends S.Struct({
1498
+ "cited_text": S.String,
1499
+ "encrypted_index": S.String,
1500
+ "title": S.Union(S.String, S.Null),
1501
+ "type": BetaResponseWebSearchResultLocationCitationType,
1502
+ "url": S.String
1503
+ }) {}
1504
+
1505
+ export class BetaResponseTextBlockType extends S.Literal("text") {}
1506
+
1083
1507
  export class BetaResponseTextBlock extends S.Struct({
1084
- "type": BetaResponseTextBlockType.pipe(S.propertySignature, S.withConstructorDefault(() => "text" as const)),
1508
+ "citations": S.NullOr(
1509
+ S.Union(
1510
+ S.Array(
1511
+ S.Union(
1512
+ BetaResponseCharLocationCitation,
1513
+ BetaResponsePageLocationCitation,
1514
+ BetaResponseContentBlockLocationCitation,
1515
+ BetaResponseWebSearchResultLocationCitation
1516
+ )
1517
+ ),
1518
+ S.Null
1519
+ )
1520
+ ),
1085
1521
  "text": S.String.pipe(S.minLength(0), S.maxLength(5000000)),
1086
- "citations": S.optionalWith(
1087
- S.NullOr(
1088
- S.Union(
1089
- S.Array(
1090
- S.Union(
1091
- BetaResponseCharLocationCitation,
1092
- BetaResponsePageLocationCitation,
1093
- BetaResponseContentBlockLocationCitation
1094
- )
1095
- ),
1096
- S.Null
1097
- )
1098
- ),
1099
- { default: () => null }
1100
- )
1522
+ "type": BetaResponseTextBlockType
1101
1523
  }) {}
1102
1524
 
1103
1525
  export class BetaResponseToolUseBlockType extends S.Literal("tool_use") {}
1104
1526
 
1105
1527
  export class BetaResponseToolUseBlock extends S.Struct({
1106
- "type": BetaResponseToolUseBlockType.pipe(S.propertySignature, S.withConstructorDefault(() => "tool_use" as const)),
1107
1528
  "id": S.String.pipe(S.pattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
1529
+ "input": S.Record({ key: S.String, value: S.Unknown }),
1108
1530
  "name": S.String.pipe(S.minLength(1)),
1109
- "input": S.Record({ key: S.String, value: S.Unknown })
1531
+ "type": BetaResponseToolUseBlockType
1532
+ }) {}
1533
+
1534
+ export class BetaResponseServerToolUseBlockName extends S.Literal("web_search", "code_execution") {}
1535
+
1536
+ export class BetaResponseServerToolUseBlockType extends S.Literal("server_tool_use") {}
1537
+
1538
+ export class BetaResponseServerToolUseBlock extends S.Struct({
1539
+ "id": S.String.pipe(S.pattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
1540
+ "input": S.Record({ key: S.String, value: S.Unknown }),
1541
+ "name": BetaResponseServerToolUseBlockName,
1542
+ "type": BetaResponseServerToolUseBlockType
1543
+ }) {}
1544
+
1545
+ export class BetaResponseWebSearchToolResultErrorType extends S.Literal("web_search_tool_result_error") {}
1546
+
1547
+ export class BetaResponseWebSearchToolResultError extends S.Struct({
1548
+ "error_code": BetaWebSearchToolResultErrorCode,
1549
+ "type": BetaResponseWebSearchToolResultErrorType
1550
+ }) {}
1551
+
1552
+ export class BetaResponseWebSearchResultBlockType extends S.Literal("web_search_result") {}
1553
+
1554
+ export class BetaResponseWebSearchResultBlock extends S.Struct({
1555
+ "encrypted_content": S.String,
1556
+ "page_age": S.NullOr(S.Union(S.String, S.Null)),
1557
+ "title": S.String,
1558
+ "type": BetaResponseWebSearchResultBlockType,
1559
+ "url": S.String
1560
+ }) {}
1561
+
1562
+ export class BetaResponseWebSearchToolResultBlockType extends S.Literal("web_search_tool_result") {}
1563
+
1564
+ export class BetaResponseWebSearchToolResultBlock extends S.Struct({
1565
+ "content": S.Union(BetaResponseWebSearchToolResultError, S.Array(BetaResponseWebSearchResultBlock)),
1566
+ "tool_use_id": S.String.pipe(S.pattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
1567
+ "type": BetaResponseWebSearchToolResultBlockType
1568
+ }) {}
1569
+
1570
+ export class BetaResponseCodeExecutionToolResultErrorType extends S.Literal("code_execution_tool_result_error") {}
1571
+
1572
+ export class BetaResponseCodeExecutionToolResultError extends S.Struct({
1573
+ "error_code": BetaCodeExecutionToolResultErrorCode,
1574
+ "type": BetaResponseCodeExecutionToolResultErrorType
1575
+ }) {}
1576
+
1577
+ export class BetaResponseCodeExecutionOutputBlockType extends S.Literal("code_execution_output") {}
1578
+
1579
+ export class BetaResponseCodeExecutionOutputBlock extends S.Struct({
1580
+ "file_id": S.String,
1581
+ "type": BetaResponseCodeExecutionOutputBlockType
1582
+ }) {}
1583
+
1584
+ export class BetaResponseCodeExecutionResultBlockType extends S.Literal("code_execution_result") {}
1585
+
1586
+ export class BetaResponseCodeExecutionResultBlock extends S.Struct({
1587
+ "content": S.Array(BetaResponseCodeExecutionOutputBlock),
1588
+ "return_code": S.Int,
1589
+ "stderr": S.String,
1590
+ "stdout": S.String,
1591
+ "type": BetaResponseCodeExecutionResultBlockType
1592
+ }) {}
1593
+
1594
+ export class BetaResponseCodeExecutionToolResultBlockType extends S.Literal("code_execution_tool_result") {}
1595
+
1596
+ export class BetaResponseCodeExecutionToolResultBlock extends S.Struct({
1597
+ "content": S.Union(BetaResponseCodeExecutionToolResultError, BetaResponseCodeExecutionResultBlock),
1598
+ "tool_use_id": S.String.pipe(S.pattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
1599
+ "type": BetaResponseCodeExecutionToolResultBlockType
1600
+ }) {}
1601
+
1602
+ export class BetaResponseMCPToolUseBlockType extends S.Literal("mcp_tool_use") {}
1603
+
1604
+ export class BetaResponseMCPToolUseBlock extends S.Struct({
1605
+ "id": S.String.pipe(S.pattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
1606
+ "input": S.Record({ key: S.String, value: S.Unknown }),
1607
+ "name": S.String,
1608
+ "server_name": S.String,
1609
+ "type": BetaResponseMCPToolUseBlockType
1610
+ }) {}
1611
+
1612
+ export class BetaResponseMCPToolResultBlockType extends S.Literal("mcp_tool_result") {}
1613
+
1614
+ export class BetaResponseMCPToolResultBlock extends S.Struct({
1615
+ "content": S.Union(S.String, S.Array(BetaResponseTextBlock)),
1616
+ "is_error": S.Boolean,
1617
+ "tool_use_id": S.String.pipe(S.pattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
1618
+ "type": BetaResponseMCPToolResultBlockType
1619
+ }) {}
1620
+
1621
+ export class BetaResponseContainerUploadBlockType extends S.Literal("container_upload") {}
1622
+
1623
+ export class BetaResponseContainerUploadBlock extends S.Struct({
1624
+ "file_id": S.String,
1625
+ "type": BetaResponseContainerUploadBlockType
1110
1626
  }) {}
1111
1627
 
1112
1628
  export class BetaResponseThinkingBlockType extends S.Literal("thinking") {}
1113
1629
 
1114
1630
  export class BetaResponseThinkingBlock extends S.Struct({
1115
- "type": BetaResponseThinkingBlockType.pipe(S.propertySignature, S.withConstructorDefault(() => "thinking" as const)),
1631
+ "signature": S.String,
1116
1632
  "thinking": S.String,
1117
- "signature": S.String
1633
+ "type": BetaResponseThinkingBlockType
1118
1634
  }) {}
1119
1635
 
1120
1636
  export class BetaResponseRedactedThinkingBlockType extends S.Literal("redacted_thinking") {}
1121
1637
 
1122
1638
  export class BetaResponseRedactedThinkingBlock extends S.Struct({
1123
- "type": BetaResponseRedactedThinkingBlockType.pipe(
1124
- S.propertySignature,
1125
- S.withConstructorDefault(() => "redacted_thinking" as const)
1126
- ),
1127
- "data": S.String
1639
+ "data": S.String,
1640
+ "type": BetaResponseRedactedThinkingBlockType
1128
1641
  }) {}
1129
1642
 
1130
1643
  export class BetaContentBlock extends S.Union(
1131
1644
  BetaResponseTextBlock,
1132
1645
  BetaResponseToolUseBlock,
1646
+ BetaResponseServerToolUseBlock,
1647
+ BetaResponseWebSearchToolResultBlock,
1648
+ BetaResponseCodeExecutionToolResultBlock,
1649
+ BetaResponseMCPToolUseBlock,
1650
+ BetaResponseMCPToolResultBlock,
1651
+ BetaResponseContainerUploadBlock,
1133
1652
  BetaResponseThinkingBlock,
1134
1653
  BetaResponseRedactedThinkingBlock
1135
1654
  ) {}
1136
1655
 
1137
- export class BetaMessageStopReasonEnum extends S.Literal("end_turn", "max_tokens", "stop_sequence", "tool_use") {}
1656
+ export class BetaStopReason
1657
+ extends S.Literal("end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn", "refusal")
1658
+ {}
1659
+
1660
+ export class BetaCacheCreation extends S.Struct({
1661
+ "ephemeral_1h_input_tokens": S.Int.pipe(S.greaterThanOrEqualTo(0)),
1662
+ "ephemeral_5m_input_tokens": S.Int.pipe(S.greaterThanOrEqualTo(0))
1663
+ }) {}
1664
+
1665
+ export class BetaServerToolUsage extends S.Struct({
1666
+ "web_search_requests": S.Int.pipe(S.greaterThanOrEqualTo(0))
1667
+ }) {}
1668
+
1669
+ export class BetaUsageServiceTierEnum extends S.Literal("standard", "priority", "batch") {}
1138
1670
 
1139
1671
  export class BetaUsage extends S.Struct({
1672
+ "cache_creation": S.NullOr(S.Union(BetaCacheCreation, S.Null)),
1673
+ "cache_creation_input_tokens": S.NullOr(S.Union(S.Int.pipe(S.greaterThanOrEqualTo(0)), S.Null)),
1674
+ "cache_read_input_tokens": S.NullOr(S.Union(S.Int.pipe(S.greaterThanOrEqualTo(0)), S.Null)),
1140
1675
  "input_tokens": S.Int.pipe(S.greaterThanOrEqualTo(0)),
1141
- "cache_creation_input_tokens": S.optionalWith(S.NullOr(S.Union(S.Int.pipe(S.greaterThanOrEqualTo(0)), S.Null)), {
1142
- default: () => null
1143
- }),
1144
- "cache_read_input_tokens": S.optionalWith(S.NullOr(S.Union(S.Int.pipe(S.greaterThanOrEqualTo(0)), S.Null)), {
1145
- default: () => null
1146
- }),
1147
- "output_tokens": S.Int.pipe(S.greaterThanOrEqualTo(0))
1676
+ "output_tokens": S.Int.pipe(S.greaterThanOrEqualTo(0)),
1677
+ "server_tool_use": S.NullOr(S.Union(BetaServerToolUsage, S.Null)),
1678
+ "service_tier": S.NullOr(S.Union(BetaUsageServiceTierEnum, S.Null))
1679
+ }) {}
1680
+
1681
+ export class BetaContainer extends S.Struct({
1682
+ "expires_at": S.String,
1683
+ "id": S.String
1148
1684
  }) {}
1149
1685
 
1150
1686
  export class BetaMessage extends S.Class<BetaMessage>("BetaMessage")({
1151
1687
  "id": S.String,
1152
- "type": BetaMessageType.pipe(S.propertySignature, S.withConstructorDefault(() => "message" as const)),
1153
- "role": BetaMessageRole.pipe(S.propertySignature, S.withConstructorDefault(() => "assistant" as const)),
1688
+ "type": BetaMessageType,
1689
+ "role": BetaMessageRole,
1154
1690
  "content": S.Array(BetaContentBlock),
1155
- "model": Model,
1156
- "stop_reason": S.Union(BetaMessageStopReasonEnum, S.Null),
1157
- "stop_sequence": S.optionalWith(S.NullOr(S.Union(S.String, S.Null)), { default: () => null }),
1158
- "usage": BetaUsage
1691
+ "model": S.Union(S.String, Model),
1692
+ "stop_reason": S.Union(BetaStopReason, S.Null),
1693
+ "stop_sequence": S.NullOr(S.Union(S.String, S.Null)),
1694
+ "usage": BetaUsage,
1695
+ "container": S.NullOr(S.Union(BetaContainer, S.Null))
1159
1696
  }) {}
1160
1697
 
1161
- export class BetaErrorResponseType extends S.Literal("error") {}
1162
-
1163
1698
  export class BetaInvalidRequestErrorType extends S.Literal("invalid_request_error") {}
1164
1699
 
1165
1700
  export class BetaInvalidRequestError extends S.Struct({
1166
- "type": BetaInvalidRequestErrorType.pipe(
1167
- S.propertySignature,
1168
- S.withConstructorDefault(() => "invalid_request_error" as const)
1169
- ),
1170
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Invalid request" as const))
1701
+ "message": S.String,
1702
+ "type": BetaInvalidRequestErrorType
1171
1703
  }) {}
1172
1704
 
1173
1705
  export class BetaAuthenticationErrorType extends S.Literal("authentication_error") {}
1174
1706
 
1175
1707
  export class BetaAuthenticationError extends S.Struct({
1176
- "type": BetaAuthenticationErrorType.pipe(
1177
- S.propertySignature,
1178
- S.withConstructorDefault(() => "authentication_error" as const)
1179
- ),
1180
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Authentication error" as const))
1708
+ "message": S.String,
1709
+ "type": BetaAuthenticationErrorType
1181
1710
  }) {}
1182
1711
 
1183
1712
  export class BetaBillingErrorType extends S.Literal("billing_error") {}
1184
1713
 
1185
1714
  export class BetaBillingError extends S.Struct({
1186
- "type": BetaBillingErrorType.pipe(S.propertySignature, S.withConstructorDefault(() => "billing_error" as const)),
1187
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Billing error" as const))
1715
+ "message": S.String,
1716
+ "type": BetaBillingErrorType
1188
1717
  }) {}
1189
1718
 
1190
1719
  export class BetaPermissionErrorType extends S.Literal("permission_error") {}
1191
1720
 
1192
1721
  export class BetaPermissionError extends S.Struct({
1193
- "type": BetaPermissionErrorType.pipe(
1194
- S.propertySignature,
1195
- S.withConstructorDefault(() => "permission_error" as const)
1196
- ),
1197
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Permission denied" as const))
1722
+ "message": S.String,
1723
+ "type": BetaPermissionErrorType
1198
1724
  }) {}
1199
1725
 
1200
1726
  export class BetaNotFoundErrorType extends S.Literal("not_found_error") {}
1201
1727
 
1202
1728
  export class BetaNotFoundError extends S.Struct({
1203
- "type": BetaNotFoundErrorType.pipe(S.propertySignature, S.withConstructorDefault(() => "not_found_error" as const)),
1204
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Not found" as const))
1729
+ "message": S.String,
1730
+ "type": BetaNotFoundErrorType
1205
1731
  }) {}
1206
1732
 
1207
1733
  export class BetaRateLimitErrorType extends S.Literal("rate_limit_error") {}
1208
1734
 
1209
1735
  export class BetaRateLimitError extends S.Struct({
1210
- "type": BetaRateLimitErrorType.pipe(S.propertySignature, S.withConstructorDefault(() => "rate_limit_error" as const)),
1211
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Rate limited" as const))
1736
+ "message": S.String,
1737
+ "type": BetaRateLimitErrorType
1212
1738
  }) {}
1213
1739
 
1214
1740
  export class BetaGatewayTimeoutErrorType extends S.Literal("timeout_error") {}
1215
1741
 
1216
1742
  export class BetaGatewayTimeoutError extends S.Struct({
1217
- "type": BetaGatewayTimeoutErrorType.pipe(
1218
- S.propertySignature,
1219
- S.withConstructorDefault(() => "timeout_error" as const)
1220
- ),
1221
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Request timeout" as const))
1743
+ "message": S.String,
1744
+ "type": BetaGatewayTimeoutErrorType
1222
1745
  }) {}
1223
1746
 
1224
1747
  export class BetaAPIErrorType extends S.Literal("api_error") {}
1225
1748
 
1226
1749
  export class BetaAPIError extends S.Struct({
1227
- "type": BetaAPIErrorType.pipe(S.propertySignature, S.withConstructorDefault(() => "api_error" as const)),
1228
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Internal server error" as const))
1750
+ "message": S.String,
1751
+ "type": BetaAPIErrorType
1229
1752
  }) {}
1230
1753
 
1231
1754
  export class BetaOverloadedErrorType extends S.Literal("overloaded_error") {}
1232
1755
 
1233
1756
  export class BetaOverloadedError extends S.Struct({
1234
- "type": BetaOverloadedErrorType.pipe(
1235
- S.propertySignature,
1236
- S.withConstructorDefault(() => "overloaded_error" as const)
1237
- ),
1238
- "message": S.String.pipe(S.propertySignature, S.withConstructorDefault(() => "Overloaded" as const))
1757
+ "message": S.String,
1758
+ "type": BetaOverloadedErrorType
1239
1759
  }) {}
1240
1760
 
1761
+ export class BetaErrorResponseType extends S.Literal("error") {}
1762
+
1241
1763
  export class BetaErrorResponse extends S.Class<BetaErrorResponse>("BetaErrorResponse")({
1242
- "type": BetaErrorResponseType.pipe(S.propertySignature, S.withConstructorDefault(() => "error" as const)),
1243
1764
  "error": S.Union(
1244
1765
  BetaInvalidRequestError,
1245
1766
  BetaAuthenticationError,
@@ -1250,83 +1771,80 @@ export class BetaErrorResponse extends S.Class<BetaErrorResponse>("BetaErrorResp
1250
1771
  BetaGatewayTimeoutError,
1251
1772
  BetaAPIError,
1252
1773
  BetaOverloadedError
1253
- )
1774
+ ),
1775
+ "type": BetaErrorResponseType
1254
1776
  }) {}
1255
1777
 
1256
1778
  export class BetaModelsListParams extends S.Struct({
1257
1779
  "before_id": S.optionalWith(S.String, { nullable: true }),
1258
1780
  "after_id": S.optionalWith(S.String, { nullable: true }),
1259
- "limit": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(1000)), {
1260
- nullable: true,
1261
- default: () => 20 as const
1262
- }),
1781
+ "limit": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(1000)), { nullable: true }),
1263
1782
  "anthropic-version": S.optionalWith(S.String, { nullable: true }),
1264
- "x-api-key": S.optionalWith(S.String, { nullable: true })
1783
+ "x-api-key": S.optionalWith(S.String, { nullable: true }),
1784
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true })
1265
1785
  }) {}
1266
1786
 
1267
1787
  export class BetaModelInfoType extends S.Literal("model") {}
1268
1788
 
1269
1789
  export class BetaModelInfo extends S.Struct({
1270
- "type": BetaModelInfoType.pipe(S.propertySignature, S.withConstructorDefault(() => "model" as const)),
1271
- "id": S.String,
1790
+ "created_at": S.String,
1272
1791
  "display_name": S.String,
1273
- "created_at": S.String
1792
+ "id": S.String,
1793
+ "type": BetaModelInfoType
1274
1794
  }) {}
1275
1795
 
1276
1796
  export class BetaListResponseModelInfo extends S.Class<BetaListResponseModelInfo>("BetaListResponseModelInfo")({
1277
1797
  "data": S.Array(BetaModelInfo),
1278
- "has_more": S.Boolean,
1279
1798
  "first_id": S.Union(S.String, S.Null),
1799
+ "has_more": S.Boolean,
1280
1800
  "last_id": S.Union(S.String, S.Null)
1281
1801
  }) {}
1282
1802
 
1283
1803
  export class BetaModelsGetParams extends S.Struct({
1284
1804
  "anthropic-version": S.optionalWith(S.String, { nullable: true }),
1285
- "x-api-key": S.optionalWith(S.String, { nullable: true })
1805
+ "x-api-key": S.optionalWith(S.String, { nullable: true }),
1806
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true })
1286
1807
  }) {}
1287
1808
 
1288
1809
  export class BetaMessageBatchesListParams extends S.Struct({
1289
1810
  "before_id": S.optionalWith(S.String, { nullable: true }),
1290
1811
  "after_id": S.optionalWith(S.String, { nullable: true }),
1291
- "limit": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(1000)), {
1292
- nullable: true,
1293
- default: () => 20 as const
1294
- }),
1812
+ "limit": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(1000)), { nullable: true }),
1295
1813
  "anthropic-beta": S.optionalWith(S.String, { nullable: true }),
1296
1814
  "anthropic-version": S.optionalWith(S.String, { nullable: true }),
1297
1815
  "x-api-key": S.optionalWith(S.String, { nullable: true })
1298
1816
  }) {}
1299
1817
 
1300
- export class BetaMessageBatchType extends S.Literal("message_batch") {}
1301
-
1302
1818
  export class BetaMessageBatchProcessingStatus extends S.Literal("in_progress", "canceling", "ended") {}
1303
1819
 
1304
1820
  export class BetaRequestCounts extends S.Struct({
1305
- "processing": S.Int.pipe(S.propertySignature, S.withConstructorDefault(() => 0 as const)),
1306
- "succeeded": S.Int.pipe(S.propertySignature, S.withConstructorDefault(() => 0 as const)),
1307
- "errored": S.Int.pipe(S.propertySignature, S.withConstructorDefault(() => 0 as const)),
1308
- "canceled": S.Int.pipe(S.propertySignature, S.withConstructorDefault(() => 0 as const)),
1309
- "expired": S.Int.pipe(S.propertySignature, S.withConstructorDefault(() => 0 as const))
1821
+ "canceled": S.Int,
1822
+ "errored": S.Int,
1823
+ "expired": S.Int,
1824
+ "processing": S.Int,
1825
+ "succeeded": S.Int
1310
1826
  }) {}
1311
1827
 
1828
+ export class BetaMessageBatchType extends S.Literal("message_batch") {}
1829
+
1312
1830
  export class BetaMessageBatch extends S.Struct({
1831
+ "archived_at": S.Union(S.String, S.Null),
1832
+ "cancel_initiated_at": S.Union(S.String, S.Null),
1833
+ "created_at": S.String,
1834
+ "ended_at": S.Union(S.String, S.Null),
1835
+ "expires_at": S.String,
1313
1836
  "id": S.String,
1314
- "type": BetaMessageBatchType.pipe(S.propertySignature, S.withConstructorDefault(() => "message_batch" as const)),
1315
1837
  "processing_status": BetaMessageBatchProcessingStatus,
1316
1838
  "request_counts": BetaRequestCounts,
1317
- "ended_at": S.Union(S.String, S.Null),
1318
- "created_at": S.String,
1319
- "expires_at": S.String,
1320
- "archived_at": S.Union(S.String, S.Null),
1321
- "cancel_initiated_at": S.Union(S.String, S.Null),
1322
- "results_url": S.Union(S.String, S.Null)
1839
+ "results_url": S.Union(S.String, S.Null),
1840
+ "type": BetaMessageBatchType
1323
1841
  }) {}
1324
1842
 
1325
1843
  export class BetaListResponseMessageBatch
1326
1844
  extends S.Class<BetaListResponseMessageBatch>("BetaListResponseMessageBatch")({
1327
1845
  "data": S.Array(BetaMessageBatch),
1328
- "has_more": S.Boolean,
1329
1846
  "first_id": S.Union(S.String, S.Null),
1847
+ "has_more": S.Boolean,
1330
1848
  "last_id": S.Union(S.String, S.Null)
1331
1849
  })
1332
1850
  {}
@@ -1364,10 +1882,7 @@ export class BetaDeleteMessageBatchResponseType extends S.Literal("message_batch
1364
1882
  export class BetaDeleteMessageBatchResponse
1365
1883
  extends S.Class<BetaDeleteMessageBatchResponse>("BetaDeleteMessageBatchResponse")({
1366
1884
  "id": S.String,
1367
- "type": BetaDeleteMessageBatchResponseType.pipe(
1368
- S.propertySignature,
1369
- S.withConstructorDefault(() => "message_batch_deleted" as const)
1370
- )
1885
+ "type": BetaDeleteMessageBatchResponseType
1371
1886
  })
1372
1887
  {}
1373
1888
 
@@ -1389,6 +1904,11 @@ export class BetaMessagesCountTokensPostParams extends S.Struct({
1389
1904
 
1390
1905
  export class BetaCountMessageTokensParams
1391
1906
  extends S.Class<BetaCountMessageTokensParams>("BetaCountMessageTokensParams")({
1907
+ "mcp_servers": S.optionalWith(S.Array(BetaRequestMCPServerURLDefinition).pipe(S.maxItems(20)), { nullable: true }),
1908
+ "messages": S.Array(BetaInputMessage),
1909
+ "model": S.Union(S.String, Model),
1910
+ "system": S.optionalWith(S.Union(S.String, S.Array(BetaRequestTextBlock)), { nullable: true }),
1911
+ "thinking": S.optionalWith(BetaThinkingConfigParam, { nullable: true }),
1392
1912
  "tool_choice": S.optionalWith(BetaToolChoice, { nullable: true }),
1393
1913
  "tools": S.optionalWith(
1394
1914
  S.Array(
@@ -1399,15 +1919,14 @@ export class BetaCountMessageTokensParams
1399
1919
  BetaTextEditor20241022,
1400
1920
  BetaComputerUseTool20250124,
1401
1921
  BetaBashTool20250124,
1402
- BetaTextEditor20250124
1922
+ BetaTextEditor20250124,
1923
+ BetaTextEditor20250429,
1924
+ BetaWebSearchTool20250305,
1925
+ BetaCodeExecutionTool20250522
1403
1926
  )
1404
1927
  ),
1405
1928
  { nullable: true }
1406
- ),
1407
- "messages": S.Array(BetaInputMessage),
1408
- "system": S.optionalWith(S.Union(S.String, S.Array(BetaRequestTextBlock)), { nullable: true }),
1409
- "thinking": S.optionalWith(BetaThinkingConfigParam, { nullable: true }),
1410
- "model": Model
1929
+ )
1411
1930
  })
1412
1931
  {}
1413
1932
 
@@ -1417,6 +1936,64 @@ export class BetaCountMessageTokensResponse
1417
1936
  })
1418
1937
  {}
1419
1938
 
1939
+ export class BetaListFilesV1FilesGetParams extends S.Struct({
1940
+ "before_id": S.optionalWith(S.String, { nullable: true }),
1941
+ "after_id": S.optionalWith(S.String, { nullable: true }),
1942
+ "limit": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(1000)), { nullable: true }),
1943
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true }),
1944
+ "anthropic-version": S.optionalWith(S.String, { nullable: true }),
1945
+ "x-api-key": S.optionalWith(S.String, { nullable: true })
1946
+ }) {}
1947
+
1948
+ export class BetaFileMetadataSchemaType extends S.Literal("file") {}
1949
+
1950
+ export class BetaFileMetadataSchema extends S.Struct({
1951
+ "created_at": S.String,
1952
+ "downloadable": S.optionalWith(S.Boolean, { nullable: true }),
1953
+ "filename": S.String.pipe(S.minLength(1), S.maxLength(500)),
1954
+ "id": S.String,
1955
+ "mime_type": S.String.pipe(S.minLength(1), S.maxLength(255)),
1956
+ "size_bytes": S.Int.pipe(S.greaterThanOrEqualTo(0)),
1957
+ "type": BetaFileMetadataSchemaType
1958
+ }) {}
1959
+
1960
+ export class BetaFileListResponse extends S.Class<BetaFileListResponse>("BetaFileListResponse")({
1961
+ "data": S.Array(BetaFileMetadataSchema),
1962
+ "first_id": S.optionalWith(S.Union(S.String, S.Null), { nullable: true }),
1963
+ "has_more": S.optionalWith(S.Boolean, { nullable: true }),
1964
+ "last_id": S.optionalWith(S.Union(S.String, S.Null), { nullable: true })
1965
+ }) {}
1966
+
1967
+ export class BetaUploadFileV1FilesPostParams extends S.Struct({
1968
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true }),
1969
+ "anthropic-version": S.optionalWith(S.String, { nullable: true })
1970
+ }) {}
1971
+
1972
+ export class BetaGetFileMetadataV1FilesFileIdGetParams extends S.Struct({
1973
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true }),
1974
+ "anthropic-version": S.optionalWith(S.String, { nullable: true }),
1975
+ "x-api-key": S.optionalWith(S.String, { nullable: true })
1976
+ }) {}
1977
+
1978
+ export class BetaDeleteFileV1FilesFileIdDeleteParams extends S.Struct({
1979
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true }),
1980
+ "anthropic-version": S.optionalWith(S.String, { nullable: true }),
1981
+ "x-api-key": S.optionalWith(S.String, { nullable: true })
1982
+ }) {}
1983
+
1984
+ export class BetaFileDeleteResponseType extends S.Literal("file_deleted") {}
1985
+
1986
+ export class BetaFileDeleteResponse extends S.Class<BetaFileDeleteResponse>("BetaFileDeleteResponse")({
1987
+ "id": S.String,
1988
+ "type": S.optionalWith(BetaFileDeleteResponseType, { nullable: true })
1989
+ }) {}
1990
+
1991
+ export class BetaDownloadFileV1FilesFileIdContentGetParams extends S.Struct({
1992
+ "anthropic-beta": S.optionalWith(S.String, { nullable: true }),
1993
+ "anthropic-version": S.optionalWith(S.String, { nullable: true }),
1994
+ "x-api-key": S.optionalWith(S.String, { nullable: true })
1995
+ }) {}
1996
+
1420
1997
  export const make = (
1421
1998
  httpClient: HttpClient.HttpClient,
1422
1999
  options: {
@@ -1444,9 +2021,10 @@ export const make = (
1444
2021
  const decodeError = <A, I, R>(response: HttpClientResponse.HttpClientResponse, schema: S.Schema<A, I, R>) =>
1445
2022
  Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)(response), Effect.fail)
1446
2023
  return {
2024
+ httpClient,
1447
2025
  "messagesPost": (options) =>
1448
2026
  HttpClientRequest.make("POST")(`/v1/messages`).pipe(
1449
- HttpClientRequest.setHeaders({ "anthropic-version": options.params["anthropic-version"] ?? undefined }),
2027
+ HttpClientRequest.setHeaders({ "anthropic-version": options.params?.["anthropic-version"] ?? undefined }),
1450
2028
  (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options.payload)),
1451
2029
  Effect.flatMap((request) =>
1452
2030
  Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
@@ -1462,7 +2040,10 @@ export const make = (
1462
2040
  ),
1463
2041
  "completePost": (options) =>
1464
2042
  HttpClientRequest.make("POST")(`/v1/complete`).pipe(
1465
- HttpClientRequest.setHeaders({ "anthropic-version": options.params["anthropic-version"] ?? undefined }),
2043
+ HttpClientRequest.setHeaders({
2044
+ "anthropic-version": options.params?.["anthropic-version"] ?? undefined,
2045
+ "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined
2046
+ }),
1466
2047
  (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options.payload)),
1467
2048
  Effect.flatMap((request) =>
1468
2049
  Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
@@ -1479,13 +2060,14 @@ export const make = (
1479
2060
  "modelsList": (options) =>
1480
2061
  HttpClientRequest.make("GET")(`/v1/models`).pipe(
1481
2062
  HttpClientRequest.setUrlParams({
1482
- "before_id": options["before_id"] as UrlParams.Coercible,
1483
- "after_id": options["after_id"] as UrlParams.Coercible,
1484
- "limit": options["limit"] as UrlParams.Coercible
2063
+ "before_id": options?.["before_id"] as UrlParams.Coercible,
2064
+ "after_id": options?.["after_id"] as UrlParams.Coercible,
2065
+ "limit": options?.["limit"] as UrlParams.Coercible
1485
2066
  }),
1486
2067
  HttpClientRequest.setHeaders({
1487
- "anthropic-version": options["anthropic-version"] ?? undefined,
1488
- "x-api-key": options["x-api-key"] ?? undefined
2068
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2069
+ "x-api-key": options?.["x-api-key"] ?? undefined,
2070
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined
1489
2071
  }),
1490
2072
  Effect.succeed,
1491
2073
  Effect.flatMap((request) =>
@@ -1503,8 +2085,9 @@ export const make = (
1503
2085
  "modelsGet": (modelId, options) =>
1504
2086
  HttpClientRequest.make("GET")(`/v1/models/${modelId}`).pipe(
1505
2087
  HttpClientRequest.setHeaders({
1506
- "anthropic-version": options["anthropic-version"] ?? undefined,
1507
- "x-api-key": options["x-api-key"] ?? undefined
2088
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2089
+ "x-api-key": options?.["x-api-key"] ?? undefined,
2090
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined
1508
2091
  }),
1509
2092
  Effect.succeed,
1510
2093
  Effect.flatMap((request) =>
@@ -1522,13 +2105,13 @@ export const make = (
1522
2105
  "messageBatchesList": (options) =>
1523
2106
  HttpClientRequest.make("GET")(`/v1/messages/batches`).pipe(
1524
2107
  HttpClientRequest.setUrlParams({
1525
- "before_id": options["before_id"] as UrlParams.Coercible,
1526
- "after_id": options["after_id"] as UrlParams.Coercible,
1527
- "limit": options["limit"] as UrlParams.Coercible
2108
+ "before_id": options?.["before_id"] as UrlParams.Coercible,
2109
+ "after_id": options?.["after_id"] as UrlParams.Coercible,
2110
+ "limit": options?.["limit"] as UrlParams.Coercible
1528
2111
  }),
1529
2112
  HttpClientRequest.setHeaders({
1530
- "anthropic-version": options["anthropic-version"] ?? undefined,
1531
- "x-api-key": options["x-api-key"] ?? undefined
2113
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2114
+ "x-api-key": options?.["x-api-key"] ?? undefined
1532
2115
  }),
1533
2116
  Effect.succeed,
1534
2117
  Effect.flatMap((request) =>
@@ -1545,7 +2128,7 @@ export const make = (
1545
2128
  ),
1546
2129
  "messageBatchesPost": (options) =>
1547
2130
  HttpClientRequest.make("POST")(`/v1/messages/batches`).pipe(
1548
- HttpClientRequest.setHeaders({ "anthropic-version": options.params["anthropic-version"] ?? undefined }),
2131
+ HttpClientRequest.setHeaders({ "anthropic-version": options.params?.["anthropic-version"] ?? undefined }),
1549
2132
  (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options.payload)),
1550
2133
  Effect.flatMap((request) =>
1551
2134
  Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
@@ -1562,8 +2145,8 @@ export const make = (
1562
2145
  "messageBatchesRetrieve": (messageBatchId, options) =>
1563
2146
  HttpClientRequest.make("GET")(`/v1/messages/batches/${messageBatchId}`).pipe(
1564
2147
  HttpClientRequest.setHeaders({
1565
- "anthropic-version": options["anthropic-version"] ?? undefined,
1566
- "x-api-key": options["x-api-key"] ?? undefined
2148
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2149
+ "x-api-key": options?.["x-api-key"] ?? undefined
1567
2150
  }),
1568
2151
  Effect.succeed,
1569
2152
  Effect.flatMap((request) =>
@@ -1584,8 +2167,8 @@ export const make = (
1584
2167
  "messageBatchesDelete": (messageBatchId, options) =>
1585
2168
  HttpClientRequest.make("DELETE")(`/v1/messages/batches/${messageBatchId}`).pipe(
1586
2169
  HttpClientRequest.setHeaders({
1587
- "anthropic-version": options["anthropic-version"] ?? undefined,
1588
- "x-api-key": options["x-api-key"] ?? undefined
2170
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2171
+ "x-api-key": options?.["x-api-key"] ?? undefined
1589
2172
  }),
1590
2173
  Effect.succeed,
1591
2174
  Effect.flatMap((request) =>
@@ -1605,7 +2188,7 @@ export const make = (
1605
2188
  ),
1606
2189
  "messageBatchesCancel": (messageBatchId, options) =>
1607
2190
  HttpClientRequest.make("POST")(`/v1/messages/batches/${messageBatchId}/cancel`).pipe(
1608
- HttpClientRequest.setHeaders({ "anthropic-version": options["anthropic-version"] ?? undefined }),
2191
+ HttpClientRequest.setHeaders({ "anthropic-version": options?.["anthropic-version"] ?? undefined }),
1609
2192
  Effect.succeed,
1610
2193
  Effect.flatMap((request) =>
1611
2194
  Effect.flatMap(
@@ -1625,8 +2208,8 @@ export const make = (
1625
2208
  "messageBatchesResults": (messageBatchId, options) =>
1626
2209
  HttpClientRequest.make("GET")(`/v1/messages/batches/${messageBatchId}/results`).pipe(
1627
2210
  HttpClientRequest.setHeaders({
1628
- "anthropic-version": options["anthropic-version"] ?? undefined,
1629
- "x-api-key": options["x-api-key"] ?? undefined
2211
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2212
+ "x-api-key": options?.["x-api-key"] ?? undefined
1630
2213
  }),
1631
2214
  Effect.succeed,
1632
2215
  Effect.flatMap((request) =>
@@ -1645,7 +2228,7 @@ export const make = (
1645
2228
  ),
1646
2229
  "messagesCountTokensPost": (options) =>
1647
2230
  HttpClientRequest.make("POST")(`/v1/messages/count_tokens`).pipe(
1648
- HttpClientRequest.setHeaders({ "anthropic-version": options.params["anthropic-version"] ?? undefined }),
2231
+ HttpClientRequest.setHeaders({ "anthropic-version": options.params?.["anthropic-version"] ?? undefined }),
1649
2232
  (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options.payload)),
1650
2233
  Effect.flatMap((request) =>
1651
2234
  Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
@@ -1659,11 +2242,117 @@ export const make = (
1659
2242
  ))
1660
2243
  )
1661
2244
  ),
2245
+ "listFilesV1FilesGet": (options) =>
2246
+ HttpClientRequest.make("GET")(`/v1/files`).pipe(
2247
+ HttpClientRequest.setUrlParams({
2248
+ "before_id": options?.["before_id"] as UrlParams.Coercible,
2249
+ "after_id": options?.["after_id"] as UrlParams.Coercible,
2250
+ "limit": options?.["limit"] as UrlParams.Coercible
2251
+ }),
2252
+ HttpClientRequest.setHeaders({
2253
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2254
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2255
+ "x-api-key": options?.["x-api-key"] ?? undefined
2256
+ }),
2257
+ Effect.succeed,
2258
+ Effect.flatMap((request) =>
2259
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
2260
+ Effect.flatMap(
2261
+ httpClient.execute(request),
2262
+ HttpClientResponse.matchStatus({
2263
+ "200": (r) => HttpClientResponse.schemaBodyJson(FileListResponse)(r),
2264
+ "4xx": (r) => decodeError(r, ErrorResponse),
2265
+ orElse: (response) => unexpectedStatus(request, response)
2266
+ })
2267
+ ))
2268
+ )
2269
+ ),
2270
+ "uploadFileV1FilesPost": (options) =>
2271
+ HttpClientRequest.make("POST")(`/v1/files`).pipe(
2272
+ HttpClientRequest.setHeaders({
2273
+ "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
2274
+ "anthropic-version": options.params?.["anthropic-version"] ?? undefined
2275
+ }),
2276
+ HttpClientRequest.bodyFormData(options.payload),
2277
+ Effect.succeed,
2278
+ Effect.flatMap((request) =>
2279
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
2280
+ Effect.flatMap(
2281
+ httpClient.execute(request),
2282
+ HttpClientResponse.matchStatus({
2283
+ "200": (r) => HttpClientResponse.schemaBodyJson(FileMetadataSchema)(r),
2284
+ "4xx": (r) => decodeError(r, ErrorResponse),
2285
+ orElse: (response) => unexpectedStatus(request, response)
2286
+ })
2287
+ ))
2288
+ )
2289
+ ),
2290
+ "getFileMetadataV1FilesFileIdGet": (fileId, options) =>
2291
+ HttpClientRequest.make("GET")(`/v1/files/${fileId}`).pipe(
2292
+ HttpClientRequest.setHeaders({
2293
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2294
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2295
+ "x-api-key": options?.["x-api-key"] ?? undefined
2296
+ }),
2297
+ Effect.succeed,
2298
+ Effect.flatMap((request) =>
2299
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
2300
+ Effect.flatMap(
2301
+ httpClient.execute(request),
2302
+ HttpClientResponse.matchStatus({
2303
+ "200": (r) => HttpClientResponse.schemaBodyJson(FileMetadataSchema)(r),
2304
+ "4xx": (r) => decodeError(r, ErrorResponse),
2305
+ orElse: (response) => unexpectedStatus(request, response)
2306
+ })
2307
+ ))
2308
+ )
2309
+ ),
2310
+ "deleteFileV1FilesFileIdDelete": (fileId, options) =>
2311
+ HttpClientRequest.make("DELETE")(`/v1/files/${fileId}`).pipe(
2312
+ HttpClientRequest.setHeaders({
2313
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2314
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2315
+ "x-api-key": options?.["x-api-key"] ?? undefined
2316
+ }),
2317
+ Effect.succeed,
2318
+ Effect.flatMap((request) =>
2319
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
2320
+ Effect.flatMap(
2321
+ httpClient.execute(request),
2322
+ HttpClientResponse.matchStatus({
2323
+ "200": (r) => HttpClientResponse.schemaBodyJson(FileDeleteResponse)(r),
2324
+ "4xx": (r) => decodeError(r, ErrorResponse),
2325
+ orElse: (response) => unexpectedStatus(request, response)
2326
+ })
2327
+ ))
2328
+ )
2329
+ ),
2330
+ "downloadFileV1FilesFileIdContentGet": (fileId, options) =>
2331
+ HttpClientRequest.make("GET")(`/v1/files/${fileId}/content`).pipe(
2332
+ HttpClientRequest.setHeaders({
2333
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2334
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2335
+ "x-api-key": options?.["x-api-key"] ?? undefined
2336
+ }),
2337
+ Effect.succeed,
2338
+ Effect.flatMap((request) =>
2339
+ Effect.flatMap(
2340
+ applyClientTransform(httpClient),
2341
+ (httpClient) =>
2342
+ Effect.flatMap(
2343
+ httpClient.execute(request),
2344
+ HttpClientResponse.matchStatus({
2345
+ orElse: (response) => unexpectedStatus(request, response)
2346
+ })
2347
+ )
2348
+ )
2349
+ )
2350
+ ),
1662
2351
  "betaMessagesPost": (options) =>
1663
2352
  HttpClientRequest.make("POST")(`/v1/messages?beta=true`).pipe(
1664
2353
  HttpClientRequest.setHeaders({
1665
- "anthropic-beta": options.params["anthropic-beta"] ?? undefined,
1666
- "anthropic-version": options.params["anthropic-version"] ?? undefined
2354
+ "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
2355
+ "anthropic-version": options.params?.["anthropic-version"] ?? undefined
1667
2356
  }),
1668
2357
  (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options.payload)),
1669
2358
  Effect.flatMap((request) =>
@@ -1681,13 +2370,14 @@ export const make = (
1681
2370
  "betaModelsList": (options) =>
1682
2371
  HttpClientRequest.make("GET")(`/v1/models?beta=true`).pipe(
1683
2372
  HttpClientRequest.setUrlParams({
1684
- "before_id": options["before_id"] as UrlParams.Coercible,
1685
- "after_id": options["after_id"] as UrlParams.Coercible,
1686
- "limit": options["limit"] as UrlParams.Coercible
2373
+ "before_id": options?.["before_id"] as UrlParams.Coercible,
2374
+ "after_id": options?.["after_id"] as UrlParams.Coercible,
2375
+ "limit": options?.["limit"] as UrlParams.Coercible
1687
2376
  }),
1688
2377
  HttpClientRequest.setHeaders({
1689
- "anthropic-version": options["anthropic-version"] ?? undefined,
1690
- "x-api-key": options["x-api-key"] ?? undefined
2378
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2379
+ "x-api-key": options?.["x-api-key"] ?? undefined,
2380
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined
1691
2381
  }),
1692
2382
  Effect.succeed,
1693
2383
  Effect.flatMap((request) =>
@@ -1705,8 +2395,9 @@ export const make = (
1705
2395
  "betaModelsGet": (modelId, options) =>
1706
2396
  HttpClientRequest.make("GET")(`/v1/models/${modelId}?beta=true`).pipe(
1707
2397
  HttpClientRequest.setHeaders({
1708
- "anthropic-version": options["anthropic-version"] ?? undefined,
1709
- "x-api-key": options["x-api-key"] ?? undefined
2398
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2399
+ "x-api-key": options?.["x-api-key"] ?? undefined,
2400
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined
1710
2401
  }),
1711
2402
  Effect.succeed,
1712
2403
  Effect.flatMap((request) =>
@@ -1724,14 +2415,14 @@ export const make = (
1724
2415
  "betaMessageBatchesList": (options) =>
1725
2416
  HttpClientRequest.make("GET")(`/v1/messages/batches?beta=true`).pipe(
1726
2417
  HttpClientRequest.setUrlParams({
1727
- "before_id": options["before_id"] as UrlParams.Coercible,
1728
- "after_id": options["after_id"] as UrlParams.Coercible,
1729
- "limit": options["limit"] as UrlParams.Coercible
2418
+ "before_id": options?.["before_id"] as UrlParams.Coercible,
2419
+ "after_id": options?.["after_id"] as UrlParams.Coercible,
2420
+ "limit": options?.["limit"] as UrlParams.Coercible
1730
2421
  }),
1731
2422
  HttpClientRequest.setHeaders({
1732
- "anthropic-beta": options["anthropic-beta"] ?? undefined,
1733
- "anthropic-version": options["anthropic-version"] ?? undefined,
1734
- "x-api-key": options["x-api-key"] ?? undefined
2423
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2424
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2425
+ "x-api-key": options?.["x-api-key"] ?? undefined
1735
2426
  }),
1736
2427
  Effect.succeed,
1737
2428
  Effect.flatMap((request) =>
@@ -1749,8 +2440,8 @@ export const make = (
1749
2440
  "betaMessageBatchesPost": (options) =>
1750
2441
  HttpClientRequest.make("POST")(`/v1/messages/batches?beta=true`).pipe(
1751
2442
  HttpClientRequest.setHeaders({
1752
- "anthropic-beta": options.params["anthropic-beta"] ?? undefined,
1753
- "anthropic-version": options.params["anthropic-version"] ?? undefined
2443
+ "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
2444
+ "anthropic-version": options.params?.["anthropic-version"] ?? undefined
1754
2445
  }),
1755
2446
  (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options.payload)),
1756
2447
  Effect.flatMap((request) =>
@@ -1768,9 +2459,9 @@ export const make = (
1768
2459
  "betaMessageBatchesRetrieve": (messageBatchId, options) =>
1769
2460
  HttpClientRequest.make("GET")(`/v1/messages/batches/${messageBatchId}?beta=true`).pipe(
1770
2461
  HttpClientRequest.setHeaders({
1771
- "anthropic-beta": options["anthropic-beta"] ?? undefined,
1772
- "anthropic-version": options["anthropic-version"] ?? undefined,
1773
- "x-api-key": options["x-api-key"] ?? undefined
2462
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2463
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2464
+ "x-api-key": options?.["x-api-key"] ?? undefined
1774
2465
  }),
1775
2466
  Effect.succeed,
1776
2467
  Effect.flatMap((request) =>
@@ -1791,9 +2482,9 @@ export const make = (
1791
2482
  "betaMessageBatchesDelete": (messageBatchId, options) =>
1792
2483
  HttpClientRequest.make("DELETE")(`/v1/messages/batches/${messageBatchId}?beta=true`).pipe(
1793
2484
  HttpClientRequest.setHeaders({
1794
- "anthropic-beta": options["anthropic-beta"] ?? undefined,
1795
- "anthropic-version": options["anthropic-version"] ?? undefined,
1796
- "x-api-key": options["x-api-key"] ?? undefined
2485
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2486
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2487
+ "x-api-key": options?.["x-api-key"] ?? undefined
1797
2488
  }),
1798
2489
  Effect.succeed,
1799
2490
  Effect.flatMap((request) =>
@@ -1814,8 +2505,8 @@ export const make = (
1814
2505
  "betaMessageBatchesCancel": (messageBatchId, options) =>
1815
2506
  HttpClientRequest.make("POST")(`/v1/messages/batches/${messageBatchId}/cancel?beta=true`).pipe(
1816
2507
  HttpClientRequest.setHeaders({
1817
- "anthropic-beta": options["anthropic-beta"] ?? undefined,
1818
- "anthropic-version": options["anthropic-version"] ?? undefined
2508
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2509
+ "anthropic-version": options?.["anthropic-version"] ?? undefined
1819
2510
  }),
1820
2511
  Effect.succeed,
1821
2512
  Effect.flatMap((request) =>
@@ -1836,9 +2527,9 @@ export const make = (
1836
2527
  "betaMessageBatchesResults": (messageBatchId, options) =>
1837
2528
  HttpClientRequest.make("GET")(`/v1/messages/batches/${messageBatchId}/results?beta=true`).pipe(
1838
2529
  HttpClientRequest.setHeaders({
1839
- "anthropic-beta": options["anthropic-beta"] ?? undefined,
1840
- "anthropic-version": options["anthropic-version"] ?? undefined,
1841
- "x-api-key": options["x-api-key"] ?? undefined
2530
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2531
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2532
+ "x-api-key": options?.["x-api-key"] ?? undefined
1842
2533
  }),
1843
2534
  Effect.succeed,
1844
2535
  Effect.flatMap((request) =>
@@ -1858,8 +2549,8 @@ export const make = (
1858
2549
  "betaMessagesCountTokensPost": (options) =>
1859
2550
  HttpClientRequest.make("POST")(`/v1/messages/count_tokens?beta=true`).pipe(
1860
2551
  HttpClientRequest.setHeaders({
1861
- "anthropic-beta": options.params["anthropic-beta"] ?? undefined,
1862
- "anthropic-version": options.params["anthropic-version"] ?? undefined
2552
+ "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
2553
+ "anthropic-version": options.params?.["anthropic-version"] ?? undefined
1863
2554
  }),
1864
2555
  (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options.payload)),
1865
2556
  Effect.flatMap((request) =>
@@ -1876,76 +2567,225 @@ export const make = (
1876
2567
  )
1877
2568
  )
1878
2569
  )
2570
+ ),
2571
+ "betaListFilesV1FilesGet": (options) =>
2572
+ HttpClientRequest.make("GET")(`/v1/files?beta=true`).pipe(
2573
+ HttpClientRequest.setUrlParams({
2574
+ "before_id": options?.["before_id"] as UrlParams.Coercible,
2575
+ "after_id": options?.["after_id"] as UrlParams.Coercible,
2576
+ "limit": options?.["limit"] as UrlParams.Coercible
2577
+ }),
2578
+ HttpClientRequest.setHeaders({
2579
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2580
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2581
+ "x-api-key": options?.["x-api-key"] ?? undefined
2582
+ }),
2583
+ Effect.succeed,
2584
+ Effect.flatMap((request) =>
2585
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
2586
+ Effect.flatMap(
2587
+ httpClient.execute(request),
2588
+ HttpClientResponse.matchStatus({
2589
+ "200": (r) => HttpClientResponse.schemaBodyJson(BetaFileListResponse)(r),
2590
+ "4xx": (r) => decodeError(r, BetaErrorResponse),
2591
+ orElse: (response) => unexpectedStatus(request, response)
2592
+ })
2593
+ ))
2594
+ )
2595
+ ),
2596
+ "betaUploadFileV1FilesPost": (options) =>
2597
+ HttpClientRequest.make("POST")(`/v1/files?beta=true`).pipe(
2598
+ HttpClientRequest.setHeaders({
2599
+ "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
2600
+ "anthropic-version": options.params?.["anthropic-version"] ?? undefined
2601
+ }),
2602
+ HttpClientRequest.bodyFormData(options.payload),
2603
+ Effect.succeed,
2604
+ Effect.flatMap((request) =>
2605
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
2606
+ Effect.flatMap(
2607
+ httpClient.execute(request),
2608
+ HttpClientResponse.matchStatus({
2609
+ "200": (r) => HttpClientResponse.schemaBodyJson(BetaFileMetadataSchema)(r),
2610
+ "4xx": (r) => decodeError(r, BetaErrorResponse),
2611
+ orElse: (response) => unexpectedStatus(request, response)
2612
+ })
2613
+ ))
2614
+ )
2615
+ ),
2616
+ "betaGetFileMetadataV1FilesFileIdGet": (fileId, options) =>
2617
+ HttpClientRequest.make("GET")(`/v1/files/${fileId}?beta=true`).pipe(
2618
+ HttpClientRequest.setHeaders({
2619
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2620
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2621
+ "x-api-key": options?.["x-api-key"] ?? undefined
2622
+ }),
2623
+ Effect.succeed,
2624
+ Effect.flatMap((request) =>
2625
+ Effect.flatMap(
2626
+ applyClientTransform(httpClient),
2627
+ (httpClient) =>
2628
+ Effect.flatMap(
2629
+ httpClient.execute(request),
2630
+ HttpClientResponse.matchStatus({
2631
+ "200": (r) => HttpClientResponse.schemaBodyJson(BetaFileMetadataSchema)(r),
2632
+ "4xx": (r) => decodeError(r, BetaErrorResponse),
2633
+ orElse: (response) => unexpectedStatus(request, response)
2634
+ })
2635
+ )
2636
+ )
2637
+ )
2638
+ ),
2639
+ "betaDeleteFileV1FilesFileIdDelete": (fileId, options) =>
2640
+ HttpClientRequest.make("DELETE")(`/v1/files/${fileId}?beta=true`).pipe(
2641
+ HttpClientRequest.setHeaders({
2642
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2643
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2644
+ "x-api-key": options?.["x-api-key"] ?? undefined
2645
+ }),
2646
+ Effect.succeed,
2647
+ Effect.flatMap((request) =>
2648
+ Effect.flatMap(
2649
+ applyClientTransform(httpClient),
2650
+ (httpClient) =>
2651
+ Effect.flatMap(
2652
+ httpClient.execute(request),
2653
+ HttpClientResponse.matchStatus({
2654
+ "200": (r) => HttpClientResponse.schemaBodyJson(BetaFileDeleteResponse)(r),
2655
+ "4xx": (r) => decodeError(r, BetaErrorResponse),
2656
+ orElse: (response) => unexpectedStatus(request, response)
2657
+ })
2658
+ )
2659
+ )
2660
+ )
2661
+ ),
2662
+ "betaDownloadFileV1FilesFileIdContentGet": (fileId, options) =>
2663
+ HttpClientRequest.make("GET")(`/v1/files/${fileId}/content?beta=true`).pipe(
2664
+ HttpClientRequest.setHeaders({
2665
+ "anthropic-beta": options?.["anthropic-beta"] ?? undefined,
2666
+ "anthropic-version": options?.["anthropic-version"] ?? undefined,
2667
+ "x-api-key": options?.["x-api-key"] ?? undefined
2668
+ }),
2669
+ Effect.succeed,
2670
+ Effect.flatMap((request) =>
2671
+ Effect.flatMap(
2672
+ applyClientTransform(httpClient),
2673
+ (httpClient) =>
2674
+ Effect.flatMap(
2675
+ httpClient.execute(request),
2676
+ HttpClientResponse.matchStatus({
2677
+ orElse: (response) => unexpectedStatus(request, response)
2678
+ })
2679
+ )
2680
+ )
2681
+ )
1879
2682
  )
1880
2683
  }
1881
2684
  }
1882
2685
 
1883
2686
  export interface Client {
2687
+ readonly httpClient: HttpClient.HttpClient
1884
2688
  readonly "messagesPost": (
1885
2689
  options: {
1886
- readonly params: typeof MessagesPostParams.Encoded
2690
+ readonly params?: typeof MessagesPostParams.Encoded | undefined
1887
2691
  readonly payload: typeof CreateMessageParams.Encoded
1888
2692
  }
1889
2693
  ) => Effect.Effect<typeof Message.Type, HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type>
1890
2694
  readonly "completePost": (
1891
- options: { readonly params: typeof CompletePostParams.Encoded; readonly payload: typeof CompletionRequest.Encoded }
2695
+ options: {
2696
+ readonly params?: typeof CompletePostParams.Encoded | undefined
2697
+ readonly payload: typeof CompletionRequest.Encoded
2698
+ }
1892
2699
  ) => Effect.Effect<
1893
2700
  typeof CompletionResponse.Type,
1894
2701
  HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type
1895
2702
  >
1896
2703
  readonly "modelsList": (
1897
- options: typeof ModelsListParams.Encoded
2704
+ options?: typeof ModelsListParams.Encoded | undefined
1898
2705
  ) => Effect.Effect<
1899
2706
  typeof ListResponseModelInfo.Type,
1900
2707
  HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type
1901
2708
  >
1902
2709
  readonly "modelsGet": (
1903
2710
  modelId: string,
1904
- options: typeof ModelsGetParams.Encoded
2711
+ options?: typeof ModelsGetParams.Encoded | undefined
1905
2712
  ) => Effect.Effect<typeof ModelInfo.Type, HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type>
1906
2713
  readonly "messageBatchesList": (
1907
- options: typeof MessageBatchesListParams.Encoded
2714
+ options?: typeof MessageBatchesListParams.Encoded | undefined
1908
2715
  ) => Effect.Effect<
1909
2716
  typeof ListResponseMessageBatch.Type,
1910
2717
  HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type
1911
2718
  >
1912
2719
  readonly "messageBatchesPost": (
1913
2720
  options: {
1914
- readonly params: typeof MessageBatchesPostParams.Encoded
2721
+ readonly params?: typeof MessageBatchesPostParams.Encoded | undefined
1915
2722
  readonly payload: typeof CreateMessageBatchParams.Encoded
1916
2723
  }
1917
2724
  ) => Effect.Effect<typeof MessageBatch.Type, HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type>
1918
2725
  readonly "messageBatchesRetrieve": (
1919
2726
  messageBatchId: string,
1920
- options: typeof MessageBatchesRetrieveParams.Encoded
2727
+ options?: typeof MessageBatchesRetrieveParams.Encoded | undefined
1921
2728
  ) => Effect.Effect<typeof MessageBatch.Type, HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type>
1922
2729
  readonly "messageBatchesDelete": (
1923
2730
  messageBatchId: string,
1924
- options: typeof MessageBatchesDeleteParams.Encoded
2731
+ options?: typeof MessageBatchesDeleteParams.Encoded | undefined
1925
2732
  ) => Effect.Effect<
1926
2733
  typeof DeleteMessageBatchResponse.Type,
1927
2734
  HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type
1928
2735
  >
1929
2736
  readonly "messageBatchesCancel": (
1930
2737
  messageBatchId: string,
1931
- options: typeof MessageBatchesCancelParams.Encoded
2738
+ options?: typeof MessageBatchesCancelParams.Encoded | undefined
1932
2739
  ) => Effect.Effect<typeof MessageBatch.Type, HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type>
1933
2740
  readonly "messageBatchesResults": (
1934
2741
  messageBatchId: string,
1935
- options: typeof MessageBatchesResultsParams.Encoded
2742
+ options?: typeof MessageBatchesResultsParams.Encoded | undefined
1936
2743
  ) => Effect.Effect<void, HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type>
1937
2744
  readonly "messagesCountTokensPost": (
1938
2745
  options: {
1939
- readonly params: typeof MessagesCountTokensPostParams.Encoded
2746
+ readonly params?: typeof MessagesCountTokensPostParams.Encoded | undefined
1940
2747
  readonly payload: typeof CountMessageTokensParams.Encoded
1941
2748
  }
1942
2749
  ) => Effect.Effect<
1943
2750
  typeof CountMessageTokensResponse.Type,
1944
2751
  HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type
1945
2752
  >
2753
+ readonly "listFilesV1FilesGet": (
2754
+ options?: typeof ListFilesV1FilesGetParams.Encoded | undefined
2755
+ ) => Effect.Effect<
2756
+ typeof FileListResponse.Type,
2757
+ HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type
2758
+ >
2759
+ readonly "uploadFileV1FilesPost": (
2760
+ options: {
2761
+ readonly params?: typeof UploadFileV1FilesPostParams.Encoded | undefined
2762
+ readonly payload: globalThis.FormData
2763
+ }
2764
+ ) => Effect.Effect<
2765
+ typeof FileMetadataSchema.Type,
2766
+ HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type
2767
+ >
2768
+ readonly "getFileMetadataV1FilesFileIdGet": (
2769
+ fileId: string,
2770
+ options?: typeof GetFileMetadataV1FilesFileIdGetParams.Encoded | undefined
2771
+ ) => Effect.Effect<
2772
+ typeof FileMetadataSchema.Type,
2773
+ HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type
2774
+ >
2775
+ readonly "deleteFileV1FilesFileIdDelete": (
2776
+ fileId: string,
2777
+ options?: typeof DeleteFileV1FilesFileIdDeleteParams.Encoded | undefined
2778
+ ) => Effect.Effect<
2779
+ typeof FileDeleteResponse.Type,
2780
+ HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type
2781
+ >
2782
+ readonly "downloadFileV1FilesFileIdContentGet": (
2783
+ fileId: string,
2784
+ options?: typeof DownloadFileV1FilesFileIdContentGetParams.Encoded | undefined
2785
+ ) => Effect.Effect<void, HttpClientError.HttpClientError | ParseError>
1946
2786
  readonly "betaMessagesPost": (
1947
2787
  options: {
1948
- readonly params: typeof BetaMessagesPostParams.Encoded
2788
+ readonly params?: typeof BetaMessagesPostParams.Encoded | undefined
1949
2789
  readonly payload: typeof BetaCreateMessageParams.Encoded
1950
2790
  }
1951
2791
  ) => Effect.Effect<
@@ -1953,27 +2793,27 @@ export interface Client {
1953
2793
  HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type
1954
2794
  >
1955
2795
  readonly "betaModelsList": (
1956
- options: typeof BetaModelsListParams.Encoded
2796
+ options?: typeof BetaModelsListParams.Encoded | undefined
1957
2797
  ) => Effect.Effect<
1958
2798
  typeof BetaListResponseModelInfo.Type,
1959
2799
  HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type
1960
2800
  >
1961
2801
  readonly "betaModelsGet": (
1962
2802
  modelId: string,
1963
- options: typeof BetaModelsGetParams.Encoded
2803
+ options?: typeof BetaModelsGetParams.Encoded | undefined
1964
2804
  ) => Effect.Effect<
1965
2805
  typeof BetaModelInfo.Type,
1966
2806
  HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type
1967
2807
  >
1968
2808
  readonly "betaMessageBatchesList": (
1969
- options: typeof BetaMessageBatchesListParams.Encoded
2809
+ options?: typeof BetaMessageBatchesListParams.Encoded | undefined
1970
2810
  ) => Effect.Effect<
1971
2811
  typeof BetaListResponseMessageBatch.Type,
1972
2812
  HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type
1973
2813
  >
1974
2814
  readonly "betaMessageBatchesPost": (
1975
2815
  options: {
1976
- readonly params: typeof BetaMessageBatchesPostParams.Encoded
2816
+ readonly params?: typeof BetaMessageBatchesPostParams.Encoded | undefined
1977
2817
  readonly payload: typeof BetaCreateMessageBatchParams.Encoded
1978
2818
  }
1979
2819
  ) => Effect.Effect<
@@ -1982,36 +2822,69 @@ export interface Client {
1982
2822
  >
1983
2823
  readonly "betaMessageBatchesRetrieve": (
1984
2824
  messageBatchId: string,
1985
- options: typeof BetaMessageBatchesRetrieveParams.Encoded
2825
+ options?: typeof BetaMessageBatchesRetrieveParams.Encoded | undefined
1986
2826
  ) => Effect.Effect<
1987
2827
  typeof BetaMessageBatch.Type,
1988
2828
  HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type
1989
2829
  >
1990
2830
  readonly "betaMessageBatchesDelete": (
1991
2831
  messageBatchId: string,
1992
- options: typeof BetaMessageBatchesDeleteParams.Encoded
2832
+ options?: typeof BetaMessageBatchesDeleteParams.Encoded | undefined
1993
2833
  ) => Effect.Effect<
1994
2834
  typeof BetaDeleteMessageBatchResponse.Type,
1995
2835
  HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type
1996
2836
  >
1997
2837
  readonly "betaMessageBatchesCancel": (
1998
2838
  messageBatchId: string,
1999
- options: typeof BetaMessageBatchesCancelParams.Encoded
2839
+ options?: typeof BetaMessageBatchesCancelParams.Encoded | undefined
2000
2840
  ) => Effect.Effect<
2001
2841
  typeof BetaMessageBatch.Type,
2002
2842
  HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type
2003
2843
  >
2004
2844
  readonly "betaMessageBatchesResults": (
2005
2845
  messageBatchId: string,
2006
- options: typeof BetaMessageBatchesResultsParams.Encoded
2846
+ options?: typeof BetaMessageBatchesResultsParams.Encoded | undefined
2007
2847
  ) => Effect.Effect<void, HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type>
2008
2848
  readonly "betaMessagesCountTokensPost": (
2009
2849
  options: {
2010
- readonly params: typeof BetaMessagesCountTokensPostParams.Encoded
2850
+ readonly params?: typeof BetaMessagesCountTokensPostParams.Encoded | undefined
2011
2851
  readonly payload: typeof BetaCountMessageTokensParams.Encoded
2012
2852
  }
2013
2853
  ) => Effect.Effect<
2014
2854
  typeof BetaCountMessageTokensResponse.Type,
2015
2855
  HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type
2016
2856
  >
2857
+ readonly "betaListFilesV1FilesGet": (
2858
+ options?: typeof BetaListFilesV1FilesGetParams.Encoded | undefined
2859
+ ) => Effect.Effect<
2860
+ typeof BetaFileListResponse.Type,
2861
+ HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type
2862
+ >
2863
+ readonly "betaUploadFileV1FilesPost": (
2864
+ options: {
2865
+ readonly params?: typeof BetaUploadFileV1FilesPostParams.Encoded | undefined
2866
+ readonly payload: globalThis.FormData
2867
+ }
2868
+ ) => Effect.Effect<
2869
+ typeof BetaFileMetadataSchema.Type,
2870
+ HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type
2871
+ >
2872
+ readonly "betaGetFileMetadataV1FilesFileIdGet": (
2873
+ fileId: string,
2874
+ options?: typeof BetaGetFileMetadataV1FilesFileIdGetParams.Encoded | undefined
2875
+ ) => Effect.Effect<
2876
+ typeof BetaFileMetadataSchema.Type,
2877
+ HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type
2878
+ >
2879
+ readonly "betaDeleteFileV1FilesFileIdDelete": (
2880
+ fileId: string,
2881
+ options?: typeof BetaDeleteFileV1FilesFileIdDeleteParams.Encoded | undefined
2882
+ ) => Effect.Effect<
2883
+ typeof BetaFileDeleteResponse.Type,
2884
+ HttpClientError.HttpClientError | ParseError | typeof BetaErrorResponse.Type
2885
+ >
2886
+ readonly "betaDownloadFileV1FilesFileIdContentGet": (
2887
+ fileId: string,
2888
+ options?: typeof BetaDownloadFileV1FilesFileIdContentGetParams.Encoded | undefined
2889
+ ) => Effect.Effect<void, HttpClientError.HttpClientError | ParseError>
2017
2890
  }