1/**
2 * @stability unstable
3 * @since 4.0.0
4 */
5
6import * as Data from "effect/Data"
7import * as Effect from "effect/Effect"
8import * as HttpClient from "effect/http/HttpClient"
9import * as HttpClientError from "effect/http/HttpClientError"
10import * as HttpClientRequest from "effect/http/HttpClientRequest"
11import * as HttpClientResponse from "effect/http/HttpClientResponse"
12import type { SchemaError } from "effect/Schema"
13import * as Schema from "effect/Schema"
14import * as Stream from "effect/Stream"
15// non-recursive definitions
16export type APIError = { readonly "message": string; readonly "type": "api_error" }
17export const APIError = Schema.Struct({
18 "message": Schema.String.annotate({ "title": "Message", "default": "Internal server error" }),
19 "type": Schema.Literal("api_error").annotate({ "title": "Type", "default": "api_error" })
20}).annotate({ "title": "APIError" })
21export type AuthenticationError = { readonly "message": string; readonly "type": "authentication_error" }
22export const AuthenticationError = Schema.Struct({
23 "message": Schema.String.annotate({ "title": "Message", "default": "Authentication error" }),
24 "type": Schema.Literal("authentication_error").annotate({ "title": "Type", "default": "authentication_error" })
25}).annotate({ "title": "AuthenticationError" })
26export type Base64ImageSource = {
27 readonly "data": string
28 readonly "media_type": "image/jpeg" | "image/png" | "image/gif" | "image/webp"
29 readonly "type": "base64"
30}
31export const Base64ImageSource = Schema.Struct({
32 "data": Schema.String.annotate({ "title": "Data", "format": "byte" }),
33 "media_type": Schema.Literals(["image/jpeg", "image/png", "image/gif", "image/webp"]).annotate({
34 "title": "Media Type"
35 }),
36 "type": Schema.Literal("base64").annotate({ "title": "Type" })
37}).annotate({ "title": "Base64ImageSource" })
38export type Base64PDFSource = {
39 readonly "data": string
40 readonly "media_type": "application/pdf"
41 readonly "type": "base64"
42}
43export const Base64PDFSource = Schema.Struct({
44 "data": Schema.String.annotate({ "title": "Data", "format": "byte" }),
45 "media_type": Schema.Literal("application/pdf").annotate({ "title": "Media Type" }),
46 "type": Schema.Literal("base64").annotate({ "title": "Type" })
47}).annotate({ "title": "Base64PDFSource" })
48export type BashCodeExecutionToolResultErrorCode =
49 | "invalid_tool_input"
50 | "unavailable"
51 | "too_many_requests"
52 | "execution_time_exceeded"
53 | "output_file_too_large"
54export const BashCodeExecutionToolResultErrorCode = Schema.Literals([
55 "invalid_tool_input",
56 "unavailable",
57 "too_many_requests",
58 "execution_time_exceeded",
59 "output_file_too_large"
60]).annotate({ "title": "BashCodeExecutionToolResultErrorCode" })
61export type BetaAPIError = { readonly "message": string; readonly "type": "api_error" }
62export const BetaAPIError = Schema.Struct({
63 "message": Schema.String.annotate({ "title": "Message", "default": "Internal server error" }),
64 "type": Schema.Literal("api_error").annotate({ "title": "Type", "default": "api_error" })
65}).annotate({ "title": "APIError" })
66export type BetaAllThinkingTurns = { readonly "type": "all" }
67export const BetaAllThinkingTurns = Schema.Struct({ "type": Schema.Literal("all").annotate({ "title": "Type" }) })
68 .annotate({ "title": "AllThinkingTurns" })
69export type BetaAuthenticationError = { readonly "message": string; readonly "type": "authentication_error" }
70export const BetaAuthenticationError = Schema.Struct({
71 "message": Schema.String.annotate({ "title": "Message", "default": "Authentication error" }),
72 "type": Schema.Literal("authentication_error").annotate({ "title": "Type", "default": "authentication_error" })
73}).annotate({ "title": "AuthenticationError" })
74export type BetaBase64ImageSource = {
75 readonly "data": string
76 readonly "media_type": "image/jpeg" | "image/png" | "image/gif" | "image/webp"
77 readonly "type": "base64"
78}
79export const BetaBase64ImageSource = Schema.Struct({
80 "data": Schema.String.annotate({ "title": "Data", "format": "byte" }),
81 "media_type": Schema.Literals(["image/jpeg", "image/png", "image/gif", "image/webp"]).annotate({
82 "title": "Media Type"
83 }),
84 "type": Schema.Literal("base64").annotate({ "title": "Type" })
85}).annotate({ "title": "Base64ImageSource" })
86export type BetaBase64PDFSource = {
87 readonly "data": string
88 readonly "media_type": "application/pdf"
89 readonly "type": "base64"
90}
91export const BetaBase64PDFSource = Schema.Struct({
92 "data": Schema.String.annotate({ "title": "Data", "format": "byte" }),
93 "media_type": Schema.Literal("application/pdf").annotate({ "title": "Media Type" }),
94 "type": Schema.Literal("base64").annotate({ "title": "Type" })
95}).annotate({ "title": "Base64PDFSource" })
96export type BetaBashCodeExecutionToolResultErrorCode =
97 | "invalid_tool_input"
98 | "unavailable"
99 | "too_many_requests"
100 | "execution_time_exceeded"
101 | "output_file_too_large"
102export const BetaBashCodeExecutionToolResultErrorCode = Schema.Literals([
103 "invalid_tool_input",
104 "unavailable",
105 "too_many_requests",
106 "execution_time_exceeded",
107 "output_file_too_large"
108]).annotate({ "title": "BashCodeExecutionToolResultErrorCode" })
109export type BetaBillingError = { readonly "message": string; readonly "type": "billing_error" }
110export const BetaBillingError = Schema.Struct({
111 "message": Schema.String.annotate({ "title": "Message", "default": "Billing error" }),
112 "type": Schema.Literal("billing_error").annotate({ "title": "Type", "default": "billing_error" })
113}).annotate({ "title": "BillingError" })
114export type BetaBody_create_skill_v1_skills_post = {
115 readonly "display_title"?: string | null
116 readonly "files"?: ReadonlyArray<string> | null
117}
118export const BetaBody_create_skill_v1_skills_post = Schema.Struct({
119 "display_title": Schema.optionalKey(
120 Schema.Union([Schema.String, Schema.Null]).annotate({
121 "title": "Display Title",
122 "description":
123 "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model."
124 })
125 ),
126 "files": Schema.optionalKey(
127 Schema.Union([Schema.Array(Schema.String.annotate({ "format": "binary" })), Schema.Null]).annotate({
128 "title": "Files",
129 "description":
130 "Files to upload for the skill.\n\nAll files must be in the same top-level directory and must include a SKILL.md file at the root of that directory."
131 })
132 )
133}).annotate({ "title": "Body_create_skill_v1_skills_post" })
134export type BetaBody_create_skill_version_v1_skills__skill_id__versions_post = {
135 readonly "files"?: ReadonlyArray<string> | null
136}
137export const BetaBody_create_skill_version_v1_skills__skill_id__versions_post = Schema.Struct({
138 "files": Schema.optionalKey(
139 Schema.Union([Schema.Array(Schema.String.annotate({ "format": "binary" })), Schema.Null]).annotate({
140 "title": "Files",
141 "description":
142 "Files to upload for the skill.\n\nAll files must be in the same top-level directory and must include a SKILL.md file at the root of that directory."
143 })
144 )
145}).annotate({ "title": "Body_create_skill_version_v1_skills__skill_id__versions_post" })
146export type BetaCacheControlEphemeral = { readonly "ttl"?: "5m" | "1h"; readonly "type": "ephemeral" }
147export const BetaCacheControlEphemeral = Schema.Struct({
148 "ttl": Schema.optionalKey(
149 Schema.Literals(["5m", "1h"]).annotate({
150 "title": "Ttl",
151 "description":
152 "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`."
153 })
154 ),
155 "type": Schema.Literal("ephemeral").annotate({ "title": "Type" })
156}).annotate({ "title": "CacheControlEphemeral" })
157export type BetaCacheCreation = {
158 readonly "ephemeral_1h_input_tokens": number
159 readonly "ephemeral_5m_input_tokens": number
160}
161export const BetaCacheCreation = Schema.Struct({
162 "ephemeral_1h_input_tokens": Schema.Number.annotate({
163 "title": "Ephemeral 1H Input Tokens",
164 "description": "The number of input tokens used to create the 1 hour cache entry.",
165 "default": 0
166 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
167 "ephemeral_5m_input_tokens": Schema.Number.annotate({
168 "title": "Ephemeral 5M Input Tokens",
169 "description": "The number of input tokens used to create the 5 minute cache entry.",
170 "default": 0
171 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
172}).annotate({ "title": "CacheCreation" })
173export type BetaCanceledResult = { readonly "type": "canceled" }
174export const BetaCanceledResult = Schema.Struct({
175 "type": Schema.Literal("canceled").annotate({ "title": "Type", "default": "canceled" })
176}).annotate({ "title": "CanceledResult" })
177export type BetaCodeExecutionToolResultErrorCode =
178 | "invalid_tool_input"
179 | "unavailable"
180 | "too_many_requests"
181 | "execution_time_exceeded"
182export const BetaCodeExecutionToolResultErrorCode = Schema.Literals([
183 "invalid_tool_input",
184 "unavailable",
185 "too_many_requests",
186 "execution_time_exceeded"
187]).annotate({ "title": "CodeExecutionToolResultErrorCode" })
188export type BetaCompactionContentBlockDelta = { readonly "content": string | null; readonly "type": "compaction_delta" }
189export const BetaCompactionContentBlockDelta = Schema.Struct({
190 "content": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Content" }),
191 "type": Schema.Literal("compaction_delta").annotate({ "title": "Type", "default": "compaction_delta" })
192}).annotate({ "title": "CompactionContentBlockDelta" })
193export type BetaContentBlockStopEvent = { readonly "index": number; readonly "type": "content_block_stop" }
194export const BetaContentBlockStopEvent = Schema.Struct({
195 "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()),
196 "type": Schema.Literal("content_block_stop").annotate({ "title": "Type", "default": "content_block_stop" })
197}).annotate({ "title": "ContentBlockStopEvent" })
198export type BetaContextManagementResponse = { readonly "original_input_tokens": number }
199export const BetaContextManagementResponse = Schema.Struct({
200 "original_input_tokens": Schema.Number.annotate({
201 "title": "Original Input Tokens",
202 "description": "The original token count before context management was applied"
203 }).check(Schema.isInt())
204}).annotate({ "title": "ContextManagementResponse" })
205export type BetaCreateSkillResponse = {
206 readonly "created_at": string
207 readonly "display_title": string | null
208 readonly "id": string
209 readonly "latest_version": string | null
210 readonly "source": string
211 readonly "type": string
212 readonly "updated_at": string
213}
214export const BetaCreateSkillResponse = Schema.Struct({
215 "created_at": Schema.String.annotate({
216 "title": "Created At",
217 "description": "ISO 8601 timestamp of when the skill was created."
218 }),
219 "display_title": Schema.Union([Schema.String, Schema.Null]).annotate({
220 "title": "Display Title",
221 "description":
222 "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model."
223 }),
224 "id": Schema.String.annotate({
225 "title": "Id",
226 "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time."
227 }),
228 "latest_version": Schema.Union([Schema.String, Schema.Null]).annotate({
229 "title": "Latest Version",
230 "description":
231 "The latest version identifier for the skill.\n\nThis represents the most recent version of the skill that has been created."
232 }),
233 "source": Schema.String.annotate({
234 "title": "Source",
235 "description":
236 "Source of the skill.\n\nThis may be one of the following values:\n* `\"custom\"`: the skill was created by a user\n* `\"anthropic\"`: the skill was created by Anthropic"
237 }),
238 "type": Schema.String.annotate({
239 "title": "Type",
240 "description": "Object type.\n\nFor Skills, this is always `\"skill\"`.",
241 "default": "skill"
242 }),
243 "updated_at": Schema.String.annotate({
244 "title": "Updated At",
245 "description": "ISO 8601 timestamp of when the skill was last updated."
246 })
247}).annotate({ "title": "CreateSkillResponse" })
248export type BetaCreateSkillVersionResponse = {
249 readonly "created_at": string
250 readonly "description": string
251 readonly "directory": string
252 readonly "id": string
253 readonly "name": string
254 readonly "skill_id": string
255 readonly "type": string
256 readonly "version": string
257}
258export const BetaCreateSkillVersionResponse = Schema.Struct({
259 "created_at": Schema.String.annotate({
260 "title": "Created At",
261 "description": "ISO 8601 timestamp of when the skill version was created."
262 }),
263 "description": Schema.String.annotate({
264 "title": "Description",
265 "description": "Description of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload."
266 }),
267 "directory": Schema.String.annotate({
268 "title": "Directory",
269 "description":
270 "Directory name of the skill version.\n\nThis is the top-level directory name that was extracted from the uploaded files."
271 }),
272 "id": Schema.String.annotate({
273 "title": "Id",
274 "description": "Unique identifier for the skill version.\n\nThe format and length of IDs may change over time."
275 }),
276 "name": Schema.String.annotate({
277 "title": "Name",
278 "description":
279 "Human-readable name of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload."
280 }),
281 "skill_id": Schema.String.annotate({
282 "title": "Skill Id",
283 "description": "Identifier for the skill that this version belongs to."
284 }),
285 "type": Schema.String.annotate({
286 "title": "Type",
287 "description": "Object type.\n\nFor Skill Versions, this is always `\"skill_version\"`.",
288 "default": "skill_version"
289 }),
290 "version": Schema.String.annotate({
291 "title": "Version",
292 "description":
293 "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")."
294 })
295}).annotate({ "title": "CreateSkillVersionResponse" })
296export type BetaDeleteMessageBatchResponse = { readonly "id": string; readonly "type": "message_batch_deleted" }
297export const BetaDeleteMessageBatchResponse = Schema.Struct({
298 "id": Schema.String.annotate({ "title": "Id", "description": "ID of the Message Batch." }),
299 "type": Schema.Literal("message_batch_deleted").annotate({
300 "title": "Type",
301 "description": "Deleted object type.\n\nFor Message Batches, this is always `\"message_batch_deleted\"`.",
302 "default": "message_batch_deleted"
303 })
304}).annotate({ "title": "DeleteMessageBatchResponse" })
305export type BetaDeleteSkillResponse = { readonly "id": string; readonly "type": string }
306export const BetaDeleteSkillResponse = Schema.Struct({
307 "id": Schema.String.annotate({
308 "title": "Id",
309 "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time."
310 }),
311 "type": Schema.String.annotate({
312 "title": "Type",
313 "description": "Deleted object type.\n\nFor Skills, this is always `\"skill_deleted\"`.",
314 "default": "skill_deleted"
315 })
316}).annotate({ "title": "DeleteSkillResponse" })
317export type BetaDeleteSkillVersionResponse = { readonly "id": string; readonly "type": string }
318export const BetaDeleteSkillVersionResponse = Schema.Struct({
319 "id": Schema.String.annotate({
320 "title": "Id",
321 "description":
322 "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")."
323 }),
324 "type": Schema.String.annotate({
325 "title": "Type",
326 "description": "Deleted object type.\n\nFor Skill Versions, this is always `\"skill_version_deleted\"`.",
327 "default": "skill_version_deleted"
328 })
329}).annotate({ "title": "DeleteSkillVersionResponse" })
330export type BetaDirectCaller = { readonly "type": "direct" }
331export const BetaDirectCaller = Schema.Struct({ "type": Schema.Literal("direct").annotate({ "title": "Type" }) })
332 .annotate({ "title": "DirectCaller", "description": "Tool invocation directly from the model." })
333export type BetaEffortLevel = "low" | "medium" | "high" | "max"
334export const BetaEffortLevel = Schema.Literals(["low", "medium", "high", "max"]).annotate({
335 "title": "EffortLevel",
336 "description": "All possible effort levels."
337})
338export type BetaExpiredResult = { readonly "type": "expired" }
339export const BetaExpiredResult = Schema.Struct({
340 "type": Schema.Literal("expired").annotate({ "title": "Type", "default": "expired" })
341}).annotate({ "title": "ExpiredResult" })
342export type BetaFileDeleteResponse = { readonly "id": string; readonly "type"?: "file_deleted" }
343export const BetaFileDeleteResponse = Schema.Struct({
344 "id": Schema.String.annotate({ "title": "Id", "description": "ID of the deleted file." }),
345 "type": Schema.optionalKey(
346 Schema.Literal("file_deleted").annotate({
347 "title": "Type",
348 "description": "Deleted object type.\n\nFor file deletion, this is always `\"file_deleted\"`.",
349 "default": "file_deleted"
350 })
351 )
352}).annotate({ "title": "FileDeleteResponse" })
353export type BetaFileDocumentSource = { readonly "file_id": string; readonly "type": "file" }
354export const BetaFileDocumentSource = Schema.Struct({
355 "file_id": Schema.String.annotate({ "title": "File Id" }),
356 "type": Schema.Literal("file").annotate({ "title": "Type" })
357}).annotate({ "title": "FileDocumentSource" })
358export type BetaFileImageSource = { readonly "file_id": string; readonly "type": "file" }
359export const BetaFileImageSource = Schema.Struct({
360 "file_id": Schema.String.annotate({ "title": "File Id" }),
361 "type": Schema.Literal("file").annotate({ "title": "Type" })
362}).annotate({ "title": "FileImageSource" })
363export type BetaFileMetadataSchema = {
364 readonly "created_at": string
365 readonly "downloadable"?: boolean
366 readonly "filename": string
367 readonly "id": string
368 readonly "mime_type": string
369 readonly "size_bytes": number
370 readonly "type": "file"
371}
372export const BetaFileMetadataSchema = Schema.Struct({
373 "created_at": Schema.String.annotate({
374 "title": "Created At",
375 "description": "RFC 3339 datetime string representing when the file was created.",
376 "format": "date-time"
377 }),
378 "downloadable": Schema.optionalKey(
379 Schema.Boolean.annotate({
380 "title": "Downloadable",
381 "description": "Whether the file can be downloaded.",
382 "default": false
383 })
384 ),
385 "filename": Schema.String.annotate({ "title": "Filename", "description": "Original filename of the uploaded file." })
386 .check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)),
387 "id": Schema.String.annotate({
388 "title": "Id",
389 "description": "Unique object identifier.\n\nThe format and length of IDs may change over time."
390 }),
391 "mime_type": Schema.String.annotate({ "title": "Mime Type", "description": "MIME type of the file." }).check(
392 Schema.isMinLength(1)
393 ).check(Schema.isMaxLength(255)),
394 "size_bytes": Schema.Number.annotate({ "title": "Size Bytes", "description": "Size of the file in bytes." }).check(
395 Schema.isInt()
396 ).check(Schema.isGreaterThanOrEqualTo(0)),
397 "type": Schema.Literal("file").annotate({
398 "title": "Type",
399 "description": "Object type.\n\nFor files, this is always `\"file\"`."
400 })
401}).annotate({ "title": "FileMetadataSchema" })
402export type BetaGatewayTimeoutError = { readonly "message": string; readonly "type": "timeout_error" }
403export const BetaGatewayTimeoutError = Schema.Struct({
404 "message": Schema.String.annotate({ "title": "Message", "default": "Request timeout" }),
405 "type": Schema.Literal("timeout_error").annotate({ "title": "Type", "default": "timeout_error" })
406}).annotate({ "title": "GatewayTimeoutError" })
407export type BetaGetSkillResponse = {
408 readonly "created_at": string
409 readonly "display_title": string | null
410 readonly "id": string
411 readonly "latest_version": string | null
412 readonly "source": string
413 readonly "type": string
414 readonly "updated_at": string
415}
416export const BetaGetSkillResponse = Schema.Struct({
417 "created_at": Schema.String.annotate({
418 "title": "Created At",
419 "description": "ISO 8601 timestamp of when the skill was created."
420 }),
421 "display_title": Schema.Union([Schema.String, Schema.Null]).annotate({
422 "title": "Display Title",
423 "description":
424 "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model."
425 }),
426 "id": Schema.String.annotate({
427 "title": "Id",
428 "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time."
429 }),
430 "latest_version": Schema.Union([Schema.String, Schema.Null]).annotate({
431 "title": "Latest Version",
432 "description":
433 "The latest version identifier for the skill.\n\nThis represents the most recent version of the skill that has been created."
434 }),
435 "source": Schema.String.annotate({
436 "title": "Source",
437 "description":
438 "Source of the skill.\n\nThis may be one of the following values:\n* `\"custom\"`: the skill was created by a user\n* `\"anthropic\"`: the skill was created by Anthropic"
439 }),
440 "type": Schema.String.annotate({
441 "title": "Type",
442 "description": "Object type.\n\nFor Skills, this is always `\"skill\"`.",
443 "default": "skill"
444 }),
445 "updated_at": Schema.String.annotate({
446 "title": "Updated At",
447 "description": "ISO 8601 timestamp of when the skill was last updated."
448 })
449}).annotate({ "title": "GetSkillResponse" })
450export type BetaGetSkillVersionResponse = {
451 readonly "created_at": string
452 readonly "description": string
453 readonly "directory": string
454 readonly "id": string
455 readonly "name": string
456 readonly "skill_id": string
457 readonly "type": string
458 readonly "version": string
459}
460export const BetaGetSkillVersionResponse = Schema.Struct({
461 "created_at": Schema.String.annotate({
462 "title": "Created At",
463 "description": "ISO 8601 timestamp of when the skill version was created."
464 }),
465 "description": Schema.String.annotate({
466 "title": "Description",
467 "description": "Description of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload."
468 }),
469 "directory": Schema.String.annotate({
470 "title": "Directory",
471 "description":
472 "Directory name of the skill version.\n\nThis is the top-level directory name that was extracted from the uploaded files."
473 }),
474 "id": Schema.String.annotate({
475 "title": "Id",
476 "description": "Unique identifier for the skill version.\n\nThe format and length of IDs may change over time."
477 }),
478 "name": Schema.String.annotate({
479 "title": "Name",
480 "description":
481 "Human-readable name of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload."
482 }),
483 "skill_id": Schema.String.annotate({
484 "title": "Skill Id",
485 "description": "Identifier for the skill that this version belongs to."
486 }),
487 "type": Schema.String.annotate({
488 "title": "Type",
489 "description": "Object type.\n\nFor Skill Versions, this is always `\"skill_version\"`.",
490 "default": "skill_version"
491 }),
492 "version": Schema.String.annotate({
493 "title": "Version",
494 "description":
495 "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")."
496 })
497}).annotate({ "title": "GetSkillVersionResponse" })
498export type BetaInputJsonContentBlockDelta = { readonly "partial_json": string; readonly "type": "input_json_delta" }
499export const BetaInputJsonContentBlockDelta = Schema.Struct({
500 "partial_json": Schema.String.annotate({ "title": "Partial Json" }),
501 "type": Schema.Literal("input_json_delta").annotate({ "title": "Type", "default": "input_json_delta" })
502}).annotate({ "title": "InputJsonContentBlockDelta" })
503export type BetaInputTokensClearAtLeast = { readonly "type": "input_tokens"; readonly "value": number }
504export const BetaInputTokensClearAtLeast = Schema.Struct({
505 "type": Schema.Literal("input_tokens").annotate({ "title": "Type" }),
506 "value": Schema.Number.annotate({ "title": "Value" }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
507}).annotate({ "title": "InputTokensClearAtLeast" })
508export type BetaInputTokensTrigger = { readonly "type": "input_tokens"; readonly "value": number }
509export const BetaInputTokensTrigger = Schema.Struct({
510 "type": Schema.Literal("input_tokens").annotate({ "title": "Type" }),
511 "value": Schema.Number.annotate({ "title": "Value" }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1))
512}).annotate({ "title": "InputTokensTrigger" })
513export type BetaInvalidRequestError = { readonly "message": string; readonly "type": "invalid_request_error" }
514export const BetaInvalidRequestError = Schema.Struct({
515 "message": Schema.String.annotate({ "title": "Message", "default": "Invalid request" }),
516 "type": Schema.Literal("invalid_request_error").annotate({ "title": "Type", "default": "invalid_request_error" })
517}).annotate({ "title": "InvalidRequestError" })
518export type BetaJsonOutputFormat = {
519 readonly "schema": { readonly [x: string]: Schema.Json }
520 readonly "type": "json_schema"
521}
522export const BetaJsonOutputFormat = Schema.Struct({
523 "schema": Schema.Record(Schema.String, Schema.Json).annotate({
524 "title": "Schema",
525 "description": "The JSON schema of the format"
526 }),
527 "type": Schema.Literal("json_schema").annotate({ "title": "Type" })
528}).annotate({ "title": "JsonOutputFormat" })
529export type BetaJsonValue = unknown
530export const BetaJsonValue = Schema.Unknown
531export type BetaMCPToolConfig = { readonly "defer_loading"?: boolean; readonly "enabled"?: boolean }
532export const BetaMCPToolConfig = Schema.Struct({
533 "defer_loading": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Defer Loading" })),
534 "enabled": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Enabled" }))
535}).annotate({ "title": "MCPToolConfig", "description": "Configuration for a specific tool in an MCP toolset." })
536export type BetaMessageBatch = {
537 readonly "archived_at": string | null
538 readonly "cancel_initiated_at": string | null
539 readonly "created_at": string
540 readonly "ended_at": string | null
541 readonly "expires_at": string
542 readonly "id": string
543 readonly "processing_status": "in_progress" | "canceling" | "ended"
544 readonly "request_counts": {
545 readonly "canceled": number
546 readonly "errored": number
547 readonly "expired": number
548 readonly "processing": number
549 readonly "succeeded": number
550 }
551 readonly "results_url": string | null
552 readonly "type": "message_batch"
553}
554export const BetaMessageBatch = Schema.Struct({
555 "archived_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({
556 "title": "Archived At",
557 "description":
558 "RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable."
559 }),
560 "cancel_initiated_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({
561 "title": "Cancel Initiated At",
562 "description":
563 "RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated."
564 }),
565 "created_at": Schema.String.annotate({
566 "title": "Created At",
567 "description": "RFC 3339 datetime string representing the time at which the Message Batch was created.",
568 "format": "date-time"
569 }),
570 "ended_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({
571 "title": "Ended At",
572 "description":
573 "RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.\n\nProcessing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired."
574 }),
575 "expires_at": Schema.String.annotate({
576 "title": "Expires At",
577 "description":
578 "RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.",
579 "format": "date-time"
580 }),
581 "id": Schema.String.annotate({
582 "title": "Id",
583 "description": "Unique object identifier.\n\nThe format and length of IDs may change over time."
584 }),
585 "processing_status": Schema.Literals(["in_progress", "canceling", "ended"]).annotate({
586 "title": "Processing Status",
587 "description": "Processing status of the Message Batch."
588 }),
589 "request_counts": Schema.Struct({
590 "canceled": Schema.Number.annotate({
591 "title": "Canceled",
592 "description":
593 "Number of requests in the Message Batch that have been canceled.\n\nThis is zero until processing of the entire Message Batch has ended.",
594 "default": 0
595 }).check(Schema.isInt()),
596 "errored": Schema.Number.annotate({
597 "title": "Errored",
598 "description":
599 "Number of requests in the Message Batch that encountered an error.\n\nThis is zero until processing of the entire Message Batch has ended.",
600 "default": 0
601 }).check(Schema.isInt()),
602 "expired": Schema.Number.annotate({
603 "title": "Expired",
604 "description":
605 "Number of requests in the Message Batch that have expired.\n\nThis is zero until processing of the entire Message Batch has ended.",
606 "default": 0
607 }).check(Schema.isInt()),
608 "processing": Schema.Number.annotate({
609 "title": "Processing",
610 "description": "Number of requests in the Message Batch that are processing.",
611 "default": 0
612 }).check(Schema.isInt()),
613 "succeeded": Schema.Number.annotate({
614 "title": "Succeeded",
615 "description":
616 "Number of requests in the Message Batch that have completed successfully.\n\nThis is zero until processing of the entire Message Batch has ended.",
617 "default": 0
618 }).check(Schema.isInt())
619 }).annotate({
620 "title": "RequestCounts",
621 "description":
622 "Tallies requests within the Message Batch, categorized by their status.\n\nRequests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch."
623 }),
624 "results_url": Schema.Union([Schema.String, Schema.Null]).annotate({
625 "title": "Results Url",
626 "description":
627 "URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.\n\nResults in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests."
628 }),
629 "type": Schema.Literal("message_batch").annotate({
630 "title": "Type",
631 "description": "Object type.\n\nFor Message Batches, this is always `\"message_batch\"`.",
632 "default": "message_batch"
633 })
634}).annotate({ "title": "MessageBatch" })
635export type BetaMessageStopEvent = { readonly "type": "message_stop" }
636export const BetaMessageStopEvent = Schema.Struct({
637 "type": Schema.Literal("message_stop").annotate({ "title": "Type", "default": "message_stop" })
638}).annotate({ "title": "MessageStopEvent" })
639export type BetaModelInfo = {
640 readonly "created_at": string
641 readonly "display_name": string
642 readonly "id": string
643 readonly "type": "model"
644}
645export const BetaModelInfo = Schema.Struct({
646 "created_at": Schema.String.annotate({
647 "title": "Created At",
648 "description":
649 "RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.",
650 "format": "date-time"
651 }),
652 "display_name": Schema.String.annotate({
653 "title": "Display Name",
654 "description": "A human-readable name for the model."
655 }),
656 "id": Schema.String.annotate({ "title": "Id", "description": "Unique model identifier." }),
657 "type": Schema.Literal("model").annotate({
658 "title": "Type",
659 "description": "Object type.\n\nFor Models, this is always `\"model\"`.",
660 "default": "model"
661 })
662}).annotate({ "title": "ModelInfo" })
663export type BetaNotFoundError = { readonly "message": string; readonly "type": "not_found_error" }
664export const BetaNotFoundError = Schema.Struct({
665 "message": Schema.String.annotate({ "title": "Message", "default": "Not found" }),
666 "type": Schema.Literal("not_found_error").annotate({ "title": "Type", "default": "not_found_error" })
667}).annotate({ "title": "NotFoundError" })
668export type BetaOverloadedError = { readonly "message": string; readonly "type": "overloaded_error" }
669export const BetaOverloadedError = Schema.Struct({
670 "message": Schema.String.annotate({ "title": "Message", "default": "Overloaded" }),
671 "type": Schema.Literal("overloaded_error").annotate({ "title": "Type", "default": "overloaded_error" })
672}).annotate({ "title": "OverloadedError" })
673export type BetaPermissionError = { readonly "message": string; readonly "type": "permission_error" }
674export const BetaPermissionError = Schema.Struct({
675 "message": Schema.String.annotate({ "title": "Message", "default": "Permission denied" }),
676 "type": Schema.Literal("permission_error").annotate({ "title": "Type", "default": "permission_error" })
677}).annotate({ "title": "PermissionError" })
678export type BetaPlainTextSource = {
679 readonly "data": string
680 readonly "media_type": "text/plain"
681 readonly "type": "text"
682}
683export const BetaPlainTextSource = Schema.Struct({
684 "data": Schema.String.annotate({ "title": "Data" }),
685 "media_type": Schema.Literal("text/plain").annotate({ "title": "Media Type" }),
686 "type": Schema.Literal("text").annotate({ "title": "Type" })
687}).annotate({ "title": "PlainTextSource" })
688export type BetaRateLimitError = { readonly "message": string; readonly "type": "rate_limit_error" }
689export const BetaRateLimitError = Schema.Struct({
690 "message": Schema.String.annotate({ "title": "Message", "default": "Rate limited" }),
691 "type": Schema.Literal("rate_limit_error").annotate({ "title": "Type", "default": "rate_limit_error" })
692}).annotate({ "title": "RateLimitError" })
693export type BetaRequestBashCodeExecutionOutputBlock = {
694 readonly "file_id": string
695 readonly "type": "bash_code_execution_output"
696}
697export const BetaRequestBashCodeExecutionOutputBlock = Schema.Struct({
698 "file_id": Schema.String.annotate({ "title": "File Id" }),
699 "type": Schema.Literal("bash_code_execution_output").annotate({ "title": "Type" })
700}).annotate({ "title": "RequestBashCodeExecutionOutputBlock" })
701export type BetaRequestCharLocationCitation = {
702 readonly "cited_text": string
703 readonly "document_index": number
704 readonly "document_title": string | null
705 readonly "end_char_index": number
706 readonly "start_char_index": number
707 readonly "type": "char_location"
708}
709export const BetaRequestCharLocationCitation = Schema.Struct({
710 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
711 "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check(
712 Schema.isGreaterThanOrEqualTo(0)
713 ),
714 "document_title": Schema.Union([
715 Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)),
716 Schema.Null
717 ]).annotate({ "title": "Document Title" }),
718 "end_char_index": Schema.Number.annotate({ "title": "End Char Index" }).check(Schema.isInt()),
719 "start_char_index": Schema.Number.annotate({ "title": "Start Char Index" }).check(Schema.isInt()).check(
720 Schema.isGreaterThanOrEqualTo(0)
721 ),
722 "type": Schema.Literal("char_location").annotate({ "title": "Type" })
723}).annotate({ "title": "RequestCharLocationCitation" })
724export type BetaRequestCitationsConfig = { readonly "enabled"?: boolean }
725export const BetaRequestCitationsConfig = Schema.Struct({
726 "enabled": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Enabled" }))
727}).annotate({ "title": "RequestCitationsConfig" })
728export type BetaRequestCodeExecutionOutputBlock = {
729 readonly "file_id": string
730 readonly "type": "code_execution_output"
731}
732export const BetaRequestCodeExecutionOutputBlock = Schema.Struct({
733 "file_id": Schema.String.annotate({ "title": "File Id" }),
734 "type": Schema.Literal("code_execution_output").annotate({ "title": "Type" })
735}).annotate({ "title": "RequestCodeExecutionOutputBlock" })
736export type BetaRequestContentBlockLocationCitation = {
737 readonly "cited_text": string
738 readonly "document_index": number
739 readonly "document_title": string | null
740 readonly "end_block_index": number
741 readonly "start_block_index": number
742 readonly "type": "content_block_location"
743}
744export const BetaRequestContentBlockLocationCitation = Schema.Struct({
745 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
746 "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check(
747 Schema.isGreaterThanOrEqualTo(0)
748 ),
749 "document_title": Schema.Union([
750 Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)),
751 Schema.Null
752 ]).annotate({ "title": "Document Title" }),
753 "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()),
754 "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check(
755 Schema.isGreaterThanOrEqualTo(0)
756 ),
757 "type": Schema.Literal("content_block_location").annotate({ "title": "Type" })
758}).annotate({ "title": "RequestContentBlockLocationCitation" })
759export type BetaRequestMCPServerToolConfiguration = {
760 readonly "allowed_tools"?: ReadonlyArray<string> | null
761 readonly "enabled"?: boolean | null
762}
763export const BetaRequestMCPServerToolConfiguration = Schema.Struct({
764 "allowed_tools": Schema.optionalKey(
765 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Tools" })
766 ),
767 "enabled": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null]).annotate({ "title": "Enabled" }))
768}).annotate({ "title": "RequestMCPServerToolConfiguration" })
769export type BetaRequestPageLocationCitation = {
770 readonly "cited_text": string
771 readonly "document_index": number
772 readonly "document_title": string | null
773 readonly "end_page_number": number
774 readonly "start_page_number": number
775 readonly "type": "page_location"
776}
777export const BetaRequestPageLocationCitation = Schema.Struct({
778 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
779 "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check(
780 Schema.isGreaterThanOrEqualTo(0)
781 ),
782 "document_title": Schema.Union([
783 Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)),
784 Schema.Null
785 ]).annotate({ "title": "Document Title" }),
786 "end_page_number": Schema.Number.annotate({ "title": "End Page Number" }).check(Schema.isInt()),
787 "start_page_number": Schema.Number.annotate({ "title": "Start Page Number" }).check(Schema.isInt()).check(
788 Schema.isGreaterThanOrEqualTo(1)
789 ),
790 "type": Schema.Literal("page_location").annotate({ "title": "Type" })
791}).annotate({ "title": "RequestPageLocationCitation" })
792export type BetaRequestSearchResultLocationCitation = {
793 readonly "cited_text": string
794 readonly "end_block_index": number
795 readonly "search_result_index": number
796 readonly "source": string
797 readonly "start_block_index": number
798 readonly "title": string | null
799 readonly "type": "search_result_location"
800}
801export const BetaRequestSearchResultLocationCitation = Schema.Struct({
802 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
803 "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()),
804 "search_result_index": Schema.Number.annotate({ "title": "Search Result Index" }).check(Schema.isInt()).check(
805 Schema.isGreaterThanOrEqualTo(0)
806 ),
807 "source": Schema.String.annotate({ "title": "Source" }),
808 "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check(
809 Schema.isGreaterThanOrEqualTo(0)
810 ),
811 "title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Title" }),
812 "type": Schema.Literal("search_result_location").annotate({ "title": "Type" })
813}).annotate({ "title": "RequestSearchResultLocationCitation" })
814export type BetaRequestTextEditorCodeExecutionCreateResultBlock = {
815 readonly "is_file_update": boolean
816 readonly "type": "text_editor_code_execution_create_result"
817}
818export const BetaRequestTextEditorCodeExecutionCreateResultBlock = Schema.Struct({
819 "is_file_update": Schema.Boolean.annotate({ "title": "Is File Update" }),
820 "type": Schema.Literal("text_editor_code_execution_create_result").annotate({ "title": "Type" })
821}).annotate({ "title": "RequestTextEditorCodeExecutionCreateResultBlock" })
822export type BetaRequestTextEditorCodeExecutionStrReplaceResultBlock = {
823 readonly "lines"?: ReadonlyArray<string> | null
824 readonly "new_lines"?: number | null
825 readonly "new_start"?: number | null
826 readonly "old_lines"?: number | null
827 readonly "old_start"?: number | null
828 readonly "type": "text_editor_code_execution_str_replace_result"
829}
830export const BetaRequestTextEditorCodeExecutionStrReplaceResultBlock = Schema.Struct({
831 "lines": Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Lines" })),
832 "new_lines": Schema.optionalKey(
833 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "New Lines" })
834 ),
835 "new_start": Schema.optionalKey(
836 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "New Start" })
837 ),
838 "old_lines": Schema.optionalKey(
839 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Old Lines" })
840 ),
841 "old_start": Schema.optionalKey(
842 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Old Start" })
843 ),
844 "type": Schema.Literal("text_editor_code_execution_str_replace_result").annotate({ "title": "Type" })
845}).annotate({ "title": "RequestTextEditorCodeExecutionStrReplaceResultBlock" })
846export type BetaRequestTextEditorCodeExecutionViewResultBlock = {
847 readonly "content": string
848 readonly "file_type": "text" | "image" | "pdf"
849 readonly "num_lines"?: number | null
850 readonly "start_line"?: number | null
851 readonly "total_lines"?: number | null
852 readonly "type": "text_editor_code_execution_view_result"
853}
854export const BetaRequestTextEditorCodeExecutionViewResultBlock = Schema.Struct({
855 "content": Schema.String.annotate({ "title": "Content" }),
856 "file_type": Schema.Literals(["text", "image", "pdf"]).annotate({ "title": "File Type" }),
857 "num_lines": Schema.optionalKey(
858 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Num Lines" })
859 ),
860 "start_line": Schema.optionalKey(
861 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Start Line" })
862 ),
863 "total_lines": Schema.optionalKey(
864 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Total Lines" })
865 ),
866 "type": Schema.Literal("text_editor_code_execution_view_result").annotate({ "title": "Type" })
867}).annotate({ "title": "RequestTextEditorCodeExecutionViewResultBlock" })
868export type BetaRequestWebSearchResultBlock = {
869 readonly "encrypted_content": string
870 readonly "page_age"?: string | null
871 readonly "title": string
872 readonly "type": "web_search_result"
873 readonly "url": string
874}
875export const BetaRequestWebSearchResultBlock = Schema.Struct({
876 "encrypted_content": Schema.String.annotate({ "title": "Encrypted Content" }),
877 "page_age": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Page Age" })),
878 "title": Schema.String.annotate({ "title": "Title" }),
879 "type": Schema.Literal("web_search_result").annotate({ "title": "Type" }),
880 "url": Schema.String.annotate({ "title": "Url" })
881}).annotate({ "title": "RequestWebSearchResultBlock" })
882export type BetaRequestWebSearchResultLocationCitation = {
883 readonly "cited_text": string
884 readonly "encrypted_index": string
885 readonly "title": string | null
886 readonly "type": "web_search_result_location"
887 readonly "url": string
888}
889export const BetaRequestWebSearchResultLocationCitation = Schema.Struct({
890 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
891 "encrypted_index": Schema.String.annotate({ "title": "Encrypted Index" }),
892 "title": Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(512)), Schema.Null])
893 .annotate({ "title": "Title" }),
894 "type": Schema.Literal("web_search_result_location").annotate({ "title": "Type" }),
895 "url": Schema.String.annotate({ "title": "Url" }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2048))
896}).annotate({ "title": "RequestWebSearchResultLocationCitation" })
897export type BetaResponseBashCodeExecutionOutputBlock = {
898 readonly "file_id": string
899 readonly "type": "bash_code_execution_output"
900}
901export const BetaResponseBashCodeExecutionOutputBlock = Schema.Struct({
902 "file_id": Schema.String.annotate({ "title": "File Id" }),
903 "type": Schema.Literal("bash_code_execution_output").annotate({
904 "title": "Type",
905 "default": "bash_code_execution_output"
906 })
907}).annotate({ "title": "ResponseBashCodeExecutionOutputBlock" })
908export type BetaResponseCharLocationCitation = {
909 readonly "cited_text": string
910 readonly "document_index": number
911 readonly "document_title": string | null
912 readonly "end_char_index": number
913 readonly "file_id": string | null
914 readonly "start_char_index": number
915 readonly "type": "char_location"
916}
917export const BetaResponseCharLocationCitation = Schema.Struct({
918 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
919 "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check(
920 Schema.isGreaterThanOrEqualTo(0)
921 ),
922 "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }),
923 "end_char_index": Schema.Number.annotate({ "title": "End Char Index" }).check(Schema.isInt()),
924 "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }),
925 "start_char_index": Schema.Number.annotate({ "title": "Start Char Index" }).check(Schema.isInt()).check(
926 Schema.isGreaterThanOrEqualTo(0)
927 ),
928 "type": Schema.Literal("char_location").annotate({ "title": "Type", "default": "char_location" })
929}).annotate({ "title": "ResponseCharLocationCitation" })
930export type BetaResponseCitationsConfig = { readonly "enabled": boolean }
931export const BetaResponseCitationsConfig = Schema.Struct({
932 "enabled": Schema.Boolean.annotate({ "title": "Enabled", "default": false })
933}).annotate({ "title": "ResponseCitationsConfig" })
934export type BetaResponseClearThinking20251015Edit = {
935 readonly "cleared_input_tokens": number
936 readonly "cleared_thinking_turns": number
937 readonly "type": "clear_thinking_20251015"
938}
939export const BetaResponseClearThinking20251015Edit = Schema.Struct({
940 "cleared_input_tokens": Schema.Number.annotate({
941 "title": "Cleared Input Tokens",
942 "description": "Number of input tokens cleared by this edit."
943 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
944 "cleared_thinking_turns": Schema.Number.annotate({
945 "title": "Cleared Thinking Turns",
946 "description": "Number of thinking turns that were cleared."
947 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
948 "type": Schema.Literal("clear_thinking_20251015").annotate({
949 "title": "Type",
950 "description": "The type of context management edit applied.",
951 "default": "clear_thinking_20251015"
952 })
953}).annotate({ "title": "ResponseClearThinking20251015Edit" })
954export type BetaResponseClearToolUses20250919Edit = {
955 readonly "cleared_input_tokens": number
956 readonly "cleared_tool_uses": number
957 readonly "type": "clear_tool_uses_20250919"
958}
959export const BetaResponseClearToolUses20250919Edit = Schema.Struct({
960 "cleared_input_tokens": Schema.Number.annotate({
961 "title": "Cleared Input Tokens",
962 "description": "Number of input tokens cleared by this edit."
963 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
964 "cleared_tool_uses": Schema.Number.annotate({
965 "title": "Cleared Tool Uses",
966 "description": "Number of tool uses that were cleared."
967 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
968 "type": Schema.Literal("clear_tool_uses_20250919").annotate({
969 "title": "Type",
970 "description": "The type of context management edit applied.",
971 "default": "clear_tool_uses_20250919"
972 })
973}).annotate({ "title": "ResponseClearToolUses20250919Edit" })
974export type BetaResponseCodeExecutionOutputBlock = {
975 readonly "file_id": string
976 readonly "type": "code_execution_output"
977}
978export const BetaResponseCodeExecutionOutputBlock = Schema.Struct({
979 "file_id": Schema.String.annotate({ "title": "File Id" }),
980 "type": Schema.Literal("code_execution_output").annotate({ "title": "Type", "default": "code_execution_output" })
981}).annotate({ "title": "ResponseCodeExecutionOutputBlock" })
982export type BetaResponseCompactionBlock = { readonly "content": string | null; readonly "type": "compaction" }
983export const BetaResponseCompactionBlock = Schema.Struct({
984 "content": Schema.Union([Schema.String, Schema.Null]).annotate({
985 "title": "Content",
986 "description": "Summary of compacted content, or null if compaction failed"
987 }),
988 "type": Schema.Literal("compaction").annotate({ "title": "Type", "default": "compaction" })
989}).annotate({
990 "title": "ResponseCompactionBlock",
991 "description":
992 "A compaction block returned when autocompact is triggered.\n\nWhen content is None, it indicates the compaction failed to produce a valid\nsummary (e.g., malformed output from the model). Clients may round-trip\ncompaction blocks with null content; the server treats them as no-ops."
993})
994export type BetaResponseContainerUploadBlock = { readonly "file_id": string; readonly "type": "container_upload" }
995export const BetaResponseContainerUploadBlock = Schema.Struct({
996 "file_id": Schema.String.annotate({ "title": "File Id" }),
997 "type": Schema.Literal("container_upload").annotate({ "title": "Type", "default": "container_upload" })
998}).annotate({
999 "title": "ResponseContainerUploadBlock",
1000 "description": "Response model for a file uploaded to the container."
1001})
1002export type BetaResponseContentBlockLocationCitation = {
1003 readonly "cited_text": string
1004 readonly "document_index": number
1005 readonly "document_title": string | null
1006 readonly "end_block_index": number
1007 readonly "file_id": string | null
1008 readonly "start_block_index": number
1009 readonly "type": "content_block_location"
1010}
1011export const BetaResponseContentBlockLocationCitation = Schema.Struct({
1012 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
1013 "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check(
1014 Schema.isGreaterThanOrEqualTo(0)
1015 ),
1016 "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }),
1017 "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()),
1018 "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }),
1019 "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check(
1020 Schema.isGreaterThanOrEqualTo(0)
1021 ),
1022 "type": Schema.Literal("content_block_location").annotate({ "title": "Type", "default": "content_block_location" })
1023}).annotate({ "title": "ResponseContentBlockLocationCitation" })
1024export type BetaResponseMCPToolUseBlock = {
1025 readonly "id": string
1026 readonly "input": { readonly [x: string]: Schema.Json }
1027 readonly "name": string
1028 readonly "server_name": string
1029 readonly "type": "mcp_tool_use"
1030}
1031export const BetaResponseMCPToolUseBlock = Schema.Struct({
1032 "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
1033 "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }),
1034 "name": Schema.String.annotate({ "title": "Name", "description": "The name of the MCP tool" }),
1035 "server_name": Schema.String.annotate({ "title": "Server Name", "description": "The name of the MCP server" }),
1036 "type": Schema.Literal("mcp_tool_use").annotate({ "title": "Type", "default": "mcp_tool_use" })
1037}).annotate({ "title": "ResponseMCPToolUseBlock" })
1038export type BetaResponsePageLocationCitation = {
1039 readonly "cited_text": string
1040 readonly "document_index": number
1041 readonly "document_title": string | null
1042 readonly "end_page_number": number
1043 readonly "file_id": string | null
1044 readonly "start_page_number": number
1045 readonly "type": "page_location"
1046}
1047export const BetaResponsePageLocationCitation = Schema.Struct({
1048 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
1049 "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check(
1050 Schema.isGreaterThanOrEqualTo(0)
1051 ),
1052 "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }),
1053 "end_page_number": Schema.Number.annotate({ "title": "End Page Number" }).check(Schema.isInt()),
1054 "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }),
1055 "start_page_number": Schema.Number.annotate({ "title": "Start Page Number" }).check(Schema.isInt()).check(
1056 Schema.isGreaterThanOrEqualTo(1)
1057 ),
1058 "type": Schema.Literal("page_location").annotate({ "title": "Type", "default": "page_location" })
1059}).annotate({ "title": "ResponsePageLocationCitation" })
1060export type BetaResponseRedactedThinkingBlock = { readonly "data": string; readonly "type": "redacted_thinking" }
1061export const BetaResponseRedactedThinkingBlock = Schema.Struct({
1062 "data": Schema.String.annotate({ "title": "Data" }),
1063 "type": Schema.Literal("redacted_thinking").annotate({ "title": "Type", "default": "redacted_thinking" })
1064}).annotate({ "title": "ResponseRedactedThinkingBlock" })
1065export type BetaResponseSearchResultLocationCitation = {
1066 readonly "cited_text": string
1067 readonly "end_block_index": number
1068 readonly "search_result_index": number
1069 readonly "source": string
1070 readonly "start_block_index": number
1071 readonly "title": string | null
1072 readonly "type": "search_result_location"
1073}
1074export const BetaResponseSearchResultLocationCitation = Schema.Struct({
1075 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
1076 "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()),
1077 "search_result_index": Schema.Number.annotate({ "title": "Search Result Index" }).check(Schema.isInt()).check(
1078 Schema.isGreaterThanOrEqualTo(0)
1079 ),
1080 "source": Schema.String.annotate({ "title": "Source" }),
1081 "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check(
1082 Schema.isGreaterThanOrEqualTo(0)
1083 ),
1084 "title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Title" }),
1085 "type": Schema.Literal("search_result_location").annotate({ "title": "Type", "default": "search_result_location" })
1086}).annotate({ "title": "ResponseSearchResultLocationCitation" })
1087export type BetaResponseTextEditorCodeExecutionCreateResultBlock = {
1088 readonly "is_file_update": boolean
1089 readonly "type": "text_editor_code_execution_create_result"
1090}
1091export const BetaResponseTextEditorCodeExecutionCreateResultBlock = Schema.Struct({
1092 "is_file_update": Schema.Boolean.annotate({ "title": "Is File Update" }),
1093 "type": Schema.Literal("text_editor_code_execution_create_result").annotate({
1094 "title": "Type",
1095 "default": "text_editor_code_execution_create_result"
1096 })
1097}).annotate({ "title": "ResponseTextEditorCodeExecutionCreateResultBlock" })
1098export type BetaResponseTextEditorCodeExecutionStrReplaceResultBlock = {
1099 readonly "lines": ReadonlyArray<string> | null
1100 readonly "new_lines": number | null
1101 readonly "new_start": number | null
1102 readonly "old_lines": number | null
1103 readonly "old_start": number | null
1104 readonly "type": "text_editor_code_execution_str_replace_result"
1105}
1106export const BetaResponseTextEditorCodeExecutionStrReplaceResultBlock = Schema.Struct({
1107 "lines": Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Lines", "default": null }),
1108 "new_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
1109 "title": "New Lines",
1110 "default": null
1111 }),
1112 "new_start": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
1113 "title": "New Start",
1114 "default": null
1115 }),
1116 "old_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
1117 "title": "Old Lines",
1118 "default": null
1119 }),
1120 "old_start": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
1121 "title": "Old Start",
1122 "default": null
1123 }),
1124 "type": Schema.Literal("text_editor_code_execution_str_replace_result").annotate({
1125 "title": "Type",
1126 "default": "text_editor_code_execution_str_replace_result"
1127 })
1128}).annotate({ "title": "ResponseTextEditorCodeExecutionStrReplaceResultBlock" })
1129export type BetaResponseTextEditorCodeExecutionViewResultBlock = {
1130 readonly "content": string
1131 readonly "file_type": "text" | "image" | "pdf"
1132 readonly "num_lines": number | null
1133 readonly "start_line": number | null
1134 readonly "total_lines": number | null
1135 readonly "type": "text_editor_code_execution_view_result"
1136}
1137export const BetaResponseTextEditorCodeExecutionViewResultBlock = Schema.Struct({
1138 "content": Schema.String.annotate({ "title": "Content" }),
1139 "file_type": Schema.Literals(["text", "image", "pdf"]).annotate({ "title": "File Type" }),
1140 "num_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
1141 "title": "Num Lines",
1142 "default": null
1143 }),
1144 "start_line": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
1145 "title": "Start Line",
1146 "default": null
1147 }),
1148 "total_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
1149 "title": "Total Lines",
1150 "default": null
1151 }),
1152 "type": Schema.Literal("text_editor_code_execution_view_result").annotate({
1153 "title": "Type",
1154 "default": "text_editor_code_execution_view_result"
1155 })
1156}).annotate({ "title": "ResponseTextEditorCodeExecutionViewResultBlock" })
1157export type BetaResponseThinkingBlock = {
1158 readonly "signature": string
1159 readonly "thinking": string
1160 readonly "type": "thinking"
1161}
1162export const BetaResponseThinkingBlock = Schema.Struct({
1163 "signature": Schema.String.annotate({ "title": "Signature" }),
1164 "thinking": Schema.String.annotate({ "title": "Thinking" }),
1165 "type": Schema.Literal("thinking").annotate({ "title": "Type", "default": "thinking" })
1166}).annotate({ "title": "ResponseThinkingBlock" })
1167export type BetaResponseToolReferenceBlock = { readonly "tool_name": string; readonly "type": "tool_reference" }
1168export const BetaResponseToolReferenceBlock = Schema.Struct({
1169 "tool_name": Schema.String.annotate({ "title": "Tool Name" }).check(Schema.isMinLength(1)).check(
1170 Schema.isMaxLength(256)
1171 ).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,256}$"))),
1172 "type": Schema.Literal("tool_reference").annotate({ "title": "Type", "default": "tool_reference" })
1173}).annotate({ "title": "ResponseToolReferenceBlock" })
1174export type BetaResponseWebSearchResultBlock = {
1175 readonly "encrypted_content": string
1176 readonly "page_age": string | null
1177 readonly "title": string
1178 readonly "type": "web_search_result"
1179 readonly "url": string
1180}
1181export const BetaResponseWebSearchResultBlock = Schema.Struct({
1182 "encrypted_content": Schema.String.annotate({ "title": "Encrypted Content" }),
1183 "page_age": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Page Age", "default": null }),
1184 "title": Schema.String.annotate({ "title": "Title" }),
1185 "type": Schema.Literal("web_search_result").annotate({ "title": "Type", "default": "web_search_result" }),
1186 "url": Schema.String.annotate({ "title": "Url" })
1187}).annotate({ "title": "ResponseWebSearchResultBlock" })
1188export type BetaResponseWebSearchResultLocationCitation = {
1189 readonly "cited_text": string
1190 readonly "encrypted_index": string
1191 readonly "title": string | null
1192 readonly "type": "web_search_result_location"
1193 readonly "url": string
1194}
1195export const BetaResponseWebSearchResultLocationCitation = Schema.Struct({
1196 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
1197 "encrypted_index": Schema.String.annotate({ "title": "Encrypted Index" }),
1198 "title": Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ "title": "Title" }),
1199 "type": Schema.Literal("web_search_result_location").annotate({
1200 "title": "Type",
1201 "default": "web_search_result_location"
1202 }),
1203 "url": Schema.String.annotate({ "title": "Url" })
1204}).annotate({ "title": "ResponseWebSearchResultLocationCitation" })
1205export type BetaServerToolCaller = { readonly "tool_id": string; readonly "type": "code_execution_20250825" }
1206export const BetaServerToolCaller = Schema.Struct({
1207 "tool_id": Schema.String.annotate({ "title": "Tool Id" }).check(
1208 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
1209 ),
1210 "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" })
1211}).annotate({ "title": "ServerToolCaller", "description": "Tool invocation generated by a server-side tool." })
1212export type BetaServerToolCaller_20260120 = { readonly "tool_id": string; readonly "type": "code_execution_20260120" }
1213export const BetaServerToolCaller_20260120 = Schema.Struct({
1214 "tool_id": Schema.String.annotate({ "title": "Tool Id" }).check(
1215 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
1216 ),
1217 "type": Schema.Literal("code_execution_20260120").annotate({ "title": "Type" })
1218}).annotate({ "title": "ServerToolCaller_20260120" })
1219export type BetaServerToolUsage = { readonly "web_fetch_requests": number; readonly "web_search_requests": number }
1220export const BetaServerToolUsage = Schema.Struct({
1221 "web_fetch_requests": Schema.Number.annotate({
1222 "title": "Web Fetch Requests",
1223 "description": "The number of web fetch tool requests.",
1224 "default": 0
1225 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
1226 "web_search_requests": Schema.Number.annotate({
1227 "title": "Web Search Requests",
1228 "description": "The number of web search tool requests.",
1229 "default": 0
1230 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
1231}).annotate({ "title": "ServerToolUsage" })
1232export type BetaSignatureContentBlockDelta = { readonly "signature": string; readonly "type": "signature_delta" }
1233export const BetaSignatureContentBlockDelta = Schema.Struct({
1234 "signature": Schema.String.annotate({ "title": "Signature" }),
1235 "type": Schema.Literal("signature_delta").annotate({ "title": "Type", "default": "signature_delta" })
1236}).annotate({ "title": "SignatureContentBlockDelta" })
1237export type BetaSkill = {
1238 readonly "skill_id": string
1239 readonly "type": "anthropic" | "custom"
1240 readonly "version": string
1241}
1242export const BetaSkill = Schema.Struct({
1243 "skill_id": Schema.String.annotate({ "title": "Skill Id", "description": "Skill ID" }).check(Schema.isMinLength(1))
1244 .check(Schema.isMaxLength(64)),
1245 "type": Schema.Literals(["anthropic", "custom"]).annotate({
1246 "title": "Type",
1247 "description": "Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)"
1248 }),
1249 "version": Schema.String.annotate({
1250 "title": "Version",
1251 "description": "Skill version or 'latest' for most recent version"
1252 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64))
1253}).annotate({ "title": "Skill", "description": "A skill that was loaded in a container (response model)." })
1254export type BetaSkillParams = {
1255 readonly "skill_id": string
1256 readonly "type": "anthropic" | "custom"
1257 readonly "version"?: string
1258}
1259export const BetaSkillParams = Schema.Struct({
1260 "skill_id": Schema.String.annotate({ "title": "Skill Id", "description": "Skill ID" }).check(Schema.isMinLength(1))
1261 .check(Schema.isMaxLength(64)),
1262 "type": Schema.Literals(["anthropic", "custom"]).annotate({
1263 "title": "Type",
1264 "description": "Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)"
1265 }),
1266 "version": Schema.optionalKey(
1267 Schema.String.annotate({ "title": "Version", "description": "Skill version or 'latest' for most recent version" })
1268 .check(Schema.isMinLength(1)).check(Schema.isMaxLength(64))
1269 )
1270}).annotate({
1271 "title": "SkillParams",
1272 "description": "Specification for a skill to be loaded in a container (request model)."
1273})
1274export type BetaSkillVersion = {
1275 readonly "created_at": string
1276 readonly "description": string
1277 readonly "directory": string
1278 readonly "id": string
1279 readonly "name": string
1280 readonly "skill_id": string
1281 readonly "type": string
1282 readonly "version": string
1283}
1284export const BetaSkillVersion = Schema.Struct({
1285 "created_at": Schema.String.annotate({
1286 "title": "Created At",
1287 "description": "ISO 8601 timestamp of when the skill version was created."
1288 }),
1289 "description": Schema.String.annotate({
1290 "title": "Description",
1291 "description": "Description of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload."
1292 }),
1293 "directory": Schema.String.annotate({
1294 "title": "Directory",
1295 "description":
1296 "Directory name of the skill version.\n\nThis is the top-level directory name that was extracted from the uploaded files."
1297 }),
1298 "id": Schema.String.annotate({
1299 "title": "Id",
1300 "description": "Unique identifier for the skill version.\n\nThe format and length of IDs may change over time."
1301 }),
1302 "name": Schema.String.annotate({
1303 "title": "Name",
1304 "description":
1305 "Human-readable name of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload."
1306 }),
1307 "skill_id": Schema.String.annotate({
1308 "title": "Skill Id",
1309 "description": "Identifier for the skill that this version belongs to."
1310 }),
1311 "type": Schema.String.annotate({
1312 "title": "Type",
1313 "description": "Object type.\n\nFor Skill Versions, this is always `\"skill_version\"`.",
1314 "default": "skill_version"
1315 }),
1316 "version": Schema.String.annotate({
1317 "title": "Version",
1318 "description":
1319 "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")."
1320 })
1321}).annotate({ "title": "SkillVersion" })
1322export type BetaSpeed = "standard" | "fast"
1323export const BetaSpeed = Schema.Literals(["standard", "fast"]).annotate({ "title": "Speed" })
1324export type BetaTextContentBlockDelta = { readonly "text": string; readonly "type": "text_delta" }
1325export const BetaTextContentBlockDelta = Schema.Struct({
1326 "text": Schema.String.annotate({ "title": "Text" }),
1327 "type": Schema.Literal("text_delta").annotate({ "title": "Type", "default": "text_delta" })
1328}).annotate({ "title": "TextContentBlockDelta" })
1329export type BetaTextEditorCodeExecutionToolResultErrorCode =
1330 | "invalid_tool_input"
1331 | "unavailable"
1332 | "too_many_requests"
1333 | "execution_time_exceeded"
1334 | "file_not_found"
1335export const BetaTextEditorCodeExecutionToolResultErrorCode = Schema.Literals([
1336 "invalid_tool_input",
1337 "unavailable",
1338 "too_many_requests",
1339 "execution_time_exceeded",
1340 "file_not_found"
1341]).annotate({ "title": "TextEditorCodeExecutionToolResultErrorCode" })
1342export type BetaThinkingConfigAdaptive = { readonly "type": "adaptive" }
1343export const BetaThinkingConfigAdaptive = Schema.Struct({
1344 "type": Schema.Literal("adaptive").annotate({ "title": "Type" })
1345}).annotate({ "title": "ThinkingConfigAdaptive" })
1346export type BetaThinkingConfigDisabled = { readonly "type": "disabled" }
1347export const BetaThinkingConfigDisabled = Schema.Struct({
1348 "type": Schema.Literal("disabled").annotate({ "title": "Type" })
1349}).annotate({ "title": "ThinkingConfigDisabled" })
1350export type BetaThinkingConfigEnabled = { readonly "budget_tokens": number; readonly "type": "enabled" }
1351export const BetaThinkingConfigEnabled = Schema.Struct({
1352 "budget_tokens": Schema.Number.annotate({
1353 "title": "Budget Tokens",
1354 "description":
1355 "Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.\n\nMust be ≥1024 and less than `max_tokens`.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details."
1356 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1024)),
1357 "type": Schema.Literal("enabled").annotate({ "title": "Type" })
1358}).annotate({ "title": "ThinkingConfigEnabled" })
1359export type BetaThinkingContentBlockDelta = { readonly "thinking": string; readonly "type": "thinking_delta" }
1360export const BetaThinkingContentBlockDelta = Schema.Struct({
1361 "thinking": Schema.String.annotate({ "title": "Thinking" }),
1362 "type": Schema.Literal("thinking_delta").annotate({ "title": "Type", "default": "thinking_delta" })
1363}).annotate({ "title": "ThinkingContentBlockDelta" })
1364export type BetaThinkingTurns = { readonly "type": "thinking_turns"; readonly "value": number }
1365export const BetaThinkingTurns = Schema.Struct({
1366 "type": Schema.Literal("thinking_turns").annotate({ "title": "Type" }),
1367 "value": Schema.Number.annotate({ "title": "Value" }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1))
1368}).annotate({ "title": "ThinkingTurns" })
1369export type BetaToolChoiceAny = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "any" }
1370export const BetaToolChoiceAny = Schema.Struct({
1371 "disable_parallel_tool_use": Schema.optionalKey(
1372 Schema.Boolean.annotate({
1373 "title": "Disable Parallel Tool Use",
1374 "description":
1375 "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use."
1376 })
1377 ),
1378 "type": Schema.Literal("any").annotate({ "title": "Type" })
1379}).annotate({ "title": "ToolChoiceAny", "description": "The model will use any available tools." })
1380export type BetaToolChoiceAuto = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "auto" }
1381export const BetaToolChoiceAuto = Schema.Struct({
1382 "disable_parallel_tool_use": Schema.optionalKey(
1383 Schema.Boolean.annotate({
1384 "title": "Disable Parallel Tool Use",
1385 "description":
1386 "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output at most one tool use."
1387 })
1388 ),
1389 "type": Schema.Literal("auto").annotate({ "title": "Type" })
1390}).annotate({ "title": "ToolChoiceAuto", "description": "The model will automatically decide whether to use tools." })
1391export type BetaToolChoiceNone = { readonly "type": "none" }
1392export const BetaToolChoiceNone = Schema.Struct({ "type": Schema.Literal("none").annotate({ "title": "Type" }) })
1393 .annotate({ "title": "ToolChoiceNone", "description": "The model will not be allowed to use tools." })
1394export type BetaToolChoiceTool = {
1395 readonly "disable_parallel_tool_use"?: boolean
1396 readonly "name": string
1397 readonly "type": "tool"
1398}
1399export const BetaToolChoiceTool = Schema.Struct({
1400 "disable_parallel_tool_use": Schema.optionalKey(
1401 Schema.Boolean.annotate({
1402 "title": "Disable Parallel Tool Use",
1403 "description":
1404 "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use."
1405 })
1406 ),
1407 "name": Schema.String.annotate({ "title": "Name", "description": "The name of the tool to use." }),
1408 "type": Schema.Literal("tool").annotate({ "title": "Type" })
1409}).annotate({
1410 "title": "ToolChoiceTool",
1411 "description": "The model will use the specified tool with `tool_choice.name`."
1412})
1413export type BetaToolSearchToolResultErrorCode =
1414 | "invalid_tool_input"
1415 | "unavailable"
1416 | "too_many_requests"
1417 | "execution_time_exceeded"
1418export const BetaToolSearchToolResultErrorCode = Schema.Literals([
1419 "invalid_tool_input",
1420 "unavailable",
1421 "too_many_requests",
1422 "execution_time_exceeded"
1423]).annotate({ "title": "ToolSearchToolResultErrorCode" })
1424export type BetaToolUsesKeep = { readonly "type": "tool_uses"; readonly "value": number }
1425export const BetaToolUsesKeep = Schema.Struct({
1426 "type": Schema.Literal("tool_uses").annotate({ "title": "Type" }),
1427 "value": Schema.Number.annotate({ "title": "Value" }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
1428}).annotate({ "title": "ToolUsesKeep" })
1429export type BetaToolUsesTrigger = { readonly "type": "tool_uses"; readonly "value": number }
1430export const BetaToolUsesTrigger = Schema.Struct({
1431 "type": Schema.Literal("tool_uses").annotate({ "title": "Type" }),
1432 "value": Schema.Number.annotate({ "title": "Value" }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1))
1433}).annotate({ "title": "ToolUsesTrigger" })
1434export type BetaURLImageSource = { readonly "type": "url"; readonly "url": string }
1435export const BetaURLImageSource = Schema.Struct({
1436 "type": Schema.Literal("url").annotate({ "title": "Type" }),
1437 "url": Schema.String.annotate({ "title": "Url" })
1438}).annotate({ "title": "URLImageSource" })
1439export type BetaURLPDFSource = { readonly "type": "url"; readonly "url": string }
1440export const BetaURLPDFSource = Schema.Struct({
1441 "type": Schema.Literal("url").annotate({ "title": "Type" }),
1442 "url": Schema.String.annotate({ "title": "Url" })
1443}).annotate({ "title": "URLPDFSource" })
1444export type BetaUserLocation = {
1445 readonly "city"?: string | null
1446 readonly "country"?: string | null
1447 readonly "region"?: string | null
1448 readonly "timezone"?: string | null
1449 readonly "type": "approximate"
1450}
1451export const BetaUserLocation = Schema.Struct({
1452 "city": Schema.optionalKey(
1453 Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({
1454 "title": "City",
1455 "description": "The city of the user."
1456 })
1457 ),
1458 "country": Schema.optionalKey(
1459 Schema.Union([Schema.String.check(Schema.isMinLength(2)).check(Schema.isMaxLength(2)), Schema.Null]).annotate({
1460 "title": "Country",
1461 "description": "The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user."
1462 })
1463 ),
1464 "region": Schema.optionalKey(
1465 Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({
1466 "title": "Region",
1467 "description": "The region of the user."
1468 })
1469 ),
1470 "timezone": Schema.optionalKey(
1471 Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({
1472 "title": "Timezone",
1473 "description": "The [IANA timezone](https://nodatime.org/TimeZones) of the user."
1474 })
1475 ),
1476 "type": Schema.Literal("approximate").annotate({ "title": "Type" })
1477}).annotate({ "title": "UserLocation" })
1478export type BetaWebFetchToolResultErrorCode =
1479 | "invalid_tool_input"
1480 | "url_too_long"
1481 | "url_not_allowed"
1482 | "url_not_accessible"
1483 | "unsupported_content_type"
1484 | "too_many_requests"
1485 | "max_uses_exceeded"
1486 | "unavailable"
1487export const BetaWebFetchToolResultErrorCode = Schema.Literals([
1488 "invalid_tool_input",
1489 "url_too_long",
1490 "url_not_allowed",
1491 "url_not_accessible",
1492 "unsupported_content_type",
1493 "too_many_requests",
1494 "max_uses_exceeded",
1495 "unavailable"
1496]).annotate({ "title": "WebFetchToolResultErrorCode" })
1497export type BetaWebSearchToolResultErrorCode =
1498 | "invalid_tool_input"
1499 | "unavailable"
1500 | "max_uses_exceeded"
1501 | "too_many_requests"
1502 | "query_too_long"
1503 | "request_too_large"
1504export const BetaWebSearchToolResultErrorCode = Schema.Literals([
1505 "invalid_tool_input",
1506 "unavailable",
1507 "max_uses_exceeded",
1508 "too_many_requests",
1509 "query_too_long",
1510 "request_too_large"
1511]).annotate({ "title": "WebSearchToolResultErrorCode" })
1512export type Betaapi__schemas__skills__Skill = {
1513 readonly "created_at": string
1514 readonly "display_title": string | null
1515 readonly "id": string
1516 readonly "latest_version": string | null
1517 readonly "source": string
1518 readonly "type": string
1519 readonly "updated_at": string
1520}
1521export const Betaapi__schemas__skills__Skill = Schema.Struct({
1522 "created_at": Schema.String.annotate({
1523 "title": "Created At",
1524 "description": "ISO 8601 timestamp of when the skill was created."
1525 }),
1526 "display_title": Schema.Union([Schema.String, Schema.Null]).annotate({
1527 "title": "Display Title",
1528 "description":
1529 "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model."
1530 }),
1531 "id": Schema.String.annotate({
1532 "title": "Id",
1533 "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time."
1534 }),
1535 "latest_version": Schema.Union([Schema.String, Schema.Null]).annotate({
1536 "title": "Latest Version",
1537 "description":
1538 "The latest version identifier for the skill.\n\nThis represents the most recent version of the skill that has been created."
1539 }),
1540 "source": Schema.String.annotate({
1541 "title": "Source",
1542 "description":
1543 "Source of the skill.\n\nThis may be one of the following values:\n* `\"custom\"`: the skill was created by a user\n* `\"anthropic\"`: the skill was created by Anthropic"
1544 }),
1545 "type": Schema.String.annotate({
1546 "title": "Type",
1547 "description": "Object type.\n\nFor Skills, this is always `\"skill\"`.",
1548 "default": "skill"
1549 }),
1550 "updated_at": Schema.String.annotate({
1551 "title": "Updated At",
1552 "description": "ISO 8601 timestamp of when the skill was last updated."
1553 })
1554}).annotate({ "title": "Skill" })
1555export type BillingError = { readonly "message": string; readonly "type": "billing_error" }
1556export const BillingError = Schema.Struct({
1557 "message": Schema.String.annotate({ "title": "Message", "default": "Billing error" }),
1558 "type": Schema.Literal("billing_error").annotate({ "title": "Type", "default": "billing_error" })
1559}).annotate({ "title": "BillingError" })
1560export type Body_create_skill_v1_skills_post = {
1561 readonly "display_title"?: string | null
1562 readonly "files"?: ReadonlyArray<string> | null
1563}
1564export const Body_create_skill_v1_skills_post = Schema.Struct({
1565 "display_title": Schema.optionalKey(
1566 Schema.Union([Schema.String, Schema.Null]).annotate({
1567 "title": "Display Title",
1568 "description":
1569 "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model."
1570 })
1571 ),
1572 "files": Schema.optionalKey(
1573 Schema.Union([Schema.Array(Schema.String.annotate({ "format": "binary" })), Schema.Null]).annotate({
1574 "title": "Files",
1575 "description":
1576 "Files to upload for the skill.\n\nAll files must be in the same top-level directory and must include a SKILL.md file at the root of that directory."
1577 })
1578 )
1579}).annotate({ "title": "Body_create_skill_v1_skills_post" })
1580export type Body_create_skill_version_v1_skills__skill_id__versions_post = {
1581 readonly "files"?: ReadonlyArray<string> | null
1582}
1583export const Body_create_skill_version_v1_skills__skill_id__versions_post = Schema.Struct({
1584 "files": Schema.optionalKey(
1585 Schema.Union([Schema.Array(Schema.String.annotate({ "format": "binary" })), Schema.Null]).annotate({
1586 "title": "Files",
1587 "description":
1588 "Files to upload for the skill.\n\nAll files must be in the same top-level directory and must include a SKILL.md file at the root of that directory."
1589 })
1590 )
1591}).annotate({ "title": "Body_create_skill_version_v1_skills__skill_id__versions_post" })
1592export type CacheControlEphemeral = { readonly "ttl"?: "5m" | "1h"; readonly "type": "ephemeral" }
1593export const CacheControlEphemeral = Schema.Struct({
1594 "ttl": Schema.optionalKey(
1595 Schema.Literals(["5m", "1h"]).annotate({
1596 "title": "Ttl",
1597 "description":
1598 "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`."
1599 })
1600 ),
1601 "type": Schema.Literal("ephemeral").annotate({ "title": "Type" })
1602}).annotate({ "title": "CacheControlEphemeral" })
1603export type CacheCreation = {
1604 readonly "ephemeral_1h_input_tokens": number
1605 readonly "ephemeral_5m_input_tokens": number
1606}
1607export const CacheCreation = Schema.Struct({
1608 "ephemeral_1h_input_tokens": Schema.Number.annotate({
1609 "title": "Ephemeral 1H Input Tokens",
1610 "description": "The number of input tokens used to create the 1 hour cache entry.",
1611 "default": 0
1612 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
1613 "ephemeral_5m_input_tokens": Schema.Number.annotate({
1614 "title": "Ephemeral 5M Input Tokens",
1615 "description": "The number of input tokens used to create the 5 minute cache entry.",
1616 "default": 0
1617 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
1618}).annotate({ "title": "CacheCreation" })
1619export type CanceledResult = { readonly "type": "canceled" }
1620export const CanceledResult = Schema.Struct({
1621 "type": Schema.Literal("canceled").annotate({ "title": "Type", "default": "canceled" })
1622}).annotate({ "title": "CanceledResult" })
1623export type CodeExecutionToolResultErrorCode =
1624 | "invalid_tool_input"
1625 | "unavailable"
1626 | "too_many_requests"
1627 | "execution_time_exceeded"
1628export const CodeExecutionToolResultErrorCode = Schema.Literals([
1629 "invalid_tool_input",
1630 "unavailable",
1631 "too_many_requests",
1632 "execution_time_exceeded"
1633]).annotate({ "title": "CodeExecutionToolResultErrorCode" })
1634export type Container = { readonly "expires_at": string; readonly "id": string }
1635export const Container = Schema.Struct({
1636 "expires_at": Schema.String.annotate({
1637 "title": "Expires At",
1638 "description": "The time at which the container will expire.",
1639 "format": "date-time"
1640 }),
1641 "id": Schema.String.annotate({ "title": "Id", "description": "Identifier for the container used in this request" })
1642}).annotate({
1643 "title": "Container",
1644 "description": "Information about the container used in the request (for the code execution tool)"
1645})
1646export type ContentBlockStopEvent = { readonly "index": number; readonly "type": "content_block_stop" }
1647export const ContentBlockStopEvent = Schema.Struct({
1648 "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()),
1649 "type": Schema.Literal("content_block_stop").annotate({ "title": "Type", "default": "content_block_stop" })
1650}).annotate({ "title": "ContentBlockStopEvent" })
1651export type CountMessageTokensResponse = { readonly "input_tokens": number }
1652export const CountMessageTokensResponse = Schema.Struct({
1653 "input_tokens": Schema.Number.annotate({
1654 "title": "Input Tokens",
1655 "description": "The total number of tokens across the provided list of messages, system prompt, and tools."
1656 }).check(Schema.isInt())
1657}).annotate({ "title": "CountMessageTokensResponse" })
1658export type CreateSkillResponse = {
1659 readonly "created_at": string
1660 readonly "display_title": string | null
1661 readonly "id": string
1662 readonly "latest_version": string | null
1663 readonly "source": string
1664 readonly "type": string
1665 readonly "updated_at": string
1666}
1667export const CreateSkillResponse = Schema.Struct({
1668 "created_at": Schema.String.annotate({
1669 "title": "Created At",
1670 "description": "ISO 8601 timestamp of when the skill was created."
1671 }),
1672 "display_title": Schema.Union([Schema.String, Schema.Null]).annotate({
1673 "title": "Display Title",
1674 "description":
1675 "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model."
1676 }),
1677 "id": Schema.String.annotate({
1678 "title": "Id",
1679 "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time."
1680 }),
1681 "latest_version": Schema.Union([Schema.String, Schema.Null]).annotate({
1682 "title": "Latest Version",
1683 "description":
1684 "The latest version identifier for the skill.\n\nThis represents the most recent version of the skill that has been created."
1685 }),
1686 "source": Schema.String.annotate({
1687 "title": "Source",
1688 "description":
1689 "Source of the skill.\n\nThis may be one of the following values:\n* `\"custom\"`: the skill was created by a user\n* `\"anthropic\"`: the skill was created by Anthropic"
1690 }),
1691 "type": Schema.String.annotate({
1692 "title": "Type",
1693 "description": "Object type.\n\nFor Skills, this is always `\"skill\"`.",
1694 "default": "skill"
1695 }),
1696 "updated_at": Schema.String.annotate({
1697 "title": "Updated At",
1698 "description": "ISO 8601 timestamp of when the skill was last updated."
1699 })
1700}).annotate({ "title": "CreateSkillResponse" })
1701export type CreateSkillVersionResponse = {
1702 readonly "created_at": string
1703 readonly "description": string
1704 readonly "directory": string
1705 readonly "id": string
1706 readonly "name": string
1707 readonly "skill_id": string
1708 readonly "type": string
1709 readonly "version": string
1710}
1711export const CreateSkillVersionResponse = Schema.Struct({
1712 "created_at": Schema.String.annotate({
1713 "title": "Created At",
1714 "description": "ISO 8601 timestamp of when the skill version was created."
1715 }),
1716 "description": Schema.String.annotate({
1717 "title": "Description",
1718 "description": "Description of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload."
1719 }),
1720 "directory": Schema.String.annotate({
1721 "title": "Directory",
1722 "description":
1723 "Directory name of the skill version.\n\nThis is the top-level directory name that was extracted from the uploaded files."
1724 }),
1725 "id": Schema.String.annotate({
1726 "title": "Id",
1727 "description": "Unique identifier for the skill version.\n\nThe format and length of IDs may change over time."
1728 }),
1729 "name": Schema.String.annotate({
1730 "title": "Name",
1731 "description":
1732 "Human-readable name of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload."
1733 }),
1734 "skill_id": Schema.String.annotate({
1735 "title": "Skill Id",
1736 "description": "Identifier for the skill that this version belongs to."
1737 }),
1738 "type": Schema.String.annotate({
1739 "title": "Type",
1740 "description": "Object type.\n\nFor Skill Versions, this is always `\"skill_version\"`.",
1741 "default": "skill_version"
1742 }),
1743 "version": Schema.String.annotate({
1744 "title": "Version",
1745 "description":
1746 "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")."
1747 })
1748}).annotate({ "title": "CreateSkillVersionResponse" })
1749export type DeleteMessageBatchResponse = { readonly "id": string; readonly "type": "message_batch_deleted" }
1750export const DeleteMessageBatchResponse = Schema.Struct({
1751 "id": Schema.String.annotate({ "title": "Id", "description": "ID of the Message Batch." }),
1752 "type": Schema.Literal("message_batch_deleted").annotate({
1753 "title": "Type",
1754 "description": "Deleted object type.\n\nFor Message Batches, this is always `\"message_batch_deleted\"`.",
1755 "default": "message_batch_deleted"
1756 })
1757}).annotate({ "title": "DeleteMessageBatchResponse" })
1758export type DeleteSkillResponse = { readonly "id": string; readonly "type": string }
1759export const DeleteSkillResponse = Schema.Struct({
1760 "id": Schema.String.annotate({
1761 "title": "Id",
1762 "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time."
1763 }),
1764 "type": Schema.String.annotate({
1765 "title": "Type",
1766 "description": "Deleted object type.\n\nFor Skills, this is always `\"skill_deleted\"`.",
1767 "default": "skill_deleted"
1768 })
1769}).annotate({ "title": "DeleteSkillResponse" })
1770export type DeleteSkillVersionResponse = { readonly "id": string; readonly "type": string }
1771export const DeleteSkillVersionResponse = Schema.Struct({
1772 "id": Schema.String.annotate({
1773 "title": "Id",
1774 "description":
1775 "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")."
1776 }),
1777 "type": Schema.String.annotate({
1778 "title": "Type",
1779 "description": "Deleted object type.\n\nFor Skill Versions, this is always `\"skill_version_deleted\"`.",
1780 "default": "skill_version_deleted"
1781 })
1782}).annotate({ "title": "DeleteSkillVersionResponse" })
1783export type DirectCaller = { readonly "type": "direct" }
1784export const DirectCaller = Schema.Struct({ "type": Schema.Literal("direct").annotate({ "title": "Type" }) }).annotate({
1785 "title": "DirectCaller",
1786 "description": "Tool invocation directly from the model."
1787})
1788export type EffortLevel = "low" | "medium" | "high" | "max"
1789export const EffortLevel = Schema.Literals(["low", "medium", "high", "max"]).annotate({
1790 "title": "EffortLevel",
1791 "description": "All possible effort levels."
1792})
1793export type ExpiredResult = { readonly "type": "expired" }
1794export const ExpiredResult = Schema.Struct({
1795 "type": Schema.Literal("expired").annotate({ "title": "Type", "default": "expired" })
1796}).annotate({ "title": "ExpiredResult" })
1797export type FileDeleteResponse = { readonly "id": string; readonly "type"?: "file_deleted" }
1798export const FileDeleteResponse = Schema.Struct({
1799 "id": Schema.String.annotate({ "title": "Id", "description": "ID of the deleted file." }),
1800 "type": Schema.optionalKey(
1801 Schema.Literal("file_deleted").annotate({
1802 "title": "Type",
1803 "description": "Deleted object type.\n\nFor file deletion, this is always `\"file_deleted\"`.",
1804 "default": "file_deleted"
1805 })
1806 )
1807}).annotate({ "title": "FileDeleteResponse" })
1808export type FileMetadataSchema = {
1809 readonly "created_at": string
1810 readonly "downloadable"?: boolean
1811 readonly "filename": string
1812 readonly "id": string
1813 readonly "mime_type": string
1814 readonly "size_bytes": number
1815 readonly "type": "file"
1816}
1817export const FileMetadataSchema = Schema.Struct({
1818 "created_at": Schema.String.annotate({
1819 "title": "Created At",
1820 "description": "RFC 3339 datetime string representing when the file was created.",
1821 "format": "date-time"
1822 }),
1823 "downloadable": Schema.optionalKey(
1824 Schema.Boolean.annotate({
1825 "title": "Downloadable",
1826 "description": "Whether the file can be downloaded.",
1827 "default": false
1828 })
1829 ),
1830 "filename": Schema.String.annotate({ "title": "Filename", "description": "Original filename of the uploaded file." })
1831 .check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)),
1832 "id": Schema.String.annotate({
1833 "title": "Id",
1834 "description": "Unique object identifier.\n\nThe format and length of IDs may change over time."
1835 }),
1836 "mime_type": Schema.String.annotate({ "title": "Mime Type", "description": "MIME type of the file." }).check(
1837 Schema.isMinLength(1)
1838 ).check(Schema.isMaxLength(255)),
1839 "size_bytes": Schema.Number.annotate({ "title": "Size Bytes", "description": "Size of the file in bytes." }).check(
1840 Schema.isInt()
1841 ).check(Schema.isGreaterThanOrEqualTo(0)),
1842 "type": Schema.Literal("file").annotate({
1843 "title": "Type",
1844 "description": "Object type.\n\nFor files, this is always `\"file\"`."
1845 })
1846}).annotate({ "title": "FileMetadataSchema" })
1847export type GatewayTimeoutError = { readonly "message": string; readonly "type": "timeout_error" }
1848export const GatewayTimeoutError = Schema.Struct({
1849 "message": Schema.String.annotate({ "title": "Message", "default": "Request timeout" }),
1850 "type": Schema.Literal("timeout_error").annotate({ "title": "Type", "default": "timeout_error" })
1851}).annotate({ "title": "GatewayTimeoutError" })
1852export type GetSkillResponse = {
1853 readonly "created_at": string
1854 readonly "display_title": string | null
1855 readonly "id": string
1856 readonly "latest_version": string | null
1857 readonly "source": string
1858 readonly "type": string
1859 readonly "updated_at": string
1860}
1861export const GetSkillResponse = Schema.Struct({
1862 "created_at": Schema.String.annotate({
1863 "title": "Created At",
1864 "description": "ISO 8601 timestamp of when the skill was created."
1865 }),
1866 "display_title": Schema.Union([Schema.String, Schema.Null]).annotate({
1867 "title": "Display Title",
1868 "description":
1869 "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model."
1870 }),
1871 "id": Schema.String.annotate({
1872 "title": "Id",
1873 "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time."
1874 }),
1875 "latest_version": Schema.Union([Schema.String, Schema.Null]).annotate({
1876 "title": "Latest Version",
1877 "description":
1878 "The latest version identifier for the skill.\n\nThis represents the most recent version of the skill that has been created."
1879 }),
1880 "source": Schema.String.annotate({
1881 "title": "Source",
1882 "description":
1883 "Source of the skill.\n\nThis may be one of the following values:\n* `\"custom\"`: the skill was created by a user\n* `\"anthropic\"`: the skill was created by Anthropic"
1884 }),
1885 "type": Schema.String.annotate({
1886 "title": "Type",
1887 "description": "Object type.\n\nFor Skills, this is always `\"skill\"`.",
1888 "default": "skill"
1889 }),
1890 "updated_at": Schema.String.annotate({
1891 "title": "Updated At",
1892 "description": "ISO 8601 timestamp of when the skill was last updated."
1893 })
1894}).annotate({ "title": "GetSkillResponse" })
1895export type GetSkillVersionResponse = {
1896 readonly "created_at": string
1897 readonly "description": string
1898 readonly "directory": string
1899 readonly "id": string
1900 readonly "name": string
1901 readonly "skill_id": string
1902 readonly "type": string
1903 readonly "version": string
1904}
1905export const GetSkillVersionResponse = Schema.Struct({
1906 "created_at": Schema.String.annotate({
1907 "title": "Created At",
1908 "description": "ISO 8601 timestamp of when the skill version was created."
1909 }),
1910 "description": Schema.String.annotate({
1911 "title": "Description",
1912 "description": "Description of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload."
1913 }),
1914 "directory": Schema.String.annotate({
1915 "title": "Directory",
1916 "description":
1917 "Directory name of the skill version.\n\nThis is the top-level directory name that was extracted from the uploaded files."
1918 }),
1919 "id": Schema.String.annotate({
1920 "title": "Id",
1921 "description": "Unique identifier for the skill version.\n\nThe format and length of IDs may change over time."
1922 }),
1923 "name": Schema.String.annotate({
1924 "title": "Name",
1925 "description":
1926 "Human-readable name of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload."
1927 }),
1928 "skill_id": Schema.String.annotate({
1929 "title": "Skill Id",
1930 "description": "Identifier for the skill that this version belongs to."
1931 }),
1932 "type": Schema.String.annotate({
1933 "title": "Type",
1934 "description": "Object type.\n\nFor Skill Versions, this is always `\"skill_version\"`.",
1935 "default": "skill_version"
1936 }),
1937 "version": Schema.String.annotate({
1938 "title": "Version",
1939 "description":
1940 "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")."
1941 })
1942}).annotate({ "title": "GetSkillVersionResponse" })
1943export type InputJsonContentBlockDelta = { readonly "partial_json": string; readonly "type": "input_json_delta" }
1944export const InputJsonContentBlockDelta = Schema.Struct({
1945 "partial_json": Schema.String.annotate({ "title": "Partial Json" }),
1946 "type": Schema.Literal("input_json_delta").annotate({ "title": "Type", "default": "input_json_delta" })
1947}).annotate({ "title": "InputJsonContentBlockDelta" })
1948export type InvalidRequestError = { readonly "message": string; readonly "type": "invalid_request_error" }
1949export const InvalidRequestError = Schema.Struct({
1950 "message": Schema.String.annotate({ "title": "Message", "default": "Invalid request" }),
1951 "type": Schema.Literal("invalid_request_error").annotate({ "title": "Type", "default": "invalid_request_error" })
1952}).annotate({ "title": "InvalidRequestError" })
1953export type JsonOutputFormat = {
1954 readonly "schema": { readonly [x: string]: Schema.Json }
1955 readonly "type": "json_schema"
1956}
1957export const JsonOutputFormat = Schema.Struct({
1958 "schema": Schema.Record(Schema.String, Schema.Json).annotate({
1959 "title": "Schema",
1960 "description": "The JSON schema of the format"
1961 }),
1962 "type": Schema.Literal("json_schema").annotate({ "title": "Type" })
1963}).annotate({ "title": "JsonOutputFormat" })
1964export type JsonValue = unknown
1965export const JsonValue = Schema.Unknown
1966export type MessageBatch = {
1967 readonly "archived_at": string | null
1968 readonly "cancel_initiated_at": string | null
1969 readonly "created_at": string
1970 readonly "ended_at": string | null
1971 readonly "expires_at": string
1972 readonly "id": string
1973 readonly "processing_status": "in_progress" | "canceling" | "ended"
1974 readonly "request_counts": {
1975 readonly "canceled": number
1976 readonly "errored": number
1977 readonly "expired": number
1978 readonly "processing": number
1979 readonly "succeeded": number
1980 }
1981 readonly "results_url": string | null
1982 readonly "type": "message_batch"
1983}
1984export const MessageBatch = Schema.Struct({
1985 "archived_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({
1986 "title": "Archived At",
1987 "description":
1988 "RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable."
1989 }),
1990 "cancel_initiated_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({
1991 "title": "Cancel Initiated At",
1992 "description":
1993 "RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated."
1994 }),
1995 "created_at": Schema.String.annotate({
1996 "title": "Created At",
1997 "description": "RFC 3339 datetime string representing the time at which the Message Batch was created.",
1998 "format": "date-time"
1999 }),
2000 "ended_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({
2001 "title": "Ended At",
2002 "description":
2003 "RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.\n\nProcessing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired."
2004 }),
2005 "expires_at": Schema.String.annotate({
2006 "title": "Expires At",
2007 "description":
2008 "RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.",
2009 "format": "date-time"
2010 }),
2011 "id": Schema.String.annotate({
2012 "title": "Id",
2013 "description": "Unique object identifier.\n\nThe format and length of IDs may change over time."
2014 }),
2015 "processing_status": Schema.Literals(["in_progress", "canceling", "ended"]).annotate({
2016 "title": "Processing Status",
2017 "description": "Processing status of the Message Batch."
2018 }),
2019 "request_counts": Schema.Struct({
2020 "canceled": Schema.Number.annotate({
2021 "title": "Canceled",
2022 "description":
2023 "Number of requests in the Message Batch that have been canceled.\n\nThis is zero until processing of the entire Message Batch has ended.",
2024 "default": 0
2025 }).check(Schema.isInt()),
2026 "errored": Schema.Number.annotate({
2027 "title": "Errored",
2028 "description":
2029 "Number of requests in the Message Batch that encountered an error.\n\nThis is zero until processing of the entire Message Batch has ended.",
2030 "default": 0
2031 }).check(Schema.isInt()),
2032 "expired": Schema.Number.annotate({
2033 "title": "Expired",
2034 "description":
2035 "Number of requests in the Message Batch that have expired.\n\nThis is zero until processing of the entire Message Batch has ended.",
2036 "default": 0
2037 }).check(Schema.isInt()),
2038 "processing": Schema.Number.annotate({
2039 "title": "Processing",
2040 "description": "Number of requests in the Message Batch that are processing.",
2041 "default": 0
2042 }).check(Schema.isInt()),
2043 "succeeded": Schema.Number.annotate({
2044 "title": "Succeeded",
2045 "description":
2046 "Number of requests in the Message Batch that have completed successfully.\n\nThis is zero until processing of the entire Message Batch has ended.",
2047 "default": 0
2048 }).check(Schema.isInt())
2049 }).annotate({
2050 "title": "RequestCounts",
2051 "description":
2052 "Tallies requests within the Message Batch, categorized by their status.\n\nRequests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch."
2053 }),
2054 "results_url": Schema.Union([Schema.String, Schema.Null]).annotate({
2055 "title": "Results Url",
2056 "description":
2057 "URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.\n\nResults in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests."
2058 }),
2059 "type": Schema.Literal("message_batch").annotate({
2060 "title": "Type",
2061 "description": "Object type.\n\nFor Message Batches, this is always `\"message_batch\"`.",
2062 "default": "message_batch"
2063 })
2064}).annotate({ "title": "MessageBatch" })
2065export type MessageStopEvent = { readonly "type": "message_stop" }
2066export const MessageStopEvent = Schema.Struct({
2067 "type": Schema.Literal("message_stop").annotate({ "title": "Type", "default": "message_stop" })
2068}).annotate({ "title": "MessageStopEvent" })
2069export type ModelInfo = {
2070 readonly "created_at": string
2071 readonly "display_name": string
2072 readonly "id": string
2073 readonly "type": "model"
2074}
2075export const ModelInfo = Schema.Struct({
2076 "created_at": Schema.String.annotate({
2077 "title": "Created At",
2078 "description":
2079 "RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.",
2080 "format": "date-time"
2081 }),
2082 "display_name": Schema.String.annotate({
2083 "title": "Display Name",
2084 "description": "A human-readable name for the model."
2085 }),
2086 "id": Schema.String.annotate({ "title": "Id", "description": "Unique model identifier." }),
2087 "type": Schema.Literal("model").annotate({
2088 "title": "Type",
2089 "description": "Object type.\n\nFor Models, this is always `\"model\"`.",
2090 "default": "model"
2091 })
2092}).annotate({ "title": "ModelInfo" })
2093export type NotFoundError = { readonly "message": string; readonly "type": "not_found_error" }
2094export const NotFoundError = Schema.Struct({
2095 "message": Schema.String.annotate({ "title": "Message", "default": "Not found" }),
2096 "type": Schema.Literal("not_found_error").annotate({ "title": "Type", "default": "not_found_error" })
2097}).annotate({ "title": "NotFoundError" })
2098export type OverloadedError = { readonly "message": string; readonly "type": "overloaded_error" }
2099export const OverloadedError = Schema.Struct({
2100 "message": Schema.String.annotate({ "title": "Message", "default": "Overloaded" }),
2101 "type": Schema.Literal("overloaded_error").annotate({ "title": "Type", "default": "overloaded_error" })
2102}).annotate({ "title": "OverloadedError" })
2103export type PermissionError = { readonly "message": string; readonly "type": "permission_error" }
2104export const PermissionError = Schema.Struct({
2105 "message": Schema.String.annotate({ "title": "Message", "default": "Permission denied" }),
2106 "type": Schema.Literal("permission_error").annotate({ "title": "Type", "default": "permission_error" })
2107}).annotate({ "title": "PermissionError" })
2108export type PlainTextSource = { readonly "data": string; readonly "media_type": "text/plain"; readonly "type": "text" }
2109export const PlainTextSource = Schema.Struct({
2110 "data": Schema.String.annotate({ "title": "Data" }),
2111 "media_type": Schema.Literal("text/plain").annotate({ "title": "Media Type" }),
2112 "type": Schema.Literal("text").annotate({ "title": "Type" })
2113}).annotate({ "title": "PlainTextSource" })
2114export type RateLimitError = { readonly "message": string; readonly "type": "rate_limit_error" }
2115export const RateLimitError = Schema.Struct({
2116 "message": Schema.String.annotate({ "title": "Message", "default": "Rate limited" }),
2117 "type": Schema.Literal("rate_limit_error").annotate({ "title": "Type", "default": "rate_limit_error" })
2118}).annotate({ "title": "RateLimitError" })
2119export type RequestBashCodeExecutionOutputBlock = {
2120 readonly "file_id": string
2121 readonly "type": "bash_code_execution_output"
2122}
2123export const RequestBashCodeExecutionOutputBlock = Schema.Struct({
2124 "file_id": Schema.String.annotate({ "title": "File Id" }),
2125 "type": Schema.Literal("bash_code_execution_output").annotate({ "title": "Type" })
2126}).annotate({ "title": "RequestBashCodeExecutionOutputBlock" })
2127export type RequestCharLocationCitation = {
2128 readonly "cited_text": string
2129 readonly "document_index": number
2130 readonly "document_title": string | null
2131 readonly "end_char_index": number
2132 readonly "start_char_index": number
2133 readonly "type": "char_location"
2134}
2135export const RequestCharLocationCitation = Schema.Struct({
2136 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
2137 "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check(
2138 Schema.isGreaterThanOrEqualTo(0)
2139 ),
2140 "document_title": Schema.Union([
2141 Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)),
2142 Schema.Null
2143 ]).annotate({ "title": "Document Title" }),
2144 "end_char_index": Schema.Number.annotate({ "title": "End Char Index" }).check(Schema.isInt()),
2145 "start_char_index": Schema.Number.annotate({ "title": "Start Char Index" }).check(Schema.isInt()).check(
2146 Schema.isGreaterThanOrEqualTo(0)
2147 ),
2148 "type": Schema.Literal("char_location").annotate({ "title": "Type" })
2149}).annotate({ "title": "RequestCharLocationCitation" })
2150export type RequestCitationsConfig = { readonly "enabled"?: boolean }
2151export const RequestCitationsConfig = Schema.Struct({
2152 "enabled": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Enabled" }))
2153}).annotate({ "title": "RequestCitationsConfig" })
2154export type RequestCodeExecutionOutputBlock = { readonly "file_id": string; readonly "type": "code_execution_output" }
2155export const RequestCodeExecutionOutputBlock = Schema.Struct({
2156 "file_id": Schema.String.annotate({ "title": "File Id" }),
2157 "type": Schema.Literal("code_execution_output").annotate({ "title": "Type" })
2158}).annotate({ "title": "RequestCodeExecutionOutputBlock" })
2159export type RequestContentBlockLocationCitation = {
2160 readonly "cited_text": string
2161 readonly "document_index": number
2162 readonly "document_title": string | null
2163 readonly "end_block_index": number
2164 readonly "start_block_index": number
2165 readonly "type": "content_block_location"
2166}
2167export const RequestContentBlockLocationCitation = Schema.Struct({
2168 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
2169 "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check(
2170 Schema.isGreaterThanOrEqualTo(0)
2171 ),
2172 "document_title": Schema.Union([
2173 Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)),
2174 Schema.Null
2175 ]).annotate({ "title": "Document Title" }),
2176 "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()),
2177 "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check(
2178 Schema.isGreaterThanOrEqualTo(0)
2179 ),
2180 "type": Schema.Literal("content_block_location").annotate({ "title": "Type" })
2181}).annotate({ "title": "RequestContentBlockLocationCitation" })
2182export type RequestPageLocationCitation = {
2183 readonly "cited_text": string
2184 readonly "document_index": number
2185 readonly "document_title": string | null
2186 readonly "end_page_number": number
2187 readonly "start_page_number": number
2188 readonly "type": "page_location"
2189}
2190export const RequestPageLocationCitation = Schema.Struct({
2191 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
2192 "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check(
2193 Schema.isGreaterThanOrEqualTo(0)
2194 ),
2195 "document_title": Schema.Union([
2196 Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)),
2197 Schema.Null
2198 ]).annotate({ "title": "Document Title" }),
2199 "end_page_number": Schema.Number.annotate({ "title": "End Page Number" }).check(Schema.isInt()),
2200 "start_page_number": Schema.Number.annotate({ "title": "Start Page Number" }).check(Schema.isInt()).check(
2201 Schema.isGreaterThanOrEqualTo(1)
2202 ),
2203 "type": Schema.Literal("page_location").annotate({ "title": "Type" })
2204}).annotate({ "title": "RequestPageLocationCitation" })
2205export type RequestSearchResultLocationCitation = {
2206 readonly "cited_text": string
2207 readonly "end_block_index": number
2208 readonly "search_result_index": number
2209 readonly "source": string
2210 readonly "start_block_index": number
2211 readonly "title": string | null
2212 readonly "type": "search_result_location"
2213}
2214export const RequestSearchResultLocationCitation = Schema.Struct({
2215 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
2216 "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()),
2217 "search_result_index": Schema.Number.annotate({ "title": "Search Result Index" }).check(Schema.isInt()).check(
2218 Schema.isGreaterThanOrEqualTo(0)
2219 ),
2220 "source": Schema.String.annotate({ "title": "Source" }),
2221 "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check(
2222 Schema.isGreaterThanOrEqualTo(0)
2223 ),
2224 "title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Title" }),
2225 "type": Schema.Literal("search_result_location").annotate({ "title": "Type" })
2226}).annotate({ "title": "RequestSearchResultLocationCitation" })
2227export type RequestTextEditorCodeExecutionCreateResultBlock = {
2228 readonly "is_file_update": boolean
2229 readonly "type": "text_editor_code_execution_create_result"
2230}
2231export const RequestTextEditorCodeExecutionCreateResultBlock = Schema.Struct({
2232 "is_file_update": Schema.Boolean.annotate({ "title": "Is File Update" }),
2233 "type": Schema.Literal("text_editor_code_execution_create_result").annotate({ "title": "Type" })
2234}).annotate({ "title": "RequestTextEditorCodeExecutionCreateResultBlock" })
2235export type RequestTextEditorCodeExecutionStrReplaceResultBlock = {
2236 readonly "lines"?: ReadonlyArray<string> | null
2237 readonly "new_lines"?: number | null
2238 readonly "new_start"?: number | null
2239 readonly "old_lines"?: number | null
2240 readonly "old_start"?: number | null
2241 readonly "type": "text_editor_code_execution_str_replace_result"
2242}
2243export const RequestTextEditorCodeExecutionStrReplaceResultBlock = Schema.Struct({
2244 "lines": Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Lines" })),
2245 "new_lines": Schema.optionalKey(
2246 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "New Lines" })
2247 ),
2248 "new_start": Schema.optionalKey(
2249 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "New Start" })
2250 ),
2251 "old_lines": Schema.optionalKey(
2252 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Old Lines" })
2253 ),
2254 "old_start": Schema.optionalKey(
2255 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Old Start" })
2256 ),
2257 "type": Schema.Literal("text_editor_code_execution_str_replace_result").annotate({ "title": "Type" })
2258}).annotate({ "title": "RequestTextEditorCodeExecutionStrReplaceResultBlock" })
2259export type RequestTextEditorCodeExecutionViewResultBlock = {
2260 readonly "content": string
2261 readonly "file_type": "text" | "image" | "pdf"
2262 readonly "num_lines"?: number | null
2263 readonly "start_line"?: number | null
2264 readonly "total_lines"?: number | null
2265 readonly "type": "text_editor_code_execution_view_result"
2266}
2267export const RequestTextEditorCodeExecutionViewResultBlock = Schema.Struct({
2268 "content": Schema.String.annotate({ "title": "Content" }),
2269 "file_type": Schema.Literals(["text", "image", "pdf"]).annotate({ "title": "File Type" }),
2270 "num_lines": Schema.optionalKey(
2271 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Num Lines" })
2272 ),
2273 "start_line": Schema.optionalKey(
2274 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Start Line" })
2275 ),
2276 "total_lines": Schema.optionalKey(
2277 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Total Lines" })
2278 ),
2279 "type": Schema.Literal("text_editor_code_execution_view_result").annotate({ "title": "Type" })
2280}).annotate({ "title": "RequestTextEditorCodeExecutionViewResultBlock" })
2281export type RequestWebSearchResultBlock = {
2282 readonly "encrypted_content": string
2283 readonly "page_age"?: string | null
2284 readonly "title": string
2285 readonly "type": "web_search_result"
2286 readonly "url": string
2287}
2288export const RequestWebSearchResultBlock = Schema.Struct({
2289 "encrypted_content": Schema.String.annotate({ "title": "Encrypted Content" }),
2290 "page_age": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Page Age" })),
2291 "title": Schema.String.annotate({ "title": "Title" }),
2292 "type": Schema.Literal("web_search_result").annotate({ "title": "Type" }),
2293 "url": Schema.String.annotate({ "title": "Url" })
2294}).annotate({ "title": "RequestWebSearchResultBlock" })
2295export type RequestWebSearchResultLocationCitation = {
2296 readonly "cited_text": string
2297 readonly "encrypted_index": string
2298 readonly "title": string | null
2299 readonly "type": "web_search_result_location"
2300 readonly "url": string
2301}
2302export const RequestWebSearchResultLocationCitation = Schema.Struct({
2303 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
2304 "encrypted_index": Schema.String.annotate({ "title": "Encrypted Index" }),
2305 "title": Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(512)), Schema.Null])
2306 .annotate({ "title": "Title" }),
2307 "type": Schema.Literal("web_search_result_location").annotate({ "title": "Type" }),
2308 "url": Schema.String.annotate({ "title": "Url" }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2048))
2309}).annotate({ "title": "RequestWebSearchResultLocationCitation" })
2310export type ResponseBashCodeExecutionOutputBlock = {
2311 readonly "file_id": string
2312 readonly "type": "bash_code_execution_output"
2313}
2314export const ResponseBashCodeExecutionOutputBlock = Schema.Struct({
2315 "file_id": Schema.String.annotate({ "title": "File Id" }),
2316 "type": Schema.Literal("bash_code_execution_output").annotate({
2317 "title": "Type",
2318 "default": "bash_code_execution_output"
2319 })
2320}).annotate({ "title": "ResponseBashCodeExecutionOutputBlock" })
2321export type ResponseCharLocationCitation = {
2322 readonly "cited_text": string
2323 readonly "document_index": number
2324 readonly "document_title": string | null
2325 readonly "end_char_index": number
2326 readonly "file_id": string | null
2327 readonly "start_char_index": number
2328 readonly "type": "char_location"
2329}
2330export const ResponseCharLocationCitation = Schema.Struct({
2331 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
2332 "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check(
2333 Schema.isGreaterThanOrEqualTo(0)
2334 ),
2335 "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }),
2336 "end_char_index": Schema.Number.annotate({ "title": "End Char Index" }).check(Schema.isInt()),
2337 "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }),
2338 "start_char_index": Schema.Number.annotate({ "title": "Start Char Index" }).check(Schema.isInt()).check(
2339 Schema.isGreaterThanOrEqualTo(0)
2340 ),
2341 "type": Schema.Literal("char_location").annotate({ "title": "Type", "default": "char_location" })
2342}).annotate({ "title": "ResponseCharLocationCitation" })
2343export type ResponseCitationsConfig = { readonly "enabled": boolean }
2344export const ResponseCitationsConfig = Schema.Struct({
2345 "enabled": Schema.Boolean.annotate({ "title": "Enabled", "default": false })
2346}).annotate({ "title": "ResponseCitationsConfig" })
2347export type ResponseCodeExecutionOutputBlock = { readonly "file_id": string; readonly "type": "code_execution_output" }
2348export const ResponseCodeExecutionOutputBlock = Schema.Struct({
2349 "file_id": Schema.String.annotate({ "title": "File Id" }),
2350 "type": Schema.Literal("code_execution_output").annotate({ "title": "Type", "default": "code_execution_output" })
2351}).annotate({ "title": "ResponseCodeExecutionOutputBlock" })
2352export type ResponseContainerUploadBlock = { readonly "file_id": string; readonly "type": "container_upload" }
2353export const ResponseContainerUploadBlock = Schema.Struct({
2354 "file_id": Schema.String.annotate({ "title": "File Id" }),
2355 "type": Schema.Literal("container_upload").annotate({ "title": "Type", "default": "container_upload" })
2356}).annotate({
2357 "title": "ResponseContainerUploadBlock",
2358 "description": "Response model for a file uploaded to the container."
2359})
2360export type ResponseContentBlockLocationCitation = {
2361 readonly "cited_text": string
2362 readonly "document_index": number
2363 readonly "document_title": string | null
2364 readonly "end_block_index": number
2365 readonly "file_id": string | null
2366 readonly "start_block_index": number
2367 readonly "type": "content_block_location"
2368}
2369export const ResponseContentBlockLocationCitation = Schema.Struct({
2370 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
2371 "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check(
2372 Schema.isGreaterThanOrEqualTo(0)
2373 ),
2374 "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }),
2375 "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()),
2376 "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }),
2377 "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check(
2378 Schema.isGreaterThanOrEqualTo(0)
2379 ),
2380 "type": Schema.Literal("content_block_location").annotate({ "title": "Type", "default": "content_block_location" })
2381}).annotate({ "title": "ResponseContentBlockLocationCitation" })
2382export type ResponsePageLocationCitation = {
2383 readonly "cited_text": string
2384 readonly "document_index": number
2385 readonly "document_title": string | null
2386 readonly "end_page_number": number
2387 readonly "file_id": string | null
2388 readonly "start_page_number": number
2389 readonly "type": "page_location"
2390}
2391export const ResponsePageLocationCitation = Schema.Struct({
2392 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
2393 "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check(
2394 Schema.isGreaterThanOrEqualTo(0)
2395 ),
2396 "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }),
2397 "end_page_number": Schema.Number.annotate({ "title": "End Page Number" }).check(Schema.isInt()),
2398 "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }),
2399 "start_page_number": Schema.Number.annotate({ "title": "Start Page Number" }).check(Schema.isInt()).check(
2400 Schema.isGreaterThanOrEqualTo(1)
2401 ),
2402 "type": Schema.Literal("page_location").annotate({ "title": "Type", "default": "page_location" })
2403}).annotate({ "title": "ResponsePageLocationCitation" })
2404export type ResponseRedactedThinkingBlock = { readonly "data": string; readonly "type": "redacted_thinking" }
2405export const ResponseRedactedThinkingBlock = Schema.Struct({
2406 "data": Schema.String.annotate({ "title": "Data" }),
2407 "type": Schema.Literal("redacted_thinking").annotate({ "title": "Type", "default": "redacted_thinking" })
2408}).annotate({ "title": "ResponseRedactedThinkingBlock" })
2409export type ResponseSearchResultLocationCitation = {
2410 readonly "cited_text": string
2411 readonly "end_block_index": number
2412 readonly "search_result_index": number
2413 readonly "source": string
2414 readonly "start_block_index": number
2415 readonly "title": string | null
2416 readonly "type": "search_result_location"
2417}
2418export const ResponseSearchResultLocationCitation = Schema.Struct({
2419 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
2420 "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()),
2421 "search_result_index": Schema.Number.annotate({ "title": "Search Result Index" }).check(Schema.isInt()).check(
2422 Schema.isGreaterThanOrEqualTo(0)
2423 ),
2424 "source": Schema.String.annotate({ "title": "Source" }),
2425 "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check(
2426 Schema.isGreaterThanOrEqualTo(0)
2427 ),
2428 "title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Title" }),
2429 "type": Schema.Literal("search_result_location").annotate({ "title": "Type", "default": "search_result_location" })
2430}).annotate({ "title": "ResponseSearchResultLocationCitation" })
2431export type ResponseTextEditorCodeExecutionCreateResultBlock = {
2432 readonly "is_file_update": boolean
2433 readonly "type": "text_editor_code_execution_create_result"
2434}
2435export const ResponseTextEditorCodeExecutionCreateResultBlock = Schema.Struct({
2436 "is_file_update": Schema.Boolean.annotate({ "title": "Is File Update" }),
2437 "type": Schema.Literal("text_editor_code_execution_create_result").annotate({
2438 "title": "Type",
2439 "default": "text_editor_code_execution_create_result"
2440 })
2441}).annotate({ "title": "ResponseTextEditorCodeExecutionCreateResultBlock" })
2442export type ResponseTextEditorCodeExecutionStrReplaceResultBlock = {
2443 readonly "lines": ReadonlyArray<string> | null
2444 readonly "new_lines": number | null
2445 readonly "new_start": number | null
2446 readonly "old_lines": number | null
2447 readonly "old_start": number | null
2448 readonly "type": "text_editor_code_execution_str_replace_result"
2449}
2450export const ResponseTextEditorCodeExecutionStrReplaceResultBlock = Schema.Struct({
2451 "lines": Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Lines", "default": null }),
2452 "new_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
2453 "title": "New Lines",
2454 "default": null
2455 }),
2456 "new_start": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
2457 "title": "New Start",
2458 "default": null
2459 }),
2460 "old_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
2461 "title": "Old Lines",
2462 "default": null
2463 }),
2464 "old_start": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
2465 "title": "Old Start",
2466 "default": null
2467 }),
2468 "type": Schema.Literal("text_editor_code_execution_str_replace_result").annotate({
2469 "title": "Type",
2470 "default": "text_editor_code_execution_str_replace_result"
2471 })
2472}).annotate({ "title": "ResponseTextEditorCodeExecutionStrReplaceResultBlock" })
2473export type ResponseTextEditorCodeExecutionViewResultBlock = {
2474 readonly "content": string
2475 readonly "file_type": "text" | "image" | "pdf"
2476 readonly "num_lines": number | null
2477 readonly "start_line": number | null
2478 readonly "total_lines": number | null
2479 readonly "type": "text_editor_code_execution_view_result"
2480}
2481export const ResponseTextEditorCodeExecutionViewResultBlock = Schema.Struct({
2482 "content": Schema.String.annotate({ "title": "Content" }),
2483 "file_type": Schema.Literals(["text", "image", "pdf"]).annotate({ "title": "File Type" }),
2484 "num_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
2485 "title": "Num Lines",
2486 "default": null
2487 }),
2488 "start_line": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
2489 "title": "Start Line",
2490 "default": null
2491 }),
2492 "total_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
2493 "title": "Total Lines",
2494 "default": null
2495 }),
2496 "type": Schema.Literal("text_editor_code_execution_view_result").annotate({
2497 "title": "Type",
2498 "default": "text_editor_code_execution_view_result"
2499 })
2500}).annotate({ "title": "ResponseTextEditorCodeExecutionViewResultBlock" })
2501export type ResponseThinkingBlock = {
2502 readonly "signature": string
2503 readonly "thinking": string
2504 readonly "type": "thinking"
2505}
2506export const ResponseThinkingBlock = Schema.Struct({
2507 "signature": Schema.String.annotate({ "title": "Signature" }),
2508 "thinking": Schema.String.annotate({ "title": "Thinking" }),
2509 "type": Schema.Literal("thinking").annotate({ "title": "Type", "default": "thinking" })
2510}).annotate({ "title": "ResponseThinkingBlock" })
2511export type ResponseToolReferenceBlock = { readonly "tool_name": string; readonly "type": "tool_reference" }
2512export const ResponseToolReferenceBlock = Schema.Struct({
2513 "tool_name": Schema.String.annotate({ "title": "Tool Name" }).check(Schema.isMinLength(1)).check(
2514 Schema.isMaxLength(256)
2515 ).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,256}$"))),
2516 "type": Schema.Literal("tool_reference").annotate({ "title": "Type", "default": "tool_reference" })
2517}).annotate({ "title": "ResponseToolReferenceBlock" })
2518export type ResponseWebSearchResultBlock = {
2519 readonly "encrypted_content": string
2520 readonly "page_age": string | null
2521 readonly "title": string
2522 readonly "type": "web_search_result"
2523 readonly "url": string
2524}
2525export const ResponseWebSearchResultBlock = Schema.Struct({
2526 "encrypted_content": Schema.String.annotate({ "title": "Encrypted Content" }),
2527 "page_age": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Page Age", "default": null }),
2528 "title": Schema.String.annotate({ "title": "Title" }),
2529 "type": Schema.Literal("web_search_result").annotate({ "title": "Type", "default": "web_search_result" }),
2530 "url": Schema.String.annotate({ "title": "Url" })
2531}).annotate({ "title": "ResponseWebSearchResultBlock" })
2532export type ResponseWebSearchResultLocationCitation = {
2533 readonly "cited_text": string
2534 readonly "encrypted_index": string
2535 readonly "title": string | null
2536 readonly "type": "web_search_result_location"
2537 readonly "url": string
2538}
2539export const ResponseWebSearchResultLocationCitation = Schema.Struct({
2540 "cited_text": Schema.String.annotate({ "title": "Cited Text" }),
2541 "encrypted_index": Schema.String.annotate({ "title": "Encrypted Index" }),
2542 "title": Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ "title": "Title" }),
2543 "type": Schema.Literal("web_search_result_location").annotate({
2544 "title": "Type",
2545 "default": "web_search_result_location"
2546 }),
2547 "url": Schema.String.annotate({ "title": "Url" })
2548}).annotate({ "title": "ResponseWebSearchResultLocationCitation" })
2549export type ServerToolCaller = { readonly "tool_id": string; readonly "type": "code_execution_20250825" }
2550export const ServerToolCaller = Schema.Struct({
2551 "tool_id": Schema.String.annotate({ "title": "Tool Id" }).check(
2552 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
2553 ),
2554 "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" })
2555}).annotate({ "title": "ServerToolCaller", "description": "Tool invocation generated by a server-side tool." })
2556export type ServerToolCaller_20260120 = { readonly "tool_id": string; readonly "type": "code_execution_20260120" }
2557export const ServerToolCaller_20260120 = Schema.Struct({
2558 "tool_id": Schema.String.annotate({ "title": "Tool Id" }).check(
2559 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
2560 ),
2561 "type": Schema.Literal("code_execution_20260120").annotate({ "title": "Type" })
2562}).annotate({ "title": "ServerToolCaller_20260120" })
2563export type ServerToolUsage = { readonly "web_fetch_requests": number; readonly "web_search_requests": number }
2564export const ServerToolUsage = Schema.Struct({
2565 "web_fetch_requests": Schema.Number.annotate({
2566 "title": "Web Fetch Requests",
2567 "description": "The number of web fetch tool requests.",
2568 "default": 0
2569 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
2570 "web_search_requests": Schema.Number.annotate({
2571 "title": "Web Search Requests",
2572 "description": "The number of web search tool requests.",
2573 "default": 0
2574 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
2575}).annotate({ "title": "ServerToolUsage" })
2576export type SignatureContentBlockDelta = { readonly "signature": string; readonly "type": "signature_delta" }
2577export const SignatureContentBlockDelta = Schema.Struct({
2578 "signature": Schema.String.annotate({ "title": "Signature" }),
2579 "type": Schema.Literal("signature_delta").annotate({ "title": "Type", "default": "signature_delta" })
2580}).annotate({ "title": "SignatureContentBlockDelta" })
2581export type Skill = {
2582 readonly "created_at": string
2583 readonly "display_title": string | null
2584 readonly "id": string
2585 readonly "latest_version": string | null
2586 readonly "source": string
2587 readonly "type": string
2588 readonly "updated_at": string
2589}
2590export const Skill = Schema.Struct({
2591 "created_at": Schema.String.annotate({
2592 "title": "Created At",
2593 "description": "ISO 8601 timestamp of when the skill was created."
2594 }),
2595 "display_title": Schema.Union([Schema.String, Schema.Null]).annotate({
2596 "title": "Display Title",
2597 "description":
2598 "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model."
2599 }),
2600 "id": Schema.String.annotate({
2601 "title": "Id",
2602 "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time."
2603 }),
2604 "latest_version": Schema.Union([Schema.String, Schema.Null]).annotate({
2605 "title": "Latest Version",
2606 "description":
2607 "The latest version identifier for the skill.\n\nThis represents the most recent version of the skill that has been created."
2608 }),
2609 "source": Schema.String.annotate({
2610 "title": "Source",
2611 "description":
2612 "Source of the skill.\n\nThis may be one of the following values:\n* `\"custom\"`: the skill was created by a user\n* `\"anthropic\"`: the skill was created by Anthropic"
2613 }),
2614 "type": Schema.String.annotate({
2615 "title": "Type",
2616 "description": "Object type.\n\nFor Skills, this is always `\"skill\"`.",
2617 "default": "skill"
2618 }),
2619 "updated_at": Schema.String.annotate({
2620 "title": "Updated At",
2621 "description": "ISO 8601 timestamp of when the skill was last updated."
2622 })
2623}).annotate({ "title": "Skill" })
2624export type SkillVersion = {
2625 readonly "created_at": string
2626 readonly "description": string
2627 readonly "directory": string
2628 readonly "id": string
2629 readonly "name": string
2630 readonly "skill_id": string
2631 readonly "type": string
2632 readonly "version": string
2633}
2634export const SkillVersion = Schema.Struct({
2635 "created_at": Schema.String.annotate({
2636 "title": "Created At",
2637 "description": "ISO 8601 timestamp of when the skill version was created."
2638 }),
2639 "description": Schema.String.annotate({
2640 "title": "Description",
2641 "description": "Description of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload."
2642 }),
2643 "directory": Schema.String.annotate({
2644 "title": "Directory",
2645 "description":
2646 "Directory name of the skill version.\n\nThis is the top-level directory name that was extracted from the uploaded files."
2647 }),
2648 "id": Schema.String.annotate({
2649 "title": "Id",
2650 "description": "Unique identifier for the skill version.\n\nThe format and length of IDs may change over time."
2651 }),
2652 "name": Schema.String.annotate({
2653 "title": "Name",
2654 "description":
2655 "Human-readable name of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload."
2656 }),
2657 "skill_id": Schema.String.annotate({
2658 "title": "Skill Id",
2659 "description": "Identifier for the skill that this version belongs to."
2660 }),
2661 "type": Schema.String.annotate({
2662 "title": "Type",
2663 "description": "Object type.\n\nFor Skill Versions, this is always `\"skill_version\"`.",
2664 "default": "skill_version"
2665 }),
2666 "version": Schema.String.annotate({
2667 "title": "Version",
2668 "description":
2669 "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")."
2670 })
2671}).annotate({ "title": "SkillVersion" })
2672export type TextContentBlockDelta = { readonly "text": string; readonly "type": "text_delta" }
2673export const TextContentBlockDelta = Schema.Struct({
2674 "text": Schema.String.annotate({ "title": "Text" }),
2675 "type": Schema.Literal("text_delta").annotate({ "title": "Type", "default": "text_delta" })
2676}).annotate({ "title": "TextContentBlockDelta" })
2677export type TextEditorCodeExecutionToolResultErrorCode =
2678 | "invalid_tool_input"
2679 | "unavailable"
2680 | "too_many_requests"
2681 | "execution_time_exceeded"
2682 | "file_not_found"
2683export const TextEditorCodeExecutionToolResultErrorCode = Schema.Literals([
2684 "invalid_tool_input",
2685 "unavailable",
2686 "too_many_requests",
2687 "execution_time_exceeded",
2688 "file_not_found"
2689]).annotate({ "title": "TextEditorCodeExecutionToolResultErrorCode" })
2690export type ThinkingConfigAdaptive = { readonly "type": "adaptive" }
2691export const ThinkingConfigAdaptive = Schema.Struct({
2692 "type": Schema.Literal("adaptive").annotate({ "title": "Type" })
2693}).annotate({ "title": "ThinkingConfigAdaptive" })
2694export type ThinkingConfigDisabled = { readonly "type": "disabled" }
2695export const ThinkingConfigDisabled = Schema.Struct({
2696 "type": Schema.Literal("disabled").annotate({ "title": "Type" })
2697}).annotate({ "title": "ThinkingConfigDisabled" })
2698export type ThinkingConfigEnabled = { readonly "budget_tokens": number; readonly "type": "enabled" }
2699export const ThinkingConfigEnabled = Schema.Struct({
2700 "budget_tokens": Schema.Number.annotate({
2701 "title": "Budget Tokens",
2702 "description":
2703 "Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.\n\nMust be ≥1024 and less than `max_tokens`.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details."
2704 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1024)),
2705 "type": Schema.Literal("enabled").annotate({ "title": "Type" })
2706}).annotate({ "title": "ThinkingConfigEnabled" })
2707export type ThinkingContentBlockDelta = { readonly "thinking": string; readonly "type": "thinking_delta" }
2708export const ThinkingContentBlockDelta = Schema.Struct({
2709 "thinking": Schema.String.annotate({ "title": "Thinking" }),
2710 "type": Schema.Literal("thinking_delta").annotate({ "title": "Type", "default": "thinking_delta" })
2711}).annotate({ "title": "ThinkingContentBlockDelta" })
2712export type ToolChoiceAny = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "any" }
2713export const ToolChoiceAny = Schema.Struct({
2714 "disable_parallel_tool_use": Schema.optionalKey(
2715 Schema.Boolean.annotate({
2716 "title": "Disable Parallel Tool Use",
2717 "description":
2718 "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use."
2719 })
2720 ),
2721 "type": Schema.Literal("any").annotate({ "title": "Type" })
2722}).annotate({ "title": "ToolChoiceAny", "description": "The model will use any available tools." })
2723export type ToolChoiceAuto = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "auto" }
2724export const ToolChoiceAuto = Schema.Struct({
2725 "disable_parallel_tool_use": Schema.optionalKey(
2726 Schema.Boolean.annotate({
2727 "title": "Disable Parallel Tool Use",
2728 "description":
2729 "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output at most one tool use."
2730 })
2731 ),
2732 "type": Schema.Literal("auto").annotate({ "title": "Type" })
2733}).annotate({ "title": "ToolChoiceAuto", "description": "The model will automatically decide whether to use tools." })
2734export type ToolChoiceNone = { readonly "type": "none" }
2735export const ToolChoiceNone = Schema.Struct({ "type": Schema.Literal("none").annotate({ "title": "Type" }) }).annotate({
2736 "title": "ToolChoiceNone",
2737 "description": "The model will not be allowed to use tools."
2738})
2739export type ToolChoiceTool = {
2740 readonly "disable_parallel_tool_use"?: boolean
2741 readonly "name": string
2742 readonly "type": "tool"
2743}
2744export const ToolChoiceTool = Schema.Struct({
2745 "disable_parallel_tool_use": Schema.optionalKey(
2746 Schema.Boolean.annotate({
2747 "title": "Disable Parallel Tool Use",
2748 "description":
2749 "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use."
2750 })
2751 ),
2752 "name": Schema.String.annotate({ "title": "Name", "description": "The name of the tool to use." }),
2753 "type": Schema.Literal("tool").annotate({ "title": "Type" })
2754}).annotate({
2755 "title": "ToolChoiceTool",
2756 "description": "The model will use the specified tool with `tool_choice.name`."
2757})
2758export type ToolSearchToolResultErrorCode =
2759 | "invalid_tool_input"
2760 | "unavailable"
2761 | "too_many_requests"
2762 | "execution_time_exceeded"
2763export const ToolSearchToolResultErrorCode = Schema.Literals([
2764 "invalid_tool_input",
2765 "unavailable",
2766 "too_many_requests",
2767 "execution_time_exceeded"
2768]).annotate({ "title": "ToolSearchToolResultErrorCode" })
2769export type URLImageSource = { readonly "type": "url"; readonly "url": string }
2770export const URLImageSource = Schema.Struct({
2771 "type": Schema.Literal("url").annotate({ "title": "Type" }),
2772 "url": Schema.String.annotate({ "title": "Url" })
2773}).annotate({ "title": "URLImageSource" })
2774export type URLPDFSource = { readonly "type": "url"; readonly "url": string }
2775export const URLPDFSource = Schema.Struct({
2776 "type": Schema.Literal("url").annotate({ "title": "Type" }),
2777 "url": Schema.String.annotate({ "title": "Url" })
2778}).annotate({ "title": "URLPDFSource" })
2779export type UserLocation = {
2780 readonly "city"?: string | null
2781 readonly "country"?: string | null
2782 readonly "region"?: string | null
2783 readonly "timezone"?: string | null
2784 readonly "type": "approximate"
2785}
2786export const UserLocation = Schema.Struct({
2787 "city": Schema.optionalKey(
2788 Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({
2789 "title": "City",
2790 "description": "The city of the user."
2791 })
2792 ),
2793 "country": Schema.optionalKey(
2794 Schema.Union([Schema.String.check(Schema.isMinLength(2)).check(Schema.isMaxLength(2)), Schema.Null]).annotate({
2795 "title": "Country",
2796 "description": "The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user."
2797 })
2798 ),
2799 "region": Schema.optionalKey(
2800 Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({
2801 "title": "Region",
2802 "description": "The region of the user."
2803 })
2804 ),
2805 "timezone": Schema.optionalKey(
2806 Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({
2807 "title": "Timezone",
2808 "description": "The [IANA timezone](https://nodatime.org/TimeZones) of the user."
2809 })
2810 ),
2811 "type": Schema.Literal("approximate").annotate({ "title": "Type" })
2812}).annotate({ "title": "UserLocation" })
2813export type WebFetchToolResultErrorCode =
2814 | "invalid_tool_input"
2815 | "url_too_long"
2816 | "url_not_allowed"
2817 | "url_not_accessible"
2818 | "unsupported_content_type"
2819 | "too_many_requests"
2820 | "max_uses_exceeded"
2821 | "unavailable"
2822export const WebFetchToolResultErrorCode = Schema.Literals([
2823 "invalid_tool_input",
2824 "url_too_long",
2825 "url_not_allowed",
2826 "url_not_accessible",
2827 "unsupported_content_type",
2828 "too_many_requests",
2829 "max_uses_exceeded",
2830 "unavailable"
2831]).annotate({ "title": "WebFetchToolResultErrorCode" })
2832export type WebSearchToolResultErrorCode =
2833 | "invalid_tool_input"
2834 | "unavailable"
2835 | "max_uses_exceeded"
2836 | "too_many_requests"
2837 | "query_too_long"
2838 | "request_too_large"
2839export const WebSearchToolResultErrorCode = Schema.Literals([
2840 "invalid_tool_input",
2841 "unavailable",
2842 "max_uses_exceeded",
2843 "too_many_requests",
2844 "query_too_long",
2845 "request_too_large"
2846]).annotate({ "title": "WebSearchToolResultErrorCode" })
2847export type StopReason = "end_turn" | "max_tokens" | "stop_sequence" | "tool_use" | "pause_turn" | "refusal"
2848export const StopReason = Schema.Literals([
2849 "end_turn",
2850 "max_tokens",
2851 "stop_sequence",
2852 "tool_use",
2853 "pause_turn",
2854 "refusal"
2855])
2856export type BetaStopReason =
2857 | "end_turn"
2858 | "max_tokens"
2859 | "stop_sequence"
2860 | "tool_use"
2861 | "pause_turn"
2862 | "compaction"
2863 | "refusal"
2864 | "model_context_window_exceeded"
2865export const BetaStopReason = Schema.Literals([
2866 "end_turn",
2867 "max_tokens",
2868 "stop_sequence",
2869 "tool_use",
2870 "pause_turn",
2871 "compaction",
2872 "refusal",
2873 "model_context_window_exceeded"
2874])
2875export type Model =
2876 | string
2877 | "claude-sonnet-5"
2878 | "claude-fable-5"
2879 | "claude-mythos-5"
2880 | "claude-opus-4-8"
2881 | "claude-opus-4-7"
2882 | "claude-mythos-preview"
2883 | "claude-opus-4-6"
2884 | "claude-sonnet-4-6"
2885 | "claude-haiku-4-5"
2886 | "claude-haiku-4-5-20251001"
2887 | "claude-opus-4-5"
2888 | "claude-opus-4-5-20251101"
2889 | "claude-sonnet-4-5"
2890 | "claude-sonnet-4-5-20250929"
2891 | "claude-opus-4-1"
2892 | "claude-opus-4-1-20250805"
2893export const Model = Schema.Union([
2894 Schema.String,
2895 Schema.Literals([
2896 "claude-sonnet-5",
2897 "claude-fable-5",
2898 "claude-mythos-5",
2899 "claude-opus-4-8",
2900 "claude-opus-4-7",
2901 "claude-mythos-preview",
2902 "claude-opus-4-6",
2903 "claude-sonnet-4-6",
2904 "claude-haiku-4-5",
2905 "claude-haiku-4-5-20251001",
2906 "claude-opus-4-5",
2907 "claude-opus-4-5-20251101",
2908 "claude-sonnet-4-5",
2909 "claude-sonnet-4-5-20250929",
2910 "claude-opus-4-1",
2911 "claude-opus-4-1-20250805"
2912 ])
2913]).annotate({
2914 "title": "Model",
2915 "description":
2916 "The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options."
2917})
2918export type BetaMemoryTool_20250818_ViewCommand = {
2919 readonly "command": "view"
2920 readonly "path": string
2921 readonly "view_range"?: ReadonlyArray<number>
2922}
2923export const BetaMemoryTool_20250818_ViewCommand = Schema.Struct({
2924 "command": Schema.Literal("view").annotate({ "description": "Command type identifier", "default": "view" }),
2925 "path": Schema.String.annotate({ "description": "Path to directory or file to view" }),
2926 "view_range": Schema.optionalKey(
2927 Schema.Array(Schema.Number.check(Schema.isInt())).annotate({
2928 "description": "Optional line range for viewing specific lines"
2929 }).check(Schema.isMinLength(2)).check(Schema.isMaxLength(2))
2930 )
2931})
2932export type BetaMemoryTool_20250818_CreateCommand = {
2933 readonly "command": "create"
2934 readonly "path": string
2935 readonly "file_text": string
2936}
2937export const BetaMemoryTool_20250818_CreateCommand = Schema.Struct({
2938 "command": Schema.Literal("create").annotate({ "description": "Command type identifier", "default": "create" }),
2939 "path": Schema.String.annotate({ "description": "Path where the file should be created" }),
2940 "file_text": Schema.String.annotate({ "description": "Content to write to the file" })
2941})
2942export type BetaMemoryTool_20250818_StrReplaceCommand = {
2943 readonly "command": "str_replace"
2944 readonly "path": string
2945 readonly "old_str": string
2946 readonly "new_str": string
2947}
2948export const BetaMemoryTool_20250818_StrReplaceCommand = Schema.Struct({
2949 "command": Schema.Literal("str_replace").annotate({
2950 "description": "Command type identifier",
2951 "default": "str_replace"
2952 }),
2953 "path": Schema.String.annotate({ "description": "Path to the file where text should be replaced" }),
2954 "old_str": Schema.String.annotate({ "description": "Text to search for and replace" }),
2955 "new_str": Schema.String.annotate({ "description": "Text to replace with" })
2956})
2957export type BetaMemoryTool_20250818_InsertCommand = {
2958 readonly "command": "insert"
2959 readonly "path": string
2960 readonly "insert_line": number
2961 readonly "insert_text": string
2962}
2963export const BetaMemoryTool_20250818_InsertCommand = Schema.Struct({
2964 "command": Schema.Literal("insert").annotate({ "description": "Command type identifier", "default": "insert" }),
2965 "path": Schema.String.annotate({ "description": "Path to the file where text should be inserted" }),
2966 "insert_line": Schema.Number.annotate({ "description": "Line number where text should be inserted" }).check(
2967 Schema.isInt()
2968 ).check(Schema.isGreaterThanOrEqualTo(1)),
2969 "insert_text": Schema.String.annotate({ "description": "Text to insert at the specified line" })
2970})
2971export type BetaMemoryTool_20250818_DeleteCommand = { readonly "command": "delete"; readonly "path": string }
2972export const BetaMemoryTool_20250818_DeleteCommand = Schema.Struct({
2973 "command": Schema.Literal("delete").annotate({ "description": "Command type identifier", "default": "delete" }),
2974 "path": Schema.String.annotate({ "description": "Path to the file or directory to delete" })
2975})
2976export type BetaMemoryTool_20250818_RenameCommand = {
2977 readonly "command": "rename"
2978 readonly "old_path": string
2979 readonly "new_path": string
2980}
2981export const BetaMemoryTool_20250818_RenameCommand = Schema.Struct({
2982 "command": Schema.Literal("rename").annotate({ "description": "Command type identifier", "default": "rename" }),
2983 "old_path": Schema.String.annotate({ "description": "Current path of the file or directory" }),
2984 "new_path": Schema.String.annotate({ "description": "New path for the file or directory" })
2985})
2986export type RequestBashCodeExecutionToolResultError = {
2987 readonly "error_code": BashCodeExecutionToolResultErrorCode
2988 readonly "type": "bash_code_execution_tool_result_error"
2989}
2990export const RequestBashCodeExecutionToolResultError = Schema.Struct({
2991 "error_code": BashCodeExecutionToolResultErrorCode,
2992 "type": Schema.Literal("bash_code_execution_tool_result_error").annotate({ "title": "Type" })
2993}).annotate({ "title": "RequestBashCodeExecutionToolResultError" })
2994export type ResponseBashCodeExecutionToolResultError = {
2995 readonly "error_code": BashCodeExecutionToolResultErrorCode
2996 readonly "type": "bash_code_execution_tool_result_error"
2997}
2998export const ResponseBashCodeExecutionToolResultError = Schema.Struct({
2999 "error_code": BashCodeExecutionToolResultErrorCode,
3000 "type": Schema.Literal("bash_code_execution_tool_result_error").annotate({
3001 "title": "Type",
3002 "default": "bash_code_execution_tool_result_error"
3003 })
3004}).annotate({ "title": "ResponseBashCodeExecutionToolResultError" })
3005export type BetaRequestBashCodeExecutionToolResultError = {
3006 readonly "error_code": BetaBashCodeExecutionToolResultErrorCode
3007 readonly "type": "bash_code_execution_tool_result_error"
3008}
3009export const BetaRequestBashCodeExecutionToolResultError = Schema.Struct({
3010 "error_code": BetaBashCodeExecutionToolResultErrorCode,
3011 "type": Schema.Literal("bash_code_execution_tool_result_error").annotate({ "title": "Type" })
3012}).annotate({ "title": "RequestBashCodeExecutionToolResultError" })
3013export type BetaResponseBashCodeExecutionToolResultError = {
3014 readonly "error_code": BetaBashCodeExecutionToolResultErrorCode
3015 readonly "type": "bash_code_execution_tool_result_error"
3016}
3017export const BetaResponseBashCodeExecutionToolResultError = Schema.Struct({
3018 "error_code": BetaBashCodeExecutionToolResultErrorCode,
3019 "type": Schema.Literal("bash_code_execution_tool_result_error").annotate({
3020 "title": "Type",
3021 "default": "bash_code_execution_tool_result_error"
3022 })
3023}).annotate({ "title": "ResponseBashCodeExecutionToolResultError" })
3024export type BetaCodeExecutionTool_20250522 = {
3025 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3026 readonly "cache_control"?: BetaCacheControlEphemeral | null
3027 readonly "defer_loading"?: boolean
3028 readonly "name": "code_execution"
3029 readonly "strict"?: boolean
3030 readonly "type": "code_execution_20250522"
3031}
3032export const BetaCodeExecutionTool_20250522 = Schema.Struct({
3033 "allowed_callers": Schema.optionalKey(
3034 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3035 "title": "Allowed Callers"
3036 })
3037 ),
3038 "cache_control": Schema.optionalKey(
3039 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3040 "title": "Cache Control",
3041 "description": "Create a cache control breakpoint at this content block."
3042 })
3043 ),
3044 "defer_loading": Schema.optionalKey(
3045 Schema.Boolean.annotate({
3046 "title": "Defer Loading",
3047 "description":
3048 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3049 })
3050 ),
3051 "name": Schema.Literal("code_execution").annotate({
3052 "title": "Name",
3053 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3054 }),
3055 "strict": Schema.optionalKey(
3056 Schema.Boolean.annotate({
3057 "title": "Strict",
3058 "description": "When true, guarantees schema validation on tool names and inputs"
3059 })
3060 ),
3061 "type": Schema.Literal("code_execution_20250522").annotate({ "title": "Type" })
3062}).annotate({ "title": "CodeExecutionTool_20250522" })
3063export type BetaCodeExecutionTool_20250825 = {
3064 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3065 readonly "cache_control"?: BetaCacheControlEphemeral | null
3066 readonly "defer_loading"?: boolean
3067 readonly "name": "code_execution"
3068 readonly "strict"?: boolean
3069 readonly "type": "code_execution_20250825"
3070}
3071export const BetaCodeExecutionTool_20250825 = Schema.Struct({
3072 "allowed_callers": Schema.optionalKey(
3073 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3074 "title": "Allowed Callers"
3075 })
3076 ),
3077 "cache_control": Schema.optionalKey(
3078 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3079 "title": "Cache Control",
3080 "description": "Create a cache control breakpoint at this content block."
3081 })
3082 ),
3083 "defer_loading": Schema.optionalKey(
3084 Schema.Boolean.annotate({
3085 "title": "Defer Loading",
3086 "description":
3087 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3088 })
3089 ),
3090 "name": Schema.Literal("code_execution").annotate({
3091 "title": "Name",
3092 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3093 }),
3094 "strict": Schema.optionalKey(
3095 Schema.Boolean.annotate({
3096 "title": "Strict",
3097 "description": "When true, guarantees schema validation on tool names and inputs"
3098 })
3099 ),
3100 "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" })
3101}).annotate({ "title": "CodeExecutionTool_20250825" })
3102export type BetaCodeExecutionTool_20260120 = {
3103 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3104 readonly "cache_control"?: BetaCacheControlEphemeral | null
3105 readonly "defer_loading"?: boolean
3106 readonly "name": "code_execution"
3107 readonly "strict"?: boolean
3108 readonly "type": "code_execution_20260120"
3109}
3110export const BetaCodeExecutionTool_20260120 = Schema.Struct({
3111 "allowed_callers": Schema.optionalKey(
3112 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3113 "title": "Allowed Callers"
3114 })
3115 ),
3116 "cache_control": Schema.optionalKey(
3117 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3118 "title": "Cache Control",
3119 "description": "Create a cache control breakpoint at this content block."
3120 })
3121 ),
3122 "defer_loading": Schema.optionalKey(
3123 Schema.Boolean.annotate({
3124 "title": "Defer Loading",
3125 "description":
3126 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3127 })
3128 ),
3129 "name": Schema.Literal("code_execution").annotate({
3130 "title": "Name",
3131 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3132 }),
3133 "strict": Schema.optionalKey(
3134 Schema.Boolean.annotate({
3135 "title": "Strict",
3136 "description": "When true, guarantees schema validation on tool names and inputs"
3137 })
3138 ),
3139 "type": Schema.Literal("code_execution_20260120").annotate({ "title": "Type" })
3140}).annotate({
3141 "title": "CodeExecutionTool_20260120",
3142 "description": "Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint)."
3143})
3144export type BetaRequestCompactionBlock = {
3145 readonly "cache_control"?: BetaCacheControlEphemeral | null
3146 readonly "content": string | null
3147 readonly "type": "compaction"
3148}
3149export const BetaRequestCompactionBlock = Schema.Struct({
3150 "cache_control": Schema.optionalKey(
3151 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3152 "title": "Cache Control",
3153 "description": "Create a cache control breakpoint at this content block."
3154 })
3155 ),
3156 "content": Schema.Union([Schema.String, Schema.Null]).annotate({
3157 "title": "Content",
3158 "description": "Summary of previously compacted content, or null if compaction failed"
3159 }),
3160 "type": Schema.Literal("compaction").annotate({ "title": "Type" })
3161}).annotate({
3162 "title": "RequestCompactionBlock",
3163 "description":
3164 "A compaction block containing summary of previous context.\n\nUsers should round-trip these blocks from responses to subsequent requests\nto maintain context across compaction boundaries.\n\nWhen content is None, the block represents a failed compaction. The server\ntreats these as no-ops. Empty string content is not allowed."
3165})
3166export type BetaRequestContainerUploadBlock = {
3167 readonly "cache_control"?: BetaCacheControlEphemeral | null
3168 readonly "file_id": string
3169 readonly "type": "container_upload"
3170}
3171export const BetaRequestContainerUploadBlock = Schema.Struct({
3172 "cache_control": Schema.optionalKey(
3173 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3174 "title": "Cache Control",
3175 "description": "Create a cache control breakpoint at this content block."
3176 })
3177 ),
3178 "file_id": Schema.String.annotate({ "title": "File Id" }),
3179 "type": Schema.Literal("container_upload").annotate({ "title": "Type" })
3180}).annotate({
3181 "title": "RequestContainerUploadBlock",
3182 "description":
3183 "A content block that represents a file to be uploaded to the container\nFiles uploaded via this block will be available in the container's input directory."
3184})
3185export type BetaRequestMCPToolUseBlock = {
3186 readonly "cache_control"?: BetaCacheControlEphemeral | null
3187 readonly "id": string
3188 readonly "input": { readonly [x: string]: Schema.Json }
3189 readonly "name": string
3190 readonly "server_name": string
3191 readonly "type": "mcp_tool_use"
3192}
3193export const BetaRequestMCPToolUseBlock = Schema.Struct({
3194 "cache_control": Schema.optionalKey(
3195 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3196 "title": "Cache Control",
3197 "description": "Create a cache control breakpoint at this content block."
3198 })
3199 ),
3200 "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
3201 "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }),
3202 "name": Schema.String.annotate({ "title": "Name" }),
3203 "server_name": Schema.String.annotate({ "title": "Server Name", "description": "The name of the MCP server" }),
3204 "type": Schema.Literal("mcp_tool_use").annotate({ "title": "Type" })
3205}).annotate({ "title": "RequestMCPToolUseBlock" })
3206export type BetaRequestToolReferenceBlock = {
3207 readonly "cache_control"?: BetaCacheControlEphemeral | null
3208 readonly "tool_name": string
3209 readonly "type": "tool_reference"
3210}
3211export const BetaRequestToolReferenceBlock = Schema.Struct({
3212 "cache_control": Schema.optionalKey(
3213 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3214 "title": "Cache Control",
3215 "description": "Create a cache control breakpoint at this content block."
3216 })
3217 ),
3218 "tool_name": Schema.String.annotate({ "title": "Tool Name" }).check(Schema.isMinLength(1)).check(
3219 Schema.isMaxLength(256)
3220 ).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,256}$"))),
3221 "type": Schema.Literal("tool_reference").annotate({ "title": "Type" })
3222}).annotate({
3223 "title": "RequestToolReferenceBlock",
3224 "description": "Tool reference block that can be included in tool_result content."
3225})
3226export type BetaToolSearchToolBM25_20251119 = {
3227 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3228 readonly "cache_control"?: BetaCacheControlEphemeral | null
3229 readonly "defer_loading"?: boolean
3230 readonly "name": "tool_search_tool_bm25"
3231 readonly "strict"?: boolean
3232 readonly "type": "tool_search_tool_bm25_20251119" | "tool_search_tool_bm25"
3233}
3234export const BetaToolSearchToolBM25_20251119 = Schema.Struct({
3235 "allowed_callers": Schema.optionalKey(
3236 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3237 "title": "Allowed Callers"
3238 })
3239 ),
3240 "cache_control": Schema.optionalKey(
3241 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3242 "title": "Cache Control",
3243 "description": "Create a cache control breakpoint at this content block."
3244 })
3245 ),
3246 "defer_loading": Schema.optionalKey(
3247 Schema.Boolean.annotate({
3248 "title": "Defer Loading",
3249 "description":
3250 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3251 })
3252 ),
3253 "name": Schema.Literal("tool_search_tool_bm25").annotate({
3254 "title": "Name",
3255 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3256 }),
3257 "strict": Schema.optionalKey(
3258 Schema.Boolean.annotate({
3259 "title": "Strict",
3260 "description": "When true, guarantees schema validation on tool names and inputs"
3261 })
3262 ),
3263 "type": Schema.Literals(["tool_search_tool_bm25_20251119", "tool_search_tool_bm25"]).annotate({ "title": "Type" })
3264}).annotate({ "title": "ToolSearchToolBM25_20251119" })
3265export type BetaToolSearchToolRegex_20251119 = {
3266 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3267 readonly "cache_control"?: BetaCacheControlEphemeral | null
3268 readonly "defer_loading"?: boolean
3269 readonly "name": "tool_search_tool_regex"
3270 readonly "strict"?: boolean
3271 readonly "type": "tool_search_tool_regex_20251119" | "tool_search_tool_regex"
3272}
3273export const BetaToolSearchToolRegex_20251119 = Schema.Struct({
3274 "allowed_callers": Schema.optionalKey(
3275 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3276 "title": "Allowed Callers"
3277 })
3278 ),
3279 "cache_control": Schema.optionalKey(
3280 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3281 "title": "Cache Control",
3282 "description": "Create a cache control breakpoint at this content block."
3283 })
3284 ),
3285 "defer_loading": Schema.optionalKey(
3286 Schema.Boolean.annotate({
3287 "title": "Defer Loading",
3288 "description":
3289 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3290 })
3291 ),
3292 "name": Schema.Literal("tool_search_tool_regex").annotate({
3293 "title": "Name",
3294 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3295 }),
3296 "strict": Schema.optionalKey(
3297 Schema.Boolean.annotate({
3298 "title": "Strict",
3299 "description": "When true, guarantees schema validation on tool names and inputs"
3300 })
3301 ),
3302 "type": Schema.Literals(["tool_search_tool_regex_20251119", "tool_search_tool_regex"]).annotate({ "title": "Type" })
3303}).annotate({ "title": "ToolSearchToolRegex_20251119" })
3304export type BetaCompactionIterationUsage = {
3305 readonly "cache_creation": BetaCacheCreation | null
3306 readonly "cache_creation_input_tokens": number
3307 readonly "cache_read_input_tokens": number
3308 readonly "input_tokens": number
3309 readonly "output_tokens": number
3310 readonly "type": "compaction"
3311}
3312export const BetaCompactionIterationUsage = Schema.Struct({
3313 "cache_creation": Schema.Union([BetaCacheCreation, Schema.Null]).annotate({
3314 "description": "Breakdown of cached tokens by TTL",
3315 "default": null
3316 }),
3317 "cache_creation_input_tokens": Schema.Number.annotate({
3318 "title": "Cache Creation Input Tokens",
3319 "description": "The number of input tokens used to create the cache entry.",
3320 "default": 0
3321 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
3322 "cache_read_input_tokens": Schema.Number.annotate({
3323 "title": "Cache Read Input Tokens",
3324 "description": "The number of input tokens read from the cache.",
3325 "default": 0
3326 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
3327 "input_tokens": Schema.Number.annotate({
3328 "title": "Input Tokens",
3329 "description": "The number of input tokens which were used."
3330 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
3331 "output_tokens": Schema.Number.annotate({
3332 "title": "Output Tokens",
3333 "description": "The number of output tokens which were used."
3334 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
3335 "type": Schema.Literal("compaction").annotate({
3336 "title": "Type",
3337 "description": "Usage for a compaction iteration",
3338 "default": "compaction"
3339 })
3340}).annotate({ "title": "CompactionIterationUsage", "description": "Token usage for a compaction iteration." })
3341export type BetaMessageIterationUsage = {
3342 readonly "cache_creation": BetaCacheCreation | null
3343 readonly "cache_creation_input_tokens": number
3344 readonly "cache_read_input_tokens": number
3345 readonly "input_tokens": number
3346 readonly "output_tokens": number
3347 readonly "type": "message"
3348}
3349export const BetaMessageIterationUsage = Schema.Struct({
3350 "cache_creation": Schema.Union([BetaCacheCreation, Schema.Null]).annotate({
3351 "description": "Breakdown of cached tokens by TTL",
3352 "default": null
3353 }),
3354 "cache_creation_input_tokens": Schema.Number.annotate({
3355 "title": "Cache Creation Input Tokens",
3356 "description": "The number of input tokens used to create the cache entry.",
3357 "default": 0
3358 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
3359 "cache_read_input_tokens": Schema.Number.annotate({
3360 "title": "Cache Read Input Tokens",
3361 "description": "The number of input tokens read from the cache.",
3362 "default": 0
3363 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
3364 "input_tokens": Schema.Number.annotate({
3365 "title": "Input Tokens",
3366 "description": "The number of input tokens which were used."
3367 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
3368 "output_tokens": Schema.Number.annotate({
3369 "title": "Output Tokens",
3370 "description": "The number of output tokens which were used."
3371 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
3372 "type": Schema.Literal("message").annotate({
3373 "title": "Type",
3374 "description": "Usage for a sampling iteration",
3375 "default": "message"
3376 })
3377}).annotate({ "title": "MessageIterationUsage", "description": "Token usage for a sampling iteration." })
3378export type BetaRequestCodeExecutionToolResultError = {
3379 readonly "error_code": BetaCodeExecutionToolResultErrorCode
3380 readonly "type": "code_execution_tool_result_error"
3381}
3382export const BetaRequestCodeExecutionToolResultError = Schema.Struct({
3383 "error_code": BetaCodeExecutionToolResultErrorCode,
3384 "type": Schema.Literal("code_execution_tool_result_error").annotate({ "title": "Type" })
3385}).annotate({ "title": "Error" })
3386export type BetaResponseCodeExecutionToolResultError = {
3387 readonly "error_code": BetaCodeExecutionToolResultErrorCode
3388 readonly "type": "code_execution_tool_result_error"
3389}
3390export const BetaResponseCodeExecutionToolResultError = Schema.Struct({
3391 "error_code": BetaCodeExecutionToolResultErrorCode,
3392 "type": Schema.Literal("code_execution_tool_result_error").annotate({
3393 "title": "Type",
3394 "default": "code_execution_tool_result_error"
3395 })
3396}).annotate({ "title": "ResponseCodeExecutionToolResultError" })
3397export type BetaCountMessageTokensResponse = {
3398 readonly "context_management": BetaContextManagementResponse | null
3399 readonly "input_tokens": number
3400}
3401export const BetaCountMessageTokensResponse = Schema.Struct({
3402 "context_management": Schema.Union([BetaContextManagementResponse, Schema.Null]).annotate({
3403 "description": "Information about context management applied to the message."
3404 }),
3405 "input_tokens": Schema.Number.annotate({
3406 "title": "Input Tokens",
3407 "description": "The total number of tokens across the provided list of messages, system prompt, and tools."
3408 }).check(Schema.isInt())
3409}).annotate({ "title": "CountMessageTokensResponse" })
3410export type BetaFileListResponse = {
3411 readonly "data": ReadonlyArray<BetaFileMetadataSchema>
3412 readonly "first_id"?: string | null
3413 readonly "has_more"?: boolean
3414 readonly "last_id"?: string | null
3415}
3416export const BetaFileListResponse = Schema.Struct({
3417 "data": Schema.Array(BetaFileMetadataSchema).annotate({
3418 "title": "Data",
3419 "description": "List of file metadata objects."
3420 }),
3421 "first_id": Schema.optionalKey(
3422 Schema.Union([Schema.String, Schema.Null]).annotate({
3423 "title": "First Id",
3424 "description": "ID of the first file in this page of results."
3425 })
3426 ),
3427 "has_more": Schema.optionalKey(
3428 Schema.Boolean.annotate({
3429 "title": "Has More",
3430 "description": "Whether there are more results available.",
3431 "default": false
3432 })
3433 ),
3434 "last_id": Schema.optionalKey(
3435 Schema.Union([Schema.String, Schema.Null]).annotate({
3436 "title": "Last Id",
3437 "description": "ID of the last file in this page of results."
3438 })
3439 )
3440}).annotate({ "title": "FileListResponse" })
3441export type BetaCompact20260112 = {
3442 readonly "instructions"?: string | null
3443 readonly "pause_after_compaction"?: boolean
3444 readonly "trigger"?: BetaInputTokensTrigger | null
3445 readonly "type": "compact_20260112"
3446}
3447export const BetaCompact20260112 = Schema.Struct({
3448 "instructions": Schema.optionalKey(
3449 Schema.Union([Schema.String, Schema.Null]).annotate({
3450 "title": "Instructions",
3451 "description": "Additional instructions for summarization."
3452 })
3453 ),
3454 "pause_after_compaction": Schema.optionalKey(
3455 Schema.Boolean.annotate({
3456 "title": "Pause After Compaction",
3457 "description": "Whether to pause after compaction and return the compaction block to the user."
3458 })
3459 ),
3460 "trigger": Schema.optionalKey(
3461 Schema.Union([BetaInputTokensTrigger, Schema.Null]).annotate({
3462 "description": "When to trigger compaction. Defaults to 150000 input tokens."
3463 })
3464 ),
3465 "type": Schema.Literal("compact_20260112").annotate({ "title": "Type" })
3466}).annotate({
3467 "title": "Compact20260112",
3468 "description": "Automatically compact older context when reaching the configured trigger threshold."
3469})
3470export type BetaBashTool_20241022 = {
3471 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3472 readonly "cache_control"?: BetaCacheControlEphemeral | null
3473 readonly "defer_loading"?: boolean
3474 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }>
3475 readonly "name": "bash"
3476 readonly "strict"?: boolean
3477 readonly "type": "bash_20241022"
3478}
3479export const BetaBashTool_20241022 = Schema.Struct({
3480 "allowed_callers": Schema.optionalKey(
3481 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3482 "title": "Allowed Callers"
3483 })
3484 ),
3485 "cache_control": Schema.optionalKey(
3486 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3487 "title": "Cache Control",
3488 "description": "Create a cache control breakpoint at this content block."
3489 })
3490 ),
3491 "defer_loading": Schema.optionalKey(
3492 Schema.Boolean.annotate({
3493 "title": "Defer Loading",
3494 "description":
3495 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3496 })
3497 ),
3498 "input_examples": Schema.optionalKey(
3499 Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" })
3500 ),
3501 "name": Schema.Literal("bash").annotate({
3502 "title": "Name",
3503 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3504 }),
3505 "strict": Schema.optionalKey(
3506 Schema.Boolean.annotate({
3507 "title": "Strict",
3508 "description": "When true, guarantees schema validation on tool names and inputs"
3509 })
3510 ),
3511 "type": Schema.Literal("bash_20241022").annotate({ "title": "Type" })
3512}).annotate({ "title": "BashTool_20241022" })
3513export type BetaBashTool_20250124 = {
3514 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3515 readonly "cache_control"?: BetaCacheControlEphemeral | null
3516 readonly "defer_loading"?: boolean
3517 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }>
3518 readonly "name": "bash"
3519 readonly "strict"?: boolean
3520 readonly "type": "bash_20250124"
3521}
3522export const BetaBashTool_20250124 = Schema.Struct({
3523 "allowed_callers": Schema.optionalKey(
3524 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3525 "title": "Allowed Callers"
3526 })
3527 ),
3528 "cache_control": Schema.optionalKey(
3529 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3530 "title": "Cache Control",
3531 "description": "Create a cache control breakpoint at this content block."
3532 })
3533 ),
3534 "defer_loading": Schema.optionalKey(
3535 Schema.Boolean.annotate({
3536 "title": "Defer Loading",
3537 "description":
3538 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3539 })
3540 ),
3541 "input_examples": Schema.optionalKey(
3542 Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" })
3543 ),
3544 "name": Schema.Literal("bash").annotate({
3545 "title": "Name",
3546 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3547 }),
3548 "strict": Schema.optionalKey(
3549 Schema.Boolean.annotate({
3550 "title": "Strict",
3551 "description": "When true, guarantees schema validation on tool names and inputs"
3552 })
3553 ),
3554 "type": Schema.Literal("bash_20250124").annotate({ "title": "Type" })
3555}).annotate({ "title": "BashTool_20250124" })
3556export type BetaComputerUseTool_20241022 = {
3557 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3558 readonly "cache_control"?: BetaCacheControlEphemeral | null
3559 readonly "defer_loading"?: boolean
3560 readonly "display_height_px": number
3561 readonly "display_number"?: number | null
3562 readonly "display_width_px": number
3563 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }>
3564 readonly "name": "computer"
3565 readonly "strict"?: boolean
3566 readonly "type": "computer_20241022"
3567}
3568export const BetaComputerUseTool_20241022 = Schema.Struct({
3569 "allowed_callers": Schema.optionalKey(
3570 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3571 "title": "Allowed Callers"
3572 })
3573 ),
3574 "cache_control": Schema.optionalKey(
3575 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3576 "title": "Cache Control",
3577 "description": "Create a cache control breakpoint at this content block."
3578 })
3579 ),
3580 "defer_loading": Schema.optionalKey(
3581 Schema.Boolean.annotate({
3582 "title": "Defer Loading",
3583 "description":
3584 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3585 })
3586 ),
3587 "display_height_px": Schema.Number.annotate({
3588 "title": "Display Height Px",
3589 "description": "The height of the display in pixels."
3590 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
3591 "display_number": Schema.optionalKey(
3592 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null]).annotate({
3593 "title": "Display Number",
3594 "description": "The X11 display number (e.g. 0, 1) for the display."
3595 })
3596 ),
3597 "display_width_px": Schema.Number.annotate({
3598 "title": "Display Width Px",
3599 "description": "The width of the display in pixels."
3600 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
3601 "input_examples": Schema.optionalKey(
3602 Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" })
3603 ),
3604 "name": Schema.Literal("computer").annotate({
3605 "title": "Name",
3606 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3607 }),
3608 "strict": Schema.optionalKey(
3609 Schema.Boolean.annotate({
3610 "title": "Strict",
3611 "description": "When true, guarantees schema validation on tool names and inputs"
3612 })
3613 ),
3614 "type": Schema.Literal("computer_20241022").annotate({ "title": "Type" })
3615}).annotate({ "title": "ComputerUseTool_20241022" })
3616export type BetaComputerUseTool_20250124 = {
3617 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3618 readonly "cache_control"?: BetaCacheControlEphemeral | null
3619 readonly "defer_loading"?: boolean
3620 readonly "display_height_px": number
3621 readonly "display_number"?: number | null
3622 readonly "display_width_px": number
3623 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }>
3624 readonly "name": "computer"
3625 readonly "strict"?: boolean
3626 readonly "type": "computer_20250124"
3627}
3628export const BetaComputerUseTool_20250124 = Schema.Struct({
3629 "allowed_callers": Schema.optionalKey(
3630 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3631 "title": "Allowed Callers"
3632 })
3633 ),
3634 "cache_control": Schema.optionalKey(
3635 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3636 "title": "Cache Control",
3637 "description": "Create a cache control breakpoint at this content block."
3638 })
3639 ),
3640 "defer_loading": Schema.optionalKey(
3641 Schema.Boolean.annotate({
3642 "title": "Defer Loading",
3643 "description":
3644 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3645 })
3646 ),
3647 "display_height_px": Schema.Number.annotate({
3648 "title": "Display Height Px",
3649 "description": "The height of the display in pixels."
3650 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
3651 "display_number": Schema.optionalKey(
3652 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null]).annotate({
3653 "title": "Display Number",
3654 "description": "The X11 display number (e.g. 0, 1) for the display."
3655 })
3656 ),
3657 "display_width_px": Schema.Number.annotate({
3658 "title": "Display Width Px",
3659 "description": "The width of the display in pixels."
3660 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
3661 "input_examples": Schema.optionalKey(
3662 Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" })
3663 ),
3664 "name": Schema.Literal("computer").annotate({
3665 "title": "Name",
3666 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3667 }),
3668 "strict": Schema.optionalKey(
3669 Schema.Boolean.annotate({
3670 "title": "Strict",
3671 "description": "When true, guarantees schema validation on tool names and inputs"
3672 })
3673 ),
3674 "type": Schema.Literal("computer_20250124").annotate({ "title": "Type" })
3675}).annotate({ "title": "ComputerUseTool_20250124" })
3676export type BetaComputerUseTool_20251124 = {
3677 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3678 readonly "cache_control"?: BetaCacheControlEphemeral | null
3679 readonly "defer_loading"?: boolean
3680 readonly "display_height_px": number
3681 readonly "display_number"?: number | null
3682 readonly "display_width_px": number
3683 readonly "enable_zoom"?: boolean
3684 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }>
3685 readonly "name": "computer"
3686 readonly "strict"?: boolean
3687 readonly "type": "computer_20251124"
3688}
3689export const BetaComputerUseTool_20251124 = Schema.Struct({
3690 "allowed_callers": Schema.optionalKey(
3691 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3692 "title": "Allowed Callers"
3693 })
3694 ),
3695 "cache_control": Schema.optionalKey(
3696 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3697 "title": "Cache Control",
3698 "description": "Create a cache control breakpoint at this content block."
3699 })
3700 ),
3701 "defer_loading": Schema.optionalKey(
3702 Schema.Boolean.annotate({
3703 "title": "Defer Loading",
3704 "description":
3705 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3706 })
3707 ),
3708 "display_height_px": Schema.Number.annotate({
3709 "title": "Display Height Px",
3710 "description": "The height of the display in pixels."
3711 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
3712 "display_number": Schema.optionalKey(
3713 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null]).annotate({
3714 "title": "Display Number",
3715 "description": "The X11 display number (e.g. 0, 1) for the display."
3716 })
3717 ),
3718 "display_width_px": Schema.Number.annotate({
3719 "title": "Display Width Px",
3720 "description": "The width of the display in pixels."
3721 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
3722 "enable_zoom": Schema.optionalKey(
3723 Schema.Boolean.annotate({
3724 "title": "Enable Zoom",
3725 "description": "Whether to enable an action to take a zoomed-in screenshot of the screen."
3726 })
3727 ),
3728 "input_examples": Schema.optionalKey(
3729 Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" })
3730 ),
3731 "name": Schema.Literal("computer").annotate({
3732 "title": "Name",
3733 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3734 }),
3735 "strict": Schema.optionalKey(
3736 Schema.Boolean.annotate({
3737 "title": "Strict",
3738 "description": "When true, guarantees schema validation on tool names and inputs"
3739 })
3740 ),
3741 "type": Schema.Literal("computer_20251124").annotate({ "title": "Type" })
3742}).annotate({ "title": "ComputerUseTool_20251124" })
3743export type BetaMemoryTool_20250818 = {
3744 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3745 readonly "cache_control"?: BetaCacheControlEphemeral | null
3746 readonly "defer_loading"?: boolean
3747 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }>
3748 readonly "name": "memory"
3749 readonly "strict"?: boolean
3750 readonly "type": "memory_20250818"
3751}
3752export const BetaMemoryTool_20250818 = Schema.Struct({
3753 "allowed_callers": Schema.optionalKey(
3754 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3755 "title": "Allowed Callers"
3756 })
3757 ),
3758 "cache_control": Schema.optionalKey(
3759 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3760 "title": "Cache Control",
3761 "description": "Create a cache control breakpoint at this content block."
3762 })
3763 ),
3764 "defer_loading": Schema.optionalKey(
3765 Schema.Boolean.annotate({
3766 "title": "Defer Loading",
3767 "description":
3768 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3769 })
3770 ),
3771 "input_examples": Schema.optionalKey(
3772 Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" })
3773 ),
3774 "name": Schema.Literal("memory").annotate({
3775 "title": "Name",
3776 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3777 }),
3778 "strict": Schema.optionalKey(
3779 Schema.Boolean.annotate({
3780 "title": "Strict",
3781 "description": "When true, guarantees schema validation on tool names and inputs"
3782 })
3783 ),
3784 "type": Schema.Literal("memory_20250818").annotate({ "title": "Type" })
3785}).annotate({ "title": "MemoryTool_20250818" })
3786export type BetaTextEditor_20241022 = {
3787 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3788 readonly "cache_control"?: BetaCacheControlEphemeral | null
3789 readonly "defer_loading"?: boolean
3790 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }>
3791 readonly "name": "str_replace_editor"
3792 readonly "strict"?: boolean
3793 readonly "type": "text_editor_20241022"
3794}
3795export const BetaTextEditor_20241022 = Schema.Struct({
3796 "allowed_callers": Schema.optionalKey(
3797 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3798 "title": "Allowed Callers"
3799 })
3800 ),
3801 "cache_control": Schema.optionalKey(
3802 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3803 "title": "Cache Control",
3804 "description": "Create a cache control breakpoint at this content block."
3805 })
3806 ),
3807 "defer_loading": Schema.optionalKey(
3808 Schema.Boolean.annotate({
3809 "title": "Defer Loading",
3810 "description":
3811 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3812 })
3813 ),
3814 "input_examples": Schema.optionalKey(
3815 Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" })
3816 ),
3817 "name": Schema.Literal("str_replace_editor").annotate({
3818 "title": "Name",
3819 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3820 }),
3821 "strict": Schema.optionalKey(
3822 Schema.Boolean.annotate({
3823 "title": "Strict",
3824 "description": "When true, guarantees schema validation on tool names and inputs"
3825 })
3826 ),
3827 "type": Schema.Literal("text_editor_20241022").annotate({ "title": "Type" })
3828}).annotate({ "title": "TextEditor_20241022" })
3829export type BetaTextEditor_20250124 = {
3830 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3831 readonly "cache_control"?: BetaCacheControlEphemeral | null
3832 readonly "defer_loading"?: boolean
3833 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }>
3834 readonly "name": "str_replace_editor"
3835 readonly "strict"?: boolean
3836 readonly "type": "text_editor_20250124"
3837}
3838export const BetaTextEditor_20250124 = Schema.Struct({
3839 "allowed_callers": Schema.optionalKey(
3840 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3841 "title": "Allowed Callers"
3842 })
3843 ),
3844 "cache_control": Schema.optionalKey(
3845 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3846 "title": "Cache Control",
3847 "description": "Create a cache control breakpoint at this content block."
3848 })
3849 ),
3850 "defer_loading": Schema.optionalKey(
3851 Schema.Boolean.annotate({
3852 "title": "Defer Loading",
3853 "description":
3854 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3855 })
3856 ),
3857 "input_examples": Schema.optionalKey(
3858 Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" })
3859 ),
3860 "name": Schema.Literal("str_replace_editor").annotate({
3861 "title": "Name",
3862 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3863 }),
3864 "strict": Schema.optionalKey(
3865 Schema.Boolean.annotate({
3866 "title": "Strict",
3867 "description": "When true, guarantees schema validation on tool names and inputs"
3868 })
3869 ),
3870 "type": Schema.Literal("text_editor_20250124").annotate({ "title": "Type" })
3871}).annotate({ "title": "TextEditor_20250124" })
3872export type BetaTextEditor_20250429 = {
3873 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3874 readonly "cache_control"?: BetaCacheControlEphemeral | null
3875 readonly "defer_loading"?: boolean
3876 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }>
3877 readonly "name": "str_replace_based_edit_tool"
3878 readonly "strict"?: boolean
3879 readonly "type": "text_editor_20250429"
3880}
3881export const BetaTextEditor_20250429 = Schema.Struct({
3882 "allowed_callers": Schema.optionalKey(
3883 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3884 "title": "Allowed Callers"
3885 })
3886 ),
3887 "cache_control": Schema.optionalKey(
3888 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3889 "title": "Cache Control",
3890 "description": "Create a cache control breakpoint at this content block."
3891 })
3892 ),
3893 "defer_loading": Schema.optionalKey(
3894 Schema.Boolean.annotate({
3895 "title": "Defer Loading",
3896 "description":
3897 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3898 })
3899 ),
3900 "input_examples": Schema.optionalKey(
3901 Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" })
3902 ),
3903 "name": Schema.Literal("str_replace_based_edit_tool").annotate({
3904 "title": "Name",
3905 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3906 }),
3907 "strict": Schema.optionalKey(
3908 Schema.Boolean.annotate({
3909 "title": "Strict",
3910 "description": "When true, guarantees schema validation on tool names and inputs"
3911 })
3912 ),
3913 "type": Schema.Literal("text_editor_20250429").annotate({ "title": "Type" })
3914}).annotate({ "title": "TextEditor_20250429" })
3915export type BetaTextEditor_20250728 = {
3916 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3917 readonly "cache_control"?: BetaCacheControlEphemeral | null
3918 readonly "defer_loading"?: boolean
3919 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }>
3920 readonly "max_characters"?: number | null
3921 readonly "name": "str_replace_based_edit_tool"
3922 readonly "strict"?: boolean
3923 readonly "type": "text_editor_20250728"
3924}
3925export const BetaTextEditor_20250728 = Schema.Struct({
3926 "allowed_callers": Schema.optionalKey(
3927 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
3928 "title": "Allowed Callers"
3929 })
3930 ),
3931 "cache_control": Schema.optionalKey(
3932 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
3933 "title": "Cache Control",
3934 "description": "Create a cache control breakpoint at this content block."
3935 })
3936 ),
3937 "defer_loading": Schema.optionalKey(
3938 Schema.Boolean.annotate({
3939 "title": "Defer Loading",
3940 "description":
3941 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
3942 })
3943 ),
3944 "input_examples": Schema.optionalKey(
3945 Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" })
3946 ),
3947 "max_characters": Schema.optionalKey(
3948 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), Schema.Null]).annotate({
3949 "title": "Max Characters",
3950 "description":
3951 "Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file."
3952 })
3953 ),
3954 "name": Schema.Literal("str_replace_based_edit_tool").annotate({
3955 "title": "Name",
3956 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3957 }),
3958 "strict": Schema.optionalKey(
3959 Schema.Boolean.annotate({
3960 "title": "Strict",
3961 "description": "When true, guarantees schema validation on tool names and inputs"
3962 })
3963 ),
3964 "type": Schema.Literal("text_editor_20250728").annotate({ "title": "Type" })
3965}).annotate({ "title": "TextEditor_20250728" })
3966export type BetaTool = {
3967 readonly "type"?: null | "custom"
3968 readonly "description"?: string
3969 readonly "name": string
3970 readonly "input_schema": {
3971 readonly "properties"?: { readonly [x: string]: Schema.Json } | null
3972 readonly "required"?: ReadonlyArray<string> | null
3973 readonly "type": "object"
3974 readonly [x: string]: Schema.Json
3975 }
3976 readonly "cache_control"?: BetaCacheControlEphemeral | null
3977 readonly "strict"?: boolean
3978 readonly "eager_input_streaming"?: boolean | null
3979 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
3980 readonly "defer_loading"?: boolean
3981 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }>
3982}
3983export const BetaTool = Schema.Struct({
3984 "type": Schema.optionalKey(Schema.Union([Schema.Null, Schema.Literal("custom")]).annotate({ "title": "Type" })),
3985 "description": Schema.optionalKey(Schema.String.annotate({
3986 "title": "Description",
3987 "description":
3988 "Description of what this tool does.\n\nTool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema."
3989 })),
3990 "name": Schema.String.annotate({
3991 "title": "Name",
3992 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
3993 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)).check(
3994 Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,128}$"))
3995 ),
3996 "input_schema": Schema.StructWithRest(
3997 Schema.Struct({
3998 "properties": Schema.optionalKey(
3999 Schema.Union([Schema.Record(Schema.String, Schema.Json), Schema.Null]).annotate({ "title": "Properties" })
4000 ),
4001 "required": Schema.optionalKey(
4002 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Required" })
4003 ),
4004 "type": Schema.Literal("object").annotate({ "title": "Type" })
4005 }),
4006 [Schema.Record(Schema.String, Schema.Json)]
4007 ).annotate({
4008 "title": "InputSchema",
4009 "description":
4010 "[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.\n\nThis defines the shape of the `input` that your tool accepts and that the model will produce."
4011 }),
4012 "cache_control": Schema.optionalKey(
4013 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
4014 "title": "Cache Control",
4015 "description": "Create a cache control breakpoint at this content block."
4016 })
4017 ),
4018 "strict": Schema.optionalKey(
4019 Schema.Boolean.annotate({
4020 "title": "Strict",
4021 "description": "When true, guarantees schema validation on tool names and inputs"
4022 })
4023 ),
4024 "eager_input_streaming": Schema.optionalKey(
4025 Schema.Union([Schema.Boolean, Schema.Null]).annotate({
4026 "title": "Eager Input Streaming",
4027 "description":
4028 "Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers."
4029 })
4030 ),
4031 "allowed_callers": Schema.optionalKey(
4032 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
4033 "title": "Allowed Callers"
4034 })
4035 ),
4036 "defer_loading": Schema.optionalKey(
4037 Schema.Boolean.annotate({
4038 "title": "Defer Loading",
4039 "description":
4040 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
4041 })
4042 ),
4043 "input_examples": Schema.optionalKey(
4044 Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" })
4045 )
4046}).annotate({ "title": "Tool" })
4047export type BetaMCPToolset = {
4048 readonly "cache_control"?: BetaCacheControlEphemeral | null
4049 readonly "configs"?: { readonly [x: string]: BetaMCPToolConfig } | null
4050 readonly "default_config"?: { readonly "defer_loading"?: boolean; readonly "enabled"?: boolean }
4051 readonly "mcp_server_name": string
4052 readonly "type": "mcp_toolset"
4053}
4054export const BetaMCPToolset = Schema.Struct({
4055 "cache_control": Schema.optionalKey(
4056 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
4057 "title": "Cache Control",
4058 "description": "Create a cache control breakpoint at this content block."
4059 })
4060 ),
4061 "configs": Schema.optionalKey(
4062 Schema.Union([Schema.Record(Schema.String, BetaMCPToolConfig), Schema.Null]).annotate({
4063 "title": "Configs",
4064 "description": "Configuration overrides for specific tools, keyed by tool name"
4065 })
4066 ),
4067 "default_config": Schema.optionalKey(
4068 Schema.Struct({
4069 "defer_loading": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Defer Loading" })),
4070 "enabled": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Enabled" }))
4071 }).annotate({
4072 "title": "MCPToolDefaultConfig",
4073 "description": "Default configuration applied to all tools from this server"
4074 })
4075 ),
4076 "mcp_server_name": Schema.String.annotate({
4077 "title": "Mcp Server Name",
4078 "description": "Name of the MCP server to configure tools for"
4079 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)),
4080 "type": Schema.Literal("mcp_toolset").annotate({ "title": "Type" })
4081}).annotate({
4082 "title": "MCPToolset",
4083 "description":
4084 "Configuration for a group of tools from an MCP server.\n\nAllows configuring enabled status and defer_loading for all tools\nfrom an MCP server, with optional per-tool overrides."
4085})
4086export type BetaListResponse_MessageBatch_ = {
4087 readonly "data": ReadonlyArray<BetaMessageBatch>
4088 readonly "first_id": string | null
4089 readonly "has_more": boolean
4090 readonly "last_id": string | null
4091}
4092export const BetaListResponse_MessageBatch_ = Schema.Struct({
4093 "data": Schema.Array(BetaMessageBatch).annotate({ "title": "Data" }),
4094 "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({
4095 "title": "First Id",
4096 "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page."
4097 }),
4098 "has_more": Schema.Boolean.annotate({
4099 "title": "Has More",
4100 "description": "Indicates if there are more results in the requested page direction."
4101 }),
4102 "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({
4103 "title": "Last Id",
4104 "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page."
4105 })
4106}).annotate({ "title": "ListResponse[MessageBatch]" })
4107export type BetaListResponse_ModelInfo_ = {
4108 readonly "data": ReadonlyArray<BetaModelInfo>
4109 readonly "first_id": string | null
4110 readonly "has_more": boolean
4111 readonly "last_id": string | null
4112}
4113export const BetaListResponse_ModelInfo_ = Schema.Struct({
4114 "data": Schema.Array(BetaModelInfo).annotate({ "title": "Data" }),
4115 "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({
4116 "title": "First Id",
4117 "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page."
4118 }),
4119 "has_more": Schema.Boolean.annotate({
4120 "title": "Has More",
4121 "description": "Indicates if there are more results in the requested page direction."
4122 }),
4123 "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({
4124 "title": "Last Id",
4125 "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page."
4126 })
4127}).annotate({ "title": "ListResponse[ModelInfo]" })
4128export type BetaErrorResponse = {
4129 readonly "error":
4130 | BetaInvalidRequestError
4131 | BetaAuthenticationError
4132 | BetaBillingError
4133 | BetaPermissionError
4134 | BetaNotFoundError
4135 | BetaRateLimitError
4136 | BetaGatewayTimeoutError
4137 | BetaAPIError
4138 | BetaOverloadedError
4139 readonly "request_id": string | null
4140 readonly "type": "error"
4141}
4142export const BetaErrorResponse = Schema.Struct({
4143 "error": Schema.Union([
4144 BetaInvalidRequestError,
4145 BetaAuthenticationError,
4146 BetaBillingError,
4147 BetaPermissionError,
4148 BetaNotFoundError,
4149 BetaRateLimitError,
4150 BetaGatewayTimeoutError,
4151 BetaAPIError,
4152 BetaOverloadedError
4153 ], { mode: "oneOf" }).annotate({ "title": "Error" }),
4154 "request_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Request Id", "default": null }),
4155 "type": Schema.Literal("error").annotate({ "title": "Type", "default": "error" })
4156}).annotate({ "title": "ErrorResponse" })
4157export type BetaRequestBashCodeExecutionResultBlock = {
4158 readonly "content": ReadonlyArray<BetaRequestBashCodeExecutionOutputBlock>
4159 readonly "return_code": number
4160 readonly "stderr": string
4161 readonly "stdout": string
4162 readonly "type": "bash_code_execution_result"
4163}
4164export const BetaRequestBashCodeExecutionResultBlock = Schema.Struct({
4165 "content": Schema.Array(BetaRequestBashCodeExecutionOutputBlock).annotate({ "title": "Content" }),
4166 "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()),
4167 "stderr": Schema.String.annotate({ "title": "Stderr" }),
4168 "stdout": Schema.String.annotate({ "title": "Stdout" }),
4169 "type": Schema.Literal("bash_code_execution_result").annotate({ "title": "Type" })
4170}).annotate({ "title": "RequestBashCodeExecutionResultBlock" })
4171export type BetaWebFetchTool_20250910 = {
4172 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
4173 readonly "allowed_domains"?: ReadonlyArray<string> | null
4174 readonly "blocked_domains"?: ReadonlyArray<string> | null
4175 readonly "cache_control"?: BetaCacheControlEphemeral | null
4176 readonly "citations"?: BetaRequestCitationsConfig | null
4177 readonly "defer_loading"?: boolean
4178 readonly "max_content_tokens"?: number | null
4179 readonly "max_uses"?: number | null
4180 readonly "name": "web_fetch"
4181 readonly "strict"?: boolean
4182 readonly "type": "web_fetch_20250910"
4183}
4184export const BetaWebFetchTool_20250910 = Schema.Struct({
4185 "allowed_callers": Schema.optionalKey(
4186 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
4187 "title": "Allowed Callers"
4188 })
4189 ),
4190 "allowed_domains": Schema.optionalKey(
4191 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
4192 "title": "Allowed Domains",
4193 "description": "List of domains to allow fetching from"
4194 })
4195 ),
4196 "blocked_domains": Schema.optionalKey(
4197 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
4198 "title": "Blocked Domains",
4199 "description": "List of domains to block fetching from"
4200 })
4201 ),
4202 "cache_control": Schema.optionalKey(
4203 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
4204 "title": "Cache Control",
4205 "description": "Create a cache control breakpoint at this content block."
4206 })
4207 ),
4208 "citations": Schema.optionalKey(
4209 Schema.Union([BetaRequestCitationsConfig, Schema.Null]).annotate({
4210 "description": "Citations configuration for fetched documents. Citations are disabled by default."
4211 })
4212 ),
4213 "defer_loading": Schema.optionalKey(
4214 Schema.Boolean.annotate({
4215 "title": "Defer Loading",
4216 "description":
4217 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
4218 })
4219 ),
4220 "max_content_tokens": Schema.optionalKey(
4221 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({
4222 "title": "Max Content Tokens",
4223 "description":
4224 "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs."
4225 })
4226 ),
4227 "max_uses": Schema.optionalKey(
4228 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({
4229 "title": "Max Uses",
4230 "description": "Maximum number of times the tool can be used in the API request."
4231 })
4232 ),
4233 "name": Schema.Literal("web_fetch").annotate({
4234 "title": "Name",
4235 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
4236 }),
4237 "strict": Schema.optionalKey(
4238 Schema.Boolean.annotate({
4239 "title": "Strict",
4240 "description": "When true, guarantees schema validation on tool names and inputs"
4241 })
4242 ),
4243 "type": Schema.Literal("web_fetch_20250910").annotate({ "title": "Type" })
4244}).annotate({ "title": "WebFetchTool_20250910" })
4245export type BetaWebFetchTool_20260209 = {
4246 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
4247 readonly "allowed_domains"?: ReadonlyArray<string> | null
4248 readonly "blocked_domains"?: ReadonlyArray<string> | null
4249 readonly "cache_control"?: BetaCacheControlEphemeral | null
4250 readonly "citations"?: BetaRequestCitationsConfig | null
4251 readonly "defer_loading"?: boolean
4252 readonly "max_content_tokens"?: number | null
4253 readonly "max_uses"?: number | null
4254 readonly "name": "web_fetch"
4255 readonly "strict"?: boolean
4256 readonly "type": "web_fetch_20260209"
4257}
4258export const BetaWebFetchTool_20260209 = Schema.Struct({
4259 "allowed_callers": Schema.optionalKey(
4260 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
4261 "title": "Allowed Callers"
4262 })
4263 ),
4264 "allowed_domains": Schema.optionalKey(
4265 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
4266 "title": "Allowed Domains",
4267 "description": "List of domains to allow fetching from"
4268 })
4269 ),
4270 "blocked_domains": Schema.optionalKey(
4271 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
4272 "title": "Blocked Domains",
4273 "description": "List of domains to block fetching from"
4274 })
4275 ),
4276 "cache_control": Schema.optionalKey(
4277 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
4278 "title": "Cache Control",
4279 "description": "Create a cache control breakpoint at this content block."
4280 })
4281 ),
4282 "citations": Schema.optionalKey(
4283 Schema.Union([BetaRequestCitationsConfig, Schema.Null]).annotate({
4284 "description": "Citations configuration for fetched documents. Citations are disabled by default."
4285 })
4286 ),
4287 "defer_loading": Schema.optionalKey(
4288 Schema.Boolean.annotate({
4289 "title": "Defer Loading",
4290 "description":
4291 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
4292 })
4293 ),
4294 "max_content_tokens": Schema.optionalKey(
4295 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({
4296 "title": "Max Content Tokens",
4297 "description":
4298 "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs."
4299 })
4300 ),
4301 "max_uses": Schema.optionalKey(
4302 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({
4303 "title": "Max Uses",
4304 "description": "Maximum number of times the tool can be used in the API request."
4305 })
4306 ),
4307 "name": Schema.Literal("web_fetch").annotate({
4308 "title": "Name",
4309 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
4310 }),
4311 "strict": Schema.optionalKey(
4312 Schema.Boolean.annotate({
4313 "title": "Strict",
4314 "description": "When true, guarantees schema validation on tool names and inputs"
4315 })
4316 ),
4317 "type": Schema.Literal("web_fetch_20260209").annotate({ "title": "Type" })
4318}).annotate({ "title": "WebFetchTool_20260209" })
4319export type BetaRequestCodeExecutionResultBlock = {
4320 readonly "content": ReadonlyArray<BetaRequestCodeExecutionOutputBlock>
4321 readonly "return_code": number
4322 readonly "stderr": string
4323 readonly "stdout": string
4324 readonly "type": "code_execution_result"
4325}
4326export const BetaRequestCodeExecutionResultBlock = Schema.Struct({
4327 "content": Schema.Array(BetaRequestCodeExecutionOutputBlock).annotate({ "title": "Content" }),
4328 "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()),
4329 "stderr": Schema.String.annotate({ "title": "Stderr" }),
4330 "stdout": Schema.String.annotate({ "title": "Stdout" }),
4331 "type": Schema.Literal("code_execution_result").annotate({ "title": "Type" })
4332}).annotate({ "title": "Result Block" })
4333export type BetaRequestEncryptedCodeExecutionResultBlock = {
4334 readonly "content": ReadonlyArray<BetaRequestCodeExecutionOutputBlock>
4335 readonly "encrypted_stdout": string
4336 readonly "return_code": number
4337 readonly "stderr": string
4338 readonly "type": "encrypted_code_execution_result"
4339}
4340export const BetaRequestEncryptedCodeExecutionResultBlock = Schema.Struct({
4341 "content": Schema.Array(BetaRequestCodeExecutionOutputBlock).annotate({ "title": "Content" }),
4342 "encrypted_stdout": Schema.String.annotate({ "title": "Encrypted Stdout" }),
4343 "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()),
4344 "stderr": Schema.String.annotate({ "title": "Stderr" }),
4345 "type": Schema.Literal("encrypted_code_execution_result").annotate({ "title": "Type" })
4346}).annotate({
4347 "title": "RequestEncryptedCodeExecutionResultBlock",
4348 "description": "Code execution result with encrypted stdout for PFC + web_search results."
4349})
4350export type BetaRequestMCPServerURLDefinition = {
4351 readonly "authorization_token"?: string | null
4352 readonly "name": string
4353 readonly "tool_configuration"?: BetaRequestMCPServerToolConfiguration | null
4354 readonly "type": "url"
4355 readonly "url": string
4356}
4357export const BetaRequestMCPServerURLDefinition = Schema.Struct({
4358 "authorization_token": Schema.optionalKey(
4359 Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Authorization Token" })
4360 ),
4361 "name": Schema.String.annotate({ "title": "Name" }),
4362 "tool_configuration": Schema.optionalKey(Schema.Union([BetaRequestMCPServerToolConfiguration, Schema.Null])),
4363 "type": Schema.Literal("url").annotate({ "title": "Type" }),
4364 "url": Schema.String.annotate({ "title": "Url" })
4365}).annotate({ "title": "RequestMCPServerURLDefinition" })
4366export type BetaRequestMCPToolResultBlock = {
4367 readonly "cache_control"?: BetaCacheControlEphemeral | null
4368 readonly "content"?:
4369 | string
4370 | ReadonlyArray<
4371 {
4372 readonly "cache_control"?: BetaCacheControlEphemeral | null
4373 readonly "citations"?:
4374 | ReadonlyArray<
4375 | BetaRequestCharLocationCitation
4376 | BetaRequestPageLocationCitation
4377 | BetaRequestContentBlockLocationCitation
4378 | BetaRequestWebSearchResultLocationCitation
4379 | BetaRequestSearchResultLocationCitation
4380 >
4381 | null
4382 readonly "text": string
4383 readonly "type": "text"
4384 }
4385 >
4386 readonly "is_error"?: boolean
4387 readonly "tool_use_id": string
4388 readonly "type": "mcp_tool_result"
4389}
4390export const BetaRequestMCPToolResultBlock = Schema.Struct({
4391 "cache_control": Schema.optionalKey(
4392 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
4393 "title": "Cache Control",
4394 "description": "Create a cache control breakpoint at this content block."
4395 })
4396 ),
4397 "content": Schema.optionalKey(
4398 Schema.Union([
4399 Schema.String,
4400 Schema.Array(
4401 Schema.Struct({
4402 "cache_control": Schema.optionalKey(
4403 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
4404 "title": "Cache Control",
4405 "description": "Create a cache control breakpoint at this content block."
4406 })
4407 ),
4408 "citations": Schema.optionalKey(
4409 Schema.Union([
4410 Schema.Array(
4411 Schema.Union([
4412 BetaRequestCharLocationCitation,
4413 BetaRequestPageLocationCitation,
4414 BetaRequestContentBlockLocationCitation,
4415 BetaRequestWebSearchResultLocationCitation,
4416 BetaRequestSearchResultLocationCitation
4417 ], { mode: "oneOf" })
4418 ),
4419 Schema.Null
4420 ]).annotate({ "title": "Citations" })
4421 ),
4422 "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)),
4423 "type": Schema.Literal("text").annotate({ "title": "Type" })
4424 }).annotate({ "title": "beta_mcp_tool_result_block_param_content_item" })
4425 ).annotate({ "title": "beta_mcp_tool_result_block_param_content" })
4426 ]).annotate({ "title": "Content" })
4427 ),
4428 "is_error": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Is Error" })),
4429 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
4430 Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))
4431 ),
4432 "type": Schema.Literal("mcp_tool_result").annotate({ "title": "Type" })
4433}).annotate({ "title": "RequestMCPToolResultBlock" })
4434export type BetaRequestTextBlock = {
4435 readonly "cache_control"?: BetaCacheControlEphemeral | null
4436 readonly "citations"?:
4437 | ReadonlyArray<
4438 | BetaRequestCharLocationCitation
4439 | BetaRequestPageLocationCitation
4440 | BetaRequestContentBlockLocationCitation
4441 | BetaRequestWebSearchResultLocationCitation
4442 | BetaRequestSearchResultLocationCitation
4443 >
4444 | null
4445 readonly "text": string
4446 readonly "type": "text"
4447}
4448export const BetaRequestTextBlock = Schema.Struct({
4449 "cache_control": Schema.optionalKey(
4450 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
4451 "title": "Cache Control",
4452 "description": "Create a cache control breakpoint at this content block."
4453 })
4454 ),
4455 "citations": Schema.optionalKey(
4456 Schema.Union([
4457 Schema.Array(
4458 Schema.Union([
4459 BetaRequestCharLocationCitation,
4460 BetaRequestPageLocationCitation,
4461 BetaRequestContentBlockLocationCitation,
4462 BetaRequestWebSearchResultLocationCitation,
4463 BetaRequestSearchResultLocationCitation
4464 ], { mode: "oneOf" })
4465 ),
4466 Schema.Null
4467 ]).annotate({ "title": "Citations" })
4468 ),
4469 "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)),
4470 "type": Schema.Literal("text").annotate({ "title": "Type" })
4471}).annotate({ "title": "RequestTextBlock" })
4472export type BetaResponseBashCodeExecutionResultBlock = {
4473 readonly "content": ReadonlyArray<BetaResponseBashCodeExecutionOutputBlock>
4474 readonly "return_code": number
4475 readonly "stderr": string
4476 readonly "stdout": string
4477 readonly "type": "bash_code_execution_result"
4478}
4479export const BetaResponseBashCodeExecutionResultBlock = Schema.Struct({
4480 "content": Schema.Array(BetaResponseBashCodeExecutionOutputBlock).annotate({ "title": "Content" }),
4481 "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()),
4482 "stderr": Schema.String.annotate({ "title": "Stderr" }),
4483 "stdout": Schema.String.annotate({ "title": "Stdout" }),
4484 "type": Schema.Literal("bash_code_execution_result").annotate({
4485 "title": "Type",
4486 "default": "bash_code_execution_result"
4487 })
4488}).annotate({ "title": "ResponseBashCodeExecutionResultBlock" })
4489export type BetaResponseDocumentBlock = {
4490 readonly "citations": BetaResponseCitationsConfig | null
4491 readonly "source": BetaBase64PDFSource | BetaPlainTextSource
4492 readonly "title": string | null
4493 readonly "type": "document"
4494}
4495export const BetaResponseDocumentBlock = Schema.Struct({
4496 "citations": Schema.Union([BetaResponseCitationsConfig, Schema.Null]).annotate({
4497 "description": "Citation configuration for the document",
4498 "default": null
4499 }),
4500 "source": Schema.Union([BetaBase64PDFSource, BetaPlainTextSource], { mode: "oneOf" }).annotate({ "title": "Source" }),
4501 "title": Schema.Union([Schema.String, Schema.Null]).annotate({
4502 "title": "Title",
4503 "description": "The title of the document",
4504 "default": null
4505 }),
4506 "type": Schema.Literal("document").annotate({ "title": "Type", "default": "document" })
4507}).annotate({ "title": "ResponseDocumentBlock" })
4508export type BetaResponseContextManagement = {
4509 readonly "applied_edits": ReadonlyArray<BetaResponseClearToolUses20250919Edit | BetaResponseClearThinking20251015Edit>
4510}
4511export const BetaResponseContextManagement = Schema.Struct({
4512 "applied_edits": Schema.Array(
4513 Schema.Union([BetaResponseClearToolUses20250919Edit, BetaResponseClearThinking20251015Edit], { mode: "oneOf" })
4514 ).annotate({ "title": "Applied Edits", "description": "List of context management edits that were applied." })
4515}).annotate({ "title": "ResponseContextManagement" })
4516export type BetaResponseCodeExecutionResultBlock = {
4517 readonly "content": ReadonlyArray<BetaResponseCodeExecutionOutputBlock>
4518 readonly "return_code": number
4519 readonly "stderr": string
4520 readonly "stdout": string
4521 readonly "type": "code_execution_result"
4522}
4523export const BetaResponseCodeExecutionResultBlock = Schema.Struct({
4524 "content": Schema.Array(BetaResponseCodeExecutionOutputBlock).annotate({ "title": "Content" }),
4525 "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()),
4526 "stderr": Schema.String.annotate({ "title": "Stderr" }),
4527 "stdout": Schema.String.annotate({ "title": "Stdout" }),
4528 "type": Schema.Literal("code_execution_result").annotate({ "title": "Type", "default": "code_execution_result" })
4529}).annotate({ "title": "ResponseCodeExecutionResultBlock" })
4530export type BetaResponseEncryptedCodeExecutionResultBlock = {
4531 readonly "content": ReadonlyArray<BetaResponseCodeExecutionOutputBlock>
4532 readonly "encrypted_stdout": string
4533 readonly "return_code": number
4534 readonly "stderr": string
4535 readonly "type": "encrypted_code_execution_result"
4536}
4537export const BetaResponseEncryptedCodeExecutionResultBlock = Schema.Struct({
4538 "content": Schema.Array(BetaResponseCodeExecutionOutputBlock).annotate({ "title": "Content" }),
4539 "encrypted_stdout": Schema.String.annotate({ "title": "Encrypted Stdout" }),
4540 "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()),
4541 "stderr": Schema.String.annotate({ "title": "Stderr" }),
4542 "type": Schema.Literal("encrypted_code_execution_result").annotate({
4543 "title": "Type",
4544 "default": "encrypted_code_execution_result"
4545 })
4546}).annotate({
4547 "title": "ResponseEncryptedCodeExecutionResultBlock",
4548 "description": "Code execution result with encrypted stdout for PFC + web_search results."
4549})
4550export type BetaResponseToolSearchToolSearchResultBlock = {
4551 readonly "tool_references": ReadonlyArray<BetaResponseToolReferenceBlock>
4552 readonly "type": "tool_search_tool_search_result"
4553}
4554export const BetaResponseToolSearchToolSearchResultBlock = Schema.Struct({
4555 "tool_references": Schema.Array(BetaResponseToolReferenceBlock).annotate({ "title": "Tool References" }),
4556 "type": Schema.Literal("tool_search_tool_search_result").annotate({
4557 "title": "Type",
4558 "default": "tool_search_tool_search_result"
4559 })
4560}).annotate({ "title": "ResponseToolSearchToolSearchResultBlock" })
4561export type BetaCitationsDelta = {
4562 readonly "citation":
4563 | BetaResponseCharLocationCitation
4564 | BetaResponsePageLocationCitation
4565 | BetaResponseContentBlockLocationCitation
4566 | BetaResponseWebSearchResultLocationCitation
4567 | BetaResponseSearchResultLocationCitation
4568 readonly "type": "citations_delta"
4569}
4570export const BetaCitationsDelta = Schema.Struct({
4571 "citation": Schema.Union([
4572 BetaResponseCharLocationCitation,
4573 BetaResponsePageLocationCitation,
4574 BetaResponseContentBlockLocationCitation,
4575 BetaResponseWebSearchResultLocationCitation,
4576 BetaResponseSearchResultLocationCitation
4577 ], { mode: "oneOf" }).annotate({ "title": "Citation" }),
4578 "type": Schema.Literal("citations_delta").annotate({ "title": "Type", "default": "citations_delta" })
4579}).annotate({ "title": "CitationsDelta" })
4580export type BetaResponseMCPToolResultBlock = {
4581 readonly "content":
4582 | string
4583 | ReadonlyArray<
4584 {
4585 readonly "citations":
4586 | ReadonlyArray<
4587 | BetaResponseCharLocationCitation
4588 | BetaResponsePageLocationCitation
4589 | BetaResponseContentBlockLocationCitation
4590 | BetaResponseWebSearchResultLocationCitation
4591 | BetaResponseSearchResultLocationCitation
4592 >
4593 | null
4594 readonly "text": string
4595 readonly "type": "text"
4596 }
4597 >
4598 readonly "is_error": boolean
4599 readonly "tool_use_id": string
4600 readonly "type": "mcp_tool_result"
4601}
4602export const BetaResponseMCPToolResultBlock = Schema.Struct({
4603 "content": Schema.Union([
4604 Schema.String,
4605 Schema.Array(
4606 Schema.Struct({
4607 "citations": Schema.Union([
4608 Schema.Array(
4609 Schema.Union([
4610 BetaResponseCharLocationCitation,
4611 BetaResponsePageLocationCitation,
4612 BetaResponseContentBlockLocationCitation,
4613 BetaResponseWebSearchResultLocationCitation,
4614 BetaResponseSearchResultLocationCitation
4615 ], { mode: "oneOf" })
4616 ),
4617 Schema.Null
4618 ]).annotate({
4619 "title": "Citations",
4620 "description":
4621 "Citations supporting the text block.\n\nThe type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.",
4622 "default": null
4623 }),
4624 "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(0)).check(
4625 Schema.isMaxLength(5000000)
4626 ),
4627 "type": Schema.Literal("text").annotate({ "title": "Type", "default": "text" })
4628 }).annotate({ "title": "beta_mcp_tool_result_block_content_item" })
4629 ).annotate({ "title": "beta_mcp_tool_result_block_content" })
4630 ]).annotate({ "title": "Content" }),
4631 "is_error": Schema.Boolean.annotate({ "title": "Is Error", "default": false }),
4632 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
4633 Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))
4634 ),
4635 "type": Schema.Literal("mcp_tool_result").annotate({ "title": "Type", "default": "mcp_tool_result" })
4636}).annotate({ "title": "ResponseMCPToolResultBlock" })
4637export type BetaResponseTextBlock = {
4638 readonly "citations"?:
4639 | ReadonlyArray<
4640 | BetaResponseCharLocationCitation
4641 | BetaResponsePageLocationCitation
4642 | BetaResponseContentBlockLocationCitation
4643 | BetaResponseWebSearchResultLocationCitation
4644 | BetaResponseSearchResultLocationCitation
4645 >
4646 | null
4647 readonly "text": string
4648 readonly "type": "text"
4649}
4650export const BetaResponseTextBlock = Schema.Struct({
4651 "citations": Schema.optionalKey(
4652 Schema.Union([
4653 Schema.Array(
4654 Schema.Union([
4655 BetaResponseCharLocationCitation,
4656 BetaResponsePageLocationCitation,
4657 BetaResponseContentBlockLocationCitation,
4658 BetaResponseWebSearchResultLocationCitation,
4659 BetaResponseSearchResultLocationCitation
4660 ], { mode: "oneOf" })
4661 ),
4662 Schema.Null
4663 ]).annotate({
4664 "title": "Citations",
4665 "description":
4666 "Citations supporting the text block.\n\nThe type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.",
4667 "default": null
4668 })
4669 ),
4670 "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(0)).check(Schema.isMaxLength(5000000)),
4671 "type": Schema.Literal("text").annotate({ "title": "Type", "default": "text" })
4672}).annotate({ "title": "ResponseTextBlock" })
4673export type BetaRequestServerToolUseBlock = {
4674 readonly "cache_control"?: BetaCacheControlEphemeral | null
4675 readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120
4676 readonly "id": string
4677 readonly "input": { readonly [x: string]: Schema.Json }
4678 readonly "name":
4679 | "web_search"
4680 | "web_fetch"
4681 | "code_execution"
4682 | "bash_code_execution"
4683 | "text_editor_code_execution"
4684 | "tool_search_tool_regex"
4685 | "tool_search_tool_bm25"
4686 readonly "type": "server_tool_use"
4687}
4688export const BetaRequestServerToolUseBlock = Schema.Struct({
4689 "cache_control": Schema.optionalKey(
4690 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
4691 "title": "Cache Control",
4692 "description": "Create a cache control breakpoint at this content block."
4693 })
4694 ),
4695 "caller": Schema.optionalKey(
4696 Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({
4697 "title": "Caller"
4698 })
4699 ),
4700 "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
4701 "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }),
4702 "name": Schema.Literals([
4703 "web_search",
4704 "web_fetch",
4705 "code_execution",
4706 "bash_code_execution",
4707 "text_editor_code_execution",
4708 "tool_search_tool_regex",
4709 "tool_search_tool_bm25"
4710 ]).annotate({ "title": "Name" }),
4711 "type": Schema.Literal("server_tool_use").annotate({ "title": "Type" })
4712}).annotate({ "title": "RequestServerToolUseBlock" })
4713export type BetaResponseServerToolUseBlock = {
4714 readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120
4715 readonly "id": string
4716 readonly "input": { readonly [x: string]: Schema.Json }
4717 readonly "name":
4718 | "web_search"
4719 | "web_fetch"
4720 | "code_execution"
4721 | "bash_code_execution"
4722 | "text_editor_code_execution"
4723 | "tool_search_tool_regex"
4724 | "tool_search_tool_bm25"
4725 readonly "type": "server_tool_use"
4726}
4727export const BetaResponseServerToolUseBlock = Schema.Struct({
4728 "caller": Schema.optionalKey(
4729 Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({
4730 "title": "Caller"
4731 })
4732 ),
4733 "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
4734 "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }),
4735 "name": Schema.Literals([
4736 "web_search",
4737 "web_fetch",
4738 "code_execution",
4739 "bash_code_execution",
4740 "text_editor_code_execution",
4741 "tool_search_tool_regex",
4742 "tool_search_tool_bm25"
4743 ]).annotate({ "title": "Name" }),
4744 "type": Schema.Literal("server_tool_use").annotate({ "title": "Type", "default": "server_tool_use" })
4745}).annotate({ "title": "ResponseServerToolUseBlock" })
4746export type BetaResponseToolUseBlock = {
4747 readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120
4748 readonly "id": string
4749 readonly "input": { readonly [x: string]: Schema.Json }
4750 readonly "name": string
4751 readonly "type": "tool_use"
4752}
4753export const BetaResponseToolUseBlock = Schema.Struct({
4754 "caller": Schema.optionalKey(
4755 Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({
4756 "title": "Caller"
4757 })
4758 ),
4759 "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
4760 "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }),
4761 "name": Schema.String.annotate({ "title": "Name" }).check(Schema.isMinLength(1)),
4762 "type": Schema.Literal("tool_use").annotate({ "title": "Type", "default": "tool_use" })
4763}).annotate({ "title": "ResponseToolUseBlock" })
4764export type BetaContainer = {
4765 readonly "expires_at": string
4766 readonly "id": string
4767 readonly "skills": ReadonlyArray<BetaSkill> | null
4768}
4769export const BetaContainer = Schema.Struct({
4770 "expires_at": Schema.String.annotate({
4771 "title": "Expires At",
4772 "description": "The time at which the container will expire.",
4773 "format": "date-time"
4774 }),
4775 "id": Schema.String.annotate({ "title": "Id", "description": "Identifier for the container used in this request" }),
4776 "skills": Schema.Union([Schema.Array(BetaSkill), Schema.Null]).annotate({
4777 "title": "Skills",
4778 "description": "Skills loaded in the container",
4779 "default": null
4780 })
4781}).annotate({
4782 "title": "Container",
4783 "description": "Information about the container used in the request (for the code execution tool)"
4784})
4785export type BetaContainerParams = {
4786 readonly "id"?: string | null
4787 readonly "skills"?: ReadonlyArray<BetaSkillParams> | null
4788}
4789export const BetaContainerParams = Schema.Struct({
4790 "id": Schema.optionalKey(
4791 Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Id", "description": "Container id" })
4792 ),
4793 "skills": Schema.optionalKey(
4794 Schema.Union([Schema.Array(BetaSkillParams).check(Schema.isMaxLength(8)), Schema.Null]).annotate({
4795 "title": "Skills",
4796 "description": "List of skills to load in the container"
4797 })
4798 )
4799}).annotate({ "title": "ContainerParams", "description": "Container parameters with skills to be loaded." })
4800export type BetaListSkillVersionsResponse = {
4801 readonly "data": ReadonlyArray<BetaSkillVersion>
4802 readonly "has_more": boolean
4803 readonly "next_page": string | null
4804}
4805export const BetaListSkillVersionsResponse = Schema.Struct({
4806 "data": Schema.Array(BetaSkillVersion).annotate({ "title": "Data", "description": "List of skill versions." }),
4807 "has_more": Schema.Boolean.annotate({
4808 "title": "Has More",
4809 "description": "Indicates if there are more results in the requested page direction."
4810 }),
4811 "next_page": Schema.Union([Schema.String, Schema.Null]).annotate({
4812 "title": "Next Page",
4813 "description": "Token to provide in as `page` in the subsequent request to retrieve the next page of data."
4814 })
4815}).annotate({ "title": "ListSkillVersionsResponse" })
4816export type BetaRequestTextEditorCodeExecutionToolResultError = {
4817 readonly "error_code": BetaTextEditorCodeExecutionToolResultErrorCode
4818 readonly "error_message"?: string | null
4819 readonly "type": "text_editor_code_execution_tool_result_error"
4820}
4821export const BetaRequestTextEditorCodeExecutionToolResultError = Schema.Struct({
4822 "error_code": BetaTextEditorCodeExecutionToolResultErrorCode,
4823 "error_message": Schema.optionalKey(
4824 Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message" })
4825 ),
4826 "type": Schema.Literal("text_editor_code_execution_tool_result_error").annotate({ "title": "Type" })
4827}).annotate({ "title": "RequestTextEditorCodeExecutionToolResultError" })
4828export type BetaResponseTextEditorCodeExecutionToolResultError = {
4829 readonly "error_code": BetaTextEditorCodeExecutionToolResultErrorCode
4830 readonly "error_message": string | null
4831 readonly "type": "text_editor_code_execution_tool_result_error"
4832}
4833export const BetaResponseTextEditorCodeExecutionToolResultError = Schema.Struct({
4834 "error_code": BetaTextEditorCodeExecutionToolResultErrorCode,
4835 "error_message": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message", "default": null }),
4836 "type": Schema.Literal("text_editor_code_execution_tool_result_error").annotate({
4837 "title": "Type",
4838 "default": "text_editor_code_execution_tool_result_error"
4839 })
4840}).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultError" })
4841export type BetaThinkingConfigParam =
4842 | BetaThinkingConfigEnabled
4843 | BetaThinkingConfigDisabled
4844 | BetaThinkingConfigAdaptive
4845export const BetaThinkingConfigParam = Schema.Union([
4846 BetaThinkingConfigEnabled,
4847 BetaThinkingConfigDisabled,
4848 BetaThinkingConfigAdaptive
4849], { mode: "oneOf" }).annotate({
4850 "title": "Thinking",
4851 "description":
4852 "Configuration for enabling Claude's extended thinking.\n\nWhen enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details."
4853})
4854export type BetaClearThinking20251015 = {
4855 readonly "keep"?: BetaThinkingTurns | BetaAllThinkingTurns | "all"
4856 readonly "type": "clear_thinking_20251015"
4857}
4858export const BetaClearThinking20251015 = Schema.Struct({
4859 "keep": Schema.optionalKey(
4860 Schema.Union([Schema.Union([BetaThinkingTurns, BetaAllThinkingTurns], { mode: "oneOf" }), Schema.Literal("all")])
4861 .annotate({
4862 "title": "Keep",
4863 "description":
4864 "Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed."
4865 })
4866 ),
4867 "type": Schema.Literal("clear_thinking_20251015").annotate({ "title": "Type" })
4868}).annotate({ "title": "ClearThinking20251015" })
4869export type BetaToolChoice = BetaToolChoiceAuto | BetaToolChoiceAny | BetaToolChoiceTool | BetaToolChoiceNone
4870export const BetaToolChoice = Schema.Union([
4871 BetaToolChoiceAuto,
4872 BetaToolChoiceAny,
4873 BetaToolChoiceTool,
4874 BetaToolChoiceNone
4875], { mode: "oneOf" }).annotate({
4876 "title": "Tool Choice",
4877 "description":
4878 "How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all."
4879})
4880export type BetaRequestToolSearchToolResultError = {
4881 readonly "error_code": BetaToolSearchToolResultErrorCode
4882 readonly "type": "tool_search_tool_result_error"
4883}
4884export const BetaRequestToolSearchToolResultError = Schema.Struct({
4885 "error_code": BetaToolSearchToolResultErrorCode,
4886 "type": Schema.Literal("tool_search_tool_result_error").annotate({ "title": "Type" })
4887}).annotate({ "title": "RequestToolSearchToolResultError" })
4888export type BetaResponseToolSearchToolResultError = {
4889 readonly "error_code": BetaToolSearchToolResultErrorCode
4890 readonly "error_message": string | null
4891 readonly "type": "tool_search_tool_result_error"
4892}
4893export const BetaResponseToolSearchToolResultError = Schema.Struct({
4894 "error_code": BetaToolSearchToolResultErrorCode,
4895 "error_message": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message", "default": null }),
4896 "type": Schema.Literal("tool_search_tool_result_error").annotate({
4897 "title": "Type",
4898 "default": "tool_search_tool_result_error"
4899 })
4900}).annotate({ "title": "ResponseToolSearchToolResultError" })
4901export type BetaClearToolUses20250919 = {
4902 readonly "clear_at_least"?: BetaInputTokensClearAtLeast | null
4903 readonly "clear_tool_inputs"?: boolean | ReadonlyArray<string> | null
4904 readonly "exclude_tools"?: ReadonlyArray<string> | null
4905 readonly "keep"?: BetaToolUsesKeep
4906 readonly "trigger"?: BetaInputTokensTrigger | BetaToolUsesTrigger
4907 readonly "type": "clear_tool_uses_20250919"
4908}
4909export const BetaClearToolUses20250919 = Schema.Struct({
4910 "clear_at_least": Schema.optionalKey(
4911 Schema.Union([BetaInputTokensClearAtLeast, Schema.Null]).annotate({
4912 "description":
4913 "Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed."
4914 })
4915 ),
4916 "clear_tool_inputs": Schema.optionalKey(
4917 Schema.Union([Schema.Boolean, Schema.Array(Schema.String), Schema.Null]).annotate({
4918 "title": "Clear Tool Inputs",
4919 "description": "Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)"
4920 })
4921 ),
4922 "exclude_tools": Schema.optionalKey(
4923 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
4924 "title": "Exclude Tools",
4925 "description": "Tool names whose uses are preserved from clearing"
4926 })
4927 ),
4928 "keep": Schema.optionalKey(
4929 Schema.Union([BetaToolUsesKeep], { mode: "oneOf" }).annotate({
4930 "title": "Keep",
4931 "description": "Number of tool uses to retain in the conversation"
4932 })
4933 ),
4934 "trigger": Schema.optionalKey(
4935 Schema.Union([BetaInputTokensTrigger, BetaToolUsesTrigger], { mode: "oneOf" }).annotate({
4936 "title": "Trigger",
4937 "description": "Condition that triggers the context management strategy"
4938 })
4939 ),
4940 "type": Schema.Literal("clear_tool_uses_20250919").annotate({ "title": "Type" })
4941}).annotate({ "title": "ClearToolUses20250919" })
4942export type BetaRequestImageBlock = {
4943 readonly "cache_control"?: BetaCacheControlEphemeral | null
4944 readonly "source": BetaBase64ImageSource | BetaURLImageSource | BetaFileImageSource
4945 readonly "type": "image"
4946}
4947export const BetaRequestImageBlock = Schema.Struct({
4948 "cache_control": Schema.optionalKey(
4949 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
4950 "title": "Cache Control",
4951 "description": "Create a cache control breakpoint at this content block."
4952 })
4953 ),
4954 "source": Schema.Union([BetaBase64ImageSource, BetaURLImageSource, BetaFileImageSource], { mode: "oneOf" }).annotate({
4955 "title": "Source"
4956 }),
4957 "type": Schema.Literal("image").annotate({ "title": "Type" })
4958}).annotate({ "title": "RequestImageBlock" })
4959export type BetaWebSearchTool_20250305 = {
4960 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
4961 readonly "allowed_domains"?: ReadonlyArray<string> | null
4962 readonly "blocked_domains"?: ReadonlyArray<string> | null
4963 readonly "cache_control"?: BetaCacheControlEphemeral | null
4964 readonly "defer_loading"?: boolean
4965 readonly "max_uses"?: number | null
4966 readonly "name": "web_search"
4967 readonly "strict"?: boolean
4968 readonly "type": "web_search_20250305"
4969 readonly "user_location"?: BetaUserLocation | null
4970}
4971export const BetaWebSearchTool_20250305 = Schema.Struct({
4972 "allowed_callers": Schema.optionalKey(
4973 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
4974 "title": "Allowed Callers"
4975 })
4976 ),
4977 "allowed_domains": Schema.optionalKey(
4978 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
4979 "title": "Allowed Domains",
4980 "description":
4981 "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`."
4982 })
4983 ),
4984 "blocked_domains": Schema.optionalKey(
4985 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
4986 "title": "Blocked Domains",
4987 "description":
4988 "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`."
4989 })
4990 ),
4991 "cache_control": Schema.optionalKey(
4992 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
4993 "title": "Cache Control",
4994 "description": "Create a cache control breakpoint at this content block."
4995 })
4996 ),
4997 "defer_loading": Schema.optionalKey(
4998 Schema.Boolean.annotate({
4999 "title": "Defer Loading",
5000 "description":
5001 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5002 })
5003 ),
5004 "max_uses": Schema.optionalKey(
5005 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({
5006 "title": "Max Uses",
5007 "description": "Maximum number of times the tool can be used in the API request."
5008 })
5009 ),
5010 "name": Schema.Literal("web_search").annotate({
5011 "title": "Name",
5012 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5013 }),
5014 "strict": Schema.optionalKey(
5015 Schema.Boolean.annotate({
5016 "title": "Strict",
5017 "description": "When true, guarantees schema validation on tool names and inputs"
5018 })
5019 ),
5020 "type": Schema.Literal("web_search_20250305").annotate({ "title": "Type" }),
5021 "user_location": Schema.optionalKey(
5022 Schema.Union([BetaUserLocation, Schema.Null]).annotate({
5023 "description": "Parameters for the user's location. Used to provide more relevant search results."
5024 })
5025 )
5026}).annotate({ "title": "WebSearchTool_20250305" })
5027export type BetaWebSearchTool_20260209 = {
5028 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5029 readonly "allowed_domains"?: ReadonlyArray<string> | null
5030 readonly "blocked_domains"?: ReadonlyArray<string> | null
5031 readonly "cache_control"?: BetaCacheControlEphemeral | null
5032 readonly "defer_loading"?: boolean
5033 readonly "max_uses"?: number | null
5034 readonly "name": "web_search"
5035 readonly "strict"?: boolean
5036 readonly "type": "web_search_20260209"
5037 readonly "user_location"?: BetaUserLocation | null
5038}
5039export const BetaWebSearchTool_20260209 = Schema.Struct({
5040 "allowed_callers": Schema.optionalKey(
5041 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5042 "title": "Allowed Callers"
5043 })
5044 ),
5045 "allowed_domains": Schema.optionalKey(
5046 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
5047 "title": "Allowed Domains",
5048 "description":
5049 "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`."
5050 })
5051 ),
5052 "blocked_domains": Schema.optionalKey(
5053 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
5054 "title": "Blocked Domains",
5055 "description":
5056 "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`."
5057 })
5058 ),
5059 "cache_control": Schema.optionalKey(
5060 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5061 "title": "Cache Control",
5062 "description": "Create a cache control breakpoint at this content block."
5063 })
5064 ),
5065 "defer_loading": Schema.optionalKey(
5066 Schema.Boolean.annotate({
5067 "title": "Defer Loading",
5068 "description":
5069 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5070 })
5071 ),
5072 "max_uses": Schema.optionalKey(
5073 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({
5074 "title": "Max Uses",
5075 "description": "Maximum number of times the tool can be used in the API request."
5076 })
5077 ),
5078 "name": Schema.Literal("web_search").annotate({
5079 "title": "Name",
5080 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5081 }),
5082 "strict": Schema.optionalKey(
5083 Schema.Boolean.annotate({
5084 "title": "Strict",
5085 "description": "When true, guarantees schema validation on tool names and inputs"
5086 })
5087 ),
5088 "type": Schema.Literal("web_search_20260209").annotate({ "title": "Type" }),
5089 "user_location": Schema.optionalKey(
5090 Schema.Union([BetaUserLocation, Schema.Null]).annotate({
5091 "description": "Parameters for the user's location. Used to provide more relevant search results."
5092 })
5093 )
5094}).annotate({ "title": "WebSearchTool_20260209" })
5095export type BetaRequestWebFetchToolResultError = {
5096 readonly "error_code": BetaWebFetchToolResultErrorCode
5097 readonly "type": "web_fetch_tool_result_error"
5098}
5099export const BetaRequestWebFetchToolResultError = Schema.Struct({
5100 "error_code": BetaWebFetchToolResultErrorCode,
5101 "type": Schema.Literal("web_fetch_tool_result_error").annotate({ "title": "Type" })
5102}).annotate({ "title": "RequestWebFetchToolResultError" })
5103export type BetaResponseWebFetchToolResultError = {
5104 readonly "error_code": BetaWebFetchToolResultErrorCode
5105 readonly "type": "web_fetch_tool_result_error"
5106}
5107export const BetaResponseWebFetchToolResultError = Schema.Struct({
5108 "error_code": BetaWebFetchToolResultErrorCode,
5109 "type": Schema.Literal("web_fetch_tool_result_error").annotate({
5110 "title": "Type",
5111 "default": "web_fetch_tool_result_error"
5112 })
5113}).annotate({ "title": "ResponseWebFetchToolResultError" })
5114export type BetaRequestWebSearchToolResultError = {
5115 readonly "error_code": BetaWebSearchToolResultErrorCode
5116 readonly "type": "web_search_tool_result_error"
5117}
5118export const BetaRequestWebSearchToolResultError = Schema.Struct({
5119 "error_code": BetaWebSearchToolResultErrorCode,
5120 "type": Schema.Literal("web_search_tool_result_error").annotate({ "title": "Type" })
5121}).annotate({ "title": "Error" })
5122export type BetaResponseWebSearchToolResultError = {
5123 readonly "error_code": BetaWebSearchToolResultErrorCode
5124 readonly "type": "web_search_tool_result_error"
5125}
5126export const BetaResponseWebSearchToolResultError = Schema.Struct({
5127 "error_code": BetaWebSearchToolResultErrorCode,
5128 "type": Schema.Literal("web_search_tool_result_error").annotate({
5129 "title": "Type",
5130 "default": "web_search_tool_result_error"
5131 })
5132}).annotate({ "title": "ResponseWebSearchToolResultError" })
5133export type BetaListSkillsResponse = {
5134 readonly "data": ReadonlyArray<Betaapi__schemas__skills__Skill>
5135 readonly "has_more": boolean
5136 readonly "next_page": string | null
5137}
5138export const BetaListSkillsResponse = Schema.Struct({
5139 "data": Schema.Array(Betaapi__schemas__skills__Skill).annotate({ "title": "Data", "description": "List of skills." }),
5140 "has_more": Schema.Boolean.annotate({
5141 "title": "Has More",
5142 "description":
5143 "Whether there are more results available.\n\nIf `true`, there are additional results that can be fetched using the `next_page` token."
5144 }),
5145 "next_page": Schema.Union([Schema.String, Schema.Null]).annotate({
5146 "title": "Next Page",
5147 "description":
5148 "Token for fetching the next page of results.\n\nIf `null`, there are no more results available. Pass this value to the `page_token` parameter in the next request to get the next page."
5149 })
5150}).annotate({ "title": "ListSkillsResponse" })
5151export type CodeExecutionTool_20250522 = {
5152 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5153 readonly "cache_control"?: CacheControlEphemeral | null
5154 readonly "defer_loading"?: boolean
5155 readonly "name": "code_execution"
5156 readonly "strict"?: boolean
5157 readonly "type": "code_execution_20250522"
5158}
5159export const CodeExecutionTool_20250522 = Schema.Struct({
5160 "allowed_callers": Schema.optionalKey(
5161 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5162 "title": "Allowed Callers"
5163 })
5164 ),
5165 "cache_control": Schema.optionalKey(
5166 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5167 "title": "Cache Control",
5168 "description": "Create a cache control breakpoint at this content block."
5169 })
5170 ),
5171 "defer_loading": Schema.optionalKey(
5172 Schema.Boolean.annotate({
5173 "title": "Defer Loading",
5174 "description":
5175 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5176 })
5177 ),
5178 "name": Schema.Literal("code_execution").annotate({
5179 "title": "Name",
5180 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5181 }),
5182 "strict": Schema.optionalKey(
5183 Schema.Boolean.annotate({
5184 "title": "Strict",
5185 "description": "When true, guarantees schema validation on tool names and inputs"
5186 })
5187 ),
5188 "type": Schema.Literal("code_execution_20250522").annotate({ "title": "Type" })
5189}).annotate({ "title": "CodeExecutionTool_20250522" })
5190export type CodeExecutionTool_20250825 = {
5191 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5192 readonly "cache_control"?: CacheControlEphemeral | null
5193 readonly "defer_loading"?: boolean
5194 readonly "name": "code_execution"
5195 readonly "strict"?: boolean
5196 readonly "type": "code_execution_20250825"
5197}
5198export const CodeExecutionTool_20250825 = Schema.Struct({
5199 "allowed_callers": Schema.optionalKey(
5200 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5201 "title": "Allowed Callers"
5202 })
5203 ),
5204 "cache_control": Schema.optionalKey(
5205 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5206 "title": "Cache Control",
5207 "description": "Create a cache control breakpoint at this content block."
5208 })
5209 ),
5210 "defer_loading": Schema.optionalKey(
5211 Schema.Boolean.annotate({
5212 "title": "Defer Loading",
5213 "description":
5214 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5215 })
5216 ),
5217 "name": Schema.Literal("code_execution").annotate({
5218 "title": "Name",
5219 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5220 }),
5221 "strict": Schema.optionalKey(
5222 Schema.Boolean.annotate({
5223 "title": "Strict",
5224 "description": "When true, guarantees schema validation on tool names and inputs"
5225 })
5226 ),
5227 "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" })
5228}).annotate({ "title": "CodeExecutionTool_20250825" })
5229export type CodeExecutionTool_20260120 = {
5230 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5231 readonly "cache_control"?: CacheControlEphemeral | null
5232 readonly "defer_loading"?: boolean
5233 readonly "name": "code_execution"
5234 readonly "strict"?: boolean
5235 readonly "type": "code_execution_20260120"
5236}
5237export const CodeExecutionTool_20260120 = Schema.Struct({
5238 "allowed_callers": Schema.optionalKey(
5239 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5240 "title": "Allowed Callers"
5241 })
5242 ),
5243 "cache_control": Schema.optionalKey(
5244 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5245 "title": "Cache Control",
5246 "description": "Create a cache control breakpoint at this content block."
5247 })
5248 ),
5249 "defer_loading": Schema.optionalKey(
5250 Schema.Boolean.annotate({
5251 "title": "Defer Loading",
5252 "description":
5253 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5254 })
5255 ),
5256 "name": Schema.Literal("code_execution").annotate({
5257 "title": "Name",
5258 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5259 }),
5260 "strict": Schema.optionalKey(
5261 Schema.Boolean.annotate({
5262 "title": "Strict",
5263 "description": "When true, guarantees schema validation on tool names and inputs"
5264 })
5265 ),
5266 "type": Schema.Literal("code_execution_20260120").annotate({ "title": "Type" })
5267}).annotate({
5268 "title": "CodeExecutionTool_20260120",
5269 "description": "Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint)."
5270})
5271export type RequestContainerUploadBlock = {
5272 readonly "cache_control"?: CacheControlEphemeral | null
5273 readonly "file_id": string
5274 readonly "type": "container_upload"
5275}
5276export const RequestContainerUploadBlock = Schema.Struct({
5277 "cache_control": Schema.optionalKey(
5278 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5279 "title": "Cache Control",
5280 "description": "Create a cache control breakpoint at this content block."
5281 })
5282 ),
5283 "file_id": Schema.String.annotate({ "title": "File Id" }),
5284 "type": Schema.Literal("container_upload").annotate({ "title": "Type" })
5285}).annotate({
5286 "title": "RequestContainerUploadBlock",
5287 "description":
5288 "A content block that represents a file to be uploaded to the container\nFiles uploaded via this block will be available in the container's input directory."
5289})
5290export type RequestToolReferenceBlock = {
5291 readonly "cache_control"?: CacheControlEphemeral | null
5292 readonly "tool_name": string
5293 readonly "type": "tool_reference"
5294}
5295export const RequestToolReferenceBlock = Schema.Struct({
5296 "cache_control": Schema.optionalKey(
5297 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5298 "title": "Cache Control",
5299 "description": "Create a cache control breakpoint at this content block."
5300 })
5301 ),
5302 "tool_name": Schema.String.annotate({ "title": "Tool Name" }).check(Schema.isMinLength(1)).check(
5303 Schema.isMaxLength(256)
5304 ).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,256}$"))),
5305 "type": Schema.Literal("tool_reference").annotate({ "title": "Type" })
5306}).annotate({
5307 "title": "RequestToolReferenceBlock",
5308 "description": "Tool reference block that can be included in tool_result content."
5309})
5310export type ToolSearchToolBM25_20251119 = {
5311 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5312 readonly "cache_control"?: CacheControlEphemeral | null
5313 readonly "defer_loading"?: boolean
5314 readonly "name": "tool_search_tool_bm25"
5315 readonly "strict"?: boolean
5316 readonly "type": "tool_search_tool_bm25_20251119" | "tool_search_tool_bm25"
5317}
5318export const ToolSearchToolBM25_20251119 = Schema.Struct({
5319 "allowed_callers": Schema.optionalKey(
5320 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5321 "title": "Allowed Callers"
5322 })
5323 ),
5324 "cache_control": Schema.optionalKey(
5325 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5326 "title": "Cache Control",
5327 "description": "Create a cache control breakpoint at this content block."
5328 })
5329 ),
5330 "defer_loading": Schema.optionalKey(
5331 Schema.Boolean.annotate({
5332 "title": "Defer Loading",
5333 "description":
5334 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5335 })
5336 ),
5337 "name": Schema.Literal("tool_search_tool_bm25").annotate({
5338 "title": "Name",
5339 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5340 }),
5341 "strict": Schema.optionalKey(
5342 Schema.Boolean.annotate({
5343 "title": "Strict",
5344 "description": "When true, guarantees schema validation on tool names and inputs"
5345 })
5346 ),
5347 "type": Schema.Literals(["tool_search_tool_bm25_20251119", "tool_search_tool_bm25"]).annotate({ "title": "Type" })
5348}).annotate({ "title": "ToolSearchToolBM25_20251119" })
5349export type ToolSearchToolRegex_20251119 = {
5350 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5351 readonly "cache_control"?: CacheControlEphemeral | null
5352 readonly "defer_loading"?: boolean
5353 readonly "name": "tool_search_tool_regex"
5354 readonly "strict"?: boolean
5355 readonly "type": "tool_search_tool_regex_20251119" | "tool_search_tool_regex"
5356}
5357export const ToolSearchToolRegex_20251119 = Schema.Struct({
5358 "allowed_callers": Schema.optionalKey(
5359 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5360 "title": "Allowed Callers"
5361 })
5362 ),
5363 "cache_control": Schema.optionalKey(
5364 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5365 "title": "Cache Control",
5366 "description": "Create a cache control breakpoint at this content block."
5367 })
5368 ),
5369 "defer_loading": Schema.optionalKey(
5370 Schema.Boolean.annotate({
5371 "title": "Defer Loading",
5372 "description":
5373 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5374 })
5375 ),
5376 "name": Schema.Literal("tool_search_tool_regex").annotate({
5377 "title": "Name",
5378 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5379 }),
5380 "strict": Schema.optionalKey(
5381 Schema.Boolean.annotate({
5382 "title": "Strict",
5383 "description": "When true, guarantees schema validation on tool names and inputs"
5384 })
5385 ),
5386 "type": Schema.Literals(["tool_search_tool_regex_20251119", "tool_search_tool_regex"]).annotate({ "title": "Type" })
5387}).annotate({ "title": "ToolSearchToolRegex_20251119" })
5388export type RequestCodeExecutionToolResultError = {
5389 readonly "error_code": CodeExecutionToolResultErrorCode
5390 readonly "type": "code_execution_tool_result_error"
5391}
5392export const RequestCodeExecutionToolResultError = Schema.Struct({
5393 "error_code": CodeExecutionToolResultErrorCode,
5394 "type": Schema.Literal("code_execution_tool_result_error").annotate({ "title": "Type" })
5395}).annotate({ "title": "RequestCodeExecutionToolResultError" })
5396export type ResponseCodeExecutionToolResultError = {
5397 readonly "error_code": CodeExecutionToolResultErrorCode
5398 readonly "type": "code_execution_tool_result_error"
5399}
5400export const ResponseCodeExecutionToolResultError = Schema.Struct({
5401 "error_code": CodeExecutionToolResultErrorCode,
5402 "type": Schema.Literal("code_execution_tool_result_error").annotate({
5403 "title": "Type",
5404 "default": "code_execution_tool_result_error"
5405 })
5406}).annotate({ "title": "ResponseCodeExecutionToolResultError" })
5407export type FileListResponse = {
5408 readonly "data": ReadonlyArray<FileMetadataSchema>
5409 readonly "first_id"?: string | null
5410 readonly "has_more"?: boolean
5411 readonly "last_id"?: string | null
5412}
5413export const FileListResponse = Schema.Struct({
5414 "data": Schema.Array(FileMetadataSchema).annotate({
5415 "title": "Data",
5416 "description": "List of file metadata objects."
5417 }),
5418 "first_id": Schema.optionalKey(
5419 Schema.Union([Schema.String, Schema.Null]).annotate({
5420 "title": "First Id",
5421 "description": "ID of the first file in this page of results."
5422 })
5423 ),
5424 "has_more": Schema.optionalKey(
5425 Schema.Boolean.annotate({
5426 "title": "Has More",
5427 "description": "Whether there are more results available.",
5428 "default": false
5429 })
5430 ),
5431 "last_id": Schema.optionalKey(
5432 Schema.Union([Schema.String, Schema.Null]).annotate({
5433 "title": "Last Id",
5434 "description": "ID of the last file in this page of results."
5435 })
5436 )
5437}).annotate({ "title": "FileListResponse" })
5438export type BashTool_20250124 = {
5439 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5440 readonly "cache_control"?: CacheControlEphemeral | null
5441 readonly "defer_loading"?: boolean
5442 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }>
5443 readonly "name": "bash"
5444 readonly "strict"?: boolean
5445 readonly "type": "bash_20250124"
5446}
5447export const BashTool_20250124 = Schema.Struct({
5448 "allowed_callers": Schema.optionalKey(
5449 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5450 "title": "Allowed Callers"
5451 })
5452 ),
5453 "cache_control": Schema.optionalKey(
5454 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5455 "title": "Cache Control",
5456 "description": "Create a cache control breakpoint at this content block."
5457 })
5458 ),
5459 "defer_loading": Schema.optionalKey(
5460 Schema.Boolean.annotate({
5461 "title": "Defer Loading",
5462 "description":
5463 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5464 })
5465 ),
5466 "input_examples": Schema.optionalKey(
5467 Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" })
5468 ),
5469 "name": Schema.Literal("bash").annotate({
5470 "title": "Name",
5471 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5472 }),
5473 "strict": Schema.optionalKey(
5474 Schema.Boolean.annotate({
5475 "title": "Strict",
5476 "description": "When true, guarantees schema validation on tool names and inputs"
5477 })
5478 ),
5479 "type": Schema.Literal("bash_20250124").annotate({ "title": "Type" })
5480}).annotate({ "title": "BashTool_20250124" })
5481export type MemoryTool_20250818 = {
5482 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5483 readonly "cache_control"?: CacheControlEphemeral | null
5484 readonly "defer_loading"?: boolean
5485 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }>
5486 readonly "name": "memory"
5487 readonly "strict"?: boolean
5488 readonly "type": "memory_20250818"
5489}
5490export const MemoryTool_20250818 = Schema.Struct({
5491 "allowed_callers": Schema.optionalKey(
5492 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5493 "title": "Allowed Callers"
5494 })
5495 ),
5496 "cache_control": Schema.optionalKey(
5497 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5498 "title": "Cache Control",
5499 "description": "Create a cache control breakpoint at this content block."
5500 })
5501 ),
5502 "defer_loading": Schema.optionalKey(
5503 Schema.Boolean.annotate({
5504 "title": "Defer Loading",
5505 "description":
5506 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5507 })
5508 ),
5509 "input_examples": Schema.optionalKey(
5510 Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" })
5511 ),
5512 "name": Schema.Literal("memory").annotate({
5513 "title": "Name",
5514 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5515 }),
5516 "strict": Schema.optionalKey(
5517 Schema.Boolean.annotate({
5518 "title": "Strict",
5519 "description": "When true, guarantees schema validation on tool names and inputs"
5520 })
5521 ),
5522 "type": Schema.Literal("memory_20250818").annotate({ "title": "Type" })
5523}).annotate({ "title": "MemoryTool_20250818" })
5524export type TextEditor_20250124 = {
5525 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5526 readonly "cache_control"?: CacheControlEphemeral | null
5527 readonly "defer_loading"?: boolean
5528 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }>
5529 readonly "name": "str_replace_editor"
5530 readonly "strict"?: boolean
5531 readonly "type": "text_editor_20250124"
5532}
5533export const TextEditor_20250124 = Schema.Struct({
5534 "allowed_callers": Schema.optionalKey(
5535 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5536 "title": "Allowed Callers"
5537 })
5538 ),
5539 "cache_control": Schema.optionalKey(
5540 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5541 "title": "Cache Control",
5542 "description": "Create a cache control breakpoint at this content block."
5543 })
5544 ),
5545 "defer_loading": Schema.optionalKey(
5546 Schema.Boolean.annotate({
5547 "title": "Defer Loading",
5548 "description":
5549 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5550 })
5551 ),
5552 "input_examples": Schema.optionalKey(
5553 Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" })
5554 ),
5555 "name": Schema.Literal("str_replace_editor").annotate({
5556 "title": "Name",
5557 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5558 }),
5559 "strict": Schema.optionalKey(
5560 Schema.Boolean.annotate({
5561 "title": "Strict",
5562 "description": "When true, guarantees schema validation on tool names and inputs"
5563 })
5564 ),
5565 "type": Schema.Literal("text_editor_20250124").annotate({ "title": "Type" })
5566}).annotate({ "title": "TextEditor_20250124" })
5567export type TextEditor_20250429 = {
5568 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5569 readonly "cache_control"?: CacheControlEphemeral | null
5570 readonly "defer_loading"?: boolean
5571 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }>
5572 readonly "name": "str_replace_based_edit_tool"
5573 readonly "strict"?: boolean
5574 readonly "type": "text_editor_20250429"
5575}
5576export const TextEditor_20250429 = Schema.Struct({
5577 "allowed_callers": Schema.optionalKey(
5578 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5579 "title": "Allowed Callers"
5580 })
5581 ),
5582 "cache_control": Schema.optionalKey(
5583 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5584 "title": "Cache Control",
5585 "description": "Create a cache control breakpoint at this content block."
5586 })
5587 ),
5588 "defer_loading": Schema.optionalKey(
5589 Schema.Boolean.annotate({
5590 "title": "Defer Loading",
5591 "description":
5592 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5593 })
5594 ),
5595 "input_examples": Schema.optionalKey(
5596 Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" })
5597 ),
5598 "name": Schema.Literal("str_replace_based_edit_tool").annotate({
5599 "title": "Name",
5600 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5601 }),
5602 "strict": Schema.optionalKey(
5603 Schema.Boolean.annotate({
5604 "title": "Strict",
5605 "description": "When true, guarantees schema validation on tool names and inputs"
5606 })
5607 ),
5608 "type": Schema.Literal("text_editor_20250429").annotate({ "title": "Type" })
5609}).annotate({ "title": "TextEditor_20250429" })
5610export type TextEditor_20250728 = {
5611 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5612 readonly "cache_control"?: CacheControlEphemeral | null
5613 readonly "defer_loading"?: boolean
5614 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }>
5615 readonly "max_characters"?: number | null
5616 readonly "name": "str_replace_based_edit_tool"
5617 readonly "strict"?: boolean
5618 readonly "type": "text_editor_20250728"
5619}
5620export const TextEditor_20250728 = Schema.Struct({
5621 "allowed_callers": Schema.optionalKey(
5622 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5623 "title": "Allowed Callers"
5624 })
5625 ),
5626 "cache_control": Schema.optionalKey(
5627 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5628 "title": "Cache Control",
5629 "description": "Create a cache control breakpoint at this content block."
5630 })
5631 ),
5632 "defer_loading": Schema.optionalKey(
5633 Schema.Boolean.annotate({
5634 "title": "Defer Loading",
5635 "description":
5636 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5637 })
5638 ),
5639 "input_examples": Schema.optionalKey(
5640 Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" })
5641 ),
5642 "max_characters": Schema.optionalKey(
5643 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), Schema.Null]).annotate({
5644 "title": "Max Characters",
5645 "description":
5646 "Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file."
5647 })
5648 ),
5649 "name": Schema.Literal("str_replace_based_edit_tool").annotate({
5650 "title": "Name",
5651 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5652 }),
5653 "strict": Schema.optionalKey(
5654 Schema.Boolean.annotate({
5655 "title": "Strict",
5656 "description": "When true, guarantees schema validation on tool names and inputs"
5657 })
5658 ),
5659 "type": Schema.Literal("text_editor_20250728").annotate({ "title": "Type" })
5660}).annotate({ "title": "TextEditor_20250728" })
5661export type Tool = {
5662 readonly "type"?: null | "custom"
5663 readonly "description"?: string
5664 readonly "name": string
5665 readonly "input_schema": {
5666 readonly "properties"?: { readonly [x: string]: Schema.Json } | null
5667 readonly "required"?: ReadonlyArray<string> | null
5668 readonly "type": "object"
5669 readonly [x: string]: Schema.Json
5670 }
5671 readonly "cache_control"?: CacheControlEphemeral | null
5672 readonly "strict"?: boolean
5673 readonly "eager_input_streaming"?: boolean | null
5674 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5675 readonly "defer_loading"?: boolean
5676 readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }>
5677}
5678export const Tool = Schema.Struct({
5679 "type": Schema.optionalKey(Schema.Union([Schema.Null, Schema.Literal("custom")]).annotate({ "title": "Type" })),
5680 "description": Schema.optionalKey(Schema.String.annotate({
5681 "title": "Description",
5682 "description":
5683 "Description of what this tool does.\n\nTool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema."
5684 })),
5685 "name": Schema.String.annotate({
5686 "title": "Name",
5687 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5688 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)).check(
5689 Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,128}$"))
5690 ),
5691 "input_schema": Schema.StructWithRest(
5692 Schema.Struct({
5693 "properties": Schema.optionalKey(
5694 Schema.Union([Schema.Record(Schema.String, Schema.Json), Schema.Null]).annotate({ "title": "Properties" })
5695 ),
5696 "required": Schema.optionalKey(
5697 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Required" })
5698 ),
5699 "type": Schema.Literal("object").annotate({ "title": "Type" })
5700 }),
5701 [Schema.Record(Schema.String, Schema.Json)]
5702 ).annotate({
5703 "title": "InputSchema",
5704 "description":
5705 "[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.\n\nThis defines the shape of the `input` that your tool accepts and that the model will produce."
5706 }),
5707 "cache_control": Schema.optionalKey(
5708 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5709 "title": "Cache Control",
5710 "description": "Create a cache control breakpoint at this content block."
5711 })
5712 ),
5713 "strict": Schema.optionalKey(
5714 Schema.Boolean.annotate({
5715 "title": "Strict",
5716 "description": "When true, guarantees schema validation on tool names and inputs"
5717 })
5718 ),
5719 "eager_input_streaming": Schema.optionalKey(
5720 Schema.Union([Schema.Boolean, Schema.Null]).annotate({
5721 "title": "Eager Input Streaming",
5722 "description":
5723 "Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers."
5724 })
5725 ),
5726 "allowed_callers": Schema.optionalKey(
5727 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5728 "title": "Allowed Callers"
5729 })
5730 ),
5731 "defer_loading": Schema.optionalKey(
5732 Schema.Boolean.annotate({
5733 "title": "Defer Loading",
5734 "description":
5735 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5736 })
5737 ),
5738 "input_examples": Schema.optionalKey(
5739 Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" })
5740 )
5741}).annotate({ "title": "Tool" })
5742export type ListResponse_MessageBatch_ = {
5743 readonly "data": ReadonlyArray<MessageBatch>
5744 readonly "first_id": string | null
5745 readonly "has_more": boolean
5746 readonly "last_id": string | null
5747}
5748export const ListResponse_MessageBatch_ = Schema.Struct({
5749 "data": Schema.Array(MessageBatch).annotate({ "title": "Data" }),
5750 "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({
5751 "title": "First Id",
5752 "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page."
5753 }),
5754 "has_more": Schema.Boolean.annotate({
5755 "title": "Has More",
5756 "description": "Indicates if there are more results in the requested page direction."
5757 }),
5758 "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({
5759 "title": "Last Id",
5760 "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page."
5761 })
5762}).annotate({ "title": "ListResponse[MessageBatch]" })
5763export type ListResponse_ModelInfo_ = {
5764 readonly "data": ReadonlyArray<ModelInfo>
5765 readonly "first_id": string | null
5766 readonly "has_more": boolean
5767 readonly "last_id": string | null
5768}
5769export const ListResponse_ModelInfo_ = Schema.Struct({
5770 "data": Schema.Array(ModelInfo).annotate({ "title": "Data" }),
5771 "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({
5772 "title": "First Id",
5773 "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page."
5774 }),
5775 "has_more": Schema.Boolean.annotate({
5776 "title": "Has More",
5777 "description": "Indicates if there are more results in the requested page direction."
5778 }),
5779 "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({
5780 "title": "Last Id",
5781 "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page."
5782 })
5783}).annotate({ "title": "ListResponse[ModelInfo]" })
5784export type ErrorResponse = {
5785 readonly "error":
5786 | InvalidRequestError
5787 | AuthenticationError
5788 | BillingError
5789 | PermissionError
5790 | NotFoundError
5791 | RateLimitError
5792 | GatewayTimeoutError
5793 | APIError
5794 | OverloadedError
5795 readonly "request_id": string | null
5796 readonly "type": "error"
5797}
5798export const ErrorResponse = Schema.Struct({
5799 "error": Schema.Union([
5800 InvalidRequestError,
5801 AuthenticationError,
5802 BillingError,
5803 PermissionError,
5804 NotFoundError,
5805 RateLimitError,
5806 GatewayTimeoutError,
5807 APIError,
5808 OverloadedError
5809 ], { mode: "oneOf" }).annotate({ "title": "Error" }),
5810 "request_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Request Id", "default": null }),
5811 "type": Schema.Literal("error").annotate({ "title": "Type", "default": "error" })
5812}).annotate({ "title": "ErrorResponse" })
5813export type RequestBashCodeExecutionResultBlock = {
5814 readonly "content": ReadonlyArray<RequestBashCodeExecutionOutputBlock>
5815 readonly "return_code": number
5816 readonly "stderr": string
5817 readonly "stdout": string
5818 readonly "type": "bash_code_execution_result"
5819}
5820export const RequestBashCodeExecutionResultBlock = Schema.Struct({
5821 "content": Schema.Array(RequestBashCodeExecutionOutputBlock).annotate({ "title": "Content" }),
5822 "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()),
5823 "stderr": Schema.String.annotate({ "title": "Stderr" }),
5824 "stdout": Schema.String.annotate({ "title": "Stdout" }),
5825 "type": Schema.Literal("bash_code_execution_result").annotate({ "title": "Type" })
5826}).annotate({ "title": "RequestBashCodeExecutionResultBlock" })
5827export type WebFetchTool_20250910 = {
5828 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5829 readonly "allowed_domains"?: ReadonlyArray<string> | null
5830 readonly "blocked_domains"?: ReadonlyArray<string> | null
5831 readonly "cache_control"?: CacheControlEphemeral | null
5832 readonly "citations"?: RequestCitationsConfig | null
5833 readonly "defer_loading"?: boolean
5834 readonly "max_content_tokens"?: number | null
5835 readonly "max_uses"?: number | null
5836 readonly "name": "web_fetch"
5837 readonly "strict"?: boolean
5838 readonly "type": "web_fetch_20250910"
5839}
5840export const WebFetchTool_20250910 = Schema.Struct({
5841 "allowed_callers": Schema.optionalKey(
5842 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5843 "title": "Allowed Callers"
5844 })
5845 ),
5846 "allowed_domains": Schema.optionalKey(
5847 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
5848 "title": "Allowed Domains",
5849 "description": "List of domains to allow fetching from"
5850 })
5851 ),
5852 "blocked_domains": Schema.optionalKey(
5853 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
5854 "title": "Blocked Domains",
5855 "description": "List of domains to block fetching from"
5856 })
5857 ),
5858 "cache_control": Schema.optionalKey(
5859 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5860 "title": "Cache Control",
5861 "description": "Create a cache control breakpoint at this content block."
5862 })
5863 ),
5864 "citations": Schema.optionalKey(
5865 Schema.Union([RequestCitationsConfig, Schema.Null]).annotate({
5866 "description": "Citations configuration for fetched documents. Citations are disabled by default."
5867 })
5868 ),
5869 "defer_loading": Schema.optionalKey(
5870 Schema.Boolean.annotate({
5871 "title": "Defer Loading",
5872 "description":
5873 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5874 })
5875 ),
5876 "max_content_tokens": Schema.optionalKey(
5877 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({
5878 "title": "Max Content Tokens",
5879 "description":
5880 "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs."
5881 })
5882 ),
5883 "max_uses": Schema.optionalKey(
5884 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({
5885 "title": "Max Uses",
5886 "description": "Maximum number of times the tool can be used in the API request."
5887 })
5888 ),
5889 "name": Schema.Literal("web_fetch").annotate({
5890 "title": "Name",
5891 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5892 }),
5893 "strict": Schema.optionalKey(
5894 Schema.Boolean.annotate({
5895 "title": "Strict",
5896 "description": "When true, guarantees schema validation on tool names and inputs"
5897 })
5898 ),
5899 "type": Schema.Literal("web_fetch_20250910").annotate({ "title": "Type" })
5900}).annotate({ "title": "WebFetchTool_20250910" })
5901export type WebFetchTool_20260209 = {
5902 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
5903 readonly "allowed_domains"?: ReadonlyArray<string> | null
5904 readonly "blocked_domains"?: ReadonlyArray<string> | null
5905 readonly "cache_control"?: CacheControlEphemeral | null
5906 readonly "citations"?: RequestCitationsConfig | null
5907 readonly "defer_loading"?: boolean
5908 readonly "max_content_tokens"?: number | null
5909 readonly "max_uses"?: number | null
5910 readonly "name": "web_fetch"
5911 readonly "strict"?: boolean
5912 readonly "type": "web_fetch_20260209"
5913}
5914export const WebFetchTool_20260209 = Schema.Struct({
5915 "allowed_callers": Schema.optionalKey(
5916 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
5917 "title": "Allowed Callers"
5918 })
5919 ),
5920 "allowed_domains": Schema.optionalKey(
5921 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
5922 "title": "Allowed Domains",
5923 "description": "List of domains to allow fetching from"
5924 })
5925 ),
5926 "blocked_domains": Schema.optionalKey(
5927 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
5928 "title": "Blocked Domains",
5929 "description": "List of domains to block fetching from"
5930 })
5931 ),
5932 "cache_control": Schema.optionalKey(
5933 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
5934 "title": "Cache Control",
5935 "description": "Create a cache control breakpoint at this content block."
5936 })
5937 ),
5938 "citations": Schema.optionalKey(
5939 Schema.Union([RequestCitationsConfig, Schema.Null]).annotate({
5940 "description": "Citations configuration for fetched documents. Citations are disabled by default."
5941 })
5942 ),
5943 "defer_loading": Schema.optionalKey(
5944 Schema.Boolean.annotate({
5945 "title": "Defer Loading",
5946 "description":
5947 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
5948 })
5949 ),
5950 "max_content_tokens": Schema.optionalKey(
5951 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({
5952 "title": "Max Content Tokens",
5953 "description":
5954 "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs."
5955 })
5956 ),
5957 "max_uses": Schema.optionalKey(
5958 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({
5959 "title": "Max Uses",
5960 "description": "Maximum number of times the tool can be used in the API request."
5961 })
5962 ),
5963 "name": Schema.Literal("web_fetch").annotate({
5964 "title": "Name",
5965 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
5966 }),
5967 "strict": Schema.optionalKey(
5968 Schema.Boolean.annotate({
5969 "title": "Strict",
5970 "description": "When true, guarantees schema validation on tool names and inputs"
5971 })
5972 ),
5973 "type": Schema.Literal("web_fetch_20260209").annotate({ "title": "Type" })
5974}).annotate({ "title": "WebFetchTool_20260209" })
5975export type RequestCodeExecutionResultBlock = {
5976 readonly "content": ReadonlyArray<RequestCodeExecutionOutputBlock>
5977 readonly "return_code": number
5978 readonly "stderr": string
5979 readonly "stdout": string
5980 readonly "type": "code_execution_result"
5981}
5982export const RequestCodeExecutionResultBlock = Schema.Struct({
5983 "content": Schema.Array(RequestCodeExecutionOutputBlock).annotate({ "title": "Content" }),
5984 "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()),
5985 "stderr": Schema.String.annotate({ "title": "Stderr" }),
5986 "stdout": Schema.String.annotate({ "title": "Stdout" }),
5987 "type": Schema.Literal("code_execution_result").annotate({ "title": "Type" })
5988}).annotate({ "title": "RequestCodeExecutionResultBlock" })
5989export type RequestEncryptedCodeExecutionResultBlock = {
5990 readonly "content": ReadonlyArray<RequestCodeExecutionOutputBlock>
5991 readonly "encrypted_stdout": string
5992 readonly "return_code": number
5993 readonly "stderr": string
5994 readonly "type": "encrypted_code_execution_result"
5995}
5996export const RequestEncryptedCodeExecutionResultBlock = Schema.Struct({
5997 "content": Schema.Array(RequestCodeExecutionOutputBlock).annotate({ "title": "Content" }),
5998 "encrypted_stdout": Schema.String.annotate({ "title": "Encrypted Stdout" }),
5999 "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()),
6000 "stderr": Schema.String.annotate({ "title": "Stderr" }),
6001 "type": Schema.Literal("encrypted_code_execution_result").annotate({ "title": "Type" })
6002}).annotate({
6003 "title": "RequestEncryptedCodeExecutionResultBlock",
6004 "description": "Code execution result with encrypted stdout for PFC + web_search results."
6005})
6006export type RequestTextBlock = {
6007 readonly "cache_control"?: CacheControlEphemeral | null
6008 readonly "citations"?:
6009 | ReadonlyArray<
6010 | RequestCharLocationCitation
6011 | RequestPageLocationCitation
6012 | RequestContentBlockLocationCitation
6013 | RequestWebSearchResultLocationCitation
6014 | RequestSearchResultLocationCitation
6015 >
6016 | null
6017 readonly "text": string
6018 readonly "type": "text"
6019}
6020export const RequestTextBlock = Schema.Struct({
6021 "cache_control": Schema.optionalKey(
6022 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
6023 "title": "Cache Control",
6024 "description": "Create a cache control breakpoint at this content block."
6025 })
6026 ),
6027 "citations": Schema.optionalKey(
6028 Schema.Union([
6029 Schema.Array(
6030 Schema.Union([
6031 RequestCharLocationCitation,
6032 RequestPageLocationCitation,
6033 RequestContentBlockLocationCitation,
6034 RequestWebSearchResultLocationCitation,
6035 RequestSearchResultLocationCitation
6036 ], { mode: "oneOf" })
6037 ),
6038 Schema.Null
6039 ]).annotate({ "title": "Citations" })
6040 ),
6041 "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)),
6042 "type": Schema.Literal("text").annotate({ "title": "Type" })
6043}).annotate({ "title": "RequestTextBlock" })
6044export type ResponseBashCodeExecutionResultBlock = {
6045 readonly "content": ReadonlyArray<ResponseBashCodeExecutionOutputBlock>
6046 readonly "return_code": number
6047 readonly "stderr": string
6048 readonly "stdout": string
6049 readonly "type": "bash_code_execution_result"
6050}
6051export const ResponseBashCodeExecutionResultBlock = Schema.Struct({
6052 "content": Schema.Array(ResponseBashCodeExecutionOutputBlock).annotate({ "title": "Content" }),
6053 "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()),
6054 "stderr": Schema.String.annotate({ "title": "Stderr" }),
6055 "stdout": Schema.String.annotate({ "title": "Stdout" }),
6056 "type": Schema.Literal("bash_code_execution_result").annotate({
6057 "title": "Type",
6058 "default": "bash_code_execution_result"
6059 })
6060}).annotate({ "title": "ResponseBashCodeExecutionResultBlock" })
6061export type ResponseDocumentBlock = {
6062 readonly "citations": ResponseCitationsConfig | null
6063 readonly "source": Base64PDFSource | PlainTextSource
6064 readonly "title": string | null
6065 readonly "type": "document"
6066}
6067export const ResponseDocumentBlock = Schema.Struct({
6068 "citations": Schema.Union([ResponseCitationsConfig, Schema.Null]).annotate({
6069 "description": "Citation configuration for the document",
6070 "default": null
6071 }),
6072 "source": Schema.Union([Base64PDFSource, PlainTextSource], { mode: "oneOf" }).annotate({ "title": "Source" }),
6073 "title": Schema.Union([Schema.String, Schema.Null]).annotate({
6074 "title": "Title",
6075 "description": "The title of the document",
6076 "default": null
6077 }),
6078 "type": Schema.Literal("document").annotate({ "title": "Type", "default": "document" })
6079}).annotate({ "title": "ResponseDocumentBlock" })
6080export type ResponseCodeExecutionResultBlock = {
6081 readonly "content": ReadonlyArray<ResponseCodeExecutionOutputBlock>
6082 readonly "return_code": number
6083 readonly "stderr": string
6084 readonly "stdout": string
6085 readonly "type": "code_execution_result"
6086}
6087export const ResponseCodeExecutionResultBlock = Schema.Struct({
6088 "content": Schema.Array(ResponseCodeExecutionOutputBlock).annotate({ "title": "Content" }),
6089 "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()),
6090 "stderr": Schema.String.annotate({ "title": "Stderr" }),
6091 "stdout": Schema.String.annotate({ "title": "Stdout" }),
6092 "type": Schema.Literal("code_execution_result").annotate({ "title": "Type", "default": "code_execution_result" })
6093}).annotate({ "title": "ResponseCodeExecutionResultBlock" })
6094export type ResponseEncryptedCodeExecutionResultBlock = {
6095 readonly "content": ReadonlyArray<ResponseCodeExecutionOutputBlock>
6096 readonly "encrypted_stdout": string
6097 readonly "return_code": number
6098 readonly "stderr": string
6099 readonly "type": "encrypted_code_execution_result"
6100}
6101export const ResponseEncryptedCodeExecutionResultBlock = Schema.Struct({
6102 "content": Schema.Array(ResponseCodeExecutionOutputBlock).annotate({ "title": "Content" }),
6103 "encrypted_stdout": Schema.String.annotate({ "title": "Encrypted Stdout" }),
6104 "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()),
6105 "stderr": Schema.String.annotate({ "title": "Stderr" }),
6106 "type": Schema.Literal("encrypted_code_execution_result").annotate({
6107 "title": "Type",
6108 "default": "encrypted_code_execution_result"
6109 })
6110}).annotate({
6111 "title": "ResponseEncryptedCodeExecutionResultBlock",
6112 "description": "Code execution result with encrypted stdout for PFC + web_search results."
6113})
6114export type ResponseToolSearchToolSearchResultBlock = {
6115 readonly "tool_references": ReadonlyArray<ResponseToolReferenceBlock>
6116 readonly "type": "tool_search_tool_search_result"
6117}
6118export const ResponseToolSearchToolSearchResultBlock = Schema.Struct({
6119 "tool_references": Schema.Array(ResponseToolReferenceBlock).annotate({ "title": "Tool References" }),
6120 "type": Schema.Literal("tool_search_tool_search_result").annotate({
6121 "title": "Type",
6122 "default": "tool_search_tool_search_result"
6123 })
6124}).annotate({ "title": "ResponseToolSearchToolSearchResultBlock" })
6125export type CitationsDelta = {
6126 readonly "citation":
6127 | ResponseCharLocationCitation
6128 | ResponsePageLocationCitation
6129 | ResponseContentBlockLocationCitation
6130 | ResponseWebSearchResultLocationCitation
6131 | ResponseSearchResultLocationCitation
6132 readonly "type": "citations_delta"
6133}
6134export const CitationsDelta = Schema.Struct({
6135 "citation": Schema.Union([
6136 ResponseCharLocationCitation,
6137 ResponsePageLocationCitation,
6138 ResponseContentBlockLocationCitation,
6139 ResponseWebSearchResultLocationCitation,
6140 ResponseSearchResultLocationCitation
6141 ], { mode: "oneOf" }).annotate({ "title": "Citation" }),
6142 "type": Schema.Literal("citations_delta").annotate({ "title": "Type", "default": "citations_delta" })
6143}).annotate({ "title": "CitationsDelta" })
6144export type ResponseTextBlock = {
6145 readonly "citations"?:
6146 | ReadonlyArray<
6147 | ResponseCharLocationCitation
6148 | ResponsePageLocationCitation
6149 | ResponseContentBlockLocationCitation
6150 | ResponseWebSearchResultLocationCitation
6151 | ResponseSearchResultLocationCitation
6152 >
6153 | null
6154 readonly "text": string
6155 readonly "type": "text"
6156}
6157export const ResponseTextBlock = Schema.Struct({
6158 "citations": Schema.optionalKey(
6159 Schema.Union([
6160 Schema.Array(
6161 Schema.Union([
6162 ResponseCharLocationCitation,
6163 ResponsePageLocationCitation,
6164 ResponseContentBlockLocationCitation,
6165 ResponseWebSearchResultLocationCitation,
6166 ResponseSearchResultLocationCitation
6167 ], { mode: "oneOf" })
6168 ),
6169 Schema.Null
6170 ]).annotate({
6171 "title": "Citations",
6172 "description":
6173 "Citations supporting the text block.\n\nThe type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.",
6174 "default": null
6175 })
6176 ),
6177 "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(0)).check(Schema.isMaxLength(5000000)),
6178 "type": Schema.Literal("text").annotate({ "title": "Type", "default": "text" })
6179}).annotate({ "title": "ResponseTextBlock" })
6180export type RequestServerToolUseBlock = {
6181 readonly "cache_control"?: CacheControlEphemeral | null
6182 readonly "caller"?: DirectCaller | ServerToolCaller | ServerToolCaller_20260120
6183 readonly "id": string
6184 readonly "input": { readonly [x: string]: Schema.Json }
6185 readonly "name":
6186 | "web_search"
6187 | "web_fetch"
6188 | "code_execution"
6189 | "bash_code_execution"
6190 | "text_editor_code_execution"
6191 | "tool_search_tool_regex"
6192 | "tool_search_tool_bm25"
6193 readonly "type": "server_tool_use"
6194}
6195export const RequestServerToolUseBlock = Schema.Struct({
6196 "cache_control": Schema.optionalKey(
6197 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
6198 "title": "Cache Control",
6199 "description": "Create a cache control breakpoint at this content block."
6200 })
6201 ),
6202 "caller": Schema.optionalKey(
6203 Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({
6204 "title": "Caller"
6205 })
6206 ),
6207 "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
6208 "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }),
6209 "name": Schema.Literals([
6210 "web_search",
6211 "web_fetch",
6212 "code_execution",
6213 "bash_code_execution",
6214 "text_editor_code_execution",
6215 "tool_search_tool_regex",
6216 "tool_search_tool_bm25"
6217 ]).annotate({ "title": "Name" }),
6218 "type": Schema.Literal("server_tool_use").annotate({ "title": "Type" })
6219}).annotate({ "title": "RequestServerToolUseBlock" })
6220export type ResponseServerToolUseBlock = {
6221 readonly "caller": DirectCaller | ServerToolCaller | ServerToolCaller_20260120
6222 readonly "id": string
6223 readonly "input": { readonly [x: string]: Schema.Json }
6224 readonly "name":
6225 | "web_search"
6226 | "web_fetch"
6227 | "code_execution"
6228 | "bash_code_execution"
6229 | "text_editor_code_execution"
6230 | "tool_search_tool_regex"
6231 | "tool_search_tool_bm25"
6232 readonly "type": "server_tool_use"
6233}
6234export const ResponseServerToolUseBlock = Schema.Struct({
6235 "caller": Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({
6236 "title": "Caller",
6237 "default": { "type": "direct" }
6238 }),
6239 "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))),
6240 "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }),
6241 "name": Schema.Literals([
6242 "web_search",
6243 "web_fetch",
6244 "code_execution",
6245 "bash_code_execution",
6246 "text_editor_code_execution",
6247 "tool_search_tool_regex",
6248 "tool_search_tool_bm25"
6249 ]).annotate({ "title": "Name" }),
6250 "type": Schema.Literal("server_tool_use").annotate({ "title": "Type", "default": "server_tool_use" })
6251}).annotate({ "title": "ResponseServerToolUseBlock" })
6252export type ResponseToolUseBlock = {
6253 readonly "caller": DirectCaller | ServerToolCaller | ServerToolCaller_20260120
6254 readonly "id": string
6255 readonly "input": { readonly [x: string]: Schema.Json }
6256 readonly "name": string
6257 readonly "type": "tool_use"
6258}
6259export const ResponseToolUseBlock = Schema.Struct({
6260 "caller": Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({
6261 "title": "Caller",
6262 "default": { "type": "direct" }
6263 }),
6264 "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
6265 "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }),
6266 "name": Schema.String.annotate({ "title": "Name" }).check(Schema.isMinLength(1)),
6267 "type": Schema.Literal("tool_use").annotate({ "title": "Type", "default": "tool_use" })
6268}).annotate({ "title": "ResponseToolUseBlock" })
6269export type ListSkillsResponse = {
6270 readonly "data": ReadonlyArray<Skill>
6271 readonly "has_more": boolean
6272 readonly "next_page": string | null
6273}
6274export const ListSkillsResponse = Schema.Struct({
6275 "data": Schema.Array(Skill).annotate({ "title": "Data", "description": "List of skills." }),
6276 "has_more": Schema.Boolean.annotate({
6277 "title": "Has More",
6278 "description":
6279 "Whether there are more results available.\n\nIf `true`, there are additional results that can be fetched using the `next_page` token."
6280 }),
6281 "next_page": Schema.Union([Schema.String, Schema.Null]).annotate({
6282 "title": "Next Page",
6283 "description":
6284 "Token for fetching the next page of results.\n\nIf `null`, there are no more results available. Pass this value to the `page_token` parameter in the next request to get the next page."
6285 })
6286}).annotate({ "title": "ListSkillsResponse" })
6287export type ListSkillVersionsResponse = {
6288 readonly "data": ReadonlyArray<SkillVersion>
6289 readonly "has_more": boolean
6290 readonly "next_page": string | null
6291}
6292export const ListSkillVersionsResponse = Schema.Struct({
6293 "data": Schema.Array(SkillVersion).annotate({ "title": "Data", "description": "List of skill versions." }),
6294 "has_more": Schema.Boolean.annotate({
6295 "title": "Has More",
6296 "description": "Indicates if there are more results in the requested page direction."
6297 }),
6298 "next_page": Schema.Union([Schema.String, Schema.Null]).annotate({
6299 "title": "Next Page",
6300 "description": "Token to provide in as `page` in the subsequent request to retrieve the next page of data."
6301 })
6302}).annotate({ "title": "ListSkillVersionsResponse" })
6303export type RequestTextEditorCodeExecutionToolResultError = {
6304 readonly "error_code": TextEditorCodeExecutionToolResultErrorCode
6305 readonly "error_message"?: string | null
6306 readonly "type": "text_editor_code_execution_tool_result_error"
6307}
6308export const RequestTextEditorCodeExecutionToolResultError = Schema.Struct({
6309 "error_code": TextEditorCodeExecutionToolResultErrorCode,
6310 "error_message": Schema.optionalKey(
6311 Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message" })
6312 ),
6313 "type": Schema.Literal("text_editor_code_execution_tool_result_error").annotate({ "title": "Type" })
6314}).annotate({ "title": "RequestTextEditorCodeExecutionToolResultError" })
6315export type ResponseTextEditorCodeExecutionToolResultError = {
6316 readonly "error_code": TextEditorCodeExecutionToolResultErrorCode
6317 readonly "error_message": string | null
6318 readonly "type": "text_editor_code_execution_tool_result_error"
6319}
6320export const ResponseTextEditorCodeExecutionToolResultError = Schema.Struct({
6321 "error_code": TextEditorCodeExecutionToolResultErrorCode,
6322 "error_message": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message", "default": null }),
6323 "type": Schema.Literal("text_editor_code_execution_tool_result_error").annotate({
6324 "title": "Type",
6325 "default": "text_editor_code_execution_tool_result_error"
6326 })
6327}).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultError" })
6328export type ThinkingConfigParam = ThinkingConfigEnabled | ThinkingConfigDisabled | ThinkingConfigAdaptive
6329export const ThinkingConfigParam = Schema.Union(
6330 [ThinkingConfigEnabled, ThinkingConfigDisabled, ThinkingConfigAdaptive],
6331 { mode: "oneOf" }
6332).annotate({
6333 "title": "Thinking",
6334 "description":
6335 "Configuration for enabling Claude's extended thinking.\n\nWhen enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details."
6336})
6337export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool | ToolChoiceNone
6338export const ToolChoice = Schema.Union([ToolChoiceAuto, ToolChoiceAny, ToolChoiceTool, ToolChoiceNone], {
6339 mode: "oneOf"
6340}).annotate({
6341 "title": "Tool Choice",
6342 "description":
6343 "How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all."
6344})
6345export type RequestToolSearchToolResultError = {
6346 readonly "error_code": ToolSearchToolResultErrorCode
6347 readonly "type": "tool_search_tool_result_error"
6348}
6349export const RequestToolSearchToolResultError = Schema.Struct({
6350 "error_code": ToolSearchToolResultErrorCode,
6351 "type": Schema.Literal("tool_search_tool_result_error").annotate({ "title": "Type" })
6352}).annotate({ "title": "RequestToolSearchToolResultError" })
6353export type ResponseToolSearchToolResultError = {
6354 readonly "error_code": ToolSearchToolResultErrorCode
6355 readonly "error_message": string | null
6356 readonly "type": "tool_search_tool_result_error"
6357}
6358export const ResponseToolSearchToolResultError = Schema.Struct({
6359 "error_code": ToolSearchToolResultErrorCode,
6360 "error_message": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message", "default": null }),
6361 "type": Schema.Literal("tool_search_tool_result_error").annotate({
6362 "title": "Type",
6363 "default": "tool_search_tool_result_error"
6364 })
6365}).annotate({ "title": "ResponseToolSearchToolResultError" })
6366export type RequestImageBlock = {
6367 readonly "cache_control"?: CacheControlEphemeral | null
6368 readonly "source": Base64ImageSource | URLImageSource
6369 readonly "type": "image"
6370}
6371export const RequestImageBlock = Schema.Struct({
6372 "cache_control": Schema.optionalKey(
6373 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
6374 "title": "Cache Control",
6375 "description": "Create a cache control breakpoint at this content block."
6376 })
6377 ),
6378 "source": Schema.Union([Base64ImageSource, URLImageSource], { mode: "oneOf" }).annotate({ "title": "Source" }),
6379 "type": Schema.Literal("image").annotate({ "title": "Type" })
6380}).annotate({ "title": "RequestImageBlock" })
6381export type WebSearchTool_20250305 = {
6382 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
6383 readonly "allowed_domains"?: ReadonlyArray<string> | null
6384 readonly "blocked_domains"?: ReadonlyArray<string> | null
6385 readonly "cache_control"?: CacheControlEphemeral | null
6386 readonly "defer_loading"?: boolean
6387 readonly "max_uses"?: number | null
6388 readonly "name": "web_search"
6389 readonly "strict"?: boolean
6390 readonly "type": "web_search_20250305"
6391 readonly "user_location"?: UserLocation | null
6392}
6393export const WebSearchTool_20250305 = Schema.Struct({
6394 "allowed_callers": Schema.optionalKey(
6395 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
6396 "title": "Allowed Callers"
6397 })
6398 ),
6399 "allowed_domains": Schema.optionalKey(
6400 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
6401 "title": "Allowed Domains",
6402 "description":
6403 "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`."
6404 })
6405 ),
6406 "blocked_domains": Schema.optionalKey(
6407 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
6408 "title": "Blocked Domains",
6409 "description":
6410 "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`."
6411 })
6412 ),
6413 "cache_control": Schema.optionalKey(
6414 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
6415 "title": "Cache Control",
6416 "description": "Create a cache control breakpoint at this content block."
6417 })
6418 ),
6419 "defer_loading": Schema.optionalKey(
6420 Schema.Boolean.annotate({
6421 "title": "Defer Loading",
6422 "description":
6423 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
6424 })
6425 ),
6426 "max_uses": Schema.optionalKey(
6427 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({
6428 "title": "Max Uses",
6429 "description": "Maximum number of times the tool can be used in the API request."
6430 })
6431 ),
6432 "name": Schema.Literal("web_search").annotate({
6433 "title": "Name",
6434 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
6435 }),
6436 "strict": Schema.optionalKey(
6437 Schema.Boolean.annotate({
6438 "title": "Strict",
6439 "description": "When true, guarantees schema validation on tool names and inputs"
6440 })
6441 ),
6442 "type": Schema.Literal("web_search_20250305").annotate({ "title": "Type" }),
6443 "user_location": Schema.optionalKey(
6444 Schema.Union([UserLocation, Schema.Null]).annotate({
6445 "description": "Parameters for the user's location. Used to provide more relevant search results."
6446 })
6447 )
6448}).annotate({ "title": "WebSearchTool_20250305" })
6449export type WebSearchTool_20260209 = {
6450 readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120">
6451 readonly "allowed_domains"?: ReadonlyArray<string> | null
6452 readonly "blocked_domains"?: ReadonlyArray<string> | null
6453 readonly "cache_control"?: CacheControlEphemeral | null
6454 readonly "defer_loading"?: boolean
6455 readonly "max_uses"?: number | null
6456 readonly "name": "web_search"
6457 readonly "strict"?: boolean
6458 readonly "type": "web_search_20260209"
6459 readonly "user_location"?: UserLocation | null
6460}
6461export const WebSearchTool_20260209 = Schema.Struct({
6462 "allowed_callers": Schema.optionalKey(
6463 Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({
6464 "title": "Allowed Callers"
6465 })
6466 ),
6467 "allowed_domains": Schema.optionalKey(
6468 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
6469 "title": "Allowed Domains",
6470 "description":
6471 "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`."
6472 })
6473 ),
6474 "blocked_domains": Schema.optionalKey(
6475 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
6476 "title": "Blocked Domains",
6477 "description":
6478 "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`."
6479 })
6480 ),
6481 "cache_control": Schema.optionalKey(
6482 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
6483 "title": "Cache Control",
6484 "description": "Create a cache control breakpoint at this content block."
6485 })
6486 ),
6487 "defer_loading": Schema.optionalKey(
6488 Schema.Boolean.annotate({
6489 "title": "Defer Loading",
6490 "description":
6491 "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search."
6492 })
6493 ),
6494 "max_uses": Schema.optionalKey(
6495 Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({
6496 "title": "Max Uses",
6497 "description": "Maximum number of times the tool can be used in the API request."
6498 })
6499 ),
6500 "name": Schema.Literal("web_search").annotate({
6501 "title": "Name",
6502 "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks."
6503 }),
6504 "strict": Schema.optionalKey(
6505 Schema.Boolean.annotate({
6506 "title": "Strict",
6507 "description": "When true, guarantees schema validation on tool names and inputs"
6508 })
6509 ),
6510 "type": Schema.Literal("web_search_20260209").annotate({ "title": "Type" }),
6511 "user_location": Schema.optionalKey(
6512 Schema.Union([UserLocation, Schema.Null]).annotate({
6513 "description": "Parameters for the user's location. Used to provide more relevant search results."
6514 })
6515 )
6516}).annotate({ "title": "WebSearchTool_20260209" })
6517export type RequestWebFetchToolResultError = {
6518 readonly "error_code": WebFetchToolResultErrorCode
6519 readonly "type": "web_fetch_tool_result_error"
6520}
6521export const RequestWebFetchToolResultError = Schema.Struct({
6522 "error_code": WebFetchToolResultErrorCode,
6523 "type": Schema.Literal("web_fetch_tool_result_error").annotate({ "title": "Type" })
6524}).annotate({ "title": "RequestWebFetchToolResultError" })
6525export type ResponseWebFetchToolResultError = {
6526 readonly "error_code": WebFetchToolResultErrorCode
6527 readonly "type": "web_fetch_tool_result_error"
6528}
6529export const ResponseWebFetchToolResultError = Schema.Struct({
6530 "error_code": WebFetchToolResultErrorCode,
6531 "type": Schema.Literal("web_fetch_tool_result_error").annotate({
6532 "title": "Type",
6533 "default": "web_fetch_tool_result_error"
6534 })
6535}).annotate({ "title": "ResponseWebFetchToolResultError" })
6536export type RequestWebSearchToolResultError = {
6537 readonly "error_code": WebSearchToolResultErrorCode
6538 readonly "type": "web_search_tool_result_error"
6539}
6540export const RequestWebSearchToolResultError = Schema.Struct({
6541 "error_code": WebSearchToolResultErrorCode,
6542 "type": Schema.Literal("web_search_tool_result_error").annotate({ "title": "Type" })
6543}).annotate({ "title": "RequestWebSearchToolResultError" })
6544export type ResponseWebSearchToolResultError = {
6545 readonly "error_code": WebSearchToolResultErrorCode
6546 readonly "type": "web_search_tool_result_error"
6547}
6548export const ResponseWebSearchToolResultError = Schema.Struct({
6549 "error_code": WebSearchToolResultErrorCode,
6550 "type": Schema.Literal("web_search_tool_result_error").annotate({
6551 "title": "Type",
6552 "default": "web_search_tool_result_error"
6553 })
6554}).annotate({ "title": "ResponseWebSearchToolResultError" })
6555export type MessageDelta = {
6556 readonly "container": Container | null
6557 readonly "stop_reason": StopReason | null
6558 readonly "stop_sequence": string | null
6559}
6560export const MessageDelta = Schema.Struct({
6561 "container": Schema.Union([Container, Schema.Null]).annotate({
6562 "description":
6563 "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used.",
6564 "default": null
6565 }),
6566 "stop_reason": Schema.Union([StopReason, Schema.Null]).annotate({ "title": "Stop Reason", "default": null }),
6567 "stop_sequence": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Stop Sequence", "default": null })
6568}).annotate({ "title": "MessageDelta" })
6569export type CompletionRequest = {
6570 readonly "model": Model
6571 readonly "prompt": string
6572 readonly "max_tokens_to_sample": number
6573 readonly "stop_sequences"?: ReadonlyArray<string>
6574 readonly "temperature"?: number
6575 readonly "top_p"?: number
6576 readonly "top_k"?: number
6577 readonly "metadata"?: { readonly "user_id"?: string | null }
6578 readonly "stream"?: boolean
6579}
6580export const CompletionRequest = Schema.Struct({
6581 "model": Model,
6582 "prompt": Schema.String.annotate({
6583 "title": "Prompt",
6584 "description":
6585 "The prompt that you want Claude to complete.\n\nFor proper response generation you will need to format your prompt using alternating `\\n\\nHuman:` and `\\n\\nAssistant:` conversational turns. For example:\n\n```\n\"\\n\\nHuman: {userQuestion}\\n\\nAssistant:\"\n```\n\nSee [prompt validation](https://docs.claude.com/en/api/prompt-validation) and our guide to [prompt design](https://docs.claude.com/en/docs/intro-to-prompting) for more details."
6586 }).check(Schema.isMinLength(1)),
6587 "max_tokens_to_sample": Schema.Number.annotate({
6588 "title": "Max Tokens To Sample",
6589 "description":
6590 "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate."
6591 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
6592 "stop_sequences": Schema.optionalKey(
6593 Schema.Array(Schema.String).annotate({
6594 "title": "Stop Sequences",
6595 "description":
6596 "Sequences that will cause the model to stop generating.\n\nOur models stop on `\"\\n\\nHuman:\"`, and may include additional built-in stop sequences in the future. By providing the stop_sequences parameter, you may include additional strings that will cause the model to stop generating."
6597 })
6598 ),
6599 "temperature": Schema.optionalKey(
6600 Schema.Number.annotate({
6601 "title": "Temperature",
6602 "description":
6603 "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic."
6604 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1))
6605 ),
6606 "top_p": Schema.optionalKey(
6607 Schema.Number.annotate({
6608 "title": "Top P",
6609 "description":
6610 "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`."
6611 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1))
6612 ),
6613 "top_k": Schema.optionalKey(
6614 Schema.Number.annotate({
6615 "title": "Top K",
6616 "description":
6617 "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`."
6618 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
6619 ),
6620 "metadata": Schema.optionalKey(
6621 Schema.Struct({
6622 "user_id": Schema.optionalKey(
6623 Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({
6624 "title": "User Id",
6625 "description":
6626 "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number."
6627 })
6628 )
6629 }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." })
6630 ),
6631 "stream": Schema.optionalKey(
6632 Schema.Boolean.annotate({
6633 "title": "Stream",
6634 "description":
6635 "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/streaming) for details."
6636 })
6637 )
6638}).annotate({ "title": "CompletionRequest" })
6639export type CompletionResponse = {
6640 readonly "completion": string
6641 readonly "id": string
6642 readonly "model": Model
6643 readonly "stop_reason": string | null
6644 readonly "type": "completion"
6645}
6646export const CompletionResponse = Schema.Struct({
6647 "completion": Schema.String.annotate({
6648 "title": "Completion",
6649 "description": "The resulting completion up to and excluding the stop sequences."
6650 }),
6651 "id": Schema.String.annotate({
6652 "title": "Id",
6653 "description": "Unique object identifier.\n\nThe format and length of IDs may change over time."
6654 }),
6655 "model": Model,
6656 "stop_reason": Schema.Union([Schema.String, Schema.Null]).annotate({
6657 "title": "Stop Reason",
6658 "description":
6659 "The reason that we stopped.\n\nThis may be one the following values:\n* `\"stop_sequence\"`: we reached a stop sequence — either provided by you via the `stop_sequences` parameter, or a stop sequence built into the model\n* `\"max_tokens\"`: we exceeded `max_tokens_to_sample` or the model's maximum"
6660 }),
6661 "type": Schema.Literal("completion").annotate({
6662 "title": "Type",
6663 "description": "Object type.\n\nFor Text Completions, this is always `\"completion\"`.",
6664 "default": "completion"
6665 })
6666}).annotate({ "title": "CompletionResponse" })
6667export type BetaRequestToolSearchToolSearchResultBlock = {
6668 readonly "tool_references": ReadonlyArray<BetaRequestToolReferenceBlock>
6669 readonly "type": "tool_search_tool_search_result"
6670}
6671export const BetaRequestToolSearchToolSearchResultBlock = Schema.Struct({
6672 "tool_references": Schema.Array(BetaRequestToolReferenceBlock).annotate({ "title": "Tool References" }),
6673 "type": Schema.Literal("tool_search_tool_search_result").annotate({ "title": "Type" })
6674}).annotate({ "title": "RequestToolSearchToolSearchResultBlock" })
6675export type BetaIterationsUsage = ReadonlyArray<BetaMessageIterationUsage | BetaCompactionIterationUsage> | null
6676export const BetaIterationsUsage = Schema.Union([
6677 Schema.Array(Schema.Union([BetaMessageIterationUsage, BetaCompactionIterationUsage])),
6678 Schema.Null
6679]).annotate({
6680 "title": "Iterations",
6681 "description":
6682 "Per-iteration token usage breakdown.\n\nEach entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:\n- Determine which iterations exceeded long context thresholds (>=200k tokens)\n- Calculate the true context window size from the last iteration\n- Understand token accumulation across server-side tool use loops",
6683 "default": null
6684})
6685export type BetaErroredResult = { readonly "error": BetaErrorResponse; readonly "type": "errored" }
6686export const BetaErroredResult = Schema.Struct({
6687 "error": BetaErrorResponse,
6688 "type": Schema.Literal("errored").annotate({ "title": "Type", "default": "errored" })
6689}).annotate({ "title": "ErroredResult" })
6690export type BetaRequestBashCodeExecutionToolResultBlock = {
6691 readonly "cache_control"?: BetaCacheControlEphemeral | null
6692 readonly "content": BetaRequestBashCodeExecutionToolResultError | BetaRequestBashCodeExecutionResultBlock
6693 readonly "tool_use_id": string
6694 readonly "type": "bash_code_execution_tool_result"
6695}
6696export const BetaRequestBashCodeExecutionToolResultBlock = Schema.Struct({
6697 "cache_control": Schema.optionalKey(
6698 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
6699 "title": "Cache Control",
6700 "description": "Create a cache control breakpoint at this content block."
6701 })
6702 ),
6703 "content": Schema.Union([BetaRequestBashCodeExecutionToolResultError, BetaRequestBashCodeExecutionResultBlock])
6704 .annotate({ "title": "Content" }),
6705 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
6706 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
6707 ),
6708 "type": Schema.Literal("bash_code_execution_tool_result").annotate({ "title": "Type" })
6709}).annotate({ "title": "RequestBashCodeExecutionToolResultBlock" })
6710export type BetaRequestCodeExecutionToolResultBlock = {
6711 readonly "cache_control"?: BetaCacheControlEphemeral | null
6712 readonly "content":
6713 | BetaRequestCodeExecutionToolResultError
6714 | BetaRequestCodeExecutionResultBlock
6715 | BetaRequestEncryptedCodeExecutionResultBlock
6716 readonly "tool_use_id": string
6717 readonly "type": "code_execution_tool_result"
6718}
6719export const BetaRequestCodeExecutionToolResultBlock = Schema.Struct({
6720 "cache_control": Schema.optionalKey(
6721 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
6722 "title": "Cache Control",
6723 "description": "Create a cache control breakpoint at this content block."
6724 })
6725 ),
6726 "content": Schema.Union([
6727 BetaRequestCodeExecutionToolResultError,
6728 BetaRequestCodeExecutionResultBlock,
6729 BetaRequestEncryptedCodeExecutionResultBlock
6730 ]).annotate({ "title": "Content" }),
6731 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
6732 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
6733 ),
6734 "type": Schema.Literal("code_execution_tool_result").annotate({ "title": "Type" })
6735}).annotate({ "title": "RequestCodeExecutionToolResultBlock" })
6736export type BetaRequestSearchResultBlock = {
6737 readonly "cache_control"?: BetaCacheControlEphemeral | null
6738 readonly "citations"?: BetaRequestCitationsConfig
6739 readonly "content": ReadonlyArray<BetaRequestTextBlock>
6740 readonly "source": string
6741 readonly "title": string
6742 readonly "type": "search_result"
6743}
6744export const BetaRequestSearchResultBlock = Schema.Struct({
6745 "cache_control": Schema.optionalKey(
6746 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
6747 "title": "Cache Control",
6748 "description": "Create a cache control breakpoint at this content block."
6749 })
6750 ),
6751 "citations": Schema.optionalKey(BetaRequestCitationsConfig),
6752 "content": Schema.Array(BetaRequestTextBlock).annotate({ "title": "Content" }),
6753 "source": Schema.String.annotate({ "title": "Source" }),
6754 "title": Schema.String.annotate({ "title": "Title" }),
6755 "type": Schema.Literal("search_result").annotate({ "title": "Type" })
6756}).annotate({ "title": "RequestSearchResultBlock" })
6757export type BetaResponseBashCodeExecutionToolResultBlock = {
6758 readonly "content": BetaResponseBashCodeExecutionToolResultError | BetaResponseBashCodeExecutionResultBlock
6759 readonly "tool_use_id": string
6760 readonly "type": "bash_code_execution_tool_result"
6761}
6762export const BetaResponseBashCodeExecutionToolResultBlock = Schema.Struct({
6763 "content": Schema.Union([BetaResponseBashCodeExecutionToolResultError, BetaResponseBashCodeExecutionResultBlock])
6764 .annotate({ "title": "Content" }),
6765 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
6766 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
6767 ),
6768 "type": Schema.Literal("bash_code_execution_tool_result").annotate({
6769 "title": "Type",
6770 "default": "bash_code_execution_tool_result"
6771 })
6772}).annotate({ "title": "ResponseBashCodeExecutionToolResultBlock" })
6773export type BetaResponseWebFetchResultBlock = {
6774 readonly "content": BetaResponseDocumentBlock
6775 readonly "retrieved_at": string | null
6776 readonly "type": "web_fetch_result"
6777 readonly "url": string
6778}
6779export const BetaResponseWebFetchResultBlock = Schema.Struct({
6780 "content": BetaResponseDocumentBlock,
6781 "retrieved_at": Schema.Union([Schema.String, Schema.Null]).annotate({
6782 "title": "Retrieved At",
6783 "description": "ISO 8601 timestamp when the content was retrieved",
6784 "default": null
6785 }),
6786 "type": Schema.Literal("web_fetch_result").annotate({ "title": "Type", "default": "web_fetch_result" }),
6787 "url": Schema.String.annotate({ "title": "Url", "description": "Fetched content URL" })
6788}).annotate({ "title": "ResponseWebFetchResultBlock" })
6789export type BetaResponseCodeExecutionToolResultBlock = {
6790 readonly "content":
6791 | BetaResponseCodeExecutionToolResultError
6792 | BetaResponseCodeExecutionResultBlock
6793 | BetaResponseEncryptedCodeExecutionResultBlock
6794 readonly "tool_use_id": string
6795 readonly "type": "code_execution_tool_result"
6796}
6797export const BetaResponseCodeExecutionToolResultBlock = Schema.Struct({
6798 "content": Schema.Union([
6799 BetaResponseCodeExecutionToolResultError,
6800 BetaResponseCodeExecutionResultBlock,
6801 BetaResponseEncryptedCodeExecutionResultBlock
6802 ]).annotate({ "title": "Content" }),
6803 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
6804 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
6805 ),
6806 "type": Schema.Literal("code_execution_tool_result").annotate({
6807 "title": "Type",
6808 "default": "code_execution_tool_result"
6809 })
6810}).annotate({ "title": "ResponseCodeExecutionToolResultBlock" })
6811export type BetaContentBlockDeltaEvent = {
6812 readonly "delta":
6813 | BetaTextContentBlockDelta
6814 | BetaInputJsonContentBlockDelta
6815 | BetaCitationsDelta
6816 | BetaThinkingContentBlockDelta
6817 | BetaSignatureContentBlockDelta
6818 | BetaCompactionContentBlockDelta
6819 readonly "index": number
6820 readonly "type": "content_block_delta"
6821}
6822export const BetaContentBlockDeltaEvent = Schema.Struct({
6823 "delta": Schema.Union([
6824 BetaTextContentBlockDelta,
6825 BetaInputJsonContentBlockDelta,
6826 BetaCitationsDelta,
6827 BetaThinkingContentBlockDelta,
6828 BetaSignatureContentBlockDelta,
6829 BetaCompactionContentBlockDelta
6830 ], { mode: "oneOf" }).annotate({ "title": "Delta" }),
6831 "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()),
6832 "type": Schema.Literal("content_block_delta").annotate({ "title": "Type", "default": "content_block_delta" })
6833}).annotate({ "title": "ContentBlockDeltaEvent" })
6834export type BetaMessageDelta = {
6835 readonly "container"?: BetaContainer | null
6836 readonly "stop_reason": BetaStopReason | null
6837 readonly "stop_sequence": string | null
6838}
6839export const BetaMessageDelta = Schema.Struct({
6840 "container": Schema.optionalKey(
6841 Schema.Union([BetaContainer, Schema.Null]).annotate({
6842 "description":
6843 "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used.",
6844 "default": null
6845 })
6846 ),
6847 "stop_reason": Schema.Union([BetaStopReason, Schema.Null]).annotate({ "title": "Stop Reason", "default": null }),
6848 "stop_sequence": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Stop Sequence", "default": null })
6849}).annotate({ "title": "MessageDelta" })
6850export type BetaRequestTextEditorCodeExecutionToolResultBlock = {
6851 readonly "cache_control"?: BetaCacheControlEphemeral | null
6852 readonly "content":
6853 | BetaRequestTextEditorCodeExecutionToolResultError
6854 | BetaRequestTextEditorCodeExecutionViewResultBlock
6855 | BetaRequestTextEditorCodeExecutionCreateResultBlock
6856 | BetaRequestTextEditorCodeExecutionStrReplaceResultBlock
6857 readonly "tool_use_id": string
6858 readonly "type": "text_editor_code_execution_tool_result"
6859}
6860export const BetaRequestTextEditorCodeExecutionToolResultBlock = Schema.Struct({
6861 "cache_control": Schema.optionalKey(
6862 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
6863 "title": "Cache Control",
6864 "description": "Create a cache control breakpoint at this content block."
6865 })
6866 ),
6867 "content": Schema.Union([
6868 BetaRequestTextEditorCodeExecutionToolResultError,
6869 BetaRequestTextEditorCodeExecutionViewResultBlock,
6870 BetaRequestTextEditorCodeExecutionCreateResultBlock,
6871 BetaRequestTextEditorCodeExecutionStrReplaceResultBlock
6872 ]).annotate({ "title": "Content" }),
6873 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
6874 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
6875 ),
6876 "type": Schema.Literal("text_editor_code_execution_tool_result").annotate({ "title": "Type" })
6877}).annotate({ "title": "RequestTextEditorCodeExecutionToolResultBlock" })
6878export type BetaResponseTextEditorCodeExecutionToolResultBlock = {
6879 readonly "content":
6880 | BetaResponseTextEditorCodeExecutionToolResultError
6881 | BetaResponseTextEditorCodeExecutionViewResultBlock
6882 | BetaResponseTextEditorCodeExecutionCreateResultBlock
6883 | BetaResponseTextEditorCodeExecutionStrReplaceResultBlock
6884 readonly "tool_use_id": string
6885 readonly "type": "text_editor_code_execution_tool_result"
6886}
6887export const BetaResponseTextEditorCodeExecutionToolResultBlock = Schema.Struct({
6888 "content": Schema.Union([
6889 BetaResponseTextEditorCodeExecutionToolResultError,
6890 BetaResponseTextEditorCodeExecutionViewResultBlock,
6891 BetaResponseTextEditorCodeExecutionCreateResultBlock,
6892 BetaResponseTextEditorCodeExecutionStrReplaceResultBlock
6893 ]).annotate({ "title": "Content" }),
6894 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
6895 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
6896 ),
6897 "type": Schema.Literal("text_editor_code_execution_tool_result").annotate({
6898 "title": "Type",
6899 "default": "text_editor_code_execution_tool_result"
6900 })
6901}).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultBlock" })
6902export type BetaResponseToolSearchToolResultBlock = {
6903 readonly "content": BetaResponseToolSearchToolResultError | BetaResponseToolSearchToolSearchResultBlock
6904 readonly "tool_use_id": string
6905 readonly "type": "tool_search_tool_result"
6906}
6907export const BetaResponseToolSearchToolResultBlock = Schema.Struct({
6908 "content": Schema.Union([BetaResponseToolSearchToolResultError, BetaResponseToolSearchToolSearchResultBlock])
6909 .annotate({ "title": "Content" }),
6910 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
6911 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
6912 ),
6913 "type": Schema.Literal("tool_search_tool_result").annotate({ "title": "Type", "default": "tool_search_tool_result" })
6914}).annotate({ "title": "ResponseToolSearchToolResultBlock" })
6915export type BetaContextManagementConfig = {
6916 readonly "edits"?: ReadonlyArray<BetaClearToolUses20250919 | BetaClearThinking20251015 | BetaCompact20260112>
6917}
6918export const BetaContextManagementConfig = Schema.Struct({
6919 "edits": Schema.optionalKey(
6920 Schema.Array(
6921 Schema.Union([BetaClearToolUses20250919, BetaClearThinking20251015, BetaCompact20260112], { mode: "oneOf" })
6922 ).annotate({ "title": "Edits", "description": "List of context management edits to apply" }).check(
6923 Schema.isMinLength(0)
6924 )
6925 )
6926}).annotate({ "title": "ContextManagementConfig" })
6927export type BetaContentBlockSource = {
6928 readonly "content": string | ReadonlyArray<BetaRequestTextBlock | BetaRequestImageBlock>
6929 readonly "type": "content"
6930}
6931export const BetaContentBlockSource = Schema.Struct({
6932 "content": Schema.Union([
6933 Schema.String,
6934 Schema.Array(
6935 Schema.Union([BetaRequestTextBlock, BetaRequestImageBlock], { mode: "oneOf" }).annotate({
6936 "title": "beta_content_block_source_content_item"
6937 })
6938 ).annotate({ "title": "beta_content_block_source_content" })
6939 ]).annotate({ "title": "Content" }),
6940 "type": Schema.Literal("content").annotate({ "title": "Type" })
6941}).annotate({ "title": "ContentBlockSource" })
6942export type BetaRequestWebSearchToolResultBlock = {
6943 readonly "cache_control"?: BetaCacheControlEphemeral | null
6944 readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120
6945 readonly "content": ReadonlyArray<BetaRequestWebSearchResultBlock> | BetaRequestWebSearchToolResultError
6946 readonly "tool_use_id": string
6947 readonly "type": "web_search_tool_result"
6948}
6949export const BetaRequestWebSearchToolResultBlock = Schema.Struct({
6950 "cache_control": Schema.optionalKey(
6951 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
6952 "title": "Cache Control",
6953 "description": "Create a cache control breakpoint at this content block."
6954 })
6955 ),
6956 "caller": Schema.optionalKey(
6957 Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({
6958 "title": "Caller"
6959 })
6960 ),
6961 "content": Schema.Union([
6962 Schema.Array(BetaRequestWebSearchResultBlock).annotate({ "title": "Result Block" }),
6963 BetaRequestWebSearchToolResultError
6964 ]).annotate({ "title": "Content" }),
6965 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
6966 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
6967 ),
6968 "type": Schema.Literal("web_search_tool_result").annotate({ "title": "Type" })
6969}).annotate({ "title": "RequestWebSearchToolResultBlock" })
6970export type BetaResponseWebSearchToolResultBlock = {
6971 readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120
6972 readonly "content": BetaResponseWebSearchToolResultError | ReadonlyArray<BetaResponseWebSearchResultBlock>
6973 readonly "tool_use_id": string
6974 readonly "type": "web_search_tool_result"
6975}
6976export const BetaResponseWebSearchToolResultBlock = Schema.Struct({
6977 "caller": Schema.optionalKey(
6978 Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({
6979 "title": "Caller"
6980 })
6981 ),
6982 "content": Schema.Union([BetaResponseWebSearchToolResultError, Schema.Array(BetaResponseWebSearchResultBlock)])
6983 .annotate({ "title": "Content" }),
6984 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
6985 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
6986 ),
6987 "type": Schema.Literal("web_search_tool_result").annotate({ "title": "Type", "default": "web_search_tool_result" })
6988}).annotate({ "title": "ResponseWebSearchToolResultBlock" })
6989export type RequestToolSearchToolSearchResultBlock = {
6990 readonly "tool_references": ReadonlyArray<RequestToolReferenceBlock>
6991 readonly "type": "tool_search_tool_search_result"
6992}
6993export const RequestToolSearchToolSearchResultBlock = Schema.Struct({
6994 "tool_references": Schema.Array(RequestToolReferenceBlock).annotate({ "title": "Tool References" }),
6995 "type": Schema.Literal("tool_search_tool_search_result").annotate({ "title": "Type" })
6996}).annotate({ "title": "RequestToolSearchToolSearchResultBlock" })
6997export type ErroredResult = { readonly "error": ErrorResponse; readonly "type": "errored" }
6998export const ErroredResult = Schema.Struct({
6999 "error": ErrorResponse,
7000 "type": Schema.Literal("errored").annotate({ "title": "Type", "default": "errored" })
7001}).annotate({ "title": "ErroredResult" })
7002export type RequestBashCodeExecutionToolResultBlock = {
7003 readonly "cache_control"?: CacheControlEphemeral | null
7004 readonly "content": RequestBashCodeExecutionToolResultError | RequestBashCodeExecutionResultBlock
7005 readonly "tool_use_id": string
7006 readonly "type": "bash_code_execution_tool_result"
7007}
7008export const RequestBashCodeExecutionToolResultBlock = Schema.Struct({
7009 "cache_control": Schema.optionalKey(
7010 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
7011 "title": "Cache Control",
7012 "description": "Create a cache control breakpoint at this content block."
7013 })
7014 ),
7015 "content": Schema.Union([RequestBashCodeExecutionToolResultError, RequestBashCodeExecutionResultBlock]).annotate({
7016 "title": "Content"
7017 }),
7018 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7019 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7020 ),
7021 "type": Schema.Literal("bash_code_execution_tool_result").annotate({ "title": "Type" })
7022}).annotate({ "title": "RequestBashCodeExecutionToolResultBlock" })
7023export type RequestCodeExecutionToolResultBlock = {
7024 readonly "cache_control"?: CacheControlEphemeral | null
7025 readonly "content":
7026 | RequestCodeExecutionToolResultError
7027 | RequestCodeExecutionResultBlock
7028 | RequestEncryptedCodeExecutionResultBlock
7029 readonly "tool_use_id": string
7030 readonly "type": "code_execution_tool_result"
7031}
7032export const RequestCodeExecutionToolResultBlock = Schema.Struct({
7033 "cache_control": Schema.optionalKey(
7034 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
7035 "title": "Cache Control",
7036 "description": "Create a cache control breakpoint at this content block."
7037 })
7038 ),
7039 "content": Schema.Union([
7040 RequestCodeExecutionToolResultError,
7041 RequestCodeExecutionResultBlock,
7042 RequestEncryptedCodeExecutionResultBlock
7043 ]).annotate({ "title": "Content" }),
7044 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7045 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7046 ),
7047 "type": Schema.Literal("code_execution_tool_result").annotate({ "title": "Type" })
7048}).annotate({ "title": "RequestCodeExecutionToolResultBlock" })
7049export type RequestSearchResultBlock = {
7050 readonly "cache_control"?: CacheControlEphemeral | null
7051 readonly "citations"?: RequestCitationsConfig
7052 readonly "content": ReadonlyArray<RequestTextBlock>
7053 readonly "source": string
7054 readonly "title": string
7055 readonly "type": "search_result"
7056}
7057export const RequestSearchResultBlock = Schema.Struct({
7058 "cache_control": Schema.optionalKey(
7059 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
7060 "title": "Cache Control",
7061 "description": "Create a cache control breakpoint at this content block."
7062 })
7063 ),
7064 "citations": Schema.optionalKey(RequestCitationsConfig),
7065 "content": Schema.Array(RequestTextBlock).annotate({ "title": "Content" }),
7066 "source": Schema.String.annotate({ "title": "Source" }),
7067 "title": Schema.String.annotate({ "title": "Title" }),
7068 "type": Schema.Literal("search_result").annotate({ "title": "Type" })
7069}).annotate({ "title": "RequestSearchResultBlock" })
7070export type ResponseBashCodeExecutionToolResultBlock = {
7071 readonly "content": ResponseBashCodeExecutionToolResultError | ResponseBashCodeExecutionResultBlock
7072 readonly "tool_use_id": string
7073 readonly "type": "bash_code_execution_tool_result"
7074}
7075export const ResponseBashCodeExecutionToolResultBlock = Schema.Struct({
7076 "content": Schema.Union([ResponseBashCodeExecutionToolResultError, ResponseBashCodeExecutionResultBlock]).annotate({
7077 "title": "Content"
7078 }),
7079 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7080 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7081 ),
7082 "type": Schema.Literal("bash_code_execution_tool_result").annotate({
7083 "title": "Type",
7084 "default": "bash_code_execution_tool_result"
7085 })
7086}).annotate({ "title": "ResponseBashCodeExecutionToolResultBlock" })
7087export type ResponseWebFetchResultBlock = {
7088 readonly "content": ResponseDocumentBlock
7089 readonly "retrieved_at": string | null
7090 readonly "type": "web_fetch_result"
7091 readonly "url": string
7092}
7093export const ResponseWebFetchResultBlock = Schema.Struct({
7094 "content": ResponseDocumentBlock,
7095 "retrieved_at": Schema.Union([Schema.String, Schema.Null]).annotate({
7096 "title": "Retrieved At",
7097 "description": "ISO 8601 timestamp when the content was retrieved",
7098 "default": null
7099 }),
7100 "type": Schema.Literal("web_fetch_result").annotate({ "title": "Type", "default": "web_fetch_result" }),
7101 "url": Schema.String.annotate({ "title": "Url", "description": "Fetched content URL" })
7102}).annotate({ "title": "ResponseWebFetchResultBlock" })
7103export type ResponseCodeExecutionToolResultBlock = {
7104 readonly "content":
7105 | ResponseCodeExecutionToolResultError
7106 | ResponseCodeExecutionResultBlock
7107 | ResponseEncryptedCodeExecutionResultBlock
7108 readonly "tool_use_id": string
7109 readonly "type": "code_execution_tool_result"
7110}
7111export const ResponseCodeExecutionToolResultBlock = Schema.Struct({
7112 "content": Schema.Union([
7113 ResponseCodeExecutionToolResultError,
7114 ResponseCodeExecutionResultBlock,
7115 ResponseEncryptedCodeExecutionResultBlock
7116 ]).annotate({ "title": "Content" }),
7117 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7118 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7119 ),
7120 "type": Schema.Literal("code_execution_tool_result").annotate({
7121 "title": "Type",
7122 "default": "code_execution_tool_result"
7123 })
7124}).annotate({ "title": "ResponseCodeExecutionToolResultBlock" })
7125export type ContentBlockDeltaEvent = {
7126 readonly "delta":
7127 | TextContentBlockDelta
7128 | InputJsonContentBlockDelta
7129 | CitationsDelta
7130 | ThinkingContentBlockDelta
7131 | SignatureContentBlockDelta
7132 readonly "index": number
7133 readonly "type": "content_block_delta"
7134}
7135export const ContentBlockDeltaEvent = Schema.Struct({
7136 "delta": Schema.Union([
7137 TextContentBlockDelta,
7138 InputJsonContentBlockDelta,
7139 CitationsDelta,
7140 ThinkingContentBlockDelta,
7141 SignatureContentBlockDelta
7142 ], { mode: "oneOf" }).annotate({ "title": "Delta" }),
7143 "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()),
7144 "type": Schema.Literal("content_block_delta").annotate({ "title": "Type", "default": "content_block_delta" })
7145}).annotate({ "title": "ContentBlockDeltaEvent" })
7146export type RequestTextEditorCodeExecutionToolResultBlock = {
7147 readonly "cache_control"?: CacheControlEphemeral | null
7148 readonly "content":
7149 | RequestTextEditorCodeExecutionToolResultError
7150 | RequestTextEditorCodeExecutionViewResultBlock
7151 | RequestTextEditorCodeExecutionCreateResultBlock
7152 | RequestTextEditorCodeExecutionStrReplaceResultBlock
7153 readonly "tool_use_id": string
7154 readonly "type": "text_editor_code_execution_tool_result"
7155}
7156export const RequestTextEditorCodeExecutionToolResultBlock = Schema.Struct({
7157 "cache_control": Schema.optionalKey(
7158 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
7159 "title": "Cache Control",
7160 "description": "Create a cache control breakpoint at this content block."
7161 })
7162 ),
7163 "content": Schema.Union([
7164 RequestTextEditorCodeExecutionToolResultError,
7165 RequestTextEditorCodeExecutionViewResultBlock,
7166 RequestTextEditorCodeExecutionCreateResultBlock,
7167 RequestTextEditorCodeExecutionStrReplaceResultBlock
7168 ]).annotate({ "title": "Content" }),
7169 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7170 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7171 ),
7172 "type": Schema.Literal("text_editor_code_execution_tool_result").annotate({ "title": "Type" })
7173}).annotate({ "title": "RequestTextEditorCodeExecutionToolResultBlock" })
7174export type ResponseTextEditorCodeExecutionToolResultBlock = {
7175 readonly "content":
7176 | ResponseTextEditorCodeExecutionToolResultError
7177 | ResponseTextEditorCodeExecutionViewResultBlock
7178 | ResponseTextEditorCodeExecutionCreateResultBlock
7179 | ResponseTextEditorCodeExecutionStrReplaceResultBlock
7180 readonly "tool_use_id": string
7181 readonly "type": "text_editor_code_execution_tool_result"
7182}
7183export const ResponseTextEditorCodeExecutionToolResultBlock = Schema.Struct({
7184 "content": Schema.Union([
7185 ResponseTextEditorCodeExecutionToolResultError,
7186 ResponseTextEditorCodeExecutionViewResultBlock,
7187 ResponseTextEditorCodeExecutionCreateResultBlock,
7188 ResponseTextEditorCodeExecutionStrReplaceResultBlock
7189 ]).annotate({ "title": "Content" }),
7190 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7191 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7192 ),
7193 "type": Schema.Literal("text_editor_code_execution_tool_result").annotate({
7194 "title": "Type",
7195 "default": "text_editor_code_execution_tool_result"
7196 })
7197}).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultBlock" })
7198export type ResponseToolSearchToolResultBlock = {
7199 readonly "content": ResponseToolSearchToolResultError | ResponseToolSearchToolSearchResultBlock
7200 readonly "tool_use_id": string
7201 readonly "type": "tool_search_tool_result"
7202}
7203export const ResponseToolSearchToolResultBlock = Schema.Struct({
7204 "content": Schema.Union([ResponseToolSearchToolResultError, ResponseToolSearchToolSearchResultBlock]).annotate({
7205 "title": "Content"
7206 }),
7207 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7208 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7209 ),
7210 "type": Schema.Literal("tool_search_tool_result").annotate({ "title": "Type", "default": "tool_search_tool_result" })
7211}).annotate({ "title": "ResponseToolSearchToolResultBlock" })
7212export type ContentBlockSource = {
7213 readonly "content": string | ReadonlyArray<RequestTextBlock | RequestImageBlock>
7214 readonly "type": "content"
7215}
7216export const ContentBlockSource = Schema.Struct({
7217 "content": Schema.Union([
7218 Schema.String,
7219 Schema.Array(
7220 Schema.Union([RequestTextBlock, RequestImageBlock], { mode: "oneOf" }).annotate({
7221 "title": "content_block_source_content_item"
7222 })
7223 ).annotate({ "title": "content_block_source_content" })
7224 ]).annotate({ "title": "Content" }),
7225 "type": Schema.Literal("content").annotate({ "title": "Type" })
7226}).annotate({ "title": "ContentBlockSource" })
7227export type RequestWebSearchToolResultBlock = {
7228 readonly "cache_control"?: CacheControlEphemeral | null
7229 readonly "caller"?: DirectCaller | ServerToolCaller | ServerToolCaller_20260120
7230 readonly "content": ReadonlyArray<RequestWebSearchResultBlock> | RequestWebSearchToolResultError
7231 readonly "tool_use_id": string
7232 readonly "type": "web_search_tool_result"
7233}
7234export const RequestWebSearchToolResultBlock = Schema.Struct({
7235 "cache_control": Schema.optionalKey(
7236 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
7237 "title": "Cache Control",
7238 "description": "Create a cache control breakpoint at this content block."
7239 })
7240 ),
7241 "caller": Schema.optionalKey(
7242 Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({
7243 "title": "Caller"
7244 })
7245 ),
7246 "content": Schema.Union([
7247 Schema.Array(RequestWebSearchResultBlock).annotate({ "title": "web_search_tool_result_block_item" }),
7248 RequestWebSearchToolResultError
7249 ]).annotate({ "title": "Content" }),
7250 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7251 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7252 ),
7253 "type": Schema.Literal("web_search_tool_result").annotate({ "title": "Type" })
7254}).annotate({ "title": "RequestWebSearchToolResultBlock" })
7255export type ResponseWebSearchToolResultBlock = {
7256 readonly "caller": DirectCaller | ServerToolCaller | ServerToolCaller_20260120
7257 readonly "content": ResponseWebSearchToolResultError | ReadonlyArray<ResponseWebSearchResultBlock>
7258 readonly "tool_use_id": string
7259 readonly "type": "web_search_tool_result"
7260}
7261export const ResponseWebSearchToolResultBlock = Schema.Struct({
7262 "caller": Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({
7263 "title": "Caller",
7264 "default": { "type": "direct" }
7265 }),
7266 "content": Schema.Union([ResponseWebSearchToolResultError, Schema.Array(ResponseWebSearchResultBlock)]).annotate({
7267 "title": "Content"
7268 }),
7269 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7270 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7271 ),
7272 "type": Schema.Literal("web_search_tool_result").annotate({ "title": "Type", "default": "web_search_tool_result" })
7273}).annotate({ "title": "ResponseWebSearchToolResultBlock" })
7274export type MessageDeltaEvent = {
7275 readonly "delta": MessageDelta
7276 readonly "type": "message_delta"
7277 readonly "usage": {
7278 readonly "cache_creation_input_tokens": number | null
7279 readonly "cache_read_input_tokens": number | null
7280 readonly "input_tokens": number | null
7281 readonly "output_tokens": number
7282 readonly "server_tool_use"?: ServerToolUsage | null
7283 }
7284}
7285export const MessageDeltaEvent = Schema.Struct({
7286 "delta": MessageDelta,
7287 "type": Schema.Literal("message_delta").annotate({ "title": "Type", "default": "message_delta" }),
7288 "usage": Schema.Struct({
7289 "cache_creation_input_tokens": Schema.Union([
7290 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7291 Schema.Null
7292 ]).annotate({
7293 "title": "Cache Creation Input Tokens",
7294 "description": "The cumulative number of input tokens used to create the cache entry.",
7295 "default": null
7296 }),
7297 "cache_read_input_tokens": Schema.Union([
7298 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7299 Schema.Null
7300 ]).annotate({
7301 "title": "Cache Read Input Tokens",
7302 "description": "The cumulative number of input tokens read from the cache.",
7303 "default": null
7304 }),
7305 "input_tokens": Schema.Union([
7306 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7307 Schema.Null
7308 ]).annotate({
7309 "title": "Input Tokens",
7310 "description": "The cumulative number of input tokens which were used.",
7311 "default": null
7312 }),
7313 "output_tokens": Schema.Number.annotate({
7314 "title": "Output Tokens",
7315 "description": "The cumulative number of output tokens which were used."
7316 }).check(Schema.isInt()),
7317 "server_tool_use": Schema.optionalKey(
7318 Schema.Union([ServerToolUsage, Schema.Null]).annotate({
7319 "description": "The number of server tool requests.",
7320 "default": null
7321 })
7322 )
7323 }).annotate({
7324 "title": "MessageDeltaUsage",
7325 "description":
7326 "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`."
7327 })
7328}).annotate({ "title": "MessageDeltaEvent" })
7329export type BetaRequestToolSearchToolResultBlock = {
7330 readonly "cache_control"?: BetaCacheControlEphemeral | null
7331 readonly "content": BetaRequestToolSearchToolResultError | BetaRequestToolSearchToolSearchResultBlock
7332 readonly "tool_use_id": string
7333 readonly "type": "tool_search_tool_result"
7334}
7335export const BetaRequestToolSearchToolResultBlock = Schema.Struct({
7336 "cache_control": Schema.optionalKey(
7337 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
7338 "title": "Cache Control",
7339 "description": "Create a cache control breakpoint at this content block."
7340 })
7341 ),
7342 "content": Schema.Union([BetaRequestToolSearchToolResultError, BetaRequestToolSearchToolSearchResultBlock]).annotate({
7343 "title": "Content"
7344 }),
7345 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7346 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7347 ),
7348 "type": Schema.Literal("tool_search_tool_result").annotate({ "title": "Type" })
7349}).annotate({ "title": "RequestToolSearchToolResultBlock" })
7350export type BetaResponseWebFetchToolResultBlock = {
7351 readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120
7352 readonly "content": BetaResponseWebFetchToolResultError | BetaResponseWebFetchResultBlock
7353 readonly "tool_use_id": string
7354 readonly "type": "web_fetch_tool_result"
7355}
7356export const BetaResponseWebFetchToolResultBlock = Schema.Struct({
7357 "caller": Schema.optionalKey(
7358 Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({
7359 "title": "Caller"
7360 })
7361 ),
7362 "content": Schema.Union([BetaResponseWebFetchToolResultError, BetaResponseWebFetchResultBlock]).annotate({
7363 "title": "Content"
7364 }),
7365 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7366 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7367 ),
7368 "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type", "default": "web_fetch_tool_result" })
7369}).annotate({ "title": "ResponseWebFetchToolResultBlock" })
7370export type BetaMessageDeltaEvent = {
7371 readonly "context_management"?: BetaResponseContextManagement | null
7372 readonly "delta": BetaMessageDelta
7373 readonly "type": "message_delta"
7374 readonly "usage": {
7375 readonly "cache_creation_input_tokens": number | null
7376 readonly "cache_read_input_tokens": number | null
7377 readonly "input_tokens": number | null
7378 readonly "iterations"?: BetaIterationsUsage
7379 readonly "output_tokens": number
7380 readonly "server_tool_use"?: BetaServerToolUsage | null
7381 }
7382}
7383export const BetaMessageDeltaEvent = Schema.Struct({
7384 "context_management": Schema.optionalKey(
7385 Schema.Union([BetaResponseContextManagement, Schema.Null]).annotate({
7386 "description": "Information about context management strategies applied during the request",
7387 "default": null
7388 })
7389 ),
7390 "delta": BetaMessageDelta,
7391 "type": Schema.Literal("message_delta").annotate({ "title": "Type", "default": "message_delta" }),
7392 "usage": Schema.Struct({
7393 "cache_creation_input_tokens": Schema.Union([
7394 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7395 Schema.Null
7396 ]).annotate({
7397 "title": "Cache Creation Input Tokens",
7398 "description": "The cumulative number of input tokens used to create the cache entry.",
7399 "default": null
7400 }),
7401 "cache_read_input_tokens": Schema.Union([
7402 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7403 Schema.Null
7404 ]).annotate({
7405 "title": "Cache Read Input Tokens",
7406 "description": "The cumulative number of input tokens read from the cache.",
7407 "default": null
7408 }),
7409 "input_tokens": Schema.Union([
7410 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7411 Schema.Null
7412 ]).annotate({
7413 "title": "Input Tokens",
7414 "description": "The cumulative number of input tokens which were used.",
7415 "default": null
7416 }),
7417 "iterations": Schema.optionalKey(BetaIterationsUsage),
7418 "output_tokens": Schema.Number.annotate({
7419 "title": "Output Tokens",
7420 "description": "The cumulative number of output tokens which were used."
7421 }).check(Schema.isInt()),
7422 "server_tool_use": Schema.optionalKey(
7423 Schema.Union([BetaServerToolUsage, Schema.Null]).annotate({
7424 "description": "The number of server tool requests.",
7425 "default": null
7426 })
7427 )
7428 }).annotate({
7429 "title": "MessageDeltaUsage",
7430 "description":
7431 "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`."
7432 })
7433}).annotate({ "title": "MessageDeltaEvent" })
7434export type BetaRequestDocumentBlock = {
7435 readonly "cache_control"?: BetaCacheControlEphemeral | null
7436 readonly "citations"?: BetaRequestCitationsConfig | null
7437 readonly "context"?: string | null
7438 readonly "source":
7439 | BetaBase64PDFSource
7440 | BetaPlainTextSource
7441 | BetaContentBlockSource
7442 | BetaURLPDFSource
7443 | BetaFileDocumentSource
7444 readonly "title"?: string | null
7445 readonly "type": "document"
7446}
7447export const BetaRequestDocumentBlock = Schema.Struct({
7448 "cache_control": Schema.optionalKey(
7449 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
7450 "title": "Cache Control",
7451 "description": "Create a cache control breakpoint at this content block."
7452 })
7453 ),
7454 "citations": Schema.optionalKey(Schema.Union([BetaRequestCitationsConfig, Schema.Null])),
7455 "context": Schema.optionalKey(
7456 Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Null]).annotate({ "title": "Context" })
7457 ),
7458 "source": Schema.Union([
7459 BetaBase64PDFSource,
7460 BetaPlainTextSource,
7461 BetaContentBlockSource,
7462 BetaURLPDFSource,
7463 BetaFileDocumentSource
7464 ], { mode: "oneOf" }).annotate({ "title": "Source" }),
7465 "title": Schema.optionalKey(
7466 Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), Schema.Null]).annotate({
7467 "title": "Title"
7468 })
7469 ),
7470 "type": Schema.Literal("document").annotate({ "title": "Type" })
7471}).annotate({ "title": "RequestDocumentBlock" })
7472export type RequestToolSearchToolResultBlock = {
7473 readonly "cache_control"?: CacheControlEphemeral | null
7474 readonly "content": RequestToolSearchToolResultError | RequestToolSearchToolSearchResultBlock
7475 readonly "tool_use_id": string
7476 readonly "type": "tool_search_tool_result"
7477}
7478export const RequestToolSearchToolResultBlock = Schema.Struct({
7479 "cache_control": Schema.optionalKey(
7480 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
7481 "title": "Cache Control",
7482 "description": "Create a cache control breakpoint at this content block."
7483 })
7484 ),
7485 "content": Schema.Union([RequestToolSearchToolResultError, RequestToolSearchToolSearchResultBlock]).annotate({
7486 "title": "Content"
7487 }),
7488 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7489 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7490 ),
7491 "type": Schema.Literal("tool_search_tool_result").annotate({ "title": "Type" })
7492}).annotate({ "title": "RequestToolSearchToolResultBlock" })
7493export type ResponseWebFetchToolResultBlock = {
7494 readonly "caller": DirectCaller | ServerToolCaller | ServerToolCaller_20260120
7495 readonly "content": ResponseWebFetchToolResultError | ResponseWebFetchResultBlock
7496 readonly "tool_use_id": string
7497 readonly "type": "web_fetch_tool_result"
7498}
7499export const ResponseWebFetchToolResultBlock = Schema.Struct({
7500 "caller": Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({
7501 "title": "Caller",
7502 "default": { "type": "direct" }
7503 }),
7504 "content": Schema.Union([ResponseWebFetchToolResultError, ResponseWebFetchResultBlock]).annotate({
7505 "title": "Content"
7506 }),
7507 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7508 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7509 ),
7510 "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type", "default": "web_fetch_tool_result" })
7511}).annotate({ "title": "ResponseWebFetchToolResultBlock" })
7512export type RequestDocumentBlock = {
7513 readonly "cache_control"?: CacheControlEphemeral | null
7514 readonly "citations"?: RequestCitationsConfig | null
7515 readonly "context"?: string | null
7516 readonly "source": Base64PDFSource | PlainTextSource | ContentBlockSource | URLPDFSource
7517 readonly "title"?: string | null
7518 readonly "type": "document"
7519}
7520export const RequestDocumentBlock = Schema.Struct({
7521 "cache_control": Schema.optionalKey(
7522 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
7523 "title": "Cache Control",
7524 "description": "Create a cache control breakpoint at this content block."
7525 })
7526 ),
7527 "citations": Schema.optionalKey(Schema.Union([RequestCitationsConfig, Schema.Null])),
7528 "context": Schema.optionalKey(
7529 Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Null]).annotate({ "title": "Context" })
7530 ),
7531 "source": Schema.Union([Base64PDFSource, PlainTextSource, ContentBlockSource, URLPDFSource], { mode: "oneOf" })
7532 .annotate({ "title": "Source" }),
7533 "title": Schema.optionalKey(
7534 Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), Schema.Null]).annotate({
7535 "title": "Title"
7536 })
7537 ),
7538 "type": Schema.Literal("document").annotate({ "title": "Type" })
7539}).annotate({ "title": "RequestDocumentBlock" })
7540export type BetaContentBlockStartEvent = {
7541 readonly "content_block":
7542 | BetaResponseTextBlock
7543 | BetaResponseThinkingBlock
7544 | BetaResponseRedactedThinkingBlock
7545 | BetaResponseToolUseBlock
7546 | BetaResponseServerToolUseBlock
7547 | BetaResponseWebSearchToolResultBlock
7548 | BetaResponseWebFetchToolResultBlock
7549 | BetaResponseCodeExecutionToolResultBlock
7550 | BetaResponseBashCodeExecutionToolResultBlock
7551 | BetaResponseTextEditorCodeExecutionToolResultBlock
7552 | BetaResponseToolSearchToolResultBlock
7553 | BetaResponseMCPToolUseBlock
7554 | BetaResponseMCPToolResultBlock
7555 | BetaResponseContainerUploadBlock
7556 | BetaResponseCompactionBlock
7557 readonly "index": number
7558 readonly "type": "content_block_start"
7559}
7560export const BetaContentBlockStartEvent = Schema.Struct({
7561 "content_block": Schema.Union([
7562 BetaResponseTextBlock,
7563 BetaResponseThinkingBlock,
7564 BetaResponseRedactedThinkingBlock,
7565 BetaResponseToolUseBlock,
7566 BetaResponseServerToolUseBlock,
7567 BetaResponseWebSearchToolResultBlock,
7568 BetaResponseWebFetchToolResultBlock,
7569 BetaResponseCodeExecutionToolResultBlock,
7570 BetaResponseBashCodeExecutionToolResultBlock,
7571 BetaResponseTextEditorCodeExecutionToolResultBlock,
7572 BetaResponseToolSearchToolResultBlock,
7573 BetaResponseMCPToolUseBlock,
7574 BetaResponseMCPToolResultBlock,
7575 BetaResponseContainerUploadBlock,
7576 BetaResponseCompactionBlock
7577 ], { mode: "oneOf" }).annotate({ "title": "Content Block" }),
7578 "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()),
7579 "type": Schema.Literal("content_block_start").annotate({ "title": "Type", "default": "content_block_start" })
7580}).annotate({ "title": "ContentBlockStartEvent" })
7581export type BetaContentBlock =
7582 | BetaResponseTextBlock
7583 | BetaResponseThinkingBlock
7584 | BetaResponseRedactedThinkingBlock
7585 | BetaResponseToolUseBlock
7586 | BetaResponseServerToolUseBlock
7587 | BetaResponseWebSearchToolResultBlock
7588 | BetaResponseWebFetchToolResultBlock
7589 | BetaResponseCodeExecutionToolResultBlock
7590 | BetaResponseBashCodeExecutionToolResultBlock
7591 | BetaResponseTextEditorCodeExecutionToolResultBlock
7592 | BetaResponseToolSearchToolResultBlock
7593 | BetaResponseMCPToolUseBlock
7594 | BetaResponseMCPToolResultBlock
7595 | BetaResponseContainerUploadBlock
7596 | BetaResponseCompactionBlock
7597export const BetaContentBlock = Schema.Union([
7598 BetaResponseTextBlock,
7599 BetaResponseThinkingBlock,
7600 BetaResponseRedactedThinkingBlock,
7601 BetaResponseToolUseBlock,
7602 BetaResponseServerToolUseBlock,
7603 BetaResponseWebSearchToolResultBlock,
7604 BetaResponseWebFetchToolResultBlock,
7605 BetaResponseCodeExecutionToolResultBlock,
7606 BetaResponseBashCodeExecutionToolResultBlock,
7607 BetaResponseTextEditorCodeExecutionToolResultBlock,
7608 BetaResponseToolSearchToolResultBlock,
7609 BetaResponseMCPToolUseBlock,
7610 BetaResponseMCPToolResultBlock,
7611 BetaResponseContainerUploadBlock,
7612 BetaResponseCompactionBlock
7613], { mode: "oneOf" })
7614export type BetaRequestWebFetchResultBlock = {
7615 readonly "content": BetaRequestDocumentBlock
7616 readonly "retrieved_at"?: string | null
7617 readonly "type": "web_fetch_result"
7618 readonly "url": string
7619}
7620export const BetaRequestWebFetchResultBlock = Schema.Struct({
7621 "content": BetaRequestDocumentBlock,
7622 "retrieved_at": Schema.optionalKey(
7623 Schema.Union([Schema.String, Schema.Null]).annotate({
7624 "title": "Retrieved At",
7625 "description": "ISO 8601 timestamp when the content was retrieved"
7626 })
7627 ),
7628 "type": Schema.Literal("web_fetch_result").annotate({ "title": "Type" }),
7629 "url": Schema.String.annotate({ "title": "Url", "description": "Fetched content URL" })
7630}).annotate({ "title": "RequestWebFetchResultBlock" })
7631export type ContentBlockStartEvent = {
7632 readonly "content_block":
7633 | ResponseTextBlock
7634 | ResponseThinkingBlock
7635 | ResponseRedactedThinkingBlock
7636 | ResponseToolUseBlock
7637 | ResponseServerToolUseBlock
7638 | ResponseWebSearchToolResultBlock
7639 | ResponseWebFetchToolResultBlock
7640 | ResponseCodeExecutionToolResultBlock
7641 | ResponseBashCodeExecutionToolResultBlock
7642 | ResponseTextEditorCodeExecutionToolResultBlock
7643 | ResponseToolSearchToolResultBlock
7644 | ResponseContainerUploadBlock
7645 readonly "index": number
7646 readonly "type": "content_block_start"
7647}
7648export const ContentBlockStartEvent = Schema.Struct({
7649 "content_block": Schema.Union([
7650 ResponseTextBlock,
7651 ResponseThinkingBlock,
7652 ResponseRedactedThinkingBlock,
7653 ResponseToolUseBlock,
7654 ResponseServerToolUseBlock,
7655 ResponseWebSearchToolResultBlock,
7656 ResponseWebFetchToolResultBlock,
7657 ResponseCodeExecutionToolResultBlock,
7658 ResponseBashCodeExecutionToolResultBlock,
7659 ResponseTextEditorCodeExecutionToolResultBlock,
7660 ResponseToolSearchToolResultBlock,
7661 ResponseContainerUploadBlock
7662 ], { mode: "oneOf" }).annotate({ "title": "Content Block" }),
7663 "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()),
7664 "type": Schema.Literal("content_block_start").annotate({ "title": "Type", "default": "content_block_start" })
7665}).annotate({ "title": "ContentBlockStartEvent" })
7666export type ContentBlock =
7667 | ResponseTextBlock
7668 | ResponseThinkingBlock
7669 | ResponseRedactedThinkingBlock
7670 | ResponseToolUseBlock
7671 | ResponseServerToolUseBlock
7672 | ResponseWebSearchToolResultBlock
7673 | ResponseWebFetchToolResultBlock
7674 | ResponseCodeExecutionToolResultBlock
7675 | ResponseBashCodeExecutionToolResultBlock
7676 | ResponseTextEditorCodeExecutionToolResultBlock
7677 | ResponseToolSearchToolResultBlock
7678 | ResponseContainerUploadBlock
7679export const ContentBlock = Schema.Union([
7680 ResponseTextBlock,
7681 ResponseThinkingBlock,
7682 ResponseRedactedThinkingBlock,
7683 ResponseToolUseBlock,
7684 ResponseServerToolUseBlock,
7685 ResponseWebSearchToolResultBlock,
7686 ResponseWebFetchToolResultBlock,
7687 ResponseCodeExecutionToolResultBlock,
7688 ResponseBashCodeExecutionToolResultBlock,
7689 ResponseTextEditorCodeExecutionToolResultBlock,
7690 ResponseToolSearchToolResultBlock,
7691 ResponseContainerUploadBlock
7692], { mode: "oneOf" })
7693export type RequestWebFetchResultBlock = {
7694 readonly "content": RequestDocumentBlock
7695 readonly "retrieved_at"?: string | null
7696 readonly "type": "web_fetch_result"
7697 readonly "url": string
7698}
7699export const RequestWebFetchResultBlock = Schema.Struct({
7700 "content": RequestDocumentBlock,
7701 "retrieved_at": Schema.optionalKey(
7702 Schema.Union([Schema.String, Schema.Null]).annotate({
7703 "title": "Retrieved At",
7704 "description": "ISO 8601 timestamp when the content was retrieved"
7705 })
7706 ),
7707 "type": Schema.Literal("web_fetch_result").annotate({ "title": "Type" }),
7708 "url": Schema.String.annotate({ "title": "Url", "description": "Fetched content URL" })
7709}).annotate({ "title": "RequestWebFetchResultBlock" })
7710export type BetaMessage = {
7711 readonly "id": string
7712 readonly "type": "message"
7713 readonly "role": "assistant"
7714 readonly "content": ReadonlyArray<BetaContentBlock>
7715 readonly "model": Model
7716 readonly "stop_reason": BetaStopReason | null
7717 readonly "stop_sequence": string | null
7718 readonly "usage": {
7719 readonly "cache_creation": BetaCacheCreation | null
7720 readonly "cache_creation_input_tokens": number | null
7721 readonly "cache_read_input_tokens": number | null
7722 readonly "inference_geo"?: string | null
7723 readonly "input_tokens": number
7724 readonly "iterations"?: BetaIterationsUsage
7725 readonly "output_tokens": number
7726 readonly "server_tool_use"?: BetaServerToolUsage | null
7727 readonly "service_tier": "standard" | "priority" | "batch" | null
7728 readonly "speed"?: BetaSpeed | null
7729 }
7730 readonly "context_management"?: BetaResponseContextManagement | null
7731 readonly "container"?: BetaContainer | null
7732}
7733export const BetaMessage = Schema.Struct({
7734 "id": Schema.String.annotate({
7735 "title": "Id",
7736 "description": "Unique object identifier.\n\nThe format and length of IDs may change over time."
7737 }),
7738 "type": Schema.Literal("message").annotate({
7739 "title": "Type",
7740 "description": "Object type.\n\nFor Messages, this is always `\"message\"`.",
7741 "default": "message"
7742 }),
7743 "role": Schema.Literal("assistant").annotate({
7744 "title": "Role",
7745 "description": "Conversational role of the generated message.\n\nThis will always be `\"assistant\"`.",
7746 "default": "assistant"
7747 }),
7748 "content": Schema.Array(BetaContentBlock).annotate({
7749 "title": "Content",
7750 "description":
7751 "Content generated by the model.\n\nThis is an array of content blocks, each of which has a `type` that determines its shape.\n\nExample:\n\n```json\n[{\"type\": \"text\", \"text\": \"Hi, I'm Claude.\"}]\n```\n\nIf the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.\n\nFor example, if the input `messages` were:\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"}\n]\n```\n\nThen the response `content` might be:\n\n```json\n[{\"type\": \"text\", \"text\": \"B)\"}]\n```"
7752 }),
7753 "model": Model,
7754 "stop_reason": Schema.Union([BetaStopReason, Schema.Null]).annotate({
7755 "title": "Stop Reason",
7756 "description":
7757 "The reason that we stopped.\n\nThis may be one the following values:\n* `\"end_turn\"`: the model reached a natural stopping point\n* `\"max_tokens\"`: we exceeded the requested `max_tokens` or the model's maximum\n* `\"stop_sequence\"`: one of your provided custom `stop_sequences` was generated\n* `\"tool_use\"`: the model invoked one or more tools\n* `\"pause_turn\"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.\n* `\"refusal\"`: when streaming classifiers intervene to handle potential policy violations\n\nIn non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise."
7758 }),
7759 "stop_sequence": Schema.Union([Schema.String, Schema.Null]).annotate({
7760 "title": "Stop Sequence",
7761 "description":
7762 "Which custom stop sequence was generated, if any.\n\nThis value will be a non-null string if one of your custom stop sequences was generated.",
7763 "default": null
7764 }),
7765 "usage": Schema.Struct({
7766 "cache_creation": Schema.Union([BetaCacheCreation, Schema.Null]).annotate({
7767 "description": "Breakdown of cached tokens by TTL",
7768 "default": null
7769 }),
7770 "cache_creation_input_tokens": Schema.Union([
7771 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7772 Schema.Null
7773 ]).annotate({
7774 "title": "Cache Creation Input Tokens",
7775 "description": "The number of input tokens used to create the cache entry.",
7776 "default": null
7777 }),
7778 "cache_read_input_tokens": Schema.Union([
7779 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7780 Schema.Null
7781 ]).annotate({
7782 "title": "Cache Read Input Tokens",
7783 "description": "The number of input tokens read from the cache.",
7784 "default": null
7785 }),
7786 "inference_geo": Schema.optionalKey(
7787 Schema.Union([Schema.String, Schema.Null]).annotate({
7788 "title": "Inference Geo",
7789 "description": "The geographic region where inference was performed for this request.",
7790 "default": null
7791 })
7792 ),
7793 "input_tokens": Schema.Number.annotate({
7794 "title": "Input Tokens",
7795 "description": "The number of input tokens which were used."
7796 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7797 "iterations": Schema.optionalKey(BetaIterationsUsage),
7798 "output_tokens": Schema.Number.annotate({
7799 "title": "Output Tokens",
7800 "description": "The number of output tokens which were used."
7801 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7802 "server_tool_use": Schema.optionalKey(
7803 Schema.Union([BetaServerToolUsage, Schema.Null]).annotate({
7804 "description": "The number of server tool requests.",
7805 "default": null
7806 })
7807 ),
7808 "service_tier": Schema.Union([Schema.Literals(["standard", "priority", "batch"]), Schema.Null]).annotate({
7809 "title": "Service Tier",
7810 "description": "If the request used the priority, standard, or batch tier.",
7811 "default": null
7812 }),
7813 "speed": Schema.optionalKey(
7814 Schema.Union([BetaSpeed, Schema.Null]).annotate({
7815 "description": "The inference speed mode used for this request.",
7816 "default": null
7817 })
7818 )
7819 }).annotate({
7820 "title": "Usage",
7821 "description":
7822 "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`."
7823 }),
7824 "context_management": Schema.optionalKey(
7825 Schema.Union([BetaResponseContextManagement, Schema.Null]).annotate({
7826 "description":
7827 "Context management response.\n\nInformation about context management strategies applied during the request.",
7828 "default": null
7829 })
7830 ),
7831 "container": Schema.optionalKey(
7832 Schema.Union([BetaContainer, Schema.Null]).annotate({
7833 "description":
7834 "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used.",
7835 "default": null
7836 })
7837 )
7838}).annotate({ "title": "Message" })
7839export type BetaRequestWebFetchToolResultBlock = {
7840 readonly "cache_control"?: BetaCacheControlEphemeral | null
7841 readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120
7842 readonly "content": BetaRequestWebFetchToolResultError | BetaRequestWebFetchResultBlock
7843 readonly "tool_use_id": string
7844 readonly "type": "web_fetch_tool_result"
7845}
7846export const BetaRequestWebFetchToolResultBlock = Schema.Struct({
7847 "cache_control": Schema.optionalKey(
7848 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
7849 "title": "Cache Control",
7850 "description": "Create a cache control breakpoint at this content block."
7851 })
7852 ),
7853 "caller": Schema.optionalKey(
7854 Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({
7855 "title": "Caller"
7856 })
7857 ),
7858 "content": Schema.Union([BetaRequestWebFetchToolResultError, BetaRequestWebFetchResultBlock]).annotate({
7859 "title": "Content"
7860 }),
7861 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7862 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
7863 ),
7864 "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type" })
7865}).annotate({ "title": "RequestWebFetchToolResultBlock" })
7866export type Message = {
7867 readonly "id": string
7868 readonly "type": "message"
7869 readonly "role": "assistant"
7870 readonly "content": ReadonlyArray<ContentBlock>
7871 readonly "model": Model
7872 readonly "stop_reason": StopReason | null
7873 readonly "stop_sequence": string | null
7874 readonly "usage": {
7875 readonly "cache_creation": CacheCreation | null
7876 readonly "cache_creation_input_tokens": number | null
7877 readonly "cache_read_input_tokens": number | null
7878 readonly "inference_geo"?: string | null
7879 readonly "input_tokens": number
7880 readonly "output_tokens": number
7881 readonly "server_tool_use"?: ServerToolUsage | null
7882 readonly "service_tier": "standard" | "priority" | "batch" | null
7883 }
7884 readonly "container": Container | null
7885}
7886export const Message = Schema.Struct({
7887 "id": Schema.String.annotate({
7888 "title": "Id",
7889 "description": "Unique object identifier.\n\nThe format and length of IDs may change over time."
7890 }),
7891 "type": Schema.Literal("message").annotate({
7892 "title": "Type",
7893 "description": "Object type.\n\nFor Messages, this is always `\"message\"`.",
7894 "default": "message"
7895 }),
7896 "role": Schema.Literal("assistant").annotate({
7897 "title": "Role",
7898 "description": "Conversational role of the generated message.\n\nThis will always be `\"assistant\"`.",
7899 "default": "assistant"
7900 }),
7901 "content": Schema.Array(ContentBlock).annotate({
7902 "title": "Content",
7903 "description":
7904 "Content generated by the model.\n\nThis is an array of content blocks, each of which has a `type` that determines its shape.\n\nExample:\n\n```json\n[{\"type\": \"text\", \"text\": \"Hi, I'm Claude.\"}]\n```\n\nIf the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.\n\nFor example, if the input `messages` were:\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"}\n]\n```\n\nThen the response `content` might be:\n\n```json\n[{\"type\": \"text\", \"text\": \"B)\"}]\n```"
7905 }),
7906 "model": Model,
7907 "stop_reason": Schema.Union([StopReason, Schema.Null]).annotate({
7908 "title": "Stop Reason",
7909 "description":
7910 "The reason that we stopped.\n\nThis may be one the following values:\n* `\"end_turn\"`: the model reached a natural stopping point\n* `\"max_tokens\"`: we exceeded the requested `max_tokens` or the model's maximum\n* `\"stop_sequence\"`: one of your provided custom `stop_sequences` was generated\n* `\"tool_use\"`: the model invoked one or more tools\n* `\"pause_turn\"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.\n* `\"refusal\"`: when streaming classifiers intervene to handle potential policy violations\n\nIn non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise."
7911 }),
7912 "stop_sequence": Schema.Union([Schema.String, Schema.Null]).annotate({
7913 "title": "Stop Sequence",
7914 "description":
7915 "Which custom stop sequence was generated, if any.\n\nThis value will be a non-null string if one of your custom stop sequences was generated.",
7916 "default": null
7917 }),
7918 "usage": Schema.Struct({
7919 "cache_creation": Schema.Union([CacheCreation, Schema.Null]).annotate({
7920 "description": "Breakdown of cached tokens by TTL",
7921 "default": null
7922 }),
7923 "cache_creation_input_tokens": Schema.Union([
7924 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7925 Schema.Null
7926 ]).annotate({
7927 "title": "Cache Creation Input Tokens",
7928 "description": "The number of input tokens used to create the cache entry.",
7929 "default": null
7930 }),
7931 "cache_read_input_tokens": Schema.Union([
7932 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7933 Schema.Null
7934 ]).annotate({
7935 "title": "Cache Read Input Tokens",
7936 "description": "The number of input tokens read from the cache.",
7937 "default": null
7938 }),
7939 "inference_geo": Schema.optionalKey(
7940 Schema.Union([Schema.String, Schema.Null]).annotate({
7941 "title": "Inference Geo",
7942 "description": "The geographic region where inference was performed for this request.",
7943 "default": null
7944 })
7945 ),
7946 "input_tokens": Schema.Number.annotate({
7947 "title": "Input Tokens",
7948 "description": "The number of input tokens which were used."
7949 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7950 "output_tokens": Schema.Number.annotate({
7951 "title": "Output Tokens",
7952 "description": "The number of output tokens which were used."
7953 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
7954 "server_tool_use": Schema.optionalKey(
7955 Schema.Union([ServerToolUsage, Schema.Null]).annotate({
7956 "description": "The number of server tool requests.",
7957 "default": null
7958 })
7959 ),
7960 "service_tier": Schema.Union([Schema.Literals(["standard", "priority", "batch"]), Schema.Null]).annotate({
7961 "title": "Service Tier",
7962 "description": "If the request used the priority, standard, or batch tier.",
7963 "default": null
7964 })
7965 }).annotate({
7966 "title": "Usage",
7967 "description":
7968 "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`."
7969 }),
7970 "container": Schema.Union([Container, Schema.Null]).annotate({
7971 "description":
7972 "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used.",
7973 "default": null
7974 })
7975}).annotate({ "title": "Message" })
7976export type RequestWebFetchToolResultBlock = {
7977 readonly "cache_control"?: CacheControlEphemeral | null
7978 readonly "caller"?: DirectCaller | ServerToolCaller | ServerToolCaller_20260120
7979 readonly "content": RequestWebFetchToolResultError | RequestWebFetchResultBlock
7980 readonly "tool_use_id": string
7981 readonly "type": "web_fetch_tool_result"
7982}
7983export const RequestWebFetchToolResultBlock = Schema.Struct({
7984 "cache_control": Schema.optionalKey(
7985 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
7986 "title": "Cache Control",
7987 "description": "Create a cache control breakpoint at this content block."
7988 })
7989 ),
7990 "caller": Schema.optionalKey(
7991 Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({
7992 "title": "Caller"
7993 })
7994 ),
7995 "content": Schema.Union([RequestWebFetchToolResultError, RequestWebFetchResultBlock]).annotate({
7996 "title": "Content"
7997 }),
7998 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
7999 Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))
8000 ),
8001 "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type" })
8002}).annotate({ "title": "RequestWebFetchToolResultBlock" })
8003export type BetaMessageStartEvent = { readonly "message": BetaMessage; readonly "type": "message_start" }
8004export const BetaMessageStartEvent = Schema.Struct({
8005 "message": BetaMessage,
8006 "type": Schema.Literal("message_start").annotate({ "title": "Type", "default": "message_start" })
8007}).annotate({ "title": "MessageStartEvent" })
8008export type BetaSucceededResult = { readonly "message": BetaMessage; readonly "type": "succeeded" }
8009export const BetaSucceededResult = Schema.Struct({
8010 "message": BetaMessage,
8011 "type": Schema.Literal("succeeded").annotate({ "title": "Type", "default": "succeeded" })
8012}).annotate({ "title": "SucceededResult" })
8013export type BetaInputContentBlock =
8014 | {
8015 readonly "cache_control"?: BetaCacheControlEphemeral | null
8016 readonly "citations"?:
8017 | ReadonlyArray<
8018 | BetaRequestCharLocationCitation
8019 | BetaRequestPageLocationCitation
8020 | BetaRequestContentBlockLocationCitation
8021 | BetaRequestWebSearchResultLocationCitation
8022 | BetaRequestSearchResultLocationCitation
8023 >
8024 | null
8025 readonly "text": string
8026 readonly "type": "text"
8027 }
8028 | {
8029 readonly "cache_control"?: BetaCacheControlEphemeral | null
8030 readonly "source": BetaBase64ImageSource | BetaURLImageSource | BetaFileImageSource
8031 readonly "type": "image"
8032 }
8033 | {
8034 readonly "cache_control"?: BetaCacheControlEphemeral | null
8035 readonly "citations"?: BetaRequestCitationsConfig | null
8036 readonly "context"?: string | null
8037 readonly "source":
8038 | BetaBase64PDFSource
8039 | BetaPlainTextSource
8040 | BetaContentBlockSource
8041 | BetaURLPDFSource
8042 | BetaFileDocumentSource
8043 readonly "title"?: string | null
8044 readonly "type": "document"
8045 }
8046 | {
8047 readonly "cache_control"?: BetaCacheControlEphemeral | null
8048 readonly "citations"?: BetaRequestCitationsConfig
8049 readonly "content": ReadonlyArray<BetaRequestTextBlock>
8050 readonly "source": string
8051 readonly "title": string
8052 readonly "type": "search_result"
8053 }
8054 | { readonly "signature": string; readonly "thinking": string; readonly "type": "thinking" }
8055 | { readonly "data": string; readonly "type": "redacted_thinking" }
8056 | {
8057 readonly "cache_control"?: BetaCacheControlEphemeral | null
8058 readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120
8059 readonly "id": string
8060 readonly "input": { readonly [x: string]: Schema.Json }
8061 readonly "name": string
8062 readonly "type": "tool_use"
8063 }
8064 | {
8065 readonly "cache_control"?: BetaCacheControlEphemeral | null
8066 readonly "content"?:
8067 | string
8068 | ReadonlyArray<
8069 | BetaRequestTextBlock
8070 | BetaRequestImageBlock
8071 | BetaRequestSearchResultBlock
8072 | BetaRequestDocumentBlock
8073 | BetaRequestToolReferenceBlock
8074 >
8075 readonly "is_error"?: boolean
8076 readonly "tool_use_id": string
8077 readonly "type": "tool_result"
8078 }
8079 | BetaRequestServerToolUseBlock
8080 | BetaRequestWebSearchToolResultBlock
8081 | BetaRequestWebFetchToolResultBlock
8082 | BetaRequestCodeExecutionToolResultBlock
8083 | BetaRequestBashCodeExecutionToolResultBlock
8084 | BetaRequestTextEditorCodeExecutionToolResultBlock
8085 | BetaRequestToolSearchToolResultBlock
8086 | BetaRequestMCPToolUseBlock
8087 | BetaRequestMCPToolResultBlock
8088 | BetaRequestContainerUploadBlock
8089 | BetaRequestCompactionBlock
8090export const BetaInputContentBlock = Schema.Union([
8091 Schema.Struct({
8092 "cache_control": Schema.optionalKey(
8093 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8094 "title": "Cache Control",
8095 "description": "Create a cache control breakpoint at this content block."
8096 })
8097 ),
8098 "citations": Schema.optionalKey(
8099 Schema.Union([
8100 Schema.Array(
8101 Schema.Union([
8102 BetaRequestCharLocationCitation,
8103 BetaRequestPageLocationCitation,
8104 BetaRequestContentBlockLocationCitation,
8105 BetaRequestWebSearchResultLocationCitation,
8106 BetaRequestSearchResultLocationCitation
8107 ], { mode: "oneOf" })
8108 ),
8109 Schema.Null
8110 ]).annotate({ "title": "Citations" })
8111 ),
8112 "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)),
8113 "type": Schema.Literal("text").annotate({ "title": "Type" })
8114 }).annotate({ "title": "RequestTextBlock", "description": "Regular text content." }),
8115 Schema.Struct({
8116 "cache_control": Schema.optionalKey(
8117 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8118 "title": "Cache Control",
8119 "description": "Create a cache control breakpoint at this content block."
8120 })
8121 ),
8122 "source": Schema.Union([BetaBase64ImageSource, BetaURLImageSource, BetaFileImageSource], { mode: "oneOf" })
8123 .annotate({ "title": "Source" }),
8124 "type": Schema.Literal("image").annotate({ "title": "Type" })
8125 }).annotate({
8126 "title": "RequestImageBlock",
8127 "description": "Image content specified directly as base64 data or as a reference via a URL."
8128 }),
8129 Schema.Struct({
8130 "cache_control": Schema.optionalKey(
8131 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8132 "title": "Cache Control",
8133 "description": "Create a cache control breakpoint at this content block."
8134 })
8135 ),
8136 "citations": Schema.optionalKey(Schema.Union([BetaRequestCitationsConfig, Schema.Null])),
8137 "context": Schema.optionalKey(
8138 Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Null]).annotate({ "title": "Context" })
8139 ),
8140 "source": Schema.Union([
8141 BetaBase64PDFSource,
8142 BetaPlainTextSource,
8143 BetaContentBlockSource,
8144 BetaURLPDFSource,
8145 BetaFileDocumentSource
8146 ], { mode: "oneOf" }).annotate({ "title": "Source" }),
8147 "title": Schema.optionalKey(
8148 Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), Schema.Null]).annotate({
8149 "title": "Title"
8150 })
8151 ),
8152 "type": Schema.Literal("document").annotate({ "title": "Type" })
8153 }).annotate({
8154 "title": "RequestDocumentBlock",
8155 "description": "Document content, either specified directly as base64 data, as text, or as a reference via a URL."
8156 }),
8157 Schema.Struct({
8158 "cache_control": Schema.optionalKey(
8159 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8160 "title": "Cache Control",
8161 "description": "Create a cache control breakpoint at this content block."
8162 })
8163 ),
8164 "citations": Schema.optionalKey(BetaRequestCitationsConfig),
8165 "content": Schema.Array(BetaRequestTextBlock).annotate({ "title": "Content" }),
8166 "source": Schema.String.annotate({ "title": "Source" }),
8167 "title": Schema.String.annotate({ "title": "Title" }),
8168 "type": Schema.Literal("search_result").annotate({ "title": "Type" })
8169 }).annotate({
8170 "title": "RequestSearchResultBlock",
8171 "description": "A search result block containing source, title, and content from search operations."
8172 }),
8173 Schema.Struct({
8174 "signature": Schema.String.annotate({ "title": "Signature" }),
8175 "thinking": Schema.String.annotate({ "title": "Thinking" }),
8176 "type": Schema.Literal("thinking").annotate({ "title": "Type" })
8177 }).annotate({ "title": "RequestThinkingBlock", "description": "A block specifying internal thinking by the model." }),
8178 Schema.Struct({
8179 "data": Schema.String.annotate({ "title": "Data" }),
8180 "type": Schema.Literal("redacted_thinking").annotate({ "title": "Type" })
8181 }).annotate({
8182 "title": "RequestRedactedThinkingBlock",
8183 "description": "A block specifying internal, redacted thinking by the model."
8184 }),
8185 Schema.Struct({
8186 "cache_control": Schema.optionalKey(
8187 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8188 "title": "Cache Control",
8189 "description": "Create a cache control breakpoint at this content block."
8190 })
8191 ),
8192 "caller": Schema.optionalKey(
8193 Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate(
8194 { "title": "Caller" }
8195 )
8196 ),
8197 "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
8198 "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }),
8199 "name": Schema.String.annotate({ "title": "Name" }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(200)),
8200 "type": Schema.Literal("tool_use").annotate({ "title": "Type" })
8201 }).annotate({ "title": "RequestToolUseBlock", "description": "A block indicating a tool use by the model." }),
8202 Schema.Struct({
8203 "cache_control": Schema.optionalKey(
8204 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8205 "title": "Cache Control",
8206 "description": "Create a cache control breakpoint at this content block."
8207 })
8208 ),
8209 "content": Schema.optionalKey(
8210 Schema.Union([
8211 Schema.String,
8212 Schema.Array(
8213 Schema.Union([
8214 BetaRequestTextBlock,
8215 BetaRequestImageBlock,
8216 BetaRequestSearchResultBlock,
8217 BetaRequestDocumentBlock,
8218 BetaRequestToolReferenceBlock
8219 ], { mode: "oneOf" }).annotate({ "title": "Block" })
8220 )
8221 ]).annotate({ "title": "Content" })
8222 ),
8223 "is_error": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Is Error" })),
8224 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
8225 Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))
8226 ),
8227 "type": Schema.Literal("tool_result").annotate({ "title": "Type" })
8228 }).annotate({
8229 "title": "RequestToolResultBlock",
8230 "description": "A block specifying the results of a tool use by the model."
8231 }),
8232 BetaRequestServerToolUseBlock,
8233 BetaRequestWebSearchToolResultBlock,
8234 BetaRequestWebFetchToolResultBlock,
8235 BetaRequestCodeExecutionToolResultBlock,
8236 BetaRequestBashCodeExecutionToolResultBlock,
8237 BetaRequestTextEditorCodeExecutionToolResultBlock,
8238 BetaRequestToolSearchToolResultBlock,
8239 BetaRequestMCPToolUseBlock,
8240 BetaRequestMCPToolResultBlock,
8241 BetaRequestContainerUploadBlock,
8242 BetaRequestCompactionBlock
8243], { mode: "oneOf" })
8244export type MessageStartEvent = { readonly "message": Message; readonly "type": "message_start" }
8245export const MessageStartEvent = Schema.Struct({
8246 "message": Message,
8247 "type": Schema.Literal("message_start").annotate({ "title": "Type", "default": "message_start" })
8248}).annotate({ "title": "MessageStartEvent" })
8249export type SucceededResult = { readonly "message": Message; readonly "type": "succeeded" }
8250export const SucceededResult = Schema.Struct({
8251 "message": Message,
8252 "type": Schema.Literal("succeeded").annotate({ "title": "Type", "default": "succeeded" })
8253}).annotate({ "title": "SucceededResult" })
8254export type InputContentBlock =
8255 | {
8256 readonly "cache_control"?: CacheControlEphemeral | null
8257 readonly "citations"?:
8258 | ReadonlyArray<
8259 | RequestCharLocationCitation
8260 | RequestPageLocationCitation
8261 | RequestContentBlockLocationCitation
8262 | RequestWebSearchResultLocationCitation
8263 | RequestSearchResultLocationCitation
8264 >
8265 | null
8266 readonly "text": string
8267 readonly "type": "text"
8268 }
8269 | {
8270 readonly "cache_control"?: CacheControlEphemeral | null
8271 readonly "source": Base64ImageSource | URLImageSource
8272 readonly "type": "image"
8273 }
8274 | {
8275 readonly "cache_control"?: CacheControlEphemeral | null
8276 readonly "citations"?: RequestCitationsConfig | null
8277 readonly "context"?: string | null
8278 readonly "source": Base64PDFSource | PlainTextSource | ContentBlockSource | URLPDFSource
8279 readonly "title"?: string | null
8280 readonly "type": "document"
8281 }
8282 | {
8283 readonly "cache_control"?: CacheControlEphemeral | null
8284 readonly "citations"?: RequestCitationsConfig
8285 readonly "content": ReadonlyArray<RequestTextBlock>
8286 readonly "source": string
8287 readonly "title": string
8288 readonly "type": "search_result"
8289 }
8290 | { readonly "signature": string; readonly "thinking": string; readonly "type": "thinking" }
8291 | { readonly "data": string; readonly "type": "redacted_thinking" }
8292 | {
8293 readonly "cache_control"?: CacheControlEphemeral | null
8294 readonly "caller"?: DirectCaller | ServerToolCaller | ServerToolCaller_20260120
8295 readonly "id": string
8296 readonly "input": { readonly [x: string]: Schema.Json }
8297 readonly "name": string
8298 readonly "type": "tool_use"
8299 }
8300 | {
8301 readonly "cache_control"?: CacheControlEphemeral | null
8302 readonly "content"?:
8303 | string
8304 | ReadonlyArray<
8305 | RequestTextBlock
8306 | RequestImageBlock
8307 | RequestSearchResultBlock
8308 | RequestDocumentBlock
8309 | RequestToolReferenceBlock
8310 >
8311 readonly "is_error"?: boolean
8312 readonly "tool_use_id": string
8313 readonly "type": "tool_result"
8314 }
8315 | RequestServerToolUseBlock
8316 | RequestWebSearchToolResultBlock
8317 | RequestWebFetchToolResultBlock
8318 | RequestCodeExecutionToolResultBlock
8319 | RequestBashCodeExecutionToolResultBlock
8320 | RequestTextEditorCodeExecutionToolResultBlock
8321 | RequestToolSearchToolResultBlock
8322 | RequestContainerUploadBlock
8323export const InputContentBlock = Schema.Union([
8324 Schema.Struct({
8325 "cache_control": Schema.optionalKey(
8326 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8327 "title": "Cache Control",
8328 "description": "Create a cache control breakpoint at this content block."
8329 })
8330 ),
8331 "citations": Schema.optionalKey(
8332 Schema.Union([
8333 Schema.Array(
8334 Schema.Union([
8335 RequestCharLocationCitation,
8336 RequestPageLocationCitation,
8337 RequestContentBlockLocationCitation,
8338 RequestWebSearchResultLocationCitation,
8339 RequestSearchResultLocationCitation
8340 ], { mode: "oneOf" })
8341 ),
8342 Schema.Null
8343 ]).annotate({ "title": "Citations" })
8344 ),
8345 "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)),
8346 "type": Schema.Literal("text").annotate({ "title": "Type" })
8347 }).annotate({ "title": "RequestTextBlock", "description": "Regular text content." }),
8348 Schema.Struct({
8349 "cache_control": Schema.optionalKey(
8350 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8351 "title": "Cache Control",
8352 "description": "Create a cache control breakpoint at this content block."
8353 })
8354 ),
8355 "source": Schema.Union([Base64ImageSource, URLImageSource], { mode: "oneOf" }).annotate({ "title": "Source" }),
8356 "type": Schema.Literal("image").annotate({ "title": "Type" })
8357 }).annotate({
8358 "title": "RequestImageBlock",
8359 "description": "Image content specified directly as base64 data or as a reference via a URL."
8360 }),
8361 Schema.Struct({
8362 "cache_control": Schema.optionalKey(
8363 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8364 "title": "Cache Control",
8365 "description": "Create a cache control breakpoint at this content block."
8366 })
8367 ),
8368 "citations": Schema.optionalKey(Schema.Union([RequestCitationsConfig, Schema.Null])),
8369 "context": Schema.optionalKey(
8370 Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Null]).annotate({ "title": "Context" })
8371 ),
8372 "source": Schema.Union([Base64PDFSource, PlainTextSource, ContentBlockSource, URLPDFSource], { mode: "oneOf" })
8373 .annotate({ "title": "Source" }),
8374 "title": Schema.optionalKey(
8375 Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), Schema.Null]).annotate({
8376 "title": "Title"
8377 })
8378 ),
8379 "type": Schema.Literal("document").annotate({ "title": "Type" })
8380 }).annotate({
8381 "title": "RequestDocumentBlock",
8382 "description": "Document content, either specified directly as base64 data, as text, or as a reference via a URL."
8383 }),
8384 Schema.Struct({
8385 "cache_control": Schema.optionalKey(
8386 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8387 "title": "Cache Control",
8388 "description": "Create a cache control breakpoint at this content block."
8389 })
8390 ),
8391 "citations": Schema.optionalKey(RequestCitationsConfig),
8392 "content": Schema.Array(RequestTextBlock).annotate({ "title": "Content" }),
8393 "source": Schema.String.annotate({ "title": "Source" }),
8394 "title": Schema.String.annotate({ "title": "Title" }),
8395 "type": Schema.Literal("search_result").annotate({ "title": "Type" })
8396 }).annotate({
8397 "title": "RequestSearchResultBlock",
8398 "description": "A search result block containing source, title, and content from search operations."
8399 }),
8400 Schema.Struct({
8401 "signature": Schema.String.annotate({ "title": "Signature" }),
8402 "thinking": Schema.String.annotate({ "title": "Thinking" }),
8403 "type": Schema.Literal("thinking").annotate({ "title": "Type" })
8404 }).annotate({ "title": "RequestThinkingBlock", "description": "A block specifying internal thinking by the model." }),
8405 Schema.Struct({
8406 "data": Schema.String.annotate({ "title": "Data" }),
8407 "type": Schema.Literal("redacted_thinking").annotate({ "title": "Type" })
8408 }).annotate({
8409 "title": "RequestRedactedThinkingBlock",
8410 "description": "A block specifying internal, redacted thinking by the model."
8411 }),
8412 Schema.Struct({
8413 "cache_control": Schema.optionalKey(
8414 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8415 "title": "Cache Control",
8416 "description": "Create a cache control breakpoint at this content block."
8417 })
8418 ),
8419 "caller": Schema.optionalKey(
8420 Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({
8421 "title": "Caller"
8422 })
8423 ),
8424 "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))),
8425 "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }),
8426 "name": Schema.String.annotate({ "title": "Name" }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(200)),
8427 "type": Schema.Literal("tool_use").annotate({ "title": "Type" })
8428 }).annotate({ "title": "RequestToolUseBlock", "description": "A block indicating a tool use by the model." }),
8429 Schema.Struct({
8430 "cache_control": Schema.optionalKey(
8431 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8432 "title": "Cache Control",
8433 "description": "Create a cache control breakpoint at this content block."
8434 })
8435 ),
8436 "content": Schema.optionalKey(
8437 Schema.Union([
8438 Schema.String,
8439 Schema.Array(
8440 Schema.Union([
8441 RequestTextBlock,
8442 RequestImageBlock,
8443 RequestSearchResultBlock,
8444 RequestDocumentBlock,
8445 RequestToolReferenceBlock
8446 ], { mode: "oneOf" }).annotate({ "title": "Block" })
8447 )
8448 ]).annotate({ "title": "Content" })
8449 ),
8450 "is_error": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Is Error" })),
8451 "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check(
8452 Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))
8453 ),
8454 "type": Schema.Literal("tool_result").annotate({ "title": "Type" })
8455 }).annotate({
8456 "title": "RequestToolResultBlock",
8457 "description": "A block specifying the results of a tool use by the model."
8458 }),
8459 RequestServerToolUseBlock,
8460 RequestWebSearchToolResultBlock,
8461 RequestWebFetchToolResultBlock,
8462 RequestCodeExecutionToolResultBlock,
8463 RequestBashCodeExecutionToolResultBlock,
8464 RequestTextEditorCodeExecutionToolResultBlock,
8465 RequestToolSearchToolResultBlock,
8466 RequestContainerUploadBlock
8467], { mode: "oneOf" })
8468export type BetaInputMessage = {
8469 readonly "content": string | ReadonlyArray<BetaInputContentBlock>
8470 readonly "role": "user" | "assistant" | "system"
8471}
8472export const BetaInputMessage = Schema.Struct({
8473 "content": Schema.Union([Schema.String, Schema.Array(BetaInputContentBlock)]).annotate({ "title": "Content" }),
8474 "role": Schema.Literals(["user", "assistant", "system"]).annotate({ "title": "Role" })
8475}).annotate({ "title": "InputMessage", "identifier": "BetaInputMessage" })
8476export type InputMessage = {
8477 readonly "content": string | ReadonlyArray<InputContentBlock>
8478 readonly "role": "user" | "assistant" | "system"
8479}
8480export const InputMessage = Schema.Struct({
8481 "content": Schema.Union([Schema.String, Schema.Array(InputContentBlock)]).annotate({ "title": "Content" }),
8482 "role": Schema.Literals(["user", "assistant", "system"]).annotate({ "title": "Role" })
8483}).annotate({ "title": "InputMessage", "identifier": "InputMessage" })
8484export type BetaCountMessageTokensParams = {
8485 readonly "cache_control"?: BetaCacheControlEphemeral | null
8486 readonly "context_management"?: BetaContextManagementConfig | null
8487 readonly "mcp_servers"?: ReadonlyArray<BetaRequestMCPServerURLDefinition>
8488 readonly "messages": ReadonlyArray<BetaInputMessage>
8489 readonly "model": Model
8490 readonly "output_config"?: {
8491 readonly "effort"?: BetaEffortLevel | null
8492 readonly "format"?: BetaJsonOutputFormat | null
8493 }
8494 readonly "output_format"?: BetaJsonOutputFormat | null
8495 readonly "speed"?: BetaSpeed | null
8496 readonly "system"?: string | ReadonlyArray<BetaRequestTextBlock>
8497 readonly "thinking"?: BetaThinkingConfigParam
8498 readonly "tool_choice"?: BetaToolChoice
8499 readonly "tools"?: ReadonlyArray<
8500 | BetaTool
8501 | BetaBashTool_20241022
8502 | BetaBashTool_20250124
8503 | BetaCodeExecutionTool_20250522
8504 | BetaCodeExecutionTool_20250825
8505 | BetaCodeExecutionTool_20260120
8506 | BetaComputerUseTool_20241022
8507 | BetaMemoryTool_20250818
8508 | BetaComputerUseTool_20250124
8509 | BetaTextEditor_20241022
8510 | BetaComputerUseTool_20251124
8511 | BetaTextEditor_20250124
8512 | BetaTextEditor_20250429
8513 | BetaTextEditor_20250728
8514 | BetaWebSearchTool_20250305
8515 | BetaWebFetchTool_20250910
8516 | BetaWebSearchTool_20260209
8517 | BetaWebFetchTool_20260209
8518 | BetaToolSearchToolBM25_20251119
8519 | BetaToolSearchToolRegex_20251119
8520 | BetaMCPToolset
8521 >
8522}
8523export const BetaCountMessageTokensParams = Schema.Struct({
8524 "cache_control": Schema.optionalKey(
8525 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8526 "title": "Cache Control",
8527 "description":
8528 "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request."
8529 })
8530 ),
8531 "context_management": Schema.optionalKey(
8532 Schema.Union([BetaContextManagementConfig, Schema.Null]).annotate({
8533 "description":
8534 "Context management configuration.\n\nThis allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not."
8535 })
8536 ),
8537 "mcp_servers": Schema.optionalKey(
8538 Schema.Array(BetaRequestMCPServerURLDefinition).annotate({
8539 "title": "Mcp Servers",
8540 "description": "MCP servers to be utilized in this request"
8541 }).check(Schema.isMaxLength(20))
8542 ),
8543 "messages": Schema.Array(BetaInputMessage).annotate({
8544 "title": "Messages",
8545 "description":
8546 "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request."
8547 }),
8548 "model": Model,
8549 "output_config": Schema.optionalKey(
8550 Schema.Struct({
8551 "effort": Schema.optionalKey(
8552 Schema.Union([BetaEffortLevel, Schema.Null]).annotate({
8553 "description":
8554 "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, or `max`."
8555 })
8556 ),
8557 "format": Schema.optionalKey(
8558 Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({
8559 "description":
8560 "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)"
8561 })
8562 )
8563 }).annotate({
8564 "title": "OutputConfig",
8565 "description": "Configuration options for the model's output, such as the output format."
8566 })
8567 ),
8568 "output_format": Schema.optionalKey(
8569 Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({
8570 "description":
8571 "Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)\n\nA schema to specify Claude's output format in responses. This parameter will be removed in a future release."
8572 })
8573 ),
8574 "speed": Schema.optionalKey(
8575 Schema.Union([BetaSpeed, Schema.Null]).annotate({
8576 "description":
8577 "The inference speed mode for this request. `\"fast\"` enables high output-tokens-per-second inference."
8578 })
8579 ),
8580 "system": Schema.optionalKey(
8581 Schema.Union([Schema.String, Schema.Array(BetaRequestTextBlock)]).annotate({
8582 "title": "System",
8583 "description":
8584 "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)."
8585 })
8586 ),
8587 "thinking": Schema.optionalKey(BetaThinkingConfigParam),
8588 "tool_choice": Schema.optionalKey(BetaToolChoice),
8589 "tools": Schema.optionalKey(
8590 Schema.Array(
8591 Schema.Union([
8592 BetaTool,
8593 BetaBashTool_20241022,
8594 BetaBashTool_20250124,
8595 BetaCodeExecutionTool_20250522,
8596 BetaCodeExecutionTool_20250825,
8597 BetaCodeExecutionTool_20260120,
8598 BetaComputerUseTool_20241022,
8599 BetaMemoryTool_20250818,
8600 BetaComputerUseTool_20250124,
8601 BetaTextEditor_20241022,
8602 BetaComputerUseTool_20251124,
8603 BetaTextEditor_20250124,
8604 BetaTextEditor_20250429,
8605 BetaTextEditor_20250728,
8606 BetaWebSearchTool_20250305,
8607 BetaWebFetchTool_20250910,
8608 BetaWebSearchTool_20260209,
8609 BetaWebFetchTool_20260209,
8610 BetaToolSearchToolBM25_20251119,
8611 BetaToolSearchToolRegex_20251119,
8612 BetaMCPToolset
8613 ], { mode: "oneOf" })
8614 ).annotate({
8615 "title": "Tools",
8616 "description":
8617 "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details."
8618 })
8619 )
8620}).annotate({ "title": "CountMessageTokensParams" })
8621export type BetaCreateMessageParams = {
8622 readonly "model": Model
8623 readonly "messages": ReadonlyArray<BetaInputMessage>
8624 readonly "cache_control"?: BetaCacheControlEphemeral | null
8625 readonly "container"?: BetaContainerParams | string | null
8626 readonly "context_management"?: BetaContextManagementConfig | null
8627 readonly "inference_geo"?: string | null
8628 readonly "max_tokens": number
8629 readonly "mcp_servers"?: ReadonlyArray<BetaRequestMCPServerURLDefinition>
8630 readonly "metadata"?: { readonly "user_id"?: string | null }
8631 readonly "output_config"?: {
8632 readonly "effort"?: BetaEffortLevel | null
8633 readonly "format"?: BetaJsonOutputFormat | null
8634 }
8635 readonly "output_format"?: BetaJsonOutputFormat | null
8636 readonly "service_tier"?: "auto" | "standard_only"
8637 readonly "speed"?: BetaSpeed | null
8638 readonly "stop_sequences"?: ReadonlyArray<string>
8639 readonly "stream"?: boolean
8640 readonly "system"?: string | ReadonlyArray<BetaRequestTextBlock>
8641 readonly "temperature"?: number
8642 readonly "thinking"?: BetaThinkingConfigParam
8643 readonly "tool_choice"?: BetaToolChoice
8644 readonly "tools"?: ReadonlyArray<
8645 | BetaTool
8646 | BetaBashTool_20241022
8647 | BetaBashTool_20250124
8648 | BetaCodeExecutionTool_20250522
8649 | BetaCodeExecutionTool_20250825
8650 | BetaCodeExecutionTool_20260120
8651 | BetaComputerUseTool_20241022
8652 | BetaMemoryTool_20250818
8653 | BetaComputerUseTool_20250124
8654 | BetaTextEditor_20241022
8655 | BetaComputerUseTool_20251124
8656 | BetaTextEditor_20250124
8657 | BetaTextEditor_20250429
8658 | BetaTextEditor_20250728
8659 | BetaWebSearchTool_20250305
8660 | BetaWebFetchTool_20250910
8661 | BetaWebSearchTool_20260209
8662 | BetaWebFetchTool_20260209
8663 | BetaToolSearchToolBM25_20251119
8664 | BetaToolSearchToolRegex_20251119
8665 | BetaMCPToolset
8666 >
8667 readonly "top_k"?: number
8668 readonly "top_p"?: number
8669}
8670export const BetaCreateMessageParams = Schema.Struct({
8671 "model": Model,
8672 "messages": Schema.Array(BetaInputMessage).annotate({
8673 "title": "Messages",
8674 "description":
8675 "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request."
8676 }),
8677 "cache_control": Schema.optionalKey(
8678 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8679 "title": "Cache Control",
8680 "description":
8681 "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request."
8682 })
8683 ),
8684 "container": Schema.optionalKey(
8685 Schema.Union([BetaContainerParams, Schema.String, Schema.Null]).annotate({
8686 "title": "Container",
8687 "description": "Container identifier for reuse across requests."
8688 })
8689 ),
8690 "context_management": Schema.optionalKey(
8691 Schema.Union([BetaContextManagementConfig, Schema.Null]).annotate({
8692 "description":
8693 "Context management configuration.\n\nThis allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not."
8694 })
8695 ),
8696 "inference_geo": Schema.optionalKey(
8697 Schema.Union([Schema.String, Schema.Null]).annotate({
8698 "title": "Inference Geo",
8699 "description":
8700 "Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used."
8701 })
8702 ),
8703 "max_tokens": Schema.Number.annotate({
8704 "title": "Max Tokens",
8705 "description":
8706 "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details."
8707 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
8708 "mcp_servers": Schema.optionalKey(
8709 Schema.Array(BetaRequestMCPServerURLDefinition).annotate({
8710 "title": "Mcp Servers",
8711 "description": "MCP servers to be utilized in this request"
8712 }).check(Schema.isMaxLength(20))
8713 ),
8714 "metadata": Schema.optionalKey(
8715 Schema.Struct({
8716 "user_id": Schema.optionalKey(
8717 Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({
8718 "title": "User Id",
8719 "description":
8720 "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number."
8721 })
8722 )
8723 }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." })
8724 ),
8725 "output_config": Schema.optionalKey(
8726 Schema.Struct({
8727 "effort": Schema.optionalKey(
8728 Schema.Union([BetaEffortLevel, Schema.Null]).annotate({
8729 "description":
8730 "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, or `max`."
8731 })
8732 ),
8733 "format": Schema.optionalKey(
8734 Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({
8735 "description":
8736 "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)"
8737 })
8738 )
8739 }).annotate({
8740 "title": "OutputConfig",
8741 "description": "Configuration options for the model's output, such as the output format."
8742 })
8743 ),
8744 "output_format": Schema.optionalKey(
8745 Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({
8746 "description":
8747 "Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)\n\nA schema to specify Claude's output format in responses. This parameter will be removed in a future release."
8748 })
8749 ),
8750 "service_tier": Schema.optionalKey(
8751 Schema.Literals(["auto", "standard_only"]).annotate({
8752 "title": "Service Tier",
8753 "description":
8754 "Determines whether to use priority capacity (if available) or standard capacity for this request.\n\nAnthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details."
8755 })
8756 ),
8757 "speed": Schema.optionalKey(
8758 Schema.Union([BetaSpeed, Schema.Null]).annotate({
8759 "description":
8760 "The inference speed mode for this request. `\"fast\"` enables high output-tokens-per-second inference."
8761 })
8762 ),
8763 "stop_sequences": Schema.optionalKey(
8764 Schema.Array(Schema.String).annotate({
8765 "title": "Stop Sequences",
8766 "description":
8767 "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence."
8768 })
8769 ),
8770 "stream": Schema.optionalKey(
8771 Schema.Boolean.annotate({
8772 "title": "Stream",
8773 "description":
8774 "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/messages-streaming) for details."
8775 })
8776 ),
8777 "system": Schema.optionalKey(
8778 Schema.Union([Schema.String, Schema.Array(BetaRequestTextBlock)]).annotate({
8779 "title": "System",
8780 "description":
8781 "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)."
8782 })
8783 ),
8784 "temperature": Schema.optionalKey(
8785 Schema.Number.annotate({
8786 "title": "Temperature",
8787 "description":
8788 "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic."
8789 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1))
8790 ),
8791 "thinking": Schema.optionalKey(BetaThinkingConfigParam),
8792 "tool_choice": Schema.optionalKey(BetaToolChoice),
8793 "tools": Schema.optionalKey(
8794 Schema.Array(
8795 Schema.Union([
8796 BetaTool,
8797 BetaBashTool_20241022,
8798 BetaBashTool_20250124,
8799 BetaCodeExecutionTool_20250522,
8800 BetaCodeExecutionTool_20250825,
8801 BetaCodeExecutionTool_20260120,
8802 BetaComputerUseTool_20241022,
8803 BetaMemoryTool_20250818,
8804 BetaComputerUseTool_20250124,
8805 BetaTextEditor_20241022,
8806 BetaComputerUseTool_20251124,
8807 BetaTextEditor_20250124,
8808 BetaTextEditor_20250429,
8809 BetaTextEditor_20250728,
8810 BetaWebSearchTool_20250305,
8811 BetaWebFetchTool_20250910,
8812 BetaWebSearchTool_20260209,
8813 BetaWebFetchTool_20260209,
8814 BetaToolSearchToolBM25_20251119,
8815 BetaToolSearchToolRegex_20251119,
8816 BetaMCPToolset
8817 ], { mode: "oneOf" })
8818 ).annotate({
8819 "title": "Tools",
8820 "description":
8821 "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details."
8822 })
8823 ),
8824 "top_k": Schema.optionalKey(
8825 Schema.Number.annotate({
8826 "title": "Top K",
8827 "description":
8828 "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`."
8829 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
8830 ),
8831 "top_p": Schema.optionalKey(
8832 Schema.Number.annotate({
8833 "title": "Top P",
8834 "description":
8835 "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`."
8836 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1))
8837 )
8838}).annotate({ "title": "CreateMessageParams" })
8839export type BetaMessageBatchIndividualRequestParams = {
8840 readonly "custom_id": string
8841 readonly "params": {
8842 readonly "model": Model
8843 readonly "messages": ReadonlyArray<BetaInputMessage>
8844 readonly "cache_control"?: BetaCacheControlEphemeral | null
8845 readonly "container"?: BetaContainerParams | string | null
8846 readonly "context_management"?: BetaContextManagementConfig | null
8847 readonly "inference_geo"?: string | null
8848 readonly "max_tokens": number
8849 readonly "mcp_servers"?: ReadonlyArray<BetaRequestMCPServerURLDefinition>
8850 readonly "metadata"?: { readonly "user_id"?: string | null }
8851 readonly "output_config"?: {
8852 readonly "effort"?: BetaEffortLevel | null
8853 readonly "format"?: BetaJsonOutputFormat | null
8854 }
8855 readonly "output_format"?: BetaJsonOutputFormat | null
8856 readonly "service_tier"?: "auto" | "standard_only"
8857 readonly "speed"?: BetaSpeed | null
8858 readonly "stop_sequences"?: ReadonlyArray<string>
8859 readonly "stream"?: boolean
8860 readonly "system"?: string | ReadonlyArray<BetaRequestTextBlock>
8861 readonly "temperature"?: number
8862 readonly "thinking"?: BetaThinkingConfigParam
8863 readonly "tool_choice"?: BetaToolChoice
8864 readonly "tools"?: ReadonlyArray<
8865 | BetaTool
8866 | BetaBashTool_20241022
8867 | BetaBashTool_20250124
8868 | BetaCodeExecutionTool_20250522
8869 | BetaCodeExecutionTool_20250825
8870 | BetaCodeExecutionTool_20260120
8871 | BetaComputerUseTool_20241022
8872 | BetaMemoryTool_20250818
8873 | BetaComputerUseTool_20250124
8874 | BetaTextEditor_20241022
8875 | BetaComputerUseTool_20251124
8876 | BetaTextEditor_20250124
8877 | BetaTextEditor_20250429
8878 | BetaTextEditor_20250728
8879 | BetaWebSearchTool_20250305
8880 | BetaWebFetchTool_20250910
8881 | BetaWebSearchTool_20260209
8882 | BetaWebFetchTool_20260209
8883 | BetaToolSearchToolBM25_20251119
8884 | BetaToolSearchToolRegex_20251119
8885 | BetaMCPToolset
8886 >
8887 readonly "top_k"?: number
8888 readonly "top_p"?: number
8889 }
8890}
8891export const BetaMessageBatchIndividualRequestParams = Schema.Struct({
8892 "custom_id": Schema.String.annotate({
8893 "title": "Custom Id",
8894 "description":
8895 "Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.\n\nMust be unique for each request within the Message Batch."
8896 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)).check(
8897 Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,64}$"))
8898 ),
8899 "params": Schema.Struct({
8900 "model": Model,
8901 "messages": Schema.Array(BetaInputMessage).annotate({
8902 "title": "Messages",
8903 "description":
8904 "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request."
8905 }),
8906 "cache_control": Schema.optionalKey(
8907 Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
8908 "title": "Cache Control",
8909 "description":
8910 "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request."
8911 })
8912 ),
8913 "container": Schema.optionalKey(
8914 Schema.Union([BetaContainerParams, Schema.String, Schema.Null]).annotate({
8915 "title": "Container",
8916 "description": "Container identifier for reuse across requests."
8917 })
8918 ),
8919 "context_management": Schema.optionalKey(
8920 Schema.Union([BetaContextManagementConfig, Schema.Null]).annotate({
8921 "description":
8922 "Context management configuration.\n\nThis allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not."
8923 })
8924 ),
8925 "inference_geo": Schema.optionalKey(
8926 Schema.Union([Schema.String, Schema.Null]).annotate({
8927 "title": "Inference Geo",
8928 "description":
8929 "Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used."
8930 })
8931 ),
8932 "max_tokens": Schema.Number.annotate({
8933 "title": "Max Tokens",
8934 "description":
8935 "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details."
8936 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
8937 "mcp_servers": Schema.optionalKey(
8938 Schema.Array(BetaRequestMCPServerURLDefinition).annotate({
8939 "title": "Mcp Servers",
8940 "description": "MCP servers to be utilized in this request"
8941 }).check(Schema.isMaxLength(20))
8942 ),
8943 "metadata": Schema.optionalKey(
8944 Schema.Struct({
8945 "user_id": Schema.optionalKey(
8946 Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({
8947 "title": "User Id",
8948 "description":
8949 "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number."
8950 })
8951 )
8952 }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." })
8953 ),
8954 "output_config": Schema.optionalKey(
8955 Schema.Struct({
8956 "effort": Schema.optionalKey(
8957 Schema.Union([BetaEffortLevel, Schema.Null]).annotate({
8958 "description":
8959 "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, or `max`."
8960 })
8961 ),
8962 "format": Schema.optionalKey(
8963 Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({
8964 "description":
8965 "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)"
8966 })
8967 )
8968 }).annotate({
8969 "title": "OutputConfig",
8970 "description": "Configuration options for the model's output, such as the output format."
8971 })
8972 ),
8973 "output_format": Schema.optionalKey(
8974 Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({
8975 "description":
8976 "Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)\n\nA schema to specify Claude's output format in responses. This parameter will be removed in a future release."
8977 })
8978 ),
8979 "service_tier": Schema.optionalKey(
8980 Schema.Literals(["auto", "standard_only"]).annotate({
8981 "title": "Service Tier",
8982 "description":
8983 "Determines whether to use priority capacity (if available) or standard capacity for this request.\n\nAnthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details."
8984 })
8985 ),
8986 "speed": Schema.optionalKey(
8987 Schema.Union([BetaSpeed, Schema.Null]).annotate({
8988 "description":
8989 "The inference speed mode for this request. `\"fast\"` enables high output-tokens-per-second inference."
8990 })
8991 ),
8992 "stop_sequences": Schema.optionalKey(
8993 Schema.Array(Schema.String).annotate({
8994 "title": "Stop Sequences",
8995 "description":
8996 "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence."
8997 })
8998 ),
8999 "stream": Schema.optionalKey(
9000 Schema.Boolean.annotate({
9001 "title": "Stream",
9002 "description":
9003 "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/messages-streaming) for details."
9004 })
9005 ),
9006 "system": Schema.optionalKey(
9007 Schema.Union([Schema.String, Schema.Array(BetaRequestTextBlock)]).annotate({
9008 "title": "System",
9009 "description":
9010 "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)."
9011 })
9012 ),
9013 "temperature": Schema.optionalKey(
9014 Schema.Number.annotate({
9015 "title": "Temperature",
9016 "description":
9017 "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic."
9018 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1))
9019 ),
9020 "thinking": Schema.optionalKey(BetaThinkingConfigParam),
9021 "tool_choice": Schema.optionalKey(BetaToolChoice),
9022 "tools": Schema.optionalKey(
9023 Schema.Array(
9024 Schema.Union([
9025 BetaTool,
9026 BetaBashTool_20241022,
9027 BetaBashTool_20250124,
9028 BetaCodeExecutionTool_20250522,
9029 BetaCodeExecutionTool_20250825,
9030 BetaCodeExecutionTool_20260120,
9031 BetaComputerUseTool_20241022,
9032 BetaMemoryTool_20250818,
9033 BetaComputerUseTool_20250124,
9034 BetaTextEditor_20241022,
9035 BetaComputerUseTool_20251124,
9036 BetaTextEditor_20250124,
9037 BetaTextEditor_20250429,
9038 BetaTextEditor_20250728,
9039 BetaWebSearchTool_20250305,
9040 BetaWebFetchTool_20250910,
9041 BetaWebSearchTool_20260209,
9042 BetaWebFetchTool_20260209,
9043 BetaToolSearchToolBM25_20251119,
9044 BetaToolSearchToolRegex_20251119,
9045 BetaMCPToolset
9046 ], { mode: "oneOf" })
9047 ).annotate({
9048 "title": "Tools",
9049 "description":
9050 "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details."
9051 })
9052 ),
9053 "top_k": Schema.optionalKey(
9054 Schema.Number.annotate({
9055 "title": "Top K",
9056 "description":
9057 "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`."
9058 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
9059 ),
9060 "top_p": Schema.optionalKey(
9061 Schema.Number.annotate({
9062 "title": "Top P",
9063 "description":
9064 "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`."
9065 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1))
9066 )
9067 }).annotate({
9068 "title": "CreateMessageParams",
9069 "description":
9070 "Messages API creation parameters for the individual request.\n\nSee the [Messages API reference](https://docs.claude.com/en/api/messages) for full documentation on available parameters."
9071 })
9072}).annotate({ "title": "MessageBatchIndividualRequestParams" })
9073export type CountMessageTokensParams = {
9074 readonly "cache_control"?: CacheControlEphemeral | null
9075 readonly "messages": ReadonlyArray<InputMessage>
9076 readonly "model": Model
9077 readonly "output_config"?: { readonly "effort"?: EffortLevel | null; readonly "format"?: JsonOutputFormat | null }
9078 readonly "system"?: string | ReadonlyArray<RequestTextBlock>
9079 readonly "thinking"?: ThinkingConfigParam
9080 readonly "tool_choice"?: ToolChoice
9081 readonly "tools"?: ReadonlyArray<
9082 | Tool
9083 | BashTool_20250124
9084 | CodeExecutionTool_20250522
9085 | CodeExecutionTool_20250825
9086 | CodeExecutionTool_20260120
9087 | MemoryTool_20250818
9088 | TextEditor_20250124
9089 | TextEditor_20250429
9090 | TextEditor_20250728
9091 | WebSearchTool_20250305
9092 | WebFetchTool_20250910
9093 | WebSearchTool_20260209
9094 | WebFetchTool_20260209
9095 | ToolSearchToolBM25_20251119
9096 | ToolSearchToolRegex_20251119
9097 >
9098}
9099export const CountMessageTokensParams = Schema.Struct({
9100 "cache_control": Schema.optionalKey(
9101 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
9102 "title": "Cache Control",
9103 "description":
9104 "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request."
9105 })
9106 ),
9107 "messages": Schema.Array(InputMessage).annotate({
9108 "title": "Messages",
9109 "description":
9110 "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request."
9111 }),
9112 "model": Model,
9113 "output_config": Schema.optionalKey(
9114 Schema.Struct({
9115 "effort": Schema.optionalKey(
9116 Schema.Union([EffortLevel, Schema.Null]).annotate({
9117 "description":
9118 "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, or `max`."
9119 })
9120 ),
9121 "format": Schema.optionalKey(
9122 Schema.Union([JsonOutputFormat, Schema.Null]).annotate({
9123 "description":
9124 "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)"
9125 })
9126 )
9127 }).annotate({
9128 "title": "OutputConfig",
9129 "description": "Configuration options for the model's output, such as the output format."
9130 })
9131 ),
9132 "system": Schema.optionalKey(
9133 Schema.Union([Schema.String, Schema.Array(RequestTextBlock)]).annotate({
9134 "title": "System",
9135 "description":
9136 "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)."
9137 })
9138 ),
9139 "thinking": Schema.optionalKey(ThinkingConfigParam),
9140 "tool_choice": Schema.optionalKey(ToolChoice),
9141 "tools": Schema.optionalKey(
9142 Schema.Array(
9143 Schema.Union([
9144 Tool,
9145 BashTool_20250124,
9146 CodeExecutionTool_20250522,
9147 CodeExecutionTool_20250825,
9148 CodeExecutionTool_20260120,
9149 MemoryTool_20250818,
9150 TextEditor_20250124,
9151 TextEditor_20250429,
9152 TextEditor_20250728,
9153 WebSearchTool_20250305,
9154 WebFetchTool_20250910,
9155 WebSearchTool_20260209,
9156 WebFetchTool_20260209,
9157 ToolSearchToolBM25_20251119,
9158 ToolSearchToolRegex_20251119
9159 ], { mode: "oneOf" })
9160 ).annotate({
9161 "title": "Tools",
9162 "description":
9163 "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details."
9164 })
9165 )
9166}).annotate({ "title": "CountMessageTokensParams" })
9167export type CreateMessageParams = {
9168 readonly "model": Model
9169 readonly "messages": ReadonlyArray<InputMessage>
9170 readonly "cache_control"?: CacheControlEphemeral | null
9171 readonly "container"?: string | null
9172 readonly "inference_geo"?: string | null
9173 readonly "max_tokens": number
9174 readonly "metadata"?: { readonly "user_id"?: string | null }
9175 readonly "output_config"?: { readonly "effort"?: EffortLevel | null; readonly "format"?: JsonOutputFormat | null }
9176 readonly "service_tier"?: "auto" | "standard_only"
9177 readonly "stop_sequences"?: ReadonlyArray<string>
9178 readonly "stream"?: boolean
9179 readonly "system"?: string | ReadonlyArray<RequestTextBlock>
9180 readonly "temperature"?: number
9181 readonly "thinking"?: ThinkingConfigParam
9182 readonly "tool_choice"?: ToolChoice
9183 readonly "tools"?: ReadonlyArray<
9184 | Tool
9185 | BashTool_20250124
9186 | CodeExecutionTool_20250522
9187 | CodeExecutionTool_20250825
9188 | CodeExecutionTool_20260120
9189 | MemoryTool_20250818
9190 | TextEditor_20250124
9191 | TextEditor_20250429
9192 | TextEditor_20250728
9193 | WebSearchTool_20250305
9194 | WebFetchTool_20250910
9195 | WebSearchTool_20260209
9196 | WebFetchTool_20260209
9197 | ToolSearchToolBM25_20251119
9198 | ToolSearchToolRegex_20251119
9199 >
9200 readonly "top_k"?: number
9201 readonly "top_p"?: number
9202}
9203export const CreateMessageParams = Schema.Struct({
9204 "model": Model,
9205 "messages": Schema.Array(InputMessage).annotate({
9206 "title": "Messages",
9207 "description":
9208 "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request."
9209 }),
9210 "cache_control": Schema.optionalKey(
9211 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
9212 "title": "Cache Control",
9213 "description":
9214 "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request."
9215 })
9216 ),
9217 "container": Schema.optionalKey(
9218 Schema.Union([Schema.String, Schema.Null]).annotate({
9219 "title": "Container",
9220 "description": "Container identifier for reuse across requests."
9221 })
9222 ),
9223 "inference_geo": Schema.optionalKey(
9224 Schema.Union([Schema.String, Schema.Null]).annotate({
9225 "title": "Inference Geo",
9226 "description":
9227 "Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used."
9228 })
9229 ),
9230 "max_tokens": Schema.Number.annotate({
9231 "title": "Max Tokens",
9232 "description":
9233 "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details."
9234 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
9235 "metadata": Schema.optionalKey(
9236 Schema.Struct({
9237 "user_id": Schema.optionalKey(
9238 Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({
9239 "title": "User Id",
9240 "description":
9241 "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number."
9242 })
9243 )
9244 }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." })
9245 ),
9246 "output_config": Schema.optionalKey(
9247 Schema.Struct({
9248 "effort": Schema.optionalKey(
9249 Schema.Union([EffortLevel, Schema.Null]).annotate({
9250 "description":
9251 "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, or `max`."
9252 })
9253 ),
9254 "format": Schema.optionalKey(
9255 Schema.Union([JsonOutputFormat, Schema.Null]).annotate({
9256 "description":
9257 "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)"
9258 })
9259 )
9260 }).annotate({
9261 "title": "OutputConfig",
9262 "description": "Configuration options for the model's output, such as the output format."
9263 })
9264 ),
9265 "service_tier": Schema.optionalKey(
9266 Schema.Literals(["auto", "standard_only"]).annotate({
9267 "title": "Service Tier",
9268 "description":
9269 "Determines whether to use priority capacity (if available) or standard capacity for this request.\n\nAnthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details."
9270 })
9271 ),
9272 "stop_sequences": Schema.optionalKey(
9273 Schema.Array(Schema.String).annotate({
9274 "title": "Stop Sequences",
9275 "description":
9276 "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence."
9277 })
9278 ),
9279 "stream": Schema.optionalKey(
9280 Schema.Boolean.annotate({
9281 "title": "Stream",
9282 "description":
9283 "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/messages-streaming) for details."
9284 })
9285 ),
9286 "system": Schema.optionalKey(
9287 Schema.Union([Schema.String, Schema.Array(RequestTextBlock)]).annotate({
9288 "title": "System",
9289 "description":
9290 "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)."
9291 })
9292 ),
9293 "temperature": Schema.optionalKey(
9294 Schema.Number.annotate({
9295 "title": "Temperature",
9296 "description":
9297 "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic."
9298 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1))
9299 ),
9300 "thinking": Schema.optionalKey(ThinkingConfigParam),
9301 "tool_choice": Schema.optionalKey(ToolChoice),
9302 "tools": Schema.optionalKey(
9303 Schema.Array(
9304 Schema.Union([
9305 Tool,
9306 BashTool_20250124,
9307 CodeExecutionTool_20250522,
9308 CodeExecutionTool_20250825,
9309 CodeExecutionTool_20260120,
9310 MemoryTool_20250818,
9311 TextEditor_20250124,
9312 TextEditor_20250429,
9313 TextEditor_20250728,
9314 WebSearchTool_20250305,
9315 WebFetchTool_20250910,
9316 WebSearchTool_20260209,
9317 WebFetchTool_20260209,
9318 ToolSearchToolBM25_20251119,
9319 ToolSearchToolRegex_20251119
9320 ], { mode: "oneOf" })
9321 ).annotate({
9322 "title": "Tools",
9323 "description":
9324 "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details."
9325 })
9326 ),
9327 "top_k": Schema.optionalKey(
9328 Schema.Number.annotate({
9329 "title": "Top K",
9330 "description":
9331 "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`."
9332 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
9333 ),
9334 "top_p": Schema.optionalKey(
9335 Schema.Number.annotate({
9336 "title": "Top P",
9337 "description":
9338 "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`."
9339 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1))
9340 )
9341}).annotate({ "title": "CreateMessageParams" })
9342export type MessageBatchIndividualRequestParams = {
9343 readonly "custom_id": string
9344 readonly "params": {
9345 readonly "model": Model
9346 readonly "messages": ReadonlyArray<InputMessage>
9347 readonly "cache_control"?: CacheControlEphemeral | null
9348 readonly "container"?: string | null
9349 readonly "inference_geo"?: string | null
9350 readonly "max_tokens": number
9351 readonly "metadata"?: { readonly "user_id"?: string | null }
9352 readonly "output_config"?: { readonly "effort"?: EffortLevel | null; readonly "format"?: JsonOutputFormat | null }
9353 readonly "service_tier"?: "auto" | "standard_only"
9354 readonly "stop_sequences"?: ReadonlyArray<string>
9355 readonly "stream"?: boolean
9356 readonly "system"?: string | ReadonlyArray<RequestTextBlock>
9357 readonly "temperature"?: number
9358 readonly "thinking"?: ThinkingConfigParam
9359 readonly "tool_choice"?: ToolChoice
9360 readonly "tools"?: ReadonlyArray<
9361 | Tool
9362 | BashTool_20250124
9363 | CodeExecutionTool_20250522
9364 | CodeExecutionTool_20250825
9365 | CodeExecutionTool_20260120
9366 | MemoryTool_20250818
9367 | TextEditor_20250124
9368 | TextEditor_20250429
9369 | TextEditor_20250728
9370 | WebSearchTool_20250305
9371 | WebFetchTool_20250910
9372 | WebSearchTool_20260209
9373 | WebFetchTool_20260209
9374 | ToolSearchToolBM25_20251119
9375 | ToolSearchToolRegex_20251119
9376 >
9377 readonly "top_k"?: number
9378 readonly "top_p"?: number
9379 }
9380}
9381export const MessageBatchIndividualRequestParams = Schema.Struct({
9382 "custom_id": Schema.String.annotate({
9383 "title": "Custom Id",
9384 "description":
9385 "Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.\n\nMust be unique for each request within the Message Batch."
9386 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)).check(
9387 Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,64}$"))
9388 ),
9389 "params": Schema.Struct({
9390 "model": Model,
9391 "messages": Schema.Array(InputMessage).annotate({
9392 "title": "Messages",
9393 "description":
9394 "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request."
9395 }),
9396 "cache_control": Schema.optionalKey(
9397 Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({
9398 "title": "Cache Control",
9399 "description":
9400 "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request."
9401 })
9402 ),
9403 "container": Schema.optionalKey(
9404 Schema.Union([Schema.String, Schema.Null]).annotate({
9405 "title": "Container",
9406 "description": "Container identifier for reuse across requests."
9407 })
9408 ),
9409 "inference_geo": Schema.optionalKey(
9410 Schema.Union([Schema.String, Schema.Null]).annotate({
9411 "title": "Inference Geo",
9412 "description":
9413 "Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used."
9414 })
9415 ),
9416 "max_tokens": Schema.Number.annotate({
9417 "title": "Max Tokens",
9418 "description":
9419 "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details."
9420 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
9421 "metadata": Schema.optionalKey(
9422 Schema.Struct({
9423 "user_id": Schema.optionalKey(
9424 Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({
9425 "title": "User Id",
9426 "description":
9427 "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number."
9428 })
9429 )
9430 }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." })
9431 ),
9432 "output_config": Schema.optionalKey(
9433 Schema.Struct({
9434 "effort": Schema.optionalKey(
9435 Schema.Union([EffortLevel, Schema.Null]).annotate({
9436 "description":
9437 "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, or `max`."
9438 })
9439 ),
9440 "format": Schema.optionalKey(
9441 Schema.Union([JsonOutputFormat, Schema.Null]).annotate({
9442 "description":
9443 "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)"
9444 })
9445 )
9446 }).annotate({
9447 "title": "OutputConfig",
9448 "description": "Configuration options for the model's output, such as the output format."
9449 })
9450 ),
9451 "service_tier": Schema.optionalKey(
9452 Schema.Literals(["auto", "standard_only"]).annotate({
9453 "title": "Service Tier",
9454 "description":
9455 "Determines whether to use priority capacity (if available) or standard capacity for this request.\n\nAnthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details."
9456 })
9457 ),
9458 "stop_sequences": Schema.optionalKey(
9459 Schema.Array(Schema.String).annotate({
9460 "title": "Stop Sequences",
9461 "description":
9462 "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence."
9463 })
9464 ),
9465 "stream": Schema.optionalKey(
9466 Schema.Boolean.annotate({
9467 "title": "Stream",
9468 "description":
9469 "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/messages-streaming) for details."
9470 })
9471 ),
9472 "system": Schema.optionalKey(
9473 Schema.Union([Schema.String, Schema.Array(RequestTextBlock)]).annotate({
9474 "title": "System",
9475 "description":
9476 "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)."
9477 })
9478 ),
9479 "temperature": Schema.optionalKey(
9480 Schema.Number.annotate({
9481 "title": "Temperature",
9482 "description":
9483 "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic."
9484 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1))
9485 ),
9486 "thinking": Schema.optionalKey(ThinkingConfigParam),
9487 "tool_choice": Schema.optionalKey(ToolChoice),
9488 "tools": Schema.optionalKey(
9489 Schema.Array(
9490 Schema.Union([
9491 Tool,
9492 BashTool_20250124,
9493 CodeExecutionTool_20250522,
9494 CodeExecutionTool_20250825,
9495 CodeExecutionTool_20260120,
9496 MemoryTool_20250818,
9497 TextEditor_20250124,
9498 TextEditor_20250429,
9499 TextEditor_20250728,
9500 WebSearchTool_20250305,
9501 WebFetchTool_20250910,
9502 WebSearchTool_20260209,
9503 WebFetchTool_20260209,
9504 ToolSearchToolBM25_20251119,
9505 ToolSearchToolRegex_20251119
9506 ], { mode: "oneOf" })
9507 ).annotate({
9508 "title": "Tools",
9509 "description":
9510 "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details."
9511 })
9512 ),
9513 "top_k": Schema.optionalKey(
9514 Schema.Number.annotate({
9515 "title": "Top K",
9516 "description":
9517 "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`."
9518 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
9519 ),
9520 "top_p": Schema.optionalKey(
9521 Schema.Number.annotate({
9522 "title": "Top P",
9523 "description":
9524 "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`."
9525 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1))
9526 )
9527 }).annotate({
9528 "title": "CreateMessageParams",
9529 "description":
9530 "Messages API creation parameters for the individual request.\n\nSee the [Messages API reference](https://docs.claude.com/en/api/messages) for full documentation on available parameters."
9531 })
9532}).annotate({ "title": "MessageBatchIndividualRequestParams" })
9533export type BetaCreateMessageBatchParams = {
9534 readonly "requests": ReadonlyArray<BetaMessageBatchIndividualRequestParams>
9535}
9536export const BetaCreateMessageBatchParams = Schema.Struct({
9537 "requests": Schema.Array(BetaMessageBatchIndividualRequestParams).annotate({
9538 "title": "Requests",
9539 "description": "List of requests for prompt completion. Each is an individual request to create a Message."
9540 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(100000))
9541}).annotate({ "title": "CreateMessageBatchParams" })
9542export type CreateMessageBatchParams = { readonly "requests": ReadonlyArray<MessageBatchIndividualRequestParams> }
9543export const CreateMessageBatchParams = Schema.Struct({
9544 "requests": Schema.Array(MessageBatchIndividualRequestParams).annotate({
9545 "title": "Requests",
9546 "description": "List of requests for prompt completion. Each is an individual request to create a Message."
9547 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(100000))
9548}).annotate({ "title": "CreateMessageBatchParams" })
9549// schemas
9550export type MessagesPostParams = { readonly "anthropic-version"?: string }
9551export const MessagesPostParams = Schema.Struct({
9552 "anthropic-version": Schema.optionalKey(
9553 Schema.String.annotate({
9554 "title": "Anthropic-Version",
9555 "description":
9556 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9557 })
9558 )
9559})
9560export type MessagesPostRequestJson = CreateMessageParams
9561export const MessagesPostRequestJson = CreateMessageParams
9562export type MessagesPost200 = Message
9563export const MessagesPost200 = Message
9564export type MessagesPost4XX = ErrorResponse
9565export const MessagesPost4XX = ErrorResponse
9566export type CompletePostParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string }
9567export const CompletePostParams = Schema.Struct({
9568 "anthropic-version": Schema.optionalKey(
9569 Schema.String.annotate({
9570 "title": "Anthropic-Version",
9571 "description":
9572 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9573 })
9574 ),
9575 "anthropic-beta": Schema.optionalKey(
9576 Schema.String.annotate({
9577 "title": "Anthropic-Beta",
9578 "description":
9579 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
9580 })
9581 )
9582})
9583export type CompletePostRequestJson = CompletionRequest
9584export const CompletePostRequestJson = CompletionRequest
9585export type CompletePost200 = CompletionResponse
9586export const CompletePost200 = CompletionResponse
9587export type CompletePost4XX = ErrorResponse
9588export const CompletePost4XX = ErrorResponse
9589export type ModelsListParams = {
9590 readonly "before_id"?: string
9591 readonly "after_id"?: string
9592 readonly "limit"?: number
9593 readonly "anthropic-version"?: string
9594 readonly "x-api-key"?: string
9595 readonly "anthropic-beta"?: string
9596}
9597export const ModelsListParams = Schema.Struct({
9598 "before_id": Schema.optionalKey(
9599 Schema.String.annotate({
9600 "title": "Before Id",
9601 "description":
9602 "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object."
9603 })
9604 ),
9605 "after_id": Schema.optionalKey(
9606 Schema.String.annotate({
9607 "title": "After Id",
9608 "description":
9609 "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object."
9610 })
9611 ),
9612 "limit": Schema.optionalKey(
9613 Schema.Number.annotate({
9614 "title": "Limit",
9615 "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.",
9616 "default": 20
9617 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000))
9618 ),
9619 "anthropic-version": Schema.optionalKey(
9620 Schema.String.annotate({
9621 "title": "Anthropic-Version",
9622 "description":
9623 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9624 })
9625 ),
9626 "x-api-key": Schema.optionalKey(Schema.String.annotate({
9627 "title": "X-Api-Key",
9628 "description":
9629 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
9630 })),
9631 "anthropic-beta": Schema.optionalKey(
9632 Schema.String.annotate({
9633 "title": "Anthropic-Beta",
9634 "description":
9635 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
9636 })
9637 )
9638})
9639export type ModelsList200 = ListResponse_ModelInfo_
9640export const ModelsList200 = ListResponse_ModelInfo_
9641export type ModelsList4XX = ErrorResponse
9642export const ModelsList4XX = ErrorResponse
9643export type ModelsGetParams = {
9644 readonly "anthropic-version"?: string
9645 readonly "x-api-key"?: string
9646 readonly "anthropic-beta"?: string
9647}
9648export const ModelsGetParams = Schema.Struct({
9649 "anthropic-version": Schema.optionalKey(
9650 Schema.String.annotate({
9651 "title": "Anthropic-Version",
9652 "description":
9653 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9654 })
9655 ),
9656 "x-api-key": Schema.optionalKey(Schema.String.annotate({
9657 "title": "X-Api-Key",
9658 "description":
9659 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
9660 })),
9661 "anthropic-beta": Schema.optionalKey(
9662 Schema.String.annotate({
9663 "title": "Anthropic-Beta",
9664 "description":
9665 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
9666 })
9667 )
9668})
9669export type ModelsGet200 = ModelInfo
9670export const ModelsGet200 = ModelInfo
9671export type ModelsGet4XX = ErrorResponse
9672export const ModelsGet4XX = ErrorResponse
9673export type MessageBatchesListParams = {
9674 readonly "before_id"?: string
9675 readonly "after_id"?: string
9676 readonly "limit"?: number
9677 readonly "anthropic-version"?: string
9678 readonly "x-api-key"?: string
9679}
9680export const MessageBatchesListParams = Schema.Struct({
9681 "before_id": Schema.optionalKey(
9682 Schema.String.annotate({
9683 "title": "Before Id",
9684 "description":
9685 "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object."
9686 })
9687 ),
9688 "after_id": Schema.optionalKey(
9689 Schema.String.annotate({
9690 "title": "After Id",
9691 "description":
9692 "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object."
9693 })
9694 ),
9695 "limit": Schema.optionalKey(
9696 Schema.Number.annotate({
9697 "title": "Limit",
9698 "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.",
9699 "default": 20
9700 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000))
9701 ),
9702 "anthropic-version": Schema.optionalKey(
9703 Schema.String.annotate({
9704 "title": "Anthropic-Version",
9705 "description":
9706 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9707 })
9708 ),
9709 "x-api-key": Schema.optionalKey(Schema.String.annotate({
9710 "title": "X-Api-Key",
9711 "description":
9712 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
9713 }))
9714})
9715export type MessageBatchesList200 = ListResponse_MessageBatch_
9716export const MessageBatchesList200 = ListResponse_MessageBatch_
9717export type MessageBatchesList4XX = ErrorResponse
9718export const MessageBatchesList4XX = ErrorResponse
9719export type MessageBatchesPostParams = { readonly "anthropic-version"?: string }
9720export const MessageBatchesPostParams = Schema.Struct({
9721 "anthropic-version": Schema.optionalKey(
9722 Schema.String.annotate({
9723 "title": "Anthropic-Version",
9724 "description":
9725 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9726 })
9727 )
9728})
9729export type MessageBatchesPostRequestJson = CreateMessageBatchParams
9730export const MessageBatchesPostRequestJson = CreateMessageBatchParams
9731export type MessageBatchesPost200 = MessageBatch
9732export const MessageBatchesPost200 = MessageBatch
9733export type MessageBatchesPost4XX = ErrorResponse
9734export const MessageBatchesPost4XX = ErrorResponse
9735export type MessageBatchesRetrieveParams = { readonly "anthropic-version"?: string; readonly "x-api-key"?: string }
9736export const MessageBatchesRetrieveParams = Schema.Struct({
9737 "anthropic-version": Schema.optionalKey(
9738 Schema.String.annotate({
9739 "title": "Anthropic-Version",
9740 "description":
9741 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9742 })
9743 ),
9744 "x-api-key": Schema.optionalKey(Schema.String.annotate({
9745 "title": "X-Api-Key",
9746 "description":
9747 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
9748 }))
9749})
9750export type MessageBatchesRetrieve200 = MessageBatch
9751export const MessageBatchesRetrieve200 = MessageBatch
9752export type MessageBatchesRetrieve4XX = ErrorResponse
9753export const MessageBatchesRetrieve4XX = ErrorResponse
9754export type MessageBatchesDeleteParams = { readonly "anthropic-version"?: string; readonly "x-api-key"?: string }
9755export const MessageBatchesDeleteParams = Schema.Struct({
9756 "anthropic-version": Schema.optionalKey(
9757 Schema.String.annotate({
9758 "title": "Anthropic-Version",
9759 "description":
9760 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9761 })
9762 ),
9763 "x-api-key": Schema.optionalKey(Schema.String.annotate({
9764 "title": "X-Api-Key",
9765 "description":
9766 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
9767 }))
9768})
9769export type MessageBatchesDelete200 = DeleteMessageBatchResponse
9770export const MessageBatchesDelete200 = DeleteMessageBatchResponse
9771export type MessageBatchesDelete4XX = ErrorResponse
9772export const MessageBatchesDelete4XX = ErrorResponse
9773export type MessageBatchesCancelParams = { readonly "anthropic-version"?: string }
9774export const MessageBatchesCancelParams = Schema.Struct({
9775 "anthropic-version": Schema.optionalKey(
9776 Schema.String.annotate({
9777 "title": "Anthropic-Version",
9778 "description":
9779 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9780 })
9781 )
9782})
9783export type MessageBatchesCancel200 = MessageBatch
9784export const MessageBatchesCancel200 = MessageBatch
9785export type MessageBatchesCancel4XX = ErrorResponse
9786export const MessageBatchesCancel4XX = ErrorResponse
9787export type MessageBatchesResultsParams = { readonly "anthropic-version"?: string; readonly "x-api-key"?: string }
9788export const MessageBatchesResultsParams = Schema.Struct({
9789 "anthropic-version": Schema.optionalKey(
9790 Schema.String.annotate({
9791 "title": "Anthropic-Version",
9792 "description":
9793 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9794 })
9795 ),
9796 "x-api-key": Schema.optionalKey(Schema.String.annotate({
9797 "title": "X-Api-Key",
9798 "description":
9799 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
9800 }))
9801})
9802export type MessageBatchesResults4XX = ErrorResponse
9803export const MessageBatchesResults4XX = ErrorResponse
9804export type MessagesCountTokensPostParams = { readonly "anthropic-version"?: string }
9805export const MessagesCountTokensPostParams = Schema.Struct({
9806 "anthropic-version": Schema.optionalKey(
9807 Schema.String.annotate({
9808 "title": "Anthropic-Version",
9809 "description":
9810 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9811 })
9812 )
9813})
9814export type MessagesCountTokensPostRequestJson = CountMessageTokensParams
9815export const MessagesCountTokensPostRequestJson = CountMessageTokensParams
9816export type MessagesCountTokensPost200 = CountMessageTokensResponse
9817export const MessagesCountTokensPost200 = CountMessageTokensResponse
9818export type MessagesCountTokensPost4XX = ErrorResponse
9819export const MessagesCountTokensPost4XX = ErrorResponse
9820export type ListFilesV1FilesGetParams = {
9821 readonly "before_id"?: string
9822 readonly "after_id"?: string
9823 readonly "limit"?: number
9824 readonly "anthropic-beta"?: string
9825 readonly "anthropic-version"?: string
9826 readonly "x-api-key"?: string
9827}
9828export const ListFilesV1FilesGetParams = Schema.Struct({
9829 "before_id": Schema.optionalKey(
9830 Schema.String.annotate({
9831 "title": "Before Id",
9832 "description":
9833 "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object."
9834 })
9835 ),
9836 "after_id": Schema.optionalKey(
9837 Schema.String.annotate({
9838 "title": "After Id",
9839 "description":
9840 "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object."
9841 })
9842 ),
9843 "limit": Schema.optionalKey(
9844 Schema.Number.annotate({
9845 "title": "Limit",
9846 "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.",
9847 "default": 20
9848 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000))
9849 ),
9850 "anthropic-beta": Schema.optionalKey(
9851 Schema.String.annotate({
9852 "title": "Anthropic-Beta",
9853 "description":
9854 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
9855 })
9856 ),
9857 "anthropic-version": Schema.optionalKey(
9858 Schema.String.annotate({
9859 "title": "Anthropic-Version",
9860 "description":
9861 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9862 })
9863 ),
9864 "x-api-key": Schema.optionalKey(Schema.String.annotate({
9865 "title": "X-Api-Key",
9866 "description":
9867 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
9868 }))
9869})
9870export type ListFilesV1FilesGet200 = FileListResponse
9871export const ListFilesV1FilesGet200 = FileListResponse
9872export type ListFilesV1FilesGet4XX = ErrorResponse
9873export const ListFilesV1FilesGet4XX = ErrorResponse
9874export type UploadFileV1FilesPostParams = { readonly "anthropic-beta"?: string; readonly "anthropic-version"?: string }
9875export const UploadFileV1FilesPostParams = Schema.Struct({
9876 "anthropic-beta": Schema.optionalKey(
9877 Schema.String.annotate({
9878 "title": "Anthropic-Beta",
9879 "description":
9880 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
9881 })
9882 ),
9883 "anthropic-version": Schema.optionalKey(
9884 Schema.String.annotate({
9885 "title": "Anthropic-Version",
9886 "description":
9887 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9888 })
9889 )
9890})
9891export type UploadFileV1FilesPostRequestFormData = { readonly "file": string }
9892export const UploadFileV1FilesPostRequestFormData = Schema.Struct({
9893 "file": Schema.String.annotate({ "description": "The file to upload", "format": "binary" })
9894})
9895export type UploadFileV1FilesPost200 = FileMetadataSchema
9896export const UploadFileV1FilesPost200 = FileMetadataSchema
9897export type UploadFileV1FilesPost4XX = ErrorResponse
9898export const UploadFileV1FilesPost4XX = ErrorResponse
9899export type GetFileMetadataV1FilesFileIdGetParams = {
9900 readonly "anthropic-beta"?: string
9901 readonly "anthropic-version"?: string
9902 readonly "x-api-key"?: string
9903}
9904export const GetFileMetadataV1FilesFileIdGetParams = Schema.Struct({
9905 "anthropic-beta": Schema.optionalKey(
9906 Schema.String.annotate({
9907 "title": "Anthropic-Beta",
9908 "description":
9909 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
9910 })
9911 ),
9912 "anthropic-version": Schema.optionalKey(
9913 Schema.String.annotate({
9914 "title": "Anthropic-Version",
9915 "description":
9916 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9917 })
9918 ),
9919 "x-api-key": Schema.optionalKey(Schema.String.annotate({
9920 "title": "X-Api-Key",
9921 "description":
9922 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
9923 }))
9924})
9925export type GetFileMetadataV1FilesFileIdGet200 = FileMetadataSchema
9926export const GetFileMetadataV1FilesFileIdGet200 = FileMetadataSchema
9927export type GetFileMetadataV1FilesFileIdGet4XX = ErrorResponse
9928export const GetFileMetadataV1FilesFileIdGet4XX = ErrorResponse
9929export type DeleteFileV1FilesFileIdDeleteParams = {
9930 readonly "anthropic-beta"?: string
9931 readonly "anthropic-version"?: string
9932 readonly "x-api-key"?: string
9933}
9934export const DeleteFileV1FilesFileIdDeleteParams = Schema.Struct({
9935 "anthropic-beta": Schema.optionalKey(
9936 Schema.String.annotate({
9937 "title": "Anthropic-Beta",
9938 "description":
9939 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
9940 })
9941 ),
9942 "anthropic-version": Schema.optionalKey(
9943 Schema.String.annotate({
9944 "title": "Anthropic-Version",
9945 "description":
9946 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9947 })
9948 ),
9949 "x-api-key": Schema.optionalKey(Schema.String.annotate({
9950 "title": "X-Api-Key",
9951 "description":
9952 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
9953 }))
9954})
9955export type DeleteFileV1FilesFileIdDelete200 = FileDeleteResponse
9956export const DeleteFileV1FilesFileIdDelete200 = FileDeleteResponse
9957export type DeleteFileV1FilesFileIdDelete4XX = ErrorResponse
9958export const DeleteFileV1FilesFileIdDelete4XX = ErrorResponse
9959export type DownloadFileV1FilesFileIdContentGetParams = {
9960 readonly "anthropic-beta"?: string
9961 readonly "anthropic-version"?: string
9962 readonly "x-api-key"?: string
9963}
9964export const DownloadFileV1FilesFileIdContentGetParams = Schema.Struct({
9965 "anthropic-beta": Schema.optionalKey(
9966 Schema.String.annotate({
9967 "title": "Anthropic-Beta",
9968 "description":
9969 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
9970 })
9971 ),
9972 "anthropic-version": Schema.optionalKey(
9973 Schema.String.annotate({
9974 "title": "Anthropic-Version",
9975 "description":
9976 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
9977 })
9978 ),
9979 "x-api-key": Schema.optionalKey(Schema.String.annotate({
9980 "title": "X-Api-Key",
9981 "description":
9982 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
9983 }))
9984})
9985export type ListSkillsV1SkillsGetParams = {
9986 readonly "page"?: string | null
9987 readonly "limit"?: number
9988 readonly "source"?: string | null
9989 readonly "anthropic-beta"?: string
9990 readonly "anthropic-version"?: string
9991 readonly "x-api-key"?: string
9992}
9993export const ListSkillsV1SkillsGetParams = Schema.Struct({
9994 "page": Schema.optionalKey(
9995 Schema.Union([Schema.String, Schema.Null]).annotate({
9996 "title": "Page",
9997 "description":
9998 "Pagination token for fetching a specific page of results.\n\nPass the value from a previous response's `next_page` field to get the next page of results."
9999 })
10000 ),
10001 "limit": Schema.optionalKey(
10002 Schema.Number.annotate({
10003 "title": "Limit",
10004 "description": "Number of results to return per page.\n\nMaximum value is 100. Defaults to 20.",
10005 "default": 20
10006 }).check(Schema.isInt())
10007 ),
10008 "source": Schema.optionalKey(
10009 Schema.Union([Schema.String, Schema.Null]).annotate({
10010 "title": "Source",
10011 "description":
10012 "Filter skills by source.\n\nIf provided, only skills from the specified source will be returned:\n* `\"custom\"`: only return user-created skills\n* `\"anthropic\"`: only return Anthropic-created skills"
10013 })
10014 ),
10015 "anthropic-beta": Schema.optionalKey(
10016 Schema.String.annotate({
10017 "title": "Anthropic-Beta",
10018 "description":
10019 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10020 })
10021 ),
10022 "anthropic-version": Schema.optionalKey(
10023 Schema.String.annotate({
10024 "title": "Anthropic-Version",
10025 "description":
10026 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10027 })
10028 ),
10029 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10030 "title": "X-Api-Key",
10031 "description":
10032 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10033 }))
10034})
10035export type ListSkillsV1SkillsGet200 = ListSkillsResponse
10036export const ListSkillsV1SkillsGet200 = ListSkillsResponse
10037export type ListSkillsV1SkillsGet4XX = ErrorResponse
10038export const ListSkillsV1SkillsGet4XX = ErrorResponse
10039export type CreateSkillV1SkillsPostParams = {
10040 readonly "anthropic-beta"?: string
10041 readonly "anthropic-version"?: string
10042}
10043export const CreateSkillV1SkillsPostParams = Schema.Struct({
10044 "anthropic-beta": Schema.optionalKey(
10045 Schema.String.annotate({
10046 "title": "Anthropic-Beta",
10047 "description":
10048 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10049 })
10050 ),
10051 "anthropic-version": Schema.optionalKey(
10052 Schema.String.annotate({
10053 "title": "Anthropic-Version",
10054 "description":
10055 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10056 })
10057 )
10058})
10059export type CreateSkillV1SkillsPostRequestFormData = Body_create_skill_v1_skills_post
10060export const CreateSkillV1SkillsPostRequestFormData = Body_create_skill_v1_skills_post
10061export type CreateSkillV1SkillsPost200 = CreateSkillResponse
10062export const CreateSkillV1SkillsPost200 = CreateSkillResponse
10063export type CreateSkillV1SkillsPost4XX = ErrorResponse
10064export const CreateSkillV1SkillsPost4XX = ErrorResponse
10065export type GetSkillV1SkillsSkillIdGetParams = {
10066 readonly "anthropic-beta"?: string
10067 readonly "anthropic-version"?: string
10068 readonly "x-api-key"?: string
10069}
10070export const GetSkillV1SkillsSkillIdGetParams = Schema.Struct({
10071 "anthropic-beta": Schema.optionalKey(
10072 Schema.String.annotate({
10073 "title": "Anthropic-Beta",
10074 "description":
10075 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10076 })
10077 ),
10078 "anthropic-version": Schema.optionalKey(
10079 Schema.String.annotate({
10080 "title": "Anthropic-Version",
10081 "description":
10082 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10083 })
10084 ),
10085 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10086 "title": "X-Api-Key",
10087 "description":
10088 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10089 }))
10090})
10091export type GetSkillV1SkillsSkillIdGet200 = GetSkillResponse
10092export const GetSkillV1SkillsSkillIdGet200 = GetSkillResponse
10093export type GetSkillV1SkillsSkillIdGet4XX = ErrorResponse
10094export const GetSkillV1SkillsSkillIdGet4XX = ErrorResponse
10095export type DeleteSkillV1SkillsSkillIdDeleteParams = {
10096 readonly "anthropic-beta"?: string
10097 readonly "anthropic-version"?: string
10098 readonly "x-api-key"?: string
10099}
10100export const DeleteSkillV1SkillsSkillIdDeleteParams = Schema.Struct({
10101 "anthropic-beta": Schema.optionalKey(
10102 Schema.String.annotate({
10103 "title": "Anthropic-Beta",
10104 "description":
10105 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10106 })
10107 ),
10108 "anthropic-version": Schema.optionalKey(
10109 Schema.String.annotate({
10110 "title": "Anthropic-Version",
10111 "description":
10112 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10113 })
10114 ),
10115 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10116 "title": "X-Api-Key",
10117 "description":
10118 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10119 }))
10120})
10121export type DeleteSkillV1SkillsSkillIdDelete200 = DeleteSkillResponse
10122export const DeleteSkillV1SkillsSkillIdDelete200 = DeleteSkillResponse
10123export type DeleteSkillV1SkillsSkillIdDelete4XX = ErrorResponse
10124export const DeleteSkillV1SkillsSkillIdDelete4XX = ErrorResponse
10125export type ListSkillVersionsV1SkillsSkillIdVersionsGetParams = {
10126 readonly "page"?: string | null
10127 readonly "limit"?: number | null
10128 readonly "anthropic-beta"?: string
10129 readonly "anthropic-version"?: string
10130 readonly "x-api-key"?: string
10131}
10132export const ListSkillVersionsV1SkillsSkillIdVersionsGetParams = Schema.Struct({
10133 "page": Schema.optionalKey(
10134 Schema.Union([Schema.String, Schema.Null]).annotate({
10135 "title": "Page",
10136 "description": "Optionally set to the `next_page` token from the previous response."
10137 })
10138 ),
10139 "limit": Schema.optionalKey(
10140 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
10141 "title": "Limit",
10142 "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`."
10143 })
10144 ),
10145 "anthropic-beta": Schema.optionalKey(
10146 Schema.String.annotate({
10147 "title": "Anthropic-Beta",
10148 "description":
10149 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10150 })
10151 ),
10152 "anthropic-version": Schema.optionalKey(
10153 Schema.String.annotate({
10154 "title": "Anthropic-Version",
10155 "description":
10156 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10157 })
10158 ),
10159 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10160 "title": "X-Api-Key",
10161 "description":
10162 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10163 }))
10164})
10165export type ListSkillVersionsV1SkillsSkillIdVersionsGet200 = ListSkillVersionsResponse
10166export const ListSkillVersionsV1SkillsSkillIdVersionsGet200 = ListSkillVersionsResponse
10167export type ListSkillVersionsV1SkillsSkillIdVersionsGet4XX = ErrorResponse
10168export const ListSkillVersionsV1SkillsSkillIdVersionsGet4XX = ErrorResponse
10169export type CreateSkillVersionV1SkillsSkillIdVersionsPostParams = {
10170 readonly "anthropic-beta"?: string
10171 readonly "anthropic-version"?: string
10172}
10173export const CreateSkillVersionV1SkillsSkillIdVersionsPostParams = Schema.Struct({
10174 "anthropic-beta": Schema.optionalKey(
10175 Schema.String.annotate({
10176 "title": "Anthropic-Beta",
10177 "description":
10178 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10179 })
10180 ),
10181 "anthropic-version": Schema.optionalKey(
10182 Schema.String.annotate({
10183 "title": "Anthropic-Version",
10184 "description":
10185 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10186 })
10187 )
10188})
10189export type CreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData =
10190 Body_create_skill_version_v1_skills__skill_id__versions_post
10191export const CreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData =
10192 Body_create_skill_version_v1_skills__skill_id__versions_post
10193export type CreateSkillVersionV1SkillsSkillIdVersionsPost200 = CreateSkillVersionResponse
10194export const CreateSkillVersionV1SkillsSkillIdVersionsPost200 = CreateSkillVersionResponse
10195export type CreateSkillVersionV1SkillsSkillIdVersionsPost4XX = ErrorResponse
10196export const CreateSkillVersionV1SkillsSkillIdVersionsPost4XX = ErrorResponse
10197export type GetSkillVersionV1SkillsSkillIdVersionsVersionGetParams = {
10198 readonly "anthropic-beta"?: string
10199 readonly "anthropic-version"?: string
10200 readonly "x-api-key"?: string
10201}
10202export const GetSkillVersionV1SkillsSkillIdVersionsVersionGetParams = Schema.Struct({
10203 "anthropic-beta": Schema.optionalKey(
10204 Schema.String.annotate({
10205 "title": "Anthropic-Beta",
10206 "description":
10207 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10208 })
10209 ),
10210 "anthropic-version": Schema.optionalKey(
10211 Schema.String.annotate({
10212 "title": "Anthropic-Version",
10213 "description":
10214 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10215 })
10216 ),
10217 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10218 "title": "X-Api-Key",
10219 "description":
10220 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10221 }))
10222})
10223export type GetSkillVersionV1SkillsSkillIdVersionsVersionGet200 = GetSkillVersionResponse
10224export const GetSkillVersionV1SkillsSkillIdVersionsVersionGet200 = GetSkillVersionResponse
10225export type GetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX = ErrorResponse
10226export const GetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX = ErrorResponse
10227export type DeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams = {
10228 readonly "anthropic-beta"?: string
10229 readonly "anthropic-version"?: string
10230 readonly "x-api-key"?: string
10231}
10232export const DeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams = Schema.Struct({
10233 "anthropic-beta": Schema.optionalKey(
10234 Schema.String.annotate({
10235 "title": "Anthropic-Beta",
10236 "description":
10237 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10238 })
10239 ),
10240 "anthropic-version": Schema.optionalKey(
10241 Schema.String.annotate({
10242 "title": "Anthropic-Version",
10243 "description":
10244 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10245 })
10246 ),
10247 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10248 "title": "X-Api-Key",
10249 "description":
10250 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10251 }))
10252})
10253export type DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200 = DeleteSkillVersionResponse
10254export const DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200 = DeleteSkillVersionResponse
10255export type DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX = ErrorResponse
10256export const DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX = ErrorResponse
10257export type BetaMessagesPostParams = { readonly "anthropic-beta"?: string; readonly "anthropic-version"?: string }
10258export const BetaMessagesPostParams = Schema.Struct({
10259 "anthropic-beta": Schema.optionalKey(
10260 Schema.String.annotate({
10261 "title": "Anthropic-Beta",
10262 "description":
10263 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10264 })
10265 ),
10266 "anthropic-version": Schema.optionalKey(
10267 Schema.String.annotate({
10268 "title": "Anthropic-Version",
10269 "description":
10270 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10271 })
10272 )
10273})
10274export type BetaMessagesPostRequestJson = BetaCreateMessageParams
10275export const BetaMessagesPostRequestJson = BetaCreateMessageParams
10276export type BetaMessagesPost200 = BetaMessage
10277export const BetaMessagesPost200 = BetaMessage
10278export type BetaMessagesPost4XX = BetaErrorResponse
10279export const BetaMessagesPost4XX = BetaErrorResponse
10280export type BetaModelsListParams = {
10281 readonly "before_id"?: string
10282 readonly "after_id"?: string
10283 readonly "limit"?: number
10284 readonly "anthropic-version"?: string
10285 readonly "x-api-key"?: string
10286 readonly "anthropic-beta"?: string
10287}
10288export const BetaModelsListParams = Schema.Struct({
10289 "before_id": Schema.optionalKey(
10290 Schema.String.annotate({
10291 "title": "Before Id",
10292 "description":
10293 "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object."
10294 })
10295 ),
10296 "after_id": Schema.optionalKey(
10297 Schema.String.annotate({
10298 "title": "After Id",
10299 "description":
10300 "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object."
10301 })
10302 ),
10303 "limit": Schema.optionalKey(
10304 Schema.Number.annotate({
10305 "title": "Limit",
10306 "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.",
10307 "default": 20
10308 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000))
10309 ),
10310 "anthropic-version": Schema.optionalKey(
10311 Schema.String.annotate({
10312 "title": "Anthropic-Version",
10313 "description":
10314 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10315 })
10316 ),
10317 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10318 "title": "X-Api-Key",
10319 "description":
10320 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10321 })),
10322 "anthropic-beta": Schema.optionalKey(
10323 Schema.String.annotate({
10324 "title": "Anthropic-Beta",
10325 "description":
10326 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10327 })
10328 )
10329})
10330export type BetaModelsList200 = BetaListResponse_ModelInfo_
10331export const BetaModelsList200 = BetaListResponse_ModelInfo_
10332export type BetaModelsList4XX = BetaErrorResponse
10333export const BetaModelsList4XX = BetaErrorResponse
10334export type BetaModelsGetParams = {
10335 readonly "anthropic-version"?: string
10336 readonly "x-api-key"?: string
10337 readonly "anthropic-beta"?: string
10338}
10339export const BetaModelsGetParams = Schema.Struct({
10340 "anthropic-version": Schema.optionalKey(
10341 Schema.String.annotate({
10342 "title": "Anthropic-Version",
10343 "description":
10344 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10345 })
10346 ),
10347 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10348 "title": "X-Api-Key",
10349 "description":
10350 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10351 })),
10352 "anthropic-beta": Schema.optionalKey(
10353 Schema.String.annotate({
10354 "title": "Anthropic-Beta",
10355 "description":
10356 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10357 })
10358 )
10359})
10360export type BetaModelsGet200 = BetaModelInfo
10361export const BetaModelsGet200 = BetaModelInfo
10362export type BetaModelsGet4XX = BetaErrorResponse
10363export const BetaModelsGet4XX = BetaErrorResponse
10364export type BetaMessageBatchesListParams = {
10365 readonly "before_id"?: string
10366 readonly "after_id"?: string
10367 readonly "limit"?: number
10368 readonly "anthropic-beta"?: string
10369 readonly "anthropic-version"?: string
10370 readonly "x-api-key"?: string
10371}
10372export const BetaMessageBatchesListParams = Schema.Struct({
10373 "before_id": Schema.optionalKey(
10374 Schema.String.annotate({
10375 "title": "Before Id",
10376 "description":
10377 "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object."
10378 })
10379 ),
10380 "after_id": Schema.optionalKey(
10381 Schema.String.annotate({
10382 "title": "After Id",
10383 "description":
10384 "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object."
10385 })
10386 ),
10387 "limit": Schema.optionalKey(
10388 Schema.Number.annotate({
10389 "title": "Limit",
10390 "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.",
10391 "default": 20
10392 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000))
10393 ),
10394 "anthropic-beta": Schema.optionalKey(
10395 Schema.String.annotate({
10396 "title": "Anthropic-Beta",
10397 "description":
10398 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10399 })
10400 ),
10401 "anthropic-version": Schema.optionalKey(
10402 Schema.String.annotate({
10403 "title": "Anthropic-Version",
10404 "description":
10405 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10406 })
10407 ),
10408 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10409 "title": "X-Api-Key",
10410 "description":
10411 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10412 }))
10413})
10414export type BetaMessageBatchesList200 = BetaListResponse_MessageBatch_
10415export const BetaMessageBatchesList200 = BetaListResponse_MessageBatch_
10416export type BetaMessageBatchesList4XX = BetaErrorResponse
10417export const BetaMessageBatchesList4XX = BetaErrorResponse
10418export type BetaMessageBatchesPostParams = { readonly "anthropic-beta"?: string; readonly "anthropic-version"?: string }
10419export const BetaMessageBatchesPostParams = Schema.Struct({
10420 "anthropic-beta": Schema.optionalKey(
10421 Schema.String.annotate({
10422 "title": "Anthropic-Beta",
10423 "description":
10424 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10425 })
10426 ),
10427 "anthropic-version": Schema.optionalKey(
10428 Schema.String.annotate({
10429 "title": "Anthropic-Version",
10430 "description":
10431 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10432 })
10433 )
10434})
10435export type BetaMessageBatchesPostRequestJson = BetaCreateMessageBatchParams
10436export const BetaMessageBatchesPostRequestJson = BetaCreateMessageBatchParams
10437export type BetaMessageBatchesPost200 = BetaMessageBatch
10438export const BetaMessageBatchesPost200 = BetaMessageBatch
10439export type BetaMessageBatchesPost4XX = BetaErrorResponse
10440export const BetaMessageBatchesPost4XX = BetaErrorResponse
10441export type BetaMessageBatchesRetrieveParams = {
10442 readonly "anthropic-beta"?: string
10443 readonly "anthropic-version"?: string
10444 readonly "x-api-key"?: string
10445}
10446export const BetaMessageBatchesRetrieveParams = Schema.Struct({
10447 "anthropic-beta": Schema.optionalKey(
10448 Schema.String.annotate({
10449 "title": "Anthropic-Beta",
10450 "description":
10451 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10452 })
10453 ),
10454 "anthropic-version": Schema.optionalKey(
10455 Schema.String.annotate({
10456 "title": "Anthropic-Version",
10457 "description":
10458 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10459 })
10460 ),
10461 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10462 "title": "X-Api-Key",
10463 "description":
10464 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10465 }))
10466})
10467export type BetaMessageBatchesRetrieve200 = BetaMessageBatch
10468export const BetaMessageBatchesRetrieve200 = BetaMessageBatch
10469export type BetaMessageBatchesRetrieve4XX = BetaErrorResponse
10470export const BetaMessageBatchesRetrieve4XX = BetaErrorResponse
10471export type BetaMessageBatchesDeleteParams = {
10472 readonly "anthropic-beta"?: string
10473 readonly "anthropic-version"?: string
10474 readonly "x-api-key"?: string
10475}
10476export const BetaMessageBatchesDeleteParams = Schema.Struct({
10477 "anthropic-beta": Schema.optionalKey(
10478 Schema.String.annotate({
10479 "title": "Anthropic-Beta",
10480 "description":
10481 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10482 })
10483 ),
10484 "anthropic-version": Schema.optionalKey(
10485 Schema.String.annotate({
10486 "title": "Anthropic-Version",
10487 "description":
10488 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10489 })
10490 ),
10491 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10492 "title": "X-Api-Key",
10493 "description":
10494 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10495 }))
10496})
10497export type BetaMessageBatchesDelete200 = BetaDeleteMessageBatchResponse
10498export const BetaMessageBatchesDelete200 = BetaDeleteMessageBatchResponse
10499export type BetaMessageBatchesDelete4XX = BetaErrorResponse
10500export const BetaMessageBatchesDelete4XX = BetaErrorResponse
10501export type BetaMessageBatchesCancelParams = {
10502 readonly "anthropic-beta"?: string
10503 readonly "anthropic-version"?: string
10504}
10505export const BetaMessageBatchesCancelParams = Schema.Struct({
10506 "anthropic-beta": Schema.optionalKey(
10507 Schema.String.annotate({
10508 "title": "Anthropic-Beta",
10509 "description":
10510 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10511 })
10512 ),
10513 "anthropic-version": Schema.optionalKey(
10514 Schema.String.annotate({
10515 "title": "Anthropic-Version",
10516 "description":
10517 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10518 })
10519 )
10520})
10521export type BetaMessageBatchesCancel200 = BetaMessageBatch
10522export const BetaMessageBatchesCancel200 = BetaMessageBatch
10523export type BetaMessageBatchesCancel4XX = BetaErrorResponse
10524export const BetaMessageBatchesCancel4XX = BetaErrorResponse
10525export type BetaMessageBatchesResultsParams = {
10526 readonly "anthropic-beta"?: string
10527 readonly "anthropic-version"?: string
10528 readonly "x-api-key"?: string
10529}
10530export const BetaMessageBatchesResultsParams = Schema.Struct({
10531 "anthropic-beta": Schema.optionalKey(
10532 Schema.String.annotate({
10533 "title": "Anthropic-Beta",
10534 "description":
10535 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10536 })
10537 ),
10538 "anthropic-version": Schema.optionalKey(
10539 Schema.String.annotate({
10540 "title": "Anthropic-Version",
10541 "description":
10542 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10543 })
10544 ),
10545 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10546 "title": "X-Api-Key",
10547 "description":
10548 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10549 }))
10550})
10551export type BetaMessageBatchesResults4XX = BetaErrorResponse
10552export const BetaMessageBatchesResults4XX = BetaErrorResponse
10553export type BetaMessagesCountTokensPostParams = {
10554 readonly "anthropic-beta"?: string
10555 readonly "anthropic-version"?: string
10556}
10557export const BetaMessagesCountTokensPostParams = Schema.Struct({
10558 "anthropic-beta": Schema.optionalKey(
10559 Schema.String.annotate({
10560 "title": "Anthropic-Beta",
10561 "description":
10562 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10563 })
10564 ),
10565 "anthropic-version": Schema.optionalKey(
10566 Schema.String.annotate({
10567 "title": "Anthropic-Version",
10568 "description":
10569 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10570 })
10571 )
10572})
10573export type BetaMessagesCountTokensPostRequestJson = BetaCountMessageTokensParams
10574export const BetaMessagesCountTokensPostRequestJson = BetaCountMessageTokensParams
10575export type BetaMessagesCountTokensPost200 = BetaCountMessageTokensResponse
10576export const BetaMessagesCountTokensPost200 = BetaCountMessageTokensResponse
10577export type BetaMessagesCountTokensPost4XX = BetaErrorResponse
10578export const BetaMessagesCountTokensPost4XX = BetaErrorResponse
10579export type BetaListFilesV1FilesGetParams = {
10580 readonly "before_id"?: string
10581 readonly "after_id"?: string
10582 readonly "limit"?: number
10583 readonly "anthropic-beta"?: string
10584 readonly "anthropic-version"?: string
10585 readonly "x-api-key"?: string
10586}
10587export const BetaListFilesV1FilesGetParams = Schema.Struct({
10588 "before_id": Schema.optionalKey(
10589 Schema.String.annotate({
10590 "title": "Before Id",
10591 "description":
10592 "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object."
10593 })
10594 ),
10595 "after_id": Schema.optionalKey(
10596 Schema.String.annotate({
10597 "title": "After Id",
10598 "description":
10599 "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object."
10600 })
10601 ),
10602 "limit": Schema.optionalKey(
10603 Schema.Number.annotate({
10604 "title": "Limit",
10605 "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.",
10606 "default": 20
10607 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000))
10608 ),
10609 "anthropic-beta": Schema.optionalKey(
10610 Schema.String.annotate({
10611 "title": "Anthropic-Beta",
10612 "description":
10613 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10614 })
10615 ),
10616 "anthropic-version": Schema.optionalKey(
10617 Schema.String.annotate({
10618 "title": "Anthropic-Version",
10619 "description":
10620 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10621 })
10622 ),
10623 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10624 "title": "X-Api-Key",
10625 "description":
10626 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10627 }))
10628})
10629export type BetaListFilesV1FilesGet200 = BetaFileListResponse
10630export const BetaListFilesV1FilesGet200 = BetaFileListResponse
10631export type BetaListFilesV1FilesGet4XX = BetaErrorResponse
10632export const BetaListFilesV1FilesGet4XX = BetaErrorResponse
10633export type BetaUploadFileV1FilesPostParams = {
10634 readonly "anthropic-beta"?: string
10635 readonly "anthropic-version"?: string
10636}
10637export const BetaUploadFileV1FilesPostParams = Schema.Struct({
10638 "anthropic-beta": Schema.optionalKey(
10639 Schema.String.annotate({
10640 "title": "Anthropic-Beta",
10641 "description":
10642 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10643 })
10644 ),
10645 "anthropic-version": Schema.optionalKey(
10646 Schema.String.annotate({
10647 "title": "Anthropic-Version",
10648 "description":
10649 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10650 })
10651 )
10652})
10653export type BetaUploadFileV1FilesPostRequestFormData = { readonly "file": string }
10654export const BetaUploadFileV1FilesPostRequestFormData = Schema.Struct({
10655 "file": Schema.String.annotate({ "description": "The file to upload", "format": "binary" })
10656})
10657export type BetaUploadFileV1FilesPost200 = BetaFileMetadataSchema
10658export const BetaUploadFileV1FilesPost200 = BetaFileMetadataSchema
10659export type BetaUploadFileV1FilesPost4XX = BetaErrorResponse
10660export const BetaUploadFileV1FilesPost4XX = BetaErrorResponse
10661export type BetaGetFileMetadataV1FilesFileIdGetParams = {
10662 readonly "anthropic-beta"?: string
10663 readonly "anthropic-version"?: string
10664 readonly "x-api-key"?: string
10665}
10666export const BetaGetFileMetadataV1FilesFileIdGetParams = Schema.Struct({
10667 "anthropic-beta": Schema.optionalKey(
10668 Schema.String.annotate({
10669 "title": "Anthropic-Beta",
10670 "description":
10671 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10672 })
10673 ),
10674 "anthropic-version": Schema.optionalKey(
10675 Schema.String.annotate({
10676 "title": "Anthropic-Version",
10677 "description":
10678 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10679 })
10680 ),
10681 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10682 "title": "X-Api-Key",
10683 "description":
10684 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10685 }))
10686})
10687export type BetaGetFileMetadataV1FilesFileIdGet200 = BetaFileMetadataSchema
10688export const BetaGetFileMetadataV1FilesFileIdGet200 = BetaFileMetadataSchema
10689export type BetaGetFileMetadataV1FilesFileIdGet4XX = BetaErrorResponse
10690export const BetaGetFileMetadataV1FilesFileIdGet4XX = BetaErrorResponse
10691export type BetaDeleteFileV1FilesFileIdDeleteParams = {
10692 readonly "anthropic-beta"?: string
10693 readonly "anthropic-version"?: string
10694 readonly "x-api-key"?: string
10695}
10696export const BetaDeleteFileV1FilesFileIdDeleteParams = Schema.Struct({
10697 "anthropic-beta": Schema.optionalKey(
10698 Schema.String.annotate({
10699 "title": "Anthropic-Beta",
10700 "description":
10701 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10702 })
10703 ),
10704 "anthropic-version": Schema.optionalKey(
10705 Schema.String.annotate({
10706 "title": "Anthropic-Version",
10707 "description":
10708 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10709 })
10710 ),
10711 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10712 "title": "X-Api-Key",
10713 "description":
10714 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10715 }))
10716})
10717export type BetaDeleteFileV1FilesFileIdDelete200 = BetaFileDeleteResponse
10718export const BetaDeleteFileV1FilesFileIdDelete200 = BetaFileDeleteResponse
10719export type BetaDeleteFileV1FilesFileIdDelete4XX = BetaErrorResponse
10720export const BetaDeleteFileV1FilesFileIdDelete4XX = BetaErrorResponse
10721export type BetaDownloadFileV1FilesFileIdContentGetParams = {
10722 readonly "anthropic-beta"?: string
10723 readonly "anthropic-version"?: string
10724 readonly "x-api-key"?: string
10725}
10726export const BetaDownloadFileV1FilesFileIdContentGetParams = Schema.Struct({
10727 "anthropic-beta": Schema.optionalKey(
10728 Schema.String.annotate({
10729 "title": "Anthropic-Beta",
10730 "description":
10731 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10732 })
10733 ),
10734 "anthropic-version": Schema.optionalKey(
10735 Schema.String.annotate({
10736 "title": "Anthropic-Version",
10737 "description":
10738 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10739 })
10740 ),
10741 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10742 "title": "X-Api-Key",
10743 "description":
10744 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10745 }))
10746})
10747export type BetaListSkillsV1SkillsGetParams = {
10748 readonly "page"?: string | null
10749 readonly "limit"?: number
10750 readonly "source"?: string | null
10751 readonly "anthropic-beta"?: string
10752 readonly "anthropic-version"?: string
10753 readonly "x-api-key"?: string
10754}
10755export const BetaListSkillsV1SkillsGetParams = Schema.Struct({
10756 "page": Schema.optionalKey(
10757 Schema.Union([Schema.String, Schema.Null]).annotate({
10758 "title": "Page",
10759 "description":
10760 "Pagination token for fetching a specific page of results.\n\nPass the value from a previous response's `next_page` field to get the next page of results."
10761 })
10762 ),
10763 "limit": Schema.optionalKey(
10764 Schema.Number.annotate({
10765 "title": "Limit",
10766 "description": "Number of results to return per page.\n\nMaximum value is 100. Defaults to 20.",
10767 "default": 20
10768 }).check(Schema.isInt())
10769 ),
10770 "source": Schema.optionalKey(
10771 Schema.Union([Schema.String, Schema.Null]).annotate({
10772 "title": "Source",
10773 "description":
10774 "Filter skills by source.\n\nIf provided, only skills from the specified source will be returned:\n* `\"custom\"`: only return user-created skills\n* `\"anthropic\"`: only return Anthropic-created skills"
10775 })
10776 ),
10777 "anthropic-beta": Schema.optionalKey(
10778 Schema.String.annotate({
10779 "title": "Anthropic-Beta",
10780 "description":
10781 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10782 })
10783 ),
10784 "anthropic-version": Schema.optionalKey(
10785 Schema.String.annotate({
10786 "title": "Anthropic-Version",
10787 "description":
10788 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10789 })
10790 ),
10791 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10792 "title": "X-Api-Key",
10793 "description":
10794 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10795 }))
10796})
10797export type BetaListSkillsV1SkillsGet200 = BetaListSkillsResponse
10798export const BetaListSkillsV1SkillsGet200 = BetaListSkillsResponse
10799export type BetaListSkillsV1SkillsGet4XX = BetaErrorResponse
10800export const BetaListSkillsV1SkillsGet4XX = BetaErrorResponse
10801export type BetaCreateSkillV1SkillsPostParams = {
10802 readonly "anthropic-beta"?: string
10803 readonly "anthropic-version"?: string
10804}
10805export const BetaCreateSkillV1SkillsPostParams = Schema.Struct({
10806 "anthropic-beta": Schema.optionalKey(
10807 Schema.String.annotate({
10808 "title": "Anthropic-Beta",
10809 "description":
10810 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10811 })
10812 ),
10813 "anthropic-version": Schema.optionalKey(
10814 Schema.String.annotate({
10815 "title": "Anthropic-Version",
10816 "description":
10817 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10818 })
10819 )
10820})
10821export type BetaCreateSkillV1SkillsPostRequestFormData = BetaBody_create_skill_v1_skills_post
10822export const BetaCreateSkillV1SkillsPostRequestFormData = BetaBody_create_skill_v1_skills_post
10823export type BetaCreateSkillV1SkillsPost200 = BetaCreateSkillResponse
10824export const BetaCreateSkillV1SkillsPost200 = BetaCreateSkillResponse
10825export type BetaCreateSkillV1SkillsPost4XX = BetaErrorResponse
10826export const BetaCreateSkillV1SkillsPost4XX = BetaErrorResponse
10827export type BetaGetSkillV1SkillsSkillIdGetParams = {
10828 readonly "anthropic-beta"?: string
10829 readonly "anthropic-version"?: string
10830 readonly "x-api-key"?: string
10831}
10832export const BetaGetSkillV1SkillsSkillIdGetParams = Schema.Struct({
10833 "anthropic-beta": Schema.optionalKey(
10834 Schema.String.annotate({
10835 "title": "Anthropic-Beta",
10836 "description":
10837 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10838 })
10839 ),
10840 "anthropic-version": Schema.optionalKey(
10841 Schema.String.annotate({
10842 "title": "Anthropic-Version",
10843 "description":
10844 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10845 })
10846 ),
10847 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10848 "title": "X-Api-Key",
10849 "description":
10850 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10851 }))
10852})
10853export type BetaGetSkillV1SkillsSkillIdGet200 = BetaGetSkillResponse
10854export const BetaGetSkillV1SkillsSkillIdGet200 = BetaGetSkillResponse
10855export type BetaGetSkillV1SkillsSkillIdGet4XX = BetaErrorResponse
10856export const BetaGetSkillV1SkillsSkillIdGet4XX = BetaErrorResponse
10857export type BetaDeleteSkillV1SkillsSkillIdDeleteParams = {
10858 readonly "anthropic-beta"?: string
10859 readonly "anthropic-version"?: string
10860 readonly "x-api-key"?: string
10861}
10862export const BetaDeleteSkillV1SkillsSkillIdDeleteParams = Schema.Struct({
10863 "anthropic-beta": Schema.optionalKey(
10864 Schema.String.annotate({
10865 "title": "Anthropic-Beta",
10866 "description":
10867 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10868 })
10869 ),
10870 "anthropic-version": Schema.optionalKey(
10871 Schema.String.annotate({
10872 "title": "Anthropic-Version",
10873 "description":
10874 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10875 })
10876 ),
10877 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10878 "title": "X-Api-Key",
10879 "description":
10880 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10881 }))
10882})
10883export type BetaDeleteSkillV1SkillsSkillIdDelete200 = BetaDeleteSkillResponse
10884export const BetaDeleteSkillV1SkillsSkillIdDelete200 = BetaDeleteSkillResponse
10885export type BetaDeleteSkillV1SkillsSkillIdDelete4XX = BetaErrorResponse
10886export const BetaDeleteSkillV1SkillsSkillIdDelete4XX = BetaErrorResponse
10887export type BetaListSkillVersionsV1SkillsSkillIdVersionsGetParams = {
10888 readonly "page"?: string | null
10889 readonly "limit"?: number | null
10890 readonly "anthropic-beta"?: string
10891 readonly "anthropic-version"?: string
10892 readonly "x-api-key"?: string
10893}
10894export const BetaListSkillVersionsV1SkillsSkillIdVersionsGetParams = Schema.Struct({
10895 "page": Schema.optionalKey(
10896 Schema.Union([Schema.String, Schema.Null]).annotate({
10897 "title": "Page",
10898 "description": "Optionally set to the `next_page` token from the previous response."
10899 })
10900 ),
10901 "limit": Schema.optionalKey(
10902 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
10903 "title": "Limit",
10904 "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`."
10905 })
10906 ),
10907 "anthropic-beta": Schema.optionalKey(
10908 Schema.String.annotate({
10909 "title": "Anthropic-Beta",
10910 "description":
10911 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10912 })
10913 ),
10914 "anthropic-version": Schema.optionalKey(
10915 Schema.String.annotate({
10916 "title": "Anthropic-Version",
10917 "description":
10918 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10919 })
10920 ),
10921 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10922 "title": "X-Api-Key",
10923 "description":
10924 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10925 }))
10926})
10927export type BetaListSkillVersionsV1SkillsSkillIdVersionsGet200 = BetaListSkillVersionsResponse
10928export const BetaListSkillVersionsV1SkillsSkillIdVersionsGet200 = BetaListSkillVersionsResponse
10929export type BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX = BetaErrorResponse
10930export const BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX = BetaErrorResponse
10931export type BetaCreateSkillVersionV1SkillsSkillIdVersionsPostParams = {
10932 readonly "anthropic-beta"?: string
10933 readonly "anthropic-version"?: string
10934}
10935export const BetaCreateSkillVersionV1SkillsSkillIdVersionsPostParams = Schema.Struct({
10936 "anthropic-beta": Schema.optionalKey(
10937 Schema.String.annotate({
10938 "title": "Anthropic-Beta",
10939 "description":
10940 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10941 })
10942 ),
10943 "anthropic-version": Schema.optionalKey(
10944 Schema.String.annotate({
10945 "title": "Anthropic-Version",
10946 "description":
10947 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10948 })
10949 )
10950})
10951export type BetaCreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData =
10952 BetaBody_create_skill_version_v1_skills__skill_id__versions_post
10953export const BetaCreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData =
10954 BetaBody_create_skill_version_v1_skills__skill_id__versions_post
10955export type BetaCreateSkillVersionV1SkillsSkillIdVersionsPost200 = BetaCreateSkillVersionResponse
10956export const BetaCreateSkillVersionV1SkillsSkillIdVersionsPost200 = BetaCreateSkillVersionResponse
10957export type BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX = BetaErrorResponse
10958export const BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX = BetaErrorResponse
10959export type BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGetParams = {
10960 readonly "anthropic-beta"?: string
10961 readonly "anthropic-version"?: string
10962 readonly "x-api-key"?: string
10963}
10964export const BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGetParams = Schema.Struct({
10965 "anthropic-beta": Schema.optionalKey(
10966 Schema.String.annotate({
10967 "title": "Anthropic-Beta",
10968 "description":
10969 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
10970 })
10971 ),
10972 "anthropic-version": Schema.optionalKey(
10973 Schema.String.annotate({
10974 "title": "Anthropic-Version",
10975 "description":
10976 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
10977 })
10978 ),
10979 "x-api-key": Schema.optionalKey(Schema.String.annotate({
10980 "title": "X-Api-Key",
10981 "description":
10982 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
10983 }))
10984})
10985export type BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet200 = BetaGetSkillVersionResponse
10986export const BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet200 = BetaGetSkillVersionResponse
10987export type BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX = BetaErrorResponse
10988export const BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX = BetaErrorResponse
10989export type BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams = {
10990 readonly "anthropic-beta"?: string
10991 readonly "anthropic-version"?: string
10992 readonly "x-api-key"?: string
10993}
10994export const BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams = Schema.Struct({
10995 "anthropic-beta": Schema.optionalKey(
10996 Schema.String.annotate({
10997 "title": "Anthropic-Beta",
10998 "description":
10999 "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta."
11000 })
11001 ),
11002 "anthropic-version": Schema.optionalKey(
11003 Schema.String.annotate({
11004 "title": "Anthropic-Version",
11005 "description":
11006 "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)."
11007 })
11008 ),
11009 "x-api-key": Schema.optionalKey(Schema.String.annotate({
11010 "title": "X-Api-Key",
11011 "description":
11012 "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace."
11013 }))
11014})
11015export type BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200 = BetaDeleteSkillVersionResponse
11016export const BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200 = BetaDeleteSkillVersionResponse
11017export type BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX = BetaErrorResponse
11018export const BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX = BetaErrorResponse
11019
11020export interface OperationConfig {
11021 /**
11022 * Whether or not the response should be included in the value returned from
11023 * an operation.
11024 *
11025 * If set to `true`, a tuple of `[A, HttpClientResponse]` will be returned,
11026 * where `A` is the success type of the operation.
11027 *
11028 * If set to `false`, only the success type of the operation will be returned.
11029 */
11030 readonly includeResponse?: boolean | undefined
11031}
11032
11033/**
11034 * A utility type which optionally includes the response in the return result
11035 * of an operation based upon the value of the `includeResponse` configuration
11036 * option.
11037 */
11038export type WithOptionalResponse<A, Config extends OperationConfig> = Config extends {
11039 readonly includeResponse: true
11040} ? [A, HttpClientResponse.HttpClientResponse] :
11041 A
11042
11043export const make = (
11044 httpClient: HttpClient.HttpClient,
11045 options: {
11046 readonly transformClient?: ((client: HttpClient.HttpClient) => Effect.Effect<HttpClient.HttpClient>) | undefined
11047 } = {}
11048): AnthropicClient => {
11049 const unexpectedStatus = (response: HttpClientResponse.HttpClientResponse) =>
11050 Effect.flatMap(
11051 Effect.orElseSucceed(response.json, () => "Unexpected status code"),
11052 (description) =>
11053 Effect.fail(
11054 new HttpClientError.HttpClientError({
11055 reason: new HttpClientError.StatusCodeError({
11056 request: response.request,
11057 response,
11058 description: typeof description === "string" ? description : JSON.stringify(description)
11059 })
11060 })
11061 )
11062 )
11063 const withResponse = <Config extends OperationConfig>(config: Config | undefined) =>
11064 (
11065 f: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<any, any>
11066 ): (request: HttpClientRequest.HttpClientRequest) => Effect.Effect<any, any> => {
11067 const withOptionalResponse = (
11068 config?.includeResponse
11069 ? (response: HttpClientResponse.HttpClientResponse) => Effect.map(f(response), (a) => [a, response])
11070 : (response: HttpClientResponse.HttpClientResponse) => f(response)
11071 ) as any
11072 return options?.transformClient
11073 ? (request) =>
11074 Effect.flatMap(
11075 Effect.flatMap(options.transformClient!(httpClient), (client) => client.execute(request)),
11076 withOptionalResponse
11077 )
11078 : (request) => Effect.flatMap(httpClient.execute(request), withOptionalResponse)
11079 }
11080 const binaryRequest = (
11081 request: HttpClientRequest.HttpClientRequest
11082 ): Stream.Stream<Uint8Array, HttpClientError.HttpClientError> =>
11083 HttpClient.filterStatusOk(httpClient).execute(request).pipe(
11084 Effect.map((response) => response.stream),
11085 Stream.unwrap
11086 )
11087 const decodeSuccess =
11088 <Schema extends Schema.Constraint>(schema: Schema) => (response: HttpClientResponse.HttpClientResponse) =>
11089 HttpClientResponse.schemaBodyJson(schema)(response)
11090 const decodeError =
11091 <const Tag extends string, Schema extends Schema.Constraint>(tag: Tag, schema: Schema) =>
11092 (response: HttpClientResponse.HttpClientResponse) =>
11093 Effect.flatMap(
11094 HttpClientResponse.schemaBodyJson(schema)(response),
11095 (cause) => Effect.fail(AnthropicClientError(tag, cause, response))
11096 )
11097 return {
11098 httpClient,
11099 "messagesPost": (options) =>
11100 HttpClientRequest.post(`/v1/messages`).pipe(
11101 HttpClientRequest.setHeaders({ "anthropic-version": options.params?.["anthropic-version"] ?? undefined }),
11102 HttpClientRequest.bodyJsonUnsafe(options.payload),
11103 withResponse(options.config)(HttpClientResponse.matchStatus({
11104 "2xx": decodeSuccess(MessagesPost200),
11105 "4xx": decodeError("MessagesPost4XX", MessagesPost4XX),
11106 orElse: unexpectedStatus
11107 }))
11108 ),
11109 "completePost": (options) =>
11110 HttpClientRequest.post(`/v1/complete`).pipe(
11111 HttpClientRequest.setHeaders({
11112 "anthropic-version": options.params?.["anthropic-version"] ?? undefined,
11113 "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined
11114 }),
11115 HttpClientRequest.bodyJsonUnsafe(options.payload),
11116 withResponse(options.config)(HttpClientResponse.matchStatus({
11117 "2xx": decodeSuccess(CompletePost200),
11118 "4xx": decodeError("CompletePost4XX", CompletePost4XX),
11119 orElse: unexpectedStatus
11120 }))
11121 ),
11122 "modelsList": (options) =>
11123 HttpClientRequest.get(`/v1/models`).pipe(
11124 HttpClientRequest.setUrlParams({
11125 "before_id": options?.params?.["before_id"] as any,
11126 "after_id": options?.params?.["after_id"] as any,
11127 "limit": options?.params?.["limit"] as any
11128 }),
11129 HttpClientRequest.setHeaders({
11130 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11131 "x-api-key": options?.params?.["x-api-key"] ?? undefined,
11132 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined
11133 }),
11134 withResponse(options?.config)(HttpClientResponse.matchStatus({
11135 "2xx": decodeSuccess(ModelsList200),
11136 "4xx": decodeError("ModelsList4XX", ModelsList4XX),
11137 orElse: unexpectedStatus
11138 }))
11139 ),
11140 "modelsGet": (modelId, options) =>
11141 HttpClientRequest.get(`/v1/models/${modelId}`).pipe(
11142 HttpClientRequest.setHeaders({
11143 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11144 "x-api-key": options?.params?.["x-api-key"] ?? undefined,
11145 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined
11146 }),
11147 withResponse(options?.config)(HttpClientResponse.matchStatus({
11148 "2xx": decodeSuccess(ModelsGet200),
11149 "4xx": decodeError("ModelsGet4XX", ModelsGet4XX),
11150 orElse: unexpectedStatus
11151 }))
11152 ),
11153 "messageBatchesList": (options) =>
11154 HttpClientRequest.get(`/v1/messages/batches`).pipe(
11155 HttpClientRequest.setUrlParams({
11156 "before_id": options?.params?.["before_id"] as any,
11157 "after_id": options?.params?.["after_id"] as any,
11158 "limit": options?.params?.["limit"] as any
11159 }),
11160 HttpClientRequest.setHeaders({
11161 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11162 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11163 }),
11164 withResponse(options?.config)(HttpClientResponse.matchStatus({
11165 "2xx": decodeSuccess(MessageBatchesList200),
11166 "4xx": decodeError("MessageBatchesList4XX", MessageBatchesList4XX),
11167 orElse: unexpectedStatus
11168 }))
11169 ),
11170 "messageBatchesPost": (options) =>
11171 HttpClientRequest.post(`/v1/messages/batches`).pipe(
11172 HttpClientRequest.setHeaders({ "anthropic-version": options.params?.["anthropic-version"] ?? undefined }),
11173 HttpClientRequest.bodyJsonUnsafe(options.payload),
11174 withResponse(options.config)(HttpClientResponse.matchStatus({
11175 "2xx": decodeSuccess(MessageBatchesPost200),
11176 "4xx": decodeError("MessageBatchesPost4XX", MessageBatchesPost4XX),
11177 orElse: unexpectedStatus
11178 }))
11179 ),
11180 "messageBatchesRetrieve": (messageBatchId, options) =>
11181 HttpClientRequest.get(`/v1/messages/batches/${messageBatchId}`).pipe(
11182 HttpClientRequest.setHeaders({
11183 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11184 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11185 }),
11186 withResponse(options?.config)(HttpClientResponse.matchStatus({
11187 "2xx": decodeSuccess(MessageBatchesRetrieve200),
11188 "4xx": decodeError("MessageBatchesRetrieve4XX", MessageBatchesRetrieve4XX),
11189 orElse: unexpectedStatus
11190 }))
11191 ),
11192 "messageBatchesDelete": (messageBatchId, options) =>
11193 HttpClientRequest.delete(`/v1/messages/batches/${messageBatchId}`).pipe(
11194 HttpClientRequest.setHeaders({
11195 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11196 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11197 }),
11198 withResponse(options?.config)(HttpClientResponse.matchStatus({
11199 "2xx": decodeSuccess(MessageBatchesDelete200),
11200 "4xx": decodeError("MessageBatchesDelete4XX", MessageBatchesDelete4XX),
11201 orElse: unexpectedStatus
11202 }))
11203 ),
11204 "messageBatchesCancel": (messageBatchId, options) =>
11205 HttpClientRequest.post(`/v1/messages/batches/${messageBatchId}/cancel`).pipe(
11206 HttpClientRequest.setHeaders({ "anthropic-version": options?.params?.["anthropic-version"] ?? undefined }),
11207 withResponse(options?.config)(HttpClientResponse.matchStatus({
11208 "2xx": decodeSuccess(MessageBatchesCancel200),
11209 "4xx": decodeError("MessageBatchesCancel4XX", MessageBatchesCancel4XX),
11210 orElse: unexpectedStatus
11211 }))
11212 ),
11213 "messageBatchesResults": (messageBatchId, options) =>
11214 HttpClientRequest.get(`/v1/messages/batches/${messageBatchId}/results`).pipe(
11215 HttpClientRequest.setHeaders({
11216 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11217 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11218 }),
11219 withResponse(options?.config)(HttpClientResponse.matchStatus({
11220 "4xx": decodeError("MessageBatchesResults4XX", MessageBatchesResults4XX),
11221 orElse: unexpectedStatus
11222 }))
11223 ),
11224 "messagesCountTokensPost": (options) =>
11225 HttpClientRequest.post(`/v1/messages/count_tokens`).pipe(
11226 HttpClientRequest.setHeaders({ "anthropic-version": options.params?.["anthropic-version"] ?? undefined }),
11227 HttpClientRequest.bodyJsonUnsafe(options.payload),
11228 withResponse(options.config)(HttpClientResponse.matchStatus({
11229 "2xx": decodeSuccess(MessagesCountTokensPost200),
11230 "4xx": decodeError("MessagesCountTokensPost4XX", MessagesCountTokensPost4XX),
11231 orElse: unexpectedStatus
11232 }))
11233 ),
11234 "listFilesV1FilesGet": (options) =>
11235 HttpClientRequest.get(`/v1/files`).pipe(
11236 HttpClientRequest.setUrlParams({
11237 "before_id": options?.params?.["before_id"] as any,
11238 "after_id": options?.params?.["after_id"] as any,
11239 "limit": options?.params?.["limit"] as any
11240 }),
11241 HttpClientRequest.setHeaders({
11242 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11243 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11244 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11245 }),
11246 withResponse(options?.config)(HttpClientResponse.matchStatus({
11247 "2xx": decodeSuccess(ListFilesV1FilesGet200),
11248 "4xx": decodeError("ListFilesV1FilesGet4XX", ListFilesV1FilesGet4XX),
11249 orElse: unexpectedStatus
11250 }))
11251 ),
11252 "uploadFileV1FilesPost": (options) =>
11253 HttpClientRequest.post(`/v1/files`).pipe(
11254 HttpClientRequest.setHeaders({
11255 "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
11256 "anthropic-version": options.params?.["anthropic-version"] ?? undefined
11257 }),
11258 HttpClientRequest.bodyFormData(options.payload as any),
11259 withResponse(options.config)(HttpClientResponse.matchStatus({
11260 "2xx": decodeSuccess(UploadFileV1FilesPost200),
11261 "4xx": decodeError("UploadFileV1FilesPost4XX", UploadFileV1FilesPost4XX),
11262 orElse: unexpectedStatus
11263 }))
11264 ),
11265 "getFileMetadataV1FilesFileIdGet": (fileId, options) =>
11266 HttpClientRequest.get(`/v1/files/${fileId}`).pipe(
11267 HttpClientRequest.setHeaders({
11268 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11269 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11270 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11271 }),
11272 withResponse(options?.config)(HttpClientResponse.matchStatus({
11273 "2xx": decodeSuccess(GetFileMetadataV1FilesFileIdGet200),
11274 "4xx": decodeError("GetFileMetadataV1FilesFileIdGet4XX", GetFileMetadataV1FilesFileIdGet4XX),
11275 orElse: unexpectedStatus
11276 }))
11277 ),
11278 "deleteFileV1FilesFileIdDelete": (fileId, options) =>
11279 HttpClientRequest.delete(`/v1/files/${fileId}`).pipe(
11280 HttpClientRequest.setHeaders({
11281 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11282 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11283 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11284 }),
11285 withResponse(options?.config)(HttpClientResponse.matchStatus({
11286 "2xx": decodeSuccess(DeleteFileV1FilesFileIdDelete200),
11287 "4xx": decodeError("DeleteFileV1FilesFileIdDelete4XX", DeleteFileV1FilesFileIdDelete4XX),
11288 orElse: unexpectedStatus
11289 }))
11290 ),
11291 "downloadFileV1FilesFileIdContentGet": (fileId, options) =>
11292 HttpClientRequest.get(`/v1/files/${fileId}/content`).pipe(
11293 HttpClientRequest.setHeaders({
11294 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11295 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11296 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11297 }),
11298 withResponse(options?.config)(HttpClientResponse.matchStatus({
11299 orElse: unexpectedStatus
11300 }))
11301 ),
11302 "downloadFileV1FilesFileIdContentGetStream": (fileId, options) =>
11303 HttpClientRequest.get(`/v1/files/${fileId}/content`).pipe(
11304 HttpClientRequest.setHeaders({
11305 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11306 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11307 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11308 }),
11309 binaryRequest
11310 ),
11311 "listSkillsV1SkillsGet": (options) =>
11312 HttpClientRequest.get(`/v1/skills`).pipe(
11313 HttpClientRequest.setUrlParams({
11314 "page": options?.params?.["page"] as any,
11315 "limit": options?.params?.["limit"] as any,
11316 "source": options?.params?.["source"] as any
11317 }),
11318 HttpClientRequest.setHeaders({
11319 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11320 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11321 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11322 }),
11323 withResponse(options?.config)(HttpClientResponse.matchStatus({
11324 "2xx": decodeSuccess(ListSkillsV1SkillsGet200),
11325 "4xx": decodeError("ListSkillsV1SkillsGet4XX", ListSkillsV1SkillsGet4XX),
11326 orElse: unexpectedStatus
11327 }))
11328 ),
11329 "createSkillV1SkillsPost": (options) =>
11330 HttpClientRequest.post(`/v1/skills`).pipe(
11331 HttpClientRequest.setHeaders({
11332 "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
11333 "anthropic-version": options.params?.["anthropic-version"] ?? undefined
11334 }),
11335 HttpClientRequest.bodyFormData(options.payload as any),
11336 withResponse(options.config)(HttpClientResponse.matchStatus({
11337 "2xx": decodeSuccess(CreateSkillV1SkillsPost200),
11338 "4xx": decodeError("CreateSkillV1SkillsPost4XX", CreateSkillV1SkillsPost4XX),
11339 orElse: unexpectedStatus
11340 }))
11341 ),
11342 "getSkillV1SkillsSkillIdGet": (skillId, options) =>
11343 HttpClientRequest.get(`/v1/skills/${skillId}`).pipe(
11344 HttpClientRequest.setHeaders({
11345 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11346 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11347 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11348 }),
11349 withResponse(options?.config)(HttpClientResponse.matchStatus({
11350 "2xx": decodeSuccess(GetSkillV1SkillsSkillIdGet200),
11351 "4xx": decodeError("GetSkillV1SkillsSkillIdGet4XX", GetSkillV1SkillsSkillIdGet4XX),
11352 orElse: unexpectedStatus
11353 }))
11354 ),
11355 "deleteSkillV1SkillsSkillIdDelete": (skillId, options) =>
11356 HttpClientRequest.delete(`/v1/skills/${skillId}`).pipe(
11357 HttpClientRequest.setHeaders({
11358 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11359 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11360 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11361 }),
11362 withResponse(options?.config)(HttpClientResponse.matchStatus({
11363 "2xx": decodeSuccess(DeleteSkillV1SkillsSkillIdDelete200),
11364 "4xx": decodeError("DeleteSkillV1SkillsSkillIdDelete4XX", DeleteSkillV1SkillsSkillIdDelete4XX),
11365 orElse: unexpectedStatus
11366 }))
11367 ),
11368 "listSkillVersionsV1SkillsSkillIdVersionsGet": (skillId, options) =>
11369 HttpClientRequest.get(`/v1/skills/${skillId}/versions`).pipe(
11370 HttpClientRequest.setUrlParams({
11371 "page": options?.params?.["page"] as any,
11372 "limit": options?.params?.["limit"] as any
11373 }),
11374 HttpClientRequest.setHeaders({
11375 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11376 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11377 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11378 }),
11379 withResponse(options?.config)(HttpClientResponse.matchStatus({
11380 "2xx": decodeSuccess(ListSkillVersionsV1SkillsSkillIdVersionsGet200),
11381 "4xx": decodeError(
11382 "ListSkillVersionsV1SkillsSkillIdVersionsGet4XX",
11383 ListSkillVersionsV1SkillsSkillIdVersionsGet4XX
11384 ),
11385 orElse: unexpectedStatus
11386 }))
11387 ),
11388 "createSkillVersionV1SkillsSkillIdVersionsPost": (skillId, options) =>
11389 HttpClientRequest.post(`/v1/skills/${skillId}/versions`).pipe(
11390 HttpClientRequest.setHeaders({
11391 "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
11392 "anthropic-version": options.params?.["anthropic-version"] ?? undefined
11393 }),
11394 HttpClientRequest.bodyFormData(options.payload as any),
11395 withResponse(options.config)(HttpClientResponse.matchStatus({
11396 "2xx": decodeSuccess(CreateSkillVersionV1SkillsSkillIdVersionsPost200),
11397 "4xx": decodeError(
11398 "CreateSkillVersionV1SkillsSkillIdVersionsPost4XX",
11399 CreateSkillVersionV1SkillsSkillIdVersionsPost4XX
11400 ),
11401 orElse: unexpectedStatus
11402 }))
11403 ),
11404 "getSkillVersionV1SkillsSkillIdVersionsVersionGet": (skillId, version, options) =>
11405 HttpClientRequest.get(`/v1/skills/${skillId}/versions/${version}`).pipe(
11406 HttpClientRequest.setHeaders({
11407 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11408 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11409 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11410 }),
11411 withResponse(options?.config)(HttpClientResponse.matchStatus({
11412 "2xx": decodeSuccess(GetSkillVersionV1SkillsSkillIdVersionsVersionGet200),
11413 "4xx": decodeError(
11414 "GetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX",
11415 GetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX
11416 ),
11417 orElse: unexpectedStatus
11418 }))
11419 ),
11420 "deleteSkillVersionV1SkillsSkillIdVersionsVersionDelete": (skillId, version, options) =>
11421 HttpClientRequest.delete(`/v1/skills/${skillId}/versions/${version}`).pipe(
11422 HttpClientRequest.setHeaders({
11423 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11424 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11425 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11426 }),
11427 withResponse(options?.config)(HttpClientResponse.matchStatus({
11428 "2xx": decodeSuccess(DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200),
11429 "4xx": decodeError(
11430 "DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX",
11431 DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX
11432 ),
11433 orElse: unexpectedStatus
11434 }))
11435 ),
11436 "betaMessagesPost": (options) =>
11437 HttpClientRequest.post(`/v1/messages?beta=true`).pipe(
11438 HttpClientRequest.setHeaders({
11439 "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
11440 "anthropic-version": options.params?.["anthropic-version"] ?? undefined
11441 }),
11442 HttpClientRequest.bodyJsonUnsafe(options.payload),
11443 withResponse(options.config)(HttpClientResponse.matchStatus({
11444 "2xx": decodeSuccess(BetaMessagesPost200),
11445 "4xx": decodeError("BetaMessagesPost4XX", BetaMessagesPost4XX),
11446 orElse: unexpectedStatus
11447 }))
11448 ),
11449 "betaModelsList": (options) =>
11450 HttpClientRequest.get(`/v1/models?beta=true`).pipe(
11451 HttpClientRequest.setUrlParams({
11452 "before_id": options?.params?.["before_id"] as any,
11453 "after_id": options?.params?.["after_id"] as any,
11454 "limit": options?.params?.["limit"] as any
11455 }),
11456 HttpClientRequest.setHeaders({
11457 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11458 "x-api-key": options?.params?.["x-api-key"] ?? undefined,
11459 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined
11460 }),
11461 withResponse(options?.config)(HttpClientResponse.matchStatus({
11462 "2xx": decodeSuccess(BetaModelsList200),
11463 "4xx": decodeError("BetaModelsList4XX", BetaModelsList4XX),
11464 orElse: unexpectedStatus
11465 }))
11466 ),
11467 "betaModelsGet": (modelId, options) =>
11468 HttpClientRequest.get(`/v1/models/${modelId}?beta=true`).pipe(
11469 HttpClientRequest.setHeaders({
11470 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11471 "x-api-key": options?.params?.["x-api-key"] ?? undefined,
11472 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined
11473 }),
11474 withResponse(options?.config)(HttpClientResponse.matchStatus({
11475 "2xx": decodeSuccess(BetaModelsGet200),
11476 "4xx": decodeError("BetaModelsGet4XX", BetaModelsGet4XX),
11477 orElse: unexpectedStatus
11478 }))
11479 ),
11480 "betaMessageBatchesList": (options) =>
11481 HttpClientRequest.get(`/v1/messages/batches?beta=true`).pipe(
11482 HttpClientRequest.setUrlParams({
11483 "before_id": options?.params?.["before_id"] as any,
11484 "after_id": options?.params?.["after_id"] as any,
11485 "limit": options?.params?.["limit"] as any
11486 }),
11487 HttpClientRequest.setHeaders({
11488 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11489 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11490 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11491 }),
11492 withResponse(options?.config)(HttpClientResponse.matchStatus({
11493 "2xx": decodeSuccess(BetaMessageBatchesList200),
11494 "4xx": decodeError("BetaMessageBatchesList4XX", BetaMessageBatchesList4XX),
11495 orElse: unexpectedStatus
11496 }))
11497 ),
11498 "betaMessageBatchesPost": (options) =>
11499 HttpClientRequest.post(`/v1/messages/batches?beta=true`).pipe(
11500 HttpClientRequest.setHeaders({
11501 "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
11502 "anthropic-version": options.params?.["anthropic-version"] ?? undefined
11503 }),
11504 HttpClientRequest.bodyJsonUnsafe(options.payload),
11505 withResponse(options.config)(HttpClientResponse.matchStatus({
11506 "2xx": decodeSuccess(BetaMessageBatchesPost200),
11507 "4xx": decodeError("BetaMessageBatchesPost4XX", BetaMessageBatchesPost4XX),
11508 orElse: unexpectedStatus
11509 }))
11510 ),
11511 "betaMessageBatchesRetrieve": (messageBatchId, options) =>
11512 HttpClientRequest.get(`/v1/messages/batches/${messageBatchId}?beta=true`).pipe(
11513 HttpClientRequest.setHeaders({
11514 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11515 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11516 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11517 }),
11518 withResponse(options?.config)(HttpClientResponse.matchStatus({
11519 "2xx": decodeSuccess(BetaMessageBatchesRetrieve200),
11520 "4xx": decodeError("BetaMessageBatchesRetrieve4XX", BetaMessageBatchesRetrieve4XX),
11521 orElse: unexpectedStatus
11522 }))
11523 ),
11524 "betaMessageBatchesDelete": (messageBatchId, options) =>
11525 HttpClientRequest.delete(`/v1/messages/batches/${messageBatchId}?beta=true`).pipe(
11526 HttpClientRequest.setHeaders({
11527 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11528 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11529 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11530 }),
11531 withResponse(options?.config)(HttpClientResponse.matchStatus({
11532 "2xx": decodeSuccess(BetaMessageBatchesDelete200),
11533 "4xx": decodeError("BetaMessageBatchesDelete4XX", BetaMessageBatchesDelete4XX),
11534 orElse: unexpectedStatus
11535 }))
11536 ),
11537 "betaMessageBatchesCancel": (messageBatchId, options) =>
11538 HttpClientRequest.post(`/v1/messages/batches/${messageBatchId}/cancel?beta=true`).pipe(
11539 HttpClientRequest.setHeaders({
11540 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11541 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined
11542 }),
11543 withResponse(options?.config)(HttpClientResponse.matchStatus({
11544 "2xx": decodeSuccess(BetaMessageBatchesCancel200),
11545 "4xx": decodeError("BetaMessageBatchesCancel4XX", BetaMessageBatchesCancel4XX),
11546 orElse: unexpectedStatus
11547 }))
11548 ),
11549 "betaMessageBatchesResults": (messageBatchId, options) =>
11550 HttpClientRequest.get(`/v1/messages/batches/${messageBatchId}/results?beta=true`).pipe(
11551 HttpClientRequest.setHeaders({
11552 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11553 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11554 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11555 }),
11556 withResponse(options?.config)(HttpClientResponse.matchStatus({
11557 "4xx": decodeError("BetaMessageBatchesResults4XX", BetaMessageBatchesResults4XX),
11558 orElse: unexpectedStatus
11559 }))
11560 ),
11561 "betaMessagesCountTokensPost": (options) =>
11562 HttpClientRequest.post(`/v1/messages/count_tokens?beta=true`).pipe(
11563 HttpClientRequest.setHeaders({
11564 "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
11565 "anthropic-version": options.params?.["anthropic-version"] ?? undefined
11566 }),
11567 HttpClientRequest.bodyJsonUnsafe(options.payload),
11568 withResponse(options.config)(HttpClientResponse.matchStatus({
11569 "2xx": decodeSuccess(BetaMessagesCountTokensPost200),
11570 "4xx": decodeError("BetaMessagesCountTokensPost4XX", BetaMessagesCountTokensPost4XX),
11571 orElse: unexpectedStatus
11572 }))
11573 ),
11574 "betaListFilesV1FilesGet": (options) =>
11575 HttpClientRequest.get(`/v1/files?beta=true`).pipe(
11576 HttpClientRequest.setUrlParams({
11577 "before_id": options?.params?.["before_id"] as any,
11578 "after_id": options?.params?.["after_id"] as any,
11579 "limit": options?.params?.["limit"] as any
11580 }),
11581 HttpClientRequest.setHeaders({
11582 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11583 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11584 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11585 }),
11586 withResponse(options?.config)(HttpClientResponse.matchStatus({
11587 "2xx": decodeSuccess(BetaListFilesV1FilesGet200),
11588 "4xx": decodeError("BetaListFilesV1FilesGet4XX", BetaListFilesV1FilesGet4XX),
11589 orElse: unexpectedStatus
11590 }))
11591 ),
11592 "betaUploadFileV1FilesPost": (options) =>
11593 HttpClientRequest.post(`/v1/files?beta=true`).pipe(
11594 HttpClientRequest.setHeaders({
11595 "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
11596 "anthropic-version": options.params?.["anthropic-version"] ?? undefined
11597 }),
11598 HttpClientRequest.bodyFormData(options.payload as any),
11599 withResponse(options.config)(HttpClientResponse.matchStatus({
11600 "2xx": decodeSuccess(BetaUploadFileV1FilesPost200),
11601 "4xx": decodeError("BetaUploadFileV1FilesPost4XX", BetaUploadFileV1FilesPost4XX),
11602 orElse: unexpectedStatus
11603 }))
11604 ),
11605 "betaGetFileMetadataV1FilesFileIdGet": (fileId, options) =>
11606 HttpClientRequest.get(`/v1/files/${fileId}?beta=true`).pipe(
11607 HttpClientRequest.setHeaders({
11608 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11609 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11610 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11611 }),
11612 withResponse(options?.config)(HttpClientResponse.matchStatus({
11613 "2xx": decodeSuccess(BetaGetFileMetadataV1FilesFileIdGet200),
11614 "4xx": decodeError("BetaGetFileMetadataV1FilesFileIdGet4XX", BetaGetFileMetadataV1FilesFileIdGet4XX),
11615 orElse: unexpectedStatus
11616 }))
11617 ),
11618 "betaDeleteFileV1FilesFileIdDelete": (fileId, options) =>
11619 HttpClientRequest.delete(`/v1/files/${fileId}?beta=true`).pipe(
11620 HttpClientRequest.setHeaders({
11621 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11622 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11623 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11624 }),
11625 withResponse(options?.config)(HttpClientResponse.matchStatus({
11626 "2xx": decodeSuccess(BetaDeleteFileV1FilesFileIdDelete200),
11627 "4xx": decodeError("BetaDeleteFileV1FilesFileIdDelete4XX", BetaDeleteFileV1FilesFileIdDelete4XX),
11628 orElse: unexpectedStatus
11629 }))
11630 ),
11631 "betaDownloadFileV1FilesFileIdContentGet": (fileId, options) =>
11632 HttpClientRequest.get(`/v1/files/${fileId}/content?beta=true`).pipe(
11633 HttpClientRequest.setHeaders({
11634 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11635 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11636 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11637 }),
11638 withResponse(options?.config)(HttpClientResponse.matchStatus({
11639 orElse: unexpectedStatus
11640 }))
11641 ),
11642 "betaDownloadFileV1FilesFileIdContentGetStream": (fileId, options) =>
11643 HttpClientRequest.get(`/v1/files/${fileId}/content?beta=true`).pipe(
11644 HttpClientRequest.setHeaders({
11645 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11646 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11647 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11648 }),
11649 binaryRequest
11650 ),
11651 "betaListSkillsV1SkillsGet": (options) =>
11652 HttpClientRequest.get(`/v1/skills?beta=true`).pipe(
11653 HttpClientRequest.setUrlParams({
11654 "page": options?.params?.["page"] as any,
11655 "limit": options?.params?.["limit"] as any,
11656 "source": options?.params?.["source"] as any
11657 }),
11658 HttpClientRequest.setHeaders({
11659 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11660 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11661 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11662 }),
11663 withResponse(options?.config)(HttpClientResponse.matchStatus({
11664 "2xx": decodeSuccess(BetaListSkillsV1SkillsGet200),
11665 "4xx": decodeError("BetaListSkillsV1SkillsGet4XX", BetaListSkillsV1SkillsGet4XX),
11666 orElse: unexpectedStatus
11667 }))
11668 ),
11669 "betaCreateSkillV1SkillsPost": (options) =>
11670 HttpClientRequest.post(`/v1/skills?beta=true`).pipe(
11671 HttpClientRequest.setHeaders({
11672 "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
11673 "anthropic-version": options.params?.["anthropic-version"] ?? undefined
11674 }),
11675 HttpClientRequest.bodyFormData(options.payload as any),
11676 withResponse(options.config)(HttpClientResponse.matchStatus({
11677 "2xx": decodeSuccess(BetaCreateSkillV1SkillsPost200),
11678 "4xx": decodeError("BetaCreateSkillV1SkillsPost4XX", BetaCreateSkillV1SkillsPost4XX),
11679 orElse: unexpectedStatus
11680 }))
11681 ),
11682 "betaGetSkillV1SkillsSkillIdGet": (skillId, options) =>
11683 HttpClientRequest.get(`/v1/skills/${skillId}?beta=true`).pipe(
11684 HttpClientRequest.setHeaders({
11685 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11686 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11687 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11688 }),
11689 withResponse(options?.config)(HttpClientResponse.matchStatus({
11690 "2xx": decodeSuccess(BetaGetSkillV1SkillsSkillIdGet200),
11691 "4xx": decodeError("BetaGetSkillV1SkillsSkillIdGet4XX", BetaGetSkillV1SkillsSkillIdGet4XX),
11692 orElse: unexpectedStatus
11693 }))
11694 ),
11695 "betaDeleteSkillV1SkillsSkillIdDelete": (skillId, options) =>
11696 HttpClientRequest.delete(`/v1/skills/${skillId}?beta=true`).pipe(
11697 HttpClientRequest.setHeaders({
11698 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11699 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11700 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11701 }),
11702 withResponse(options?.config)(HttpClientResponse.matchStatus({
11703 "2xx": decodeSuccess(BetaDeleteSkillV1SkillsSkillIdDelete200),
11704 "4xx": decodeError("BetaDeleteSkillV1SkillsSkillIdDelete4XX", BetaDeleteSkillV1SkillsSkillIdDelete4XX),
11705 orElse: unexpectedStatus
11706 }))
11707 ),
11708 "betaListSkillVersionsV1SkillsSkillIdVersionsGet": (skillId, options) =>
11709 HttpClientRequest.get(`/v1/skills/${skillId}/versions?beta=true`).pipe(
11710 HttpClientRequest.setUrlParams({
11711 "page": options?.params?.["page"] as any,
11712 "limit": options?.params?.["limit"] as any
11713 }),
11714 HttpClientRequest.setHeaders({
11715 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11716 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11717 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11718 }),
11719 withResponse(options?.config)(HttpClientResponse.matchStatus({
11720 "2xx": decodeSuccess(BetaListSkillVersionsV1SkillsSkillIdVersionsGet200),
11721 "4xx": decodeError(
11722 "BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX",
11723 BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX
11724 ),
11725 orElse: unexpectedStatus
11726 }))
11727 ),
11728 "betaCreateSkillVersionV1SkillsSkillIdVersionsPost": (skillId, options) =>
11729 HttpClientRequest.post(`/v1/skills/${skillId}/versions?beta=true`).pipe(
11730 HttpClientRequest.setHeaders({
11731 "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined,
11732 "anthropic-version": options.params?.["anthropic-version"] ?? undefined
11733 }),
11734 HttpClientRequest.bodyFormData(options.payload as any),
11735 withResponse(options.config)(HttpClientResponse.matchStatus({
11736 "2xx": decodeSuccess(BetaCreateSkillVersionV1SkillsSkillIdVersionsPost200),
11737 "4xx": decodeError(
11738 "BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX",
11739 BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX
11740 ),
11741 orElse: unexpectedStatus
11742 }))
11743 ),
11744 "betaGetSkillVersionV1SkillsSkillIdVersionsVersionGet": (skillId, version, options) =>
11745 HttpClientRequest.get(`/v1/skills/${skillId}/versions/${version}?beta=true`).pipe(
11746 HttpClientRequest.setHeaders({
11747 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11748 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11749 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11750 }),
11751 withResponse(options?.config)(HttpClientResponse.matchStatus({
11752 "2xx": decodeSuccess(BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet200),
11753 "4xx": decodeError(
11754 "BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX",
11755 BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX
11756 ),
11757 orElse: unexpectedStatus
11758 }))
11759 ),
11760 "betaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete": (skillId, version, options) =>
11761 HttpClientRequest.delete(`/v1/skills/${skillId}/versions/${version}?beta=true`).pipe(
11762 HttpClientRequest.setHeaders({
11763 "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
11764 "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
11765 "x-api-key": options?.params?.["x-api-key"] ?? undefined
11766 }),
11767 withResponse(options?.config)(HttpClientResponse.matchStatus({
11768 "2xx": decodeSuccess(BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200),
11769 "4xx": decodeError(
11770 "BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX",
11771 BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX
11772 ),
11773 orElse: unexpectedStatus
11774 }))
11775 )
11776 }
11777}
11778
11779export interface AnthropicClient {
11780 readonly httpClient: HttpClient.HttpClient
11781 /**
11782 * Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
11783 *
11784 * The Messages API can be used for either single queries or stateless multi-turn conversations.
11785 *
11786 * Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup)
11787 */
11788 readonly "messagesPost": <Config extends OperationConfig>(
11789 options: {
11790 readonly params?: typeof MessagesPostParams.Encoded | undefined
11791 readonly payload: typeof MessagesPostRequestJson.Encoded
11792 readonly config?: Config | undefined
11793 }
11794 ) => Effect.Effect<
11795 WithOptionalResponse<typeof MessagesPost200.Type, Config>,
11796 HttpClientError.HttpClientError | SchemaError | AnthropicClientError<"MessagesPost4XX", typeof MessagesPost4XX.Type>
11797 >
11798 /**
11799 * [Legacy] Create a Text Completion.
11800 *
11801 * The Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.claude.com/en/api/messages) going forward.
11802 *
11803 * Future models and features will not be compatible with Text Completions. See our [migration guide](https://docs.claude.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages.
11804 */
11805 readonly "completePost": <Config extends OperationConfig>(
11806 options: {
11807 readonly params?: typeof CompletePostParams.Encoded | undefined
11808 readonly payload: typeof CompletePostRequestJson.Encoded
11809 readonly config?: Config | undefined
11810 }
11811 ) => Effect.Effect<
11812 WithOptionalResponse<typeof CompletePost200.Type, Config>,
11813 HttpClientError.HttpClientError | SchemaError | AnthropicClientError<"CompletePost4XX", typeof CompletePost4XX.Type>
11814 >
11815 /**
11816 * List available models.
11817 *
11818 * The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first.
11819 */
11820 readonly "modelsList": <Config extends OperationConfig>(
11821 options:
11822 | { readonly params?: typeof ModelsListParams.Encoded | undefined; readonly config?: Config | undefined }
11823 | undefined
11824 ) => Effect.Effect<
11825 WithOptionalResponse<typeof ModelsList200.Type, Config>,
11826 HttpClientError.HttpClientError | SchemaError | AnthropicClientError<"ModelsList4XX", typeof ModelsList4XX.Type>
11827 >
11828 /**
11829 * Get a specific model.
11830 *
11831 * The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID.
11832 */
11833 readonly "modelsGet": <Config extends OperationConfig>(
11834 modelId: string,
11835 options:
11836 | { readonly params?: typeof ModelsGetParams.Encoded | undefined; readonly config?: Config | undefined }
11837 | undefined
11838 ) => Effect.Effect<
11839 WithOptionalResponse<typeof ModelsGet200.Type, Config>,
11840 HttpClientError.HttpClientError | SchemaError | AnthropicClientError<"ModelsGet4XX", typeof ModelsGet4XX.Type>
11841 >
11842 /**
11843 * List all Message Batches within a Workspace. Most recently created batches are returned first.
11844 *
11845 * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
11846 */
11847 readonly "messageBatchesList": <Config extends OperationConfig>(
11848 options: {
11849 readonly params?: typeof MessageBatchesListParams.Encoded | undefined
11850 readonly config?: Config | undefined
11851 } | undefined
11852 ) => Effect.Effect<
11853 WithOptionalResponse<typeof MessageBatchesList200.Type, Config>,
11854 | HttpClientError.HttpClientError
11855 | SchemaError
11856 | AnthropicClientError<"MessageBatchesList4XX", typeof MessageBatchesList4XX.Type>
11857 >
11858 /**
11859 * Send a batch of Message creation requests.
11860 *
11861 * The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete.
11862 *
11863 * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
11864 */
11865 readonly "messageBatchesPost": <Config extends OperationConfig>(
11866 options: {
11867 readonly params?: typeof MessageBatchesPostParams.Encoded | undefined
11868 readonly payload: typeof MessageBatchesPostRequestJson.Encoded
11869 readonly config?: Config | undefined
11870 }
11871 ) => Effect.Effect<
11872 WithOptionalResponse<typeof MessageBatchesPost200.Type, Config>,
11873 | HttpClientError.HttpClientError
11874 | SchemaError
11875 | AnthropicClientError<"MessageBatchesPost4XX", typeof MessageBatchesPost4XX.Type>
11876 >
11877 /**
11878 * This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response.
11879 *
11880 * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
11881 */
11882 readonly "messageBatchesRetrieve": <Config extends OperationConfig>(
11883 messageBatchId: string,
11884 options: {
11885 readonly params?: typeof MessageBatchesRetrieveParams.Encoded | undefined
11886 readonly config?: Config | undefined
11887 } | undefined
11888 ) => Effect.Effect<
11889 WithOptionalResponse<typeof MessageBatchesRetrieve200.Type, Config>,
11890 | HttpClientError.HttpClientError
11891 | SchemaError
11892 | AnthropicClientError<"MessageBatchesRetrieve4XX", typeof MessageBatchesRetrieve4XX.Type>
11893 >
11894 /**
11895 * Delete a Message Batch.
11896 *
11897 * Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it.
11898 *
11899 * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
11900 */
11901 readonly "messageBatchesDelete": <Config extends OperationConfig>(
11902 messageBatchId: string,
11903 options: {
11904 readonly params?: typeof MessageBatchesDeleteParams.Encoded | undefined
11905 readonly config?: Config | undefined
11906 } | undefined
11907 ) => Effect.Effect<
11908 WithOptionalResponse<typeof MessageBatchesDelete200.Type, Config>,
11909 | HttpClientError.HttpClientError
11910 | SchemaError
11911 | AnthropicClientError<"MessageBatchesDelete4XX", typeof MessageBatchesDelete4XX.Type>
11912 >
11913 /**
11914 * Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.
11915 *
11916 * The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible.
11917 *
11918 * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
11919 */
11920 readonly "messageBatchesCancel": <Config extends OperationConfig>(
11921 messageBatchId: string,
11922 options: {
11923 readonly params?: typeof MessageBatchesCancelParams.Encoded | undefined
11924 readonly config?: Config | undefined
11925 } | undefined
11926 ) => Effect.Effect<
11927 WithOptionalResponse<typeof MessageBatchesCancel200.Type, Config>,
11928 | HttpClientError.HttpClientError
11929 | SchemaError
11930 | AnthropicClientError<"MessageBatchesCancel4XX", typeof MessageBatchesCancel4XX.Type>
11931 >
11932 /**
11933 * Streams the results of a Message Batch as a `.jsonl` file.
11934 *
11935 * Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.
11936 *
11937 * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
11938 */
11939 readonly "messageBatchesResults": <Config extends OperationConfig>(
11940 messageBatchId: string,
11941 options: {
11942 readonly params?: typeof MessageBatchesResultsParams.Encoded | undefined
11943 readonly config?: Config | undefined
11944 } | undefined
11945 ) => Effect.Effect<
11946 WithOptionalResponse<void, Config>,
11947 | HttpClientError.HttpClientError
11948 | SchemaError
11949 | AnthropicClientError<"MessageBatchesResults4XX", typeof MessageBatchesResults4XX.Type>
11950 >
11951 /**
11952 * Count the number of tokens in a Message.
11953 *
11954 * The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it.
11955 *
11956 * Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)
11957 */
11958 readonly "messagesCountTokensPost": <Config extends OperationConfig>(
11959 options: {
11960 readonly params?: typeof MessagesCountTokensPostParams.Encoded | undefined
11961 readonly payload: typeof MessagesCountTokensPostRequestJson.Encoded
11962 readonly config?: Config | undefined
11963 }
11964 ) => Effect.Effect<
11965 WithOptionalResponse<typeof MessagesCountTokensPost200.Type, Config>,
11966 | HttpClientError.HttpClientError
11967 | SchemaError
11968 | AnthropicClientError<"MessagesCountTokensPost4XX", typeof MessagesCountTokensPost4XX.Type>
11969 >
11970 /**
11971 * List Files
11972 */
11973 readonly "listFilesV1FilesGet": <Config extends OperationConfig>(
11974 options: {
11975 readonly params?: typeof ListFilesV1FilesGetParams.Encoded | undefined
11976 readonly config?: Config | undefined
11977 } | undefined
11978 ) => Effect.Effect<
11979 WithOptionalResponse<typeof ListFilesV1FilesGet200.Type, Config>,
11980 | HttpClientError.HttpClientError
11981 | SchemaError
11982 | AnthropicClientError<"ListFilesV1FilesGet4XX", typeof ListFilesV1FilesGet4XX.Type>
11983 >
11984 /**
11985 * Upload File
11986 */
11987 readonly "uploadFileV1FilesPost": <Config extends OperationConfig>(
11988 options: {
11989 readonly params?: typeof UploadFileV1FilesPostParams.Encoded | undefined
11990 readonly payload: typeof UploadFileV1FilesPostRequestFormData.Encoded
11991 readonly config?: Config | undefined
11992 }
11993 ) => Effect.Effect<
11994 WithOptionalResponse<typeof UploadFileV1FilesPost200.Type, Config>,
11995 | HttpClientError.HttpClientError
11996 | SchemaError
11997 | AnthropicClientError<"UploadFileV1FilesPost4XX", typeof UploadFileV1FilesPost4XX.Type>
11998 >
11999 /**
12000 * Get File Metadata
12001 */
12002 readonly "getFileMetadataV1FilesFileIdGet": <Config extends OperationConfig>(
12003 fileId: string,
12004 options: {
12005 readonly params?: typeof GetFileMetadataV1FilesFileIdGetParams.Encoded | undefined
12006 readonly config?: Config | undefined
12007 } | undefined
12008 ) => Effect.Effect<
12009 WithOptionalResponse<typeof GetFileMetadataV1FilesFileIdGet200.Type, Config>,
12010 | HttpClientError.HttpClientError
12011 | SchemaError
12012 | AnthropicClientError<"GetFileMetadataV1FilesFileIdGet4XX", typeof GetFileMetadataV1FilesFileIdGet4XX.Type>
12013 >
12014 /**
12015 * Delete File
12016 */
12017 readonly "deleteFileV1FilesFileIdDelete": <Config extends OperationConfig>(
12018 fileId: string,
12019 options: {
12020 readonly params?: typeof DeleteFileV1FilesFileIdDeleteParams.Encoded | undefined
12021 readonly config?: Config | undefined
12022 } | undefined
12023 ) => Effect.Effect<
12024 WithOptionalResponse<typeof DeleteFileV1FilesFileIdDelete200.Type, Config>,
12025 | HttpClientError.HttpClientError
12026 | SchemaError
12027 | AnthropicClientError<"DeleteFileV1FilesFileIdDelete4XX", typeof DeleteFileV1FilesFileIdDelete4XX.Type>
12028 >
12029 /**
12030 * Download File
12031 */
12032 readonly "downloadFileV1FilesFileIdContentGet": <Config extends OperationConfig>(
12033 fileId: string,
12034 options: {
12035 readonly params?: typeof DownloadFileV1FilesFileIdContentGetParams.Encoded | undefined
12036 readonly config?: Config | undefined
12037 } | undefined
12038 ) => Effect.Effect<WithOptionalResponse<void, Config>, HttpClientError.HttpClientError | SchemaError>
12039 /**
12040 * Download File
12041 */
12042 readonly "downloadFileV1FilesFileIdContentGetStream": (
12043 fileId: string,
12044 options: { readonly params?: typeof DownloadFileV1FilesFileIdContentGetParams.Encoded | undefined } | undefined
12045 ) => Stream.Stream<Uint8Array, HttpClientError.HttpClientError>
12046 /**
12047 * List Skills
12048 */
12049 readonly "listSkillsV1SkillsGet": <Config extends OperationConfig>(
12050 options: {
12051 readonly params?: typeof ListSkillsV1SkillsGetParams.Encoded | undefined
12052 readonly config?: Config | undefined
12053 } | undefined
12054 ) => Effect.Effect<
12055 WithOptionalResponse<typeof ListSkillsV1SkillsGet200.Type, Config>,
12056 | HttpClientError.HttpClientError
12057 | SchemaError
12058 | AnthropicClientError<"ListSkillsV1SkillsGet4XX", typeof ListSkillsV1SkillsGet4XX.Type>
12059 >
12060 /**
12061 * Create Skill
12062 */
12063 readonly "createSkillV1SkillsPost": <Config extends OperationConfig>(
12064 options: {
12065 readonly params?: typeof CreateSkillV1SkillsPostParams.Encoded | undefined
12066 readonly payload: typeof CreateSkillV1SkillsPostRequestFormData.Encoded
12067 readonly config?: Config | undefined
12068 }
12069 ) => Effect.Effect<
12070 WithOptionalResponse<typeof CreateSkillV1SkillsPost200.Type, Config>,
12071 | HttpClientError.HttpClientError
12072 | SchemaError
12073 | AnthropicClientError<"CreateSkillV1SkillsPost4XX", typeof CreateSkillV1SkillsPost4XX.Type>
12074 >
12075 /**
12076 * Get Skill
12077 */
12078 readonly "getSkillV1SkillsSkillIdGet": <Config extends OperationConfig>(
12079 skillId: string,
12080 options: {
12081 readonly params?: typeof GetSkillV1SkillsSkillIdGetParams.Encoded | undefined
12082 readonly config?: Config | undefined
12083 } | undefined
12084 ) => Effect.Effect<
12085 WithOptionalResponse<typeof GetSkillV1SkillsSkillIdGet200.Type, Config>,
12086 | HttpClientError.HttpClientError
12087 | SchemaError
12088 | AnthropicClientError<"GetSkillV1SkillsSkillIdGet4XX", typeof GetSkillV1SkillsSkillIdGet4XX.Type>
12089 >
12090 /**
12091 * Delete Skill
12092 */
12093 readonly "deleteSkillV1SkillsSkillIdDelete": <Config extends OperationConfig>(
12094 skillId: string,
12095 options: {
12096 readonly params?: typeof DeleteSkillV1SkillsSkillIdDeleteParams.Encoded | undefined
12097 readonly config?: Config | undefined
12098 } | undefined
12099 ) => Effect.Effect<
12100 WithOptionalResponse<typeof DeleteSkillV1SkillsSkillIdDelete200.Type, Config>,
12101 | HttpClientError.HttpClientError
12102 | SchemaError
12103 | AnthropicClientError<"DeleteSkillV1SkillsSkillIdDelete4XX", typeof DeleteSkillV1SkillsSkillIdDelete4XX.Type>
12104 >
12105 /**
12106 * List Skill Versions
12107 */
12108 readonly "listSkillVersionsV1SkillsSkillIdVersionsGet": <Config extends OperationConfig>(
12109 skillId: string,
12110 options: {
12111 readonly params?: typeof ListSkillVersionsV1SkillsSkillIdVersionsGetParams.Encoded | undefined
12112 readonly config?: Config | undefined
12113 } | undefined
12114 ) => Effect.Effect<
12115 WithOptionalResponse<typeof ListSkillVersionsV1SkillsSkillIdVersionsGet200.Type, Config>,
12116 | HttpClientError.HttpClientError
12117 | SchemaError
12118 | AnthropicClientError<
12119 "ListSkillVersionsV1SkillsSkillIdVersionsGet4XX",
12120 typeof ListSkillVersionsV1SkillsSkillIdVersionsGet4XX.Type
12121 >
12122 >
12123 /**
12124 * Create Skill Version
12125 */
12126 readonly "createSkillVersionV1SkillsSkillIdVersionsPost": <Config extends OperationConfig>(
12127 skillId: string,
12128 options: {
12129 readonly params?: typeof CreateSkillVersionV1SkillsSkillIdVersionsPostParams.Encoded | undefined
12130 readonly payload: typeof CreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData.Encoded
12131 readonly config?: Config | undefined
12132 }
12133 ) => Effect.Effect<
12134 WithOptionalResponse<typeof CreateSkillVersionV1SkillsSkillIdVersionsPost200.Type, Config>,
12135 | HttpClientError.HttpClientError
12136 | SchemaError
12137 | AnthropicClientError<
12138 "CreateSkillVersionV1SkillsSkillIdVersionsPost4XX",
12139 typeof CreateSkillVersionV1SkillsSkillIdVersionsPost4XX.Type
12140 >
12141 >
12142 /**
12143 * Get Skill Version
12144 */
12145 readonly "getSkillVersionV1SkillsSkillIdVersionsVersionGet": <Config extends OperationConfig>(
12146 skillId: string,
12147 version: string,
12148 options: {
12149 readonly params?: typeof GetSkillVersionV1SkillsSkillIdVersionsVersionGetParams.Encoded | undefined
12150 readonly config?: Config | undefined
12151 } | undefined
12152 ) => Effect.Effect<
12153 WithOptionalResponse<typeof GetSkillVersionV1SkillsSkillIdVersionsVersionGet200.Type, Config>,
12154 | HttpClientError.HttpClientError
12155 | SchemaError
12156 | AnthropicClientError<
12157 "GetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX",
12158 typeof GetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX.Type
12159 >
12160 >
12161 /**
12162 * Delete Skill Version
12163 */
12164 readonly "deleteSkillVersionV1SkillsSkillIdVersionsVersionDelete": <Config extends OperationConfig>(
12165 skillId: string,
12166 version: string,
12167 options: {
12168 readonly params?: typeof DeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams.Encoded | undefined
12169 readonly config?: Config | undefined
12170 } | undefined
12171 ) => Effect.Effect<
12172 WithOptionalResponse<typeof DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200.Type, Config>,
12173 | HttpClientError.HttpClientError
12174 | SchemaError
12175 | AnthropicClientError<
12176 "DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX",
12177 typeof DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX.Type
12178 >
12179 >
12180 /**
12181 * Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
12182 *
12183 * The Messages API can be used for either single queries or stateless multi-turn conversations.
12184 *
12185 * Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup)
12186 */
12187 readonly "betaMessagesPost": <Config extends OperationConfig>(
12188 options: {
12189 readonly params?: typeof BetaMessagesPostParams.Encoded | undefined
12190 readonly payload: typeof BetaMessagesPostRequestJson.Encoded
12191 readonly config?: Config | undefined
12192 }
12193 ) => Effect.Effect<
12194 WithOptionalResponse<typeof BetaMessagesPost200.Type, Config>,
12195 | HttpClientError.HttpClientError
12196 | SchemaError
12197 | AnthropicClientError<"BetaMessagesPost4XX", typeof BetaMessagesPost4XX.Type>
12198 >
12199 /**
12200 * List available models.
12201 *
12202 * The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first.
12203 */
12204 readonly "betaModelsList": <Config extends OperationConfig>(
12205 options:
12206 | { readonly params?: typeof BetaModelsListParams.Encoded | undefined; readonly config?: Config | undefined }
12207 | undefined
12208 ) => Effect.Effect<
12209 WithOptionalResponse<typeof BetaModelsList200.Type, Config>,
12210 | HttpClientError.HttpClientError
12211 | SchemaError
12212 | AnthropicClientError<"BetaModelsList4XX", typeof BetaModelsList4XX.Type>
12213 >
12214 /**
12215 * Get a specific model.
12216 *
12217 * The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID.
12218 */
12219 readonly "betaModelsGet": <Config extends OperationConfig>(
12220 modelId: string,
12221 options:
12222 | { readonly params?: typeof BetaModelsGetParams.Encoded | undefined; readonly config?: Config | undefined }
12223 | undefined
12224 ) => Effect.Effect<
12225 WithOptionalResponse<typeof BetaModelsGet200.Type, Config>,
12226 | HttpClientError.HttpClientError
12227 | SchemaError
12228 | AnthropicClientError<"BetaModelsGet4XX", typeof BetaModelsGet4XX.Type>
12229 >
12230 /**
12231 * List all Message Batches within a Workspace. Most recently created batches are returned first.
12232 *
12233 * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
12234 */
12235 readonly "betaMessageBatchesList": <Config extends OperationConfig>(
12236 options: {
12237 readonly params?: typeof BetaMessageBatchesListParams.Encoded | undefined
12238 readonly config?: Config | undefined
12239 } | undefined
12240 ) => Effect.Effect<
12241 WithOptionalResponse<typeof BetaMessageBatchesList200.Type, Config>,
12242 | HttpClientError.HttpClientError
12243 | SchemaError
12244 | AnthropicClientError<"BetaMessageBatchesList4XX", typeof BetaMessageBatchesList4XX.Type>
12245 >
12246 /**
12247 * Send a batch of Message creation requests.
12248 *
12249 * The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete.
12250 *
12251 * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
12252 */
12253 readonly "betaMessageBatchesPost": <Config extends OperationConfig>(
12254 options: {
12255 readonly params?: typeof BetaMessageBatchesPostParams.Encoded | undefined
12256 readonly payload: typeof BetaMessageBatchesPostRequestJson.Encoded
12257 readonly config?: Config | undefined
12258 }
12259 ) => Effect.Effect<
12260 WithOptionalResponse<typeof BetaMessageBatchesPost200.Type, Config>,
12261 | HttpClientError.HttpClientError
12262 | SchemaError
12263 | AnthropicClientError<"BetaMessageBatchesPost4XX", typeof BetaMessageBatchesPost4XX.Type>
12264 >
12265 /**
12266 * This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response.
12267 *
12268 * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
12269 */
12270 readonly "betaMessageBatchesRetrieve": <Config extends OperationConfig>(
12271 messageBatchId: string,
12272 options: {
12273 readonly params?: typeof BetaMessageBatchesRetrieveParams.Encoded | undefined
12274 readonly config?: Config | undefined
12275 } | undefined
12276 ) => Effect.Effect<
12277 WithOptionalResponse<typeof BetaMessageBatchesRetrieve200.Type, Config>,
12278 | HttpClientError.HttpClientError
12279 | SchemaError
12280 | AnthropicClientError<"BetaMessageBatchesRetrieve4XX", typeof BetaMessageBatchesRetrieve4XX.Type>
12281 >
12282 /**
12283 * Delete a Message Batch.
12284 *
12285 * Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it.
12286 *
12287 * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
12288 */
12289 readonly "betaMessageBatchesDelete": <Config extends OperationConfig>(
12290 messageBatchId: string,
12291 options: {
12292 readonly params?: typeof BetaMessageBatchesDeleteParams.Encoded | undefined
12293 readonly config?: Config | undefined
12294 } | undefined
12295 ) => Effect.Effect<
12296 WithOptionalResponse<typeof BetaMessageBatchesDelete200.Type, Config>,
12297 | HttpClientError.HttpClientError
12298 | SchemaError
12299 | AnthropicClientError<"BetaMessageBatchesDelete4XX", typeof BetaMessageBatchesDelete4XX.Type>
12300 >
12301 /**
12302 * Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.
12303 *
12304 * The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible.
12305 *
12306 * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
12307 */
12308 readonly "betaMessageBatchesCancel": <Config extends OperationConfig>(
12309 messageBatchId: string,
12310 options: {
12311 readonly params?: typeof BetaMessageBatchesCancelParams.Encoded | undefined
12312 readonly config?: Config | undefined
12313 } | undefined
12314 ) => Effect.Effect<
12315 WithOptionalResponse<typeof BetaMessageBatchesCancel200.Type, Config>,
12316 | HttpClientError.HttpClientError
12317 | SchemaError
12318 | AnthropicClientError<"BetaMessageBatchesCancel4XX", typeof BetaMessageBatchesCancel4XX.Type>
12319 >
12320 /**
12321 * Streams the results of a Message Batch as a `.jsonl` file.
12322 *
12323 * Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.
12324 *
12325 * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
12326 */
12327 readonly "betaMessageBatchesResults": <Config extends OperationConfig>(
12328 messageBatchId: string,
12329 options: {
12330 readonly params?: typeof BetaMessageBatchesResultsParams.Encoded | undefined
12331 readonly config?: Config | undefined
12332 } | undefined
12333 ) => Effect.Effect<
12334 WithOptionalResponse<void, Config>,
12335 | HttpClientError.HttpClientError
12336 | SchemaError
12337 | AnthropicClientError<"BetaMessageBatchesResults4XX", typeof BetaMessageBatchesResults4XX.Type>
12338 >
12339 /**
12340 * Count the number of tokens in a Message.
12341 *
12342 * The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it.
12343 *
12344 * Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)
12345 */
12346 readonly "betaMessagesCountTokensPost": <Config extends OperationConfig>(
12347 options: {
12348 readonly params?: typeof BetaMessagesCountTokensPostParams.Encoded | undefined
12349 readonly payload: typeof BetaMessagesCountTokensPostRequestJson.Encoded
12350 readonly config?: Config | undefined
12351 }
12352 ) => Effect.Effect<
12353 WithOptionalResponse<typeof BetaMessagesCountTokensPost200.Type, Config>,
12354 | HttpClientError.HttpClientError
12355 | SchemaError
12356 | AnthropicClientError<"BetaMessagesCountTokensPost4XX", typeof BetaMessagesCountTokensPost4XX.Type>
12357 >
12358 /**
12359 * List Files
12360 */
12361 readonly "betaListFilesV1FilesGet": <Config extends OperationConfig>(
12362 options: {
12363 readonly params?: typeof BetaListFilesV1FilesGetParams.Encoded | undefined
12364 readonly config?: Config | undefined
12365 } | undefined
12366 ) => Effect.Effect<
12367 WithOptionalResponse<typeof BetaListFilesV1FilesGet200.Type, Config>,
12368 | HttpClientError.HttpClientError
12369 | SchemaError
12370 | AnthropicClientError<"BetaListFilesV1FilesGet4XX", typeof BetaListFilesV1FilesGet4XX.Type>
12371 >
12372 /**
12373 * Upload File
12374 */
12375 readonly "betaUploadFileV1FilesPost": <Config extends OperationConfig>(
12376 options: {
12377 readonly params?: typeof BetaUploadFileV1FilesPostParams.Encoded | undefined
12378 readonly payload: typeof BetaUploadFileV1FilesPostRequestFormData.Encoded
12379 readonly config?: Config | undefined
12380 }
12381 ) => Effect.Effect<
12382 WithOptionalResponse<typeof BetaUploadFileV1FilesPost200.Type, Config>,
12383 | HttpClientError.HttpClientError
12384 | SchemaError
12385 | AnthropicClientError<"BetaUploadFileV1FilesPost4XX", typeof BetaUploadFileV1FilesPost4XX.Type>
12386 >
12387 /**
12388 * Get File Metadata
12389 */
12390 readonly "betaGetFileMetadataV1FilesFileIdGet": <Config extends OperationConfig>(
12391 fileId: string,
12392 options: {
12393 readonly params?: typeof BetaGetFileMetadataV1FilesFileIdGetParams.Encoded | undefined
12394 readonly config?: Config | undefined
12395 } | undefined
12396 ) => Effect.Effect<
12397 WithOptionalResponse<typeof BetaGetFileMetadataV1FilesFileIdGet200.Type, Config>,
12398 | HttpClientError.HttpClientError
12399 | SchemaError
12400 | AnthropicClientError<"BetaGetFileMetadataV1FilesFileIdGet4XX", typeof BetaGetFileMetadataV1FilesFileIdGet4XX.Type>
12401 >
12402 /**
12403 * Delete File
12404 */
12405 readonly "betaDeleteFileV1FilesFileIdDelete": <Config extends OperationConfig>(
12406 fileId: string,
12407 options: {
12408 readonly params?: typeof BetaDeleteFileV1FilesFileIdDeleteParams.Encoded | undefined
12409 readonly config?: Config | undefined
12410 } | undefined
12411 ) => Effect.Effect<
12412 WithOptionalResponse<typeof BetaDeleteFileV1FilesFileIdDelete200.Type, Config>,
12413 | HttpClientError.HttpClientError
12414 | SchemaError
12415 | AnthropicClientError<"BetaDeleteFileV1FilesFileIdDelete4XX", typeof BetaDeleteFileV1FilesFileIdDelete4XX.Type>
12416 >
12417 /**
12418 * Download File
12419 */
12420 readonly "betaDownloadFileV1FilesFileIdContentGet": <Config extends OperationConfig>(
12421 fileId: string,
12422 options: {
12423 readonly params?: typeof BetaDownloadFileV1FilesFileIdContentGetParams.Encoded | undefined
12424 readonly config?: Config | undefined
12425 } | undefined
12426 ) => Effect.Effect<WithOptionalResponse<void, Config>, HttpClientError.HttpClientError | SchemaError>
12427 /**
12428 * Download File
12429 */
12430 readonly "betaDownloadFileV1FilesFileIdContentGetStream": (
12431 fileId: string,
12432 options: { readonly params?: typeof BetaDownloadFileV1FilesFileIdContentGetParams.Encoded | undefined } | undefined
12433 ) => Stream.Stream<Uint8Array, HttpClientError.HttpClientError>
12434 /**
12435 * List Skills
12436 */
12437 readonly "betaListSkillsV1SkillsGet": <Config extends OperationConfig>(
12438 options: {
12439 readonly params?: typeof BetaListSkillsV1SkillsGetParams.Encoded | undefined
12440 readonly config?: Config | undefined
12441 } | undefined
12442 ) => Effect.Effect<
12443 WithOptionalResponse<typeof BetaListSkillsV1SkillsGet200.Type, Config>,
12444 | HttpClientError.HttpClientError
12445 | SchemaError
12446 | AnthropicClientError<"BetaListSkillsV1SkillsGet4XX", typeof BetaListSkillsV1SkillsGet4XX.Type>
12447 >
12448 /**
12449 * Create Skill
12450 */
12451 readonly "betaCreateSkillV1SkillsPost": <Config extends OperationConfig>(
12452 options: {
12453 readonly params?: typeof BetaCreateSkillV1SkillsPostParams.Encoded | undefined
12454 readonly payload: typeof BetaCreateSkillV1SkillsPostRequestFormData.Encoded
12455 readonly config?: Config | undefined
12456 }
12457 ) => Effect.Effect<
12458 WithOptionalResponse<typeof BetaCreateSkillV1SkillsPost200.Type, Config>,
12459 | HttpClientError.HttpClientError
12460 | SchemaError
12461 | AnthropicClientError<"BetaCreateSkillV1SkillsPost4XX", typeof BetaCreateSkillV1SkillsPost4XX.Type>
12462 >
12463 /**
12464 * Get Skill
12465 */
12466 readonly "betaGetSkillV1SkillsSkillIdGet": <Config extends OperationConfig>(
12467 skillId: string,
12468 options: {
12469 readonly params?: typeof BetaGetSkillV1SkillsSkillIdGetParams.Encoded | undefined
12470 readonly config?: Config | undefined
12471 } | undefined
12472 ) => Effect.Effect<
12473 WithOptionalResponse<typeof BetaGetSkillV1SkillsSkillIdGet200.Type, Config>,
12474 | HttpClientError.HttpClientError
12475 | SchemaError
12476 | AnthropicClientError<"BetaGetSkillV1SkillsSkillIdGet4XX", typeof BetaGetSkillV1SkillsSkillIdGet4XX.Type>
12477 >
12478 /**
12479 * Delete Skill
12480 */
12481 readonly "betaDeleteSkillV1SkillsSkillIdDelete": <Config extends OperationConfig>(
12482 skillId: string,
12483 options: {
12484 readonly params?: typeof BetaDeleteSkillV1SkillsSkillIdDeleteParams.Encoded | undefined
12485 readonly config?: Config | undefined
12486 } | undefined
12487 ) => Effect.Effect<
12488 WithOptionalResponse<typeof BetaDeleteSkillV1SkillsSkillIdDelete200.Type, Config>,
12489 | HttpClientError.HttpClientError
12490 | SchemaError
12491 | AnthropicClientError<
12492 "BetaDeleteSkillV1SkillsSkillIdDelete4XX",
12493 typeof BetaDeleteSkillV1SkillsSkillIdDelete4XX.Type
12494 >
12495 >
12496 /**
12497 * List Skill Versions
12498 */
12499 readonly "betaListSkillVersionsV1SkillsSkillIdVersionsGet": <Config extends OperationConfig>(
12500 skillId: string,
12501 options: {
12502 readonly params?: typeof BetaListSkillVersionsV1SkillsSkillIdVersionsGetParams.Encoded | undefined
12503 readonly config?: Config | undefined
12504 } | undefined
12505 ) => Effect.Effect<
12506 WithOptionalResponse<typeof BetaListSkillVersionsV1SkillsSkillIdVersionsGet200.Type, Config>,
12507 | HttpClientError.HttpClientError
12508 | SchemaError
12509 | AnthropicClientError<
12510 "BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX",
12511 typeof BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX.Type
12512 >
12513 >
12514 /**
12515 * Create Skill Version
12516 */
12517 readonly "betaCreateSkillVersionV1SkillsSkillIdVersionsPost": <Config extends OperationConfig>(
12518 skillId: string,
12519 options: {
12520 readonly params?: typeof BetaCreateSkillVersionV1SkillsSkillIdVersionsPostParams.Encoded | undefined
12521 readonly payload: typeof BetaCreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData.Encoded
12522 readonly config?: Config | undefined
12523 }
12524 ) => Effect.Effect<
12525 WithOptionalResponse<typeof BetaCreateSkillVersionV1SkillsSkillIdVersionsPost200.Type, Config>,
12526 | HttpClientError.HttpClientError
12527 | SchemaError
12528 | AnthropicClientError<
12529 "BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX",
12530 typeof BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX.Type
12531 >
12532 >
12533 /**
12534 * Get Skill Version
12535 */
12536 readonly "betaGetSkillVersionV1SkillsSkillIdVersionsVersionGet": <Config extends OperationConfig>(
12537 skillId: string,
12538 version: string,
12539 options: {
12540 readonly params?: typeof BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGetParams.Encoded | undefined
12541 readonly config?: Config | undefined
12542 } | undefined
12543 ) => Effect.Effect<
12544 WithOptionalResponse<typeof BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet200.Type, Config>,
12545 | HttpClientError.HttpClientError
12546 | SchemaError
12547 | AnthropicClientError<
12548 "BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX",
12549 typeof BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX.Type
12550 >
12551 >
12552 /**
12553 * Delete Skill Version
12554 */
12555 readonly "betaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete": <Config extends OperationConfig>(
12556 skillId: string,
12557 version: string,
12558 options: {
12559 readonly params?: typeof BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams.Encoded | undefined
12560 readonly config?: Config | undefined
12561 } | undefined
12562 ) => Effect.Effect<
12563 WithOptionalResponse<typeof BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200.Type, Config>,
12564 | HttpClientError.HttpClientError
12565 | SchemaError
12566 | AnthropicClientError<
12567 "BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX",
12568 typeof BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX.Type
12569 >
12570 >
12571}
12572
12573export interface AnthropicClientError<Tag extends string, E> {
12574 readonly _tag: Tag
12575 readonly request: HttpClientRequest.HttpClientRequest
12576 readonly response: HttpClientResponse.HttpClientResponse
12577 readonly cause: E
12578}
12579
12580class AnthropicClientErrorImpl extends Data.Error<{
12581 _tag: string
12582 cause: any
12583 request: HttpClientRequest.HttpClientRequest
12584 response: HttpClientResponse.HttpClientResponse
12585}> {}
12586
12587export const AnthropicClientError = <Tag extends string, E>(
12588 tag: Tag,
12589 cause: E,
12590 response: HttpClientResponse.HttpClientResponse
12591): AnthropicClientError<Tag, E> =>
12592 new AnthropicClientErrorImpl({
12593 _tag: tag,
12594 cause,
12595 response,
12596 request: response.request
12597 }) as any