import {z} from 'zod' export type AnthropicBeta = string | 'message-batches-2024-09-24' | 'prompt-caching-2024-07-31' | 'computer-use-2024-10-22' | 'computer-use-2025-01-24' | 'pdfs-2024-09-25' | 'token-counting-2024-11-01' | 'token-efficient-tools-2025-02-19' | 'output-128k-2025-02-19' | 'files-api-2025-04-14' | 'mcp-client-2025-04-04' | 'mcp-client-2025-11-20' | 'dev-full-thinking-2025-05-14' | 'interleaved-thinking-2025-05-14' | 'code-execution-2025-05-22' | 'extended-cache-ttl-2025-04-11' | 'context-1m-2025-08-07' | 'context-management-2025-06-27' | 'model-context-window-exceeded-2025-08-26' | 'skills-2025-10-02' | 'fast-mode-2026-02-01' | 'output-300k-2026-03-24' | 'user-profiles-2026-03-24' | 'user-profiles-2026-08-18' | 'user-profiles-2026-09-04' | 'advisor-tool-2026-03-01' | 'managed-agents-2026-04-01' | 'cache-diagnosis-2026-04-07' | 'dreaming-2026-04-21' | 'thinking-token-count-2026-05-13' | 'server-side-fallback-2026-06-01' | 'server-side-fallback-2026-07-01' | 'fallback-credit-2026-06-01' | 'fallback-credit-2026-07-01' | 'agent-memory-2026-07-22' | 'mid-conversation-tool-changes-2026-07-01' | 'compact-2026-01-12' | 'computer-use-2025-11-24' | 'mcp-tunnels-2026-06-22' | 'structured-outputs-2025-11-13' | 'task-budgets-2026-03-13' | 'thinking-display-updates-2026-08-18' | 'ce-user-management-2026-07-13' | 'mid-conversation-output-config-2026-07-01' | 'thinking-binding-controls-2026-08-01' | 'mid-conversation-system-clear-at-2026-08-21' | 'compact-2026-09-04' | 'inline-tools-2026-09-15' | 'mcp-client-2026-09-15' | 'ce-plugins-2026-09-01' | 'spend-limit-reads-2026-09-26' | 'telemetry-destinations-2026-08-11' | 'webhooks-2026-10-07' | 'admin-user-sign-out-2026-10-08' | 'message-threads-2026-08-12' | 'analytics-usage-cost-2026-08-24' | 'experimental-claude-tag-2026-10-21'; export type Model = 'claude-fable-5-2' | 'claude-mythos-5-2' | 'claude-haiku-5-5' | 'claude-sonnet-5-5' | 'claude-fable-5-1' | 'claude-opus-5-5' | 'claude-mythos-5-1' | 'claude-sonnet-5' | 'claude-fable-5' | 'claude-mythos-5' | 'claude-opus-5' | 'claude-opus-4-8' | 'claude-opus-4-7' | 'claude-mythos-preview' | 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | string; export type BetaCacheControlEphemeral = {ttl?: ('5m' | '1h') | undefined, type: 'ephemeral'}; export type BetaRequestCharLocationCitation = {cited_text: string, document_index: number, document_title: string | null, end_char_index: number, start_char_index: number, type: 'char_location'}; export type BetaRequestPageLocationCitation = {cited_text: string, document_index: number, document_title: string | null, end_page_number: number, start_page_number: number, type: 'page_location'}; export type BetaRequestContentBlockLocationCitation = {cited_text: string, document_index: number, document_title: string | null, end_block_index: number, start_block_index: number, type: 'content_block_location'}; export type BetaRequestWebSearchResultLocationCitation = {cited_text: string, encrypted_index: string, title: string | null, type: 'web_search_result_location', url: string}; export type BetaRequestSearchResultLocationCitation = {cited_text: string, end_block_index: number, search_result_index: number, source: string, start_block_index: number, title: string | null, type: 'search_result_location'}; export type BetaBase64ImageSource = {data: string, media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp', type: 'base64'}; export type BetaURLImageSource = {type: 'url', url: string}; export type BetaFileImageSource = {file_id: string, type: 'file'}; export type BetaRequestImageTransformations = {oversized_image?: ('downsize' | 'error') | undefined}; export type BetaRequestCitationsConfig = {enabled?: boolean | undefined}; export type BetaBase64PDFSource = {data: string, media_type: 'application/pdf', type: 'base64'}; export type BetaPlainTextSource = {data: string, media_type: 'text/plain', type: 'text'}; export type BetaRequestTextBlock = {cache_control?: (BetaCacheControlEphemeral | null) | undefined, citations?: (Array | null) | undefined, text: string, type: 'text'}; export type BetaRequestImageBlock = {cache_control?: (BetaCacheControlEphemeral | null) | undefined, source: BetaBase64ImageSource | BetaURLImageSource | BetaFileImageSource, transformations?: (BetaRequestImageTransformations | null) | undefined, type: 'image'}; export type BetaContentBlockSource = {content: string | Array, type: 'content'}; export type BetaURLPDFSource = {type: 'url', url: string}; export type BetaFileDocumentSource = {file_id: string, type: 'file'}; export type BetaDirectCaller = {type: 'direct'}; export type BetaServerToolCaller = {tool_id: string, type: 'code_execution_20250825'}; export type BetaServerToolCaller20260120 = {tool_id: string, type: 'code_execution_20260120'}; export type BetaRequestSearchResultBlock = {cache_control?: (BetaCacheControlEphemeral | null) | undefined, citations?: BetaRequestCitationsConfig | undefined, content: Array, source: string, title: string, type: 'search_result'}; export type BetaRequestDocumentBlock = {cache_control?: (BetaCacheControlEphemeral | null) | undefined, citations?: (BetaRequestCitationsConfig | null) | undefined, context?: (string | null) | undefined, source: BetaBase64PDFSource | BetaPlainTextSource | BetaContentBlockSource | BetaURLPDFSource | BetaFileDocumentSource, title?: (string | null) | undefined, type: 'document'}; export type BetaRequestToolReferenceBlock = {cache_control?: (BetaCacheControlEphemeral | null) | undefined, tool_name: string, type: 'tool_reference'}; export type BetaBrowserStateChangeTabOpened = {tab_id: string, type: 'tab_opened'}; export type BetaBrowserStateChangeDownloadStarted = {download_id: string, type: 'download_started', url: string}; export type BetaBrowserStateChangeDownloadCompleted = {download_id: string, path?: (string | null) | undefined, size_bytes?: (number | null) | undefined, type: 'download_completed', url: string}; export type BetaBrowserStateChangeDownloadFailed = {download_id: string, error?: (string | null) | undefined, type: 'download_failed', url: string}; export type BetaBrowserStateTabEntry = {active?: boolean | undefined, tab_id: string, title: string, url: string}; export type BetaRequestBrowserStateBlock = {cache_control?: (BetaCacheControlEphemeral | null) | undefined, state_changes?: (Array | null) | undefined, tabs: Array, type: 'browser_state'}; export type BetaRequestWebSearchResultBlock = {encrypted_content: string, page_age?: (string | null) | undefined, title: string, type: 'web_search_result', url: string}; export type BetaWebSearchToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'max_uses_exceeded' | 'too_many_requests' | 'query_too_long' | 'request_too_large'; export type BetaRequestWebSearchToolResultError = {error_code: BetaWebSearchToolResultErrorCode, type: 'web_search_tool_result_error'}; export type BetaWebFetchToolResultErrorCode = 'invalid_tool_input' | 'url_too_long' | 'url_not_allowed' | 'url_not_in_prior_context' | 'url_not_accessible' | 'unsupported_content_type' | 'too_many_requests' | 'max_uses_exceeded' | 'unavailable' | 'content_too_large'; export type BetaRequestWebFetchToolResultError = {error_code: BetaWebFetchToolResultErrorCode, type: 'web_fetch_tool_result_error'}; export type BetaRequestWebFetchResultBlock = {content: BetaRequestDocumentBlock, retrieved_at?: (string | null) | undefined, type: 'web_fetch_result', url: string}; export type BetaAdvisorToolResultErrorCode = 'max_uses_exceeded' | 'prompt_too_long' | 'too_many_requests' | 'overloaded' | 'unavailable' | 'execution_time_exceeded' | 'model_not_found'; export type BetaRequestAdvisorToolResultError = {error_code: BetaAdvisorToolResultErrorCode, type: 'advisor_tool_result_error'}; export type BetaRequestAdvisorResultBlock = {stop_reason?: (string | null) | undefined, text: string, type: 'advisor_result'}; export type BetaRequestAdvisorRedactedResultBlock = {encrypted_content: string, stop_reason?: (string | null) | undefined, type: 'advisor_redacted_result'}; export type BetaCodeExecutionToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded'; export type BetaRequestCodeExecutionToolResultError = {error_code: BetaCodeExecutionToolResultErrorCode, type: 'code_execution_tool_result_error'}; export type BetaRequestCodeExecutionOutputBlock = {file_id: string, type: 'code_execution_output'}; export type BetaRequestCodeExecutionResultBlock = {content: Array, return_code: number, stderr: string, stdout: string, type: 'code_execution_result'}; export type BetaRequestEncryptedCodeExecutionResultBlock = {content: Array, encrypted_stdout: string, return_code: number, stderr: string, type: 'encrypted_code_execution_result'}; export type BetaBashCodeExecutionToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded' | 'output_file_too_large'; export type BetaRequestBashCodeExecutionToolResultError = {error_code: BetaBashCodeExecutionToolResultErrorCode, type: 'bash_code_execution_tool_result_error'}; export type BetaRequestBashCodeExecutionOutputBlock = {file_id: string, type: 'bash_code_execution_output'}; export type BetaRequestBashCodeExecutionResultBlock = {content: Array, return_code: number, stderr: string, stdout: string, type: 'bash_code_execution_result'}; export type BetaTextEditorCodeExecutionToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded' | 'file_not_found'; export type BetaRequestTextEditorCodeExecutionToolResultError = {error_code: BetaTextEditorCodeExecutionToolResultErrorCode, error_message?: (string | null) | undefined, type: 'text_editor_code_execution_tool_result_error'}; export type BetaRequestTextEditorCodeExecutionViewResultBlock = {content: string, file_type: 'text' | 'image' | 'pdf', num_lines?: (number | null) | undefined, start_line?: (number | null) | undefined, total_lines?: (number | null) | undefined, type: 'text_editor_code_execution_view_result'}; export type BetaRequestTextEditorCodeExecutionCreateResultBlock = {is_file_update: boolean, type: 'text_editor_code_execution_create_result'}; export type BetaRequestTextEditorCodeExecutionStrReplaceResultBlock = {lines?: (Array | null) | undefined, new_lines?: (number | null) | undefined, new_start?: (number | null) | undefined, old_lines?: (number | null) | undefined, old_start?: (number | null) | undefined, type: 'text_editor_code_execution_str_replace_result'}; export type BetaToolSearchToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded'; export type BetaRequestToolSearchToolResultError = {error_code: BetaToolSearchToolResultErrorCode, error_message?: (string | null) | undefined, type: 'tool_search_tool_result_error'}; export type BetaRequestToolSearchToolSearchResultBlock = {tool_references: Array, type: 'tool_search_tool_search_result'}; export type BetaToolChangeToolReference = {name: string, type: 'tool_reference'}; export type BetaToolChangeMCPToolReference = {name: string, server_name: string, type: 'mcp_tool_reference'}; export type BetaToolChangeMCPToolsetReference = {server_name: string, type: 'mcp_toolset_reference'}; export type BetaInputSchema = {properties?: ({[key: string]: unknown} | null) | undefined, required?: (Array | null) | undefined, type: 'object'} | {[key: string]: unknown}; export type BetaAllowedCaller = 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'; export type BetaJsonValue = unknown; export type BetaTool = {type?: ('custom' | null) | undefined, description?: string | undefined, name: string, input_schema: BetaInputSchema, cache_control?: (BetaCacheControlEphemeral | null) | undefined, strict?: boolean | undefined, eager_input_streaming?: (boolean | null) | undefined, allowed_callers?: Array | undefined, defer_loading?: boolean | undefined, input_examples?: Array<{[key: string]: BetaJsonValue}> | undefined}; export type BetaBashTool20241022 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, input_examples?: Array<{[key: string]: BetaJsonValue}> | undefined, name: 'bash', strict?: boolean | undefined, type: 'bash_20241022'}; export type BetaBashTool20250124 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, input_examples?: Array<{[key: string]: BetaJsonValue}> | undefined, name: 'bash', strict?: boolean | undefined, type: 'bash_20250124'}; export type BetaCodeExecutionTool20250522 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, name: 'code_execution', strict?: boolean | undefined, type: 'code_execution_20250522'}; export type BetaCodeExecutionTool20250825 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, name: 'code_execution', strict?: boolean | undefined, type: 'code_execution_20250825'}; export type BetaCodeExecutionTool20260120 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, name: 'code_execution', strict?: boolean | undefined, type: 'code_execution_20260120'}; export type BetaCodeExecutionTool20260521 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, name: 'code_execution', strict?: boolean | undefined, type: 'code_execution_20260521'}; export type BetaBrowserCloseTabConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserDoubleClickConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserFileUploadConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserFindConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserFormInputConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserGetPageTextConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserHoldKeyConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserHoverConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserJavascriptExecConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserKeyConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserLeftClickConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserLeftClickDragConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserLeftMouseDownConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserLeftMouseUpConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserListTabsConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserMiddleClickConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserMouseMoveConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserNavigateConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserNewTabConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserReadConsoleConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserReadNetworkConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserReadPageConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserRightClickConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserScreenshotConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserScrollConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserScrollToConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserSwitchTabConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserTripleClickConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserTypeConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserWaitConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserZoomConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaBrowserToolsetConfigs = {close_tab?: (BetaBrowserCloseTabConfig | null) | undefined, double_click?: (BetaBrowserDoubleClickConfig | null) | undefined, file_upload?: (BetaBrowserFileUploadConfig | null) | undefined, find?: (BetaBrowserFindConfig | null) | undefined, form_input?: (BetaBrowserFormInputConfig | null) | undefined, get_page_text?: (BetaBrowserGetPageTextConfig | null) | undefined, hold_key?: (BetaBrowserHoldKeyConfig | null) | undefined, hover?: (BetaBrowserHoverConfig | null) | undefined, javascript_exec?: (BetaBrowserJavascriptExecConfig | null) | undefined, key?: (BetaBrowserKeyConfig | null) | undefined, left_click?: (BetaBrowserLeftClickConfig | null) | undefined, left_click_drag?: (BetaBrowserLeftClickDragConfig | null) | undefined, left_mouse_down?: (BetaBrowserLeftMouseDownConfig | null) | undefined, left_mouse_up?: (BetaBrowserLeftMouseUpConfig | null) | undefined, list_tabs?: (BetaBrowserListTabsConfig | null) | undefined, middle_click?: (BetaBrowserMiddleClickConfig | null) | undefined, mouse_move?: (BetaBrowserMouseMoveConfig | null) | undefined, navigate?: (BetaBrowserNavigateConfig | null) | undefined, new_tab?: (BetaBrowserNewTabConfig | null) | undefined, read_console?: (BetaBrowserReadConsoleConfig | null) | undefined, read_network?: (BetaBrowserReadNetworkConfig | null) | undefined, read_page?: (BetaBrowserReadPageConfig | null) | undefined, right_click?: (BetaBrowserRightClickConfig | null) | undefined, screenshot?: (BetaBrowserScreenshotConfig | null) | undefined, scroll?: (BetaBrowserScrollConfig | null) | undefined, scroll_to?: (BetaBrowserScrollToConfig | null) | undefined, switch_tab?: (BetaBrowserSwitchTabConfig | null) | undefined, triple_click?: (BetaBrowserTripleClickConfig | null) | undefined, type?: (BetaBrowserTypeConfig | null) | undefined, wait?: (BetaBrowserWaitConfig | null) | undefined, zoom?: (BetaBrowserZoomConfig | null) | undefined}; export type BetaBrowserToolset20260801 = {cache_control?: (BetaCacheControlEphemeral | null) | undefined, configs?: (BetaBrowserToolsetConfigs | null) | undefined, type: 'browser_toolset_20260801'}; export type BetaComputerUseTool20241022 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, display_height_px: number, display_number?: (number | null) | undefined, display_width_px: number, input_examples?: Array<{[key: string]: BetaJsonValue}> | undefined, name: 'computer', strict?: boolean | undefined, type: 'computer_20241022'}; export type BetaMemoryTool20250818 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, input_examples?: Array<{[key: string]: BetaJsonValue}> | undefined, name: 'memory', strict?: boolean | undefined, type: 'memory_20250818'}; export type BetaComputerUseTool20250124 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, display_height_px: number, display_number?: (number | null) | undefined, display_width_px: number, input_examples?: Array<{[key: string]: BetaJsonValue}> | undefined, name: 'computer', strict?: boolean | undefined, type: 'computer_20250124'}; export type BetaTextEditor20241022 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, input_examples?: Array<{[key: string]: BetaJsonValue}> | undefined, name: 'str_replace_editor', strict?: boolean | undefined, type: 'text_editor_20241022'}; export type BetaComputerUseTool20251124 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, display_height_px: number, display_number?: (number | null) | undefined, display_width_px: number, enable_zoom?: boolean | undefined, input_examples?: Array<{[key: string]: BetaJsonValue}> | undefined, name: 'computer', strict?: boolean | undefined, type: 'computer_20251124'}; export type BetaComputerCursorPositionConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerDoubleClickConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerHoldKeyConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerKeyConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerLeftClickConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerLeftClickDragConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerLeftMouseDownConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerLeftMouseUpConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerMiddleClickConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerMouseMoveConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerRightClickConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerScreenshotConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerScrollConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerTripleClickConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerTypeConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerWaitConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerZoomConfig = {defer_loading?: (boolean | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaComputerToolsetConfigs = {cursor_position?: (BetaComputerCursorPositionConfig | null) | undefined, double_click?: (BetaComputerDoubleClickConfig | null) | undefined, hold_key?: (BetaComputerHoldKeyConfig | null) | undefined, key?: (BetaComputerKeyConfig | null) | undefined, left_click?: (BetaComputerLeftClickConfig | null) | undefined, left_click_drag?: (BetaComputerLeftClickDragConfig | null) | undefined, left_mouse_down?: (BetaComputerLeftMouseDownConfig | null) | undefined, left_mouse_up?: (BetaComputerLeftMouseUpConfig | null) | undefined, middle_click?: (BetaComputerMiddleClickConfig | null) | undefined, mouse_move?: (BetaComputerMouseMoveConfig | null) | undefined, right_click?: (BetaComputerRightClickConfig | null) | undefined, screenshot?: (BetaComputerScreenshotConfig | null) | undefined, scroll?: (BetaComputerScrollConfig | null) | undefined, triple_click?: (BetaComputerTripleClickConfig | null) | undefined, type?: (BetaComputerTypeConfig | null) | undefined, wait?: (BetaComputerWaitConfig | null) | undefined, zoom?: (BetaComputerZoomConfig | null) | undefined}; export type BetaComputerToolset20260801 = {cache_control?: (BetaCacheControlEphemeral | null) | undefined, configs?: (BetaComputerToolsetConfigs | null) | undefined, type: 'computer_toolset_20260801'}; export type BetaTextEditor20250124 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, input_examples?: Array<{[key: string]: BetaJsonValue}> | undefined, name: 'str_replace_editor', strict?: boolean | undefined, type: 'text_editor_20250124'}; export type BetaTextEditor20250429 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, input_examples?: Array<{[key: string]: BetaJsonValue}> | undefined, name: 'str_replace_based_edit_tool', strict?: boolean | undefined, type: 'text_editor_20250429'}; export type BetaTextEditor20250728 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, input_examples?: Array<{[key: string]: BetaJsonValue}> | undefined, max_characters?: (number | null) | undefined, name: 'str_replace_based_edit_tool', strict?: boolean | undefined, type: 'text_editor_20250728'}; export type BetaUserLocation = {city?: (string | null) | undefined, country?: (string | null) | undefined, region?: (string | null) | undefined, timezone?: (string | null) | undefined, type: 'approximate'}; export type BetaWebSearchTool20250305 = {allowed_callers?: Array | undefined, allowed_domains?: (Array | null) | undefined, blocked_domains?: (Array | null) | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, max_uses?: (number | null) | undefined, name: 'web_search', strict?: boolean | undefined, type: 'web_search_20250305', user_location?: (BetaUserLocation | null) | undefined}; export type BetaWebFetchUrlSourceAll = {type: 'all'}; export type BetaWebFetchUrlSourceNone = {type: 'none'}; export type BetaWebFetchUrlSourceToolReference = {name: string, type: 'tool_reference'}; export type BetaWebFetchUrlSourceOnly = {tools: Array, type: 'only'}; export type BetaWebFetchUrlSourceExcept = {tools: Array, type: 'except'}; export type BetaWebFetchUrlSources = {client_tool_results?: (BetaWebFetchUrlSourceAll | BetaWebFetchUrlSourceNone | BetaWebFetchUrlSourceOnly | BetaWebFetchUrlSourceExcept) | undefined, server_tool_results?: (BetaWebFetchUrlSourceAll | BetaWebFetchUrlSourceNone | BetaWebFetchUrlSourceOnly | BetaWebFetchUrlSourceExcept) | undefined, user_input?: (BetaWebFetchUrlSourceAll | BetaWebFetchUrlSourceNone) | undefined}; export type BetaWebFetchTool20250910 = {allowed_callers?: Array | undefined, allowed_domains?: (Array | null) | undefined, blocked_domains?: (Array | null) | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, citations?: (BetaRequestCitationsConfig | null) | undefined, defer_loading?: boolean | undefined, max_content_tokens?: (number | null) | undefined, max_uses?: (number | null) | undefined, name: 'web_fetch', strict?: boolean | undefined, type: 'web_fetch_20250910', url_sources?: (BetaWebFetchUrlSources | null) | undefined}; export type BetaWebSearchTool20260209 = {allowed_callers?: Array | undefined, allowed_domains?: (Array | null) | undefined, blocked_domains?: (Array | null) | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, max_uses?: (number | null) | undefined, name: 'web_search', strict?: boolean | undefined, type: 'web_search_20260209', user_location?: (BetaUserLocation | null) | undefined}; export type BetaWebFetchTool20260209 = {allowed_callers?: Array | undefined, allowed_domains?: (Array | null) | undefined, blocked_domains?: (Array | null) | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, citations?: (BetaRequestCitationsConfig | null) | undefined, defer_loading?: boolean | undefined, max_content_tokens?: (number | null) | undefined, max_uses?: (number | null) | undefined, name: 'web_fetch', strict?: boolean | undefined, type: 'web_fetch_20260209', url_sources?: (BetaWebFetchUrlSources | null) | undefined}; export type BetaWebFetchTool20260309 = {allowed_callers?: Array | undefined, allowed_domains?: (Array | null) | undefined, blocked_domains?: (Array | null) | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, citations?: (BetaRequestCitationsConfig | null) | undefined, defer_loading?: boolean | undefined, max_content_tokens?: (number | null) | undefined, max_uses?: (number | null) | undefined, name: 'web_fetch', strict?: boolean | undefined, type: 'web_fetch_20260309', url_sources?: (BetaWebFetchUrlSources | null) | undefined, use_cache?: boolean | undefined}; export type BetaWebSearchTool20260318 = {allowed_callers?: Array | undefined, allowed_domains?: (Array | null) | undefined, blocked_domains?: (Array | null) | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, max_uses?: (number | null) | undefined, name: 'web_search', response_inclusion?: ('full' | 'excluded') | undefined, strict?: boolean | undefined, type: 'web_search_20260318', user_location?: (BetaUserLocation | null) | undefined}; export type BetaWebFetchTool20260318 = {allowed_callers?: Array | undefined, allowed_domains?: (Array | null) | undefined, blocked_domains?: (Array | null) | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, citations?: (BetaRequestCitationsConfig | null) | undefined, defer_loading?: boolean | undefined, max_content_tokens?: (number | null) | undefined, max_uses?: (number | null) | undefined, name: 'web_fetch', response_inclusion?: ('full' | 'excluded') | undefined, strict?: boolean | undefined, type: 'web_fetch_20260318', url_sources?: (BetaWebFetchUrlSources | null) | undefined, use_cache?: boolean | undefined}; export type BetaAdvisorTool20260301 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, caching?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, max_tokens?: (number | null) | undefined, max_uses?: (number | null) | undefined, model: Model, name: 'advisor', strict?: boolean | undefined, type: 'advisor_20260301'}; export type BetaToolSearchToolBM2520251119 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, name: 'tool_search_tool_bm25', strict?: boolean | undefined, type: 'tool_search_tool_bm25_20251119' | 'tool_search_tool_bm25'}; export type BetaToolSearchToolRegex20251119 = {allowed_callers?: Array | undefined, cache_control?: (BetaCacheControlEphemeral | null) | undefined, defer_loading?: boolean | undefined, name: 'tool_search_tool_regex', strict?: boolean | undefined, type: 'tool_search_tool_regex_20251119' | 'tool_search_tool_regex'}; export type BetaMCPToolConfig = {defer_loading?: boolean | undefined, enabled?: boolean | undefined}; export type BetaMCPToolDefaultConfig = {defer_loading?: boolean | undefined, enabled?: boolean | undefined}; export type BetaMCPTool = {description?: (string | null) | undefined, input_schema: {[key: string]: BetaJsonValue}, name: string}; export type BetaMCPToolset = {cache_control?: (BetaCacheControlEphemeral | null) | undefined, configs?: ({[key: string]: BetaMCPToolConfig} | null) | undefined, default_config?: BetaMCPToolDefaultConfig | undefined, mcp_server_name: string, tools?: (Array | null) | undefined, type: 'mcp_toolset'}; export type BetaToolUnion = BetaTool | BetaBashTool20241022 | BetaBashTool20250124 | BetaCodeExecutionTool20250522 | BetaCodeExecutionTool20250825 | BetaCodeExecutionTool20260120 | BetaCodeExecutionTool20260521 | BetaBrowserToolset20260801 | BetaComputerUseTool20241022 | BetaMemoryTool20250818 | BetaComputerUseTool20250124 | BetaTextEditor20241022 | BetaComputerUseTool20251124 | BetaComputerToolset20260801 | BetaTextEditor20250124 | BetaTextEditor20250429 | BetaTextEditor20250728 | BetaWebSearchTool20250305 | BetaWebFetchTool20250910 | BetaWebSearchTool20260209 | BetaWebFetchTool20260209 | BetaWebFetchTool20260309 | BetaWebSearchTool20260318 | BetaWebFetchTool20260318 | BetaAdvisorTool20260301 | BetaToolSearchToolBM2520251119 | BetaToolSearchToolRegex20251119 | BetaMCPToolset; export type BetaToolChangeToolDefinition = {definition: BetaToolUnion, type: 'tool_definition'}; export type BetaRequestToolAdditionBlock = {cache_control?: (BetaCacheControlEphemeral | null) | undefined, tool: BetaToolChangeToolReference | BetaToolChangeMCPToolReference | BetaToolChangeMCPToolsetReference | BetaToolChangeToolDefinition, type: 'tool_addition'}; export type BetaRequestToolRemovalBlock = {cache_control?: (BetaCacheControlEphemeral | null) | undefined, tool: BetaToolChangeToolReference | BetaToolChangeMCPToolReference | BetaToolChangeMCPToolsetReference, type: 'tool_removal'}; export type BetaRequestFallbackHopInfo = {model: Model}; export type BetaInputContentBlock = {cache_control?: (BetaCacheControlEphemeral | null) | undefined, citations?: (Array | null) | undefined, text: string, type: 'text'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, source: BetaBase64ImageSource | BetaURLImageSource | BetaFileImageSource, transformations?: (BetaRequestImageTransformations | null) | undefined, type: 'image'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, citations?: (BetaRequestCitationsConfig | null) | undefined, context?: (string | null) | undefined, source: BetaBase64PDFSource | BetaPlainTextSource | BetaContentBlockSource | BetaURLPDFSource | BetaFileDocumentSource, title?: (string | null) | undefined, type: 'document'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, citations?: BetaRequestCitationsConfig | undefined, content: Array, source: string, title: string, type: 'search_result'} | {signature: string, thinking: string, type: 'thinking'} | {data: string, type: 'redacted_thinking'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, caller?: (BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller20260120) | undefined, id: string, input: {[key: string]: unknown}, name: string, toolset_name?: (string | null) | undefined, type: 'tool_use'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, content?: (string | Array) | undefined, is_error?: boolean | undefined, tool_use_id: string, toolset_name?: (string | null) | undefined, type: 'tool_result'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, caller?: (BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller20260120) | undefined, id: string, input: {[key: string]: unknown}, name: 'advisor' | 'web_search' | 'web_fetch' | 'code_execution' | 'bash_code_execution' | 'text_editor_code_execution' | 'tool_search_tool_regex' | 'tool_search_tool_bm25', type: 'server_tool_use'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, caller?: (BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller20260120) | undefined, content: Array | BetaRequestWebSearchToolResultError, tool_use_id: string, type: 'web_search_tool_result'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, caller?: (BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller20260120) | undefined, content: BetaRequestWebFetchToolResultError | BetaRequestWebFetchResultBlock, tool_use_id: string, type: 'web_fetch_tool_result'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, content: BetaRequestAdvisorToolResultError | BetaRequestAdvisorResultBlock | BetaRequestAdvisorRedactedResultBlock, tool_use_id: string, type: 'advisor_tool_result'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, content: BetaRequestCodeExecutionToolResultError | BetaRequestCodeExecutionResultBlock | BetaRequestEncryptedCodeExecutionResultBlock, tool_use_id: string, type: 'code_execution_tool_result'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, content: BetaRequestBashCodeExecutionToolResultError | BetaRequestBashCodeExecutionResultBlock, tool_use_id: string, type: 'bash_code_execution_tool_result'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, content: BetaRequestTextEditorCodeExecutionToolResultError | BetaRequestTextEditorCodeExecutionViewResultBlock | BetaRequestTextEditorCodeExecutionCreateResultBlock | BetaRequestTextEditorCodeExecutionStrReplaceResultBlock, tool_use_id: string, type: 'text_editor_code_execution_tool_result'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, content: BetaRequestToolSearchToolResultError | BetaRequestToolSearchToolSearchResultBlock, tool_use_id: string, type: 'tool_search_tool_result'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, id: string, input: {[key: string]: unknown}, name: string, server_name: string, type: 'mcp_tool_use'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, content?: (string | Array) | undefined, is_error?: boolean | undefined, tool_use_id: string, type: 'mcp_tool_result'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, file_id: string, type: 'container_upload'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, content?: (string | null) | undefined, encrypted_content?: (string | null) | undefined, signature?: (string | null) | undefined, tool_changes?: (Array | null) | undefined, type: 'compaction'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, tool: BetaToolChangeToolReference | BetaToolChangeMCPToolReference | BetaToolChangeMCPToolsetReference | BetaToolChangeToolDefinition, type: 'tool_addition'} | {cache_control?: (BetaCacheControlEphemeral | null) | undefined, tool: BetaToolChangeToolReference | BetaToolChangeMCPToolReference | BetaToolChangeMCPToolsetReference, type: 'tool_removal'} | {mcp_server_name: string, tools: Array, type: 'mcp_tool_listing'} | {from: BetaRequestFallbackHopInfo, to: BetaRequestFallbackHopInfo, trigger: unknown, type: 'fallback'}; export type BetaInputMessageContent = string | Array; export type BetaEffortLevel = 'low' | 'medium' | 'high' | 'xhigh' | 'max'; export type BetaInputMessageUnion = {content: BetaInputMessageContent, role: 'user'} | {content: BetaInputMessageContent, role: 'assistant'} | {clear_at?: ('next_user_message' | 'never' | null) | undefined, content?: (string | Array) | undefined, output_config?: ({effort?: (BetaEffortLevel | null) | undefined} | null) | undefined, role: 'system'}; export type BetaSkillParams = {skill_id: string, type: 'anthropic' | 'custom', version?: string | undefined}; export type BetaContainerParams = {id?: (string | null) | undefined, skills?: (Array | null) | undefined}; export type BetaInputTokensClearAtLeast = {type: 'input_tokens', value: number}; export type BetaToolUsesKeep = {type: 'tool_uses', value: number}; export type BetaInputTokensTrigger = {type: 'input_tokens', value: number}; export type BetaToolUsesTrigger = {type: 'tool_uses', value: number}; export type BetaClearToolUses20250919 = {clear_at_least?: (BetaInputTokensClearAtLeast | null) | undefined, clear_tool_inputs?: (boolean | Array | null) | undefined, exclude_tools?: (Array | null) | undefined, keep?: BetaToolUsesKeep | undefined, trigger?: (BetaInputTokensTrigger | BetaToolUsesTrigger) | undefined, type: 'clear_tool_uses_20250919'}; export type BetaThinkingTurns = {type: 'thinking_turns', value: number}; export type BetaAllThinkingTurns = {type: 'all'}; export type BetaClearThinking20251015 = {keep?: (BetaThinkingTurns | BetaAllThinkingTurns | 'all') | undefined, type: 'clear_thinking_20251015'}; export type BetaCompact20260112 = {instructions?: (string | null) | undefined, pause_after_compaction?: boolean | undefined, trigger?: (BetaInputTokensTrigger | null) | undefined, type: 'compact_20260112'}; export type BetaDiagnosticsParam = {previous_message_id?: (string | null) | undefined}; export type BetaJsonOutputFormat = {schema: {[key: string]: unknown}, type: 'json_schema'}; export type BetaOutputConfig = {effort?: (BetaEffortLevel | null) | undefined, format?: (BetaJsonOutputFormat | null) | undefined, task_budget?: ({remaining?: (number | null) | undefined, total: number, type: 'tokens'} | null) | undefined}; export type BetaSpeed = 'standard' | 'fast'; export type BetaThinkingPrefixMismatchBehavior = 'error' | 'drop_block'; export type BetaThinkingDisplayMode = 'summarized' | 'omitted' | 'updates'; export type BetaThinkingConfigEnabled = {block_binding?: ({prefix_mismatch_behavior?: (BetaThinkingPrefixMismatchBehavior | null) | undefined} | null) | undefined, budget_tokens: number, display?: (BetaThinkingDisplayMode | null) | undefined, type: 'enabled'}; export type BetaThinkingConfigDisabled = {type: 'disabled'}; export type BetaThinkingConfigBetweenTools = {type: 'between_tools'}; export type BetaThinkingConfigAdaptive = {block_binding?: ({prefix_mismatch_behavior?: (BetaThinkingPrefixMismatchBehavior | null) | undefined} | null) | undefined, display?: (BetaThinkingDisplayMode | null) | undefined, type: 'adaptive'}; export type BetaFallbackConfigV2 = {max_tokens?: (number | null) | undefined, model: Model, output_config?: (BetaOutputConfig | null) | undefined, speed?: (BetaSpeed | null) | undefined, thinking?: (BetaThinkingConfigEnabled | BetaThinkingConfigDisabled | BetaThinkingConfigBetweenTools | BetaThinkingConfigAdaptive | null) | undefined} | {[key: string]: unknown}; export type BetaRequestMCPServerToolConfiguration = {allowed_tools?: (Array | null) | undefined, enabled?: (boolean | null) | undefined}; export type BetaRequestMCPServerURLDefinition = {authorization_token?: (string | null) | undefined, name: string, tool_configuration?: (BetaRequestMCPServerToolConfiguration | null) | undefined, type: 'url', url: string}; export type BetaMetadata = {user_id?: (string | null) | undefined}; export type BetaThinkingConfigParam = BetaThinkingConfigEnabled | BetaThinkingConfigDisabled | BetaThinkingConfigBetweenTools | BetaThinkingConfigAdaptive; export type BetaToolChoiceAuto = {disable_parallel_tool_use?: boolean | undefined, type: 'auto'}; export type BetaToolChoiceAny = {disable_parallel_tool_use?: boolean | undefined, type: 'any'}; export type BetaToolChoiceTool = {disable_parallel_tool_use?: boolean | undefined, name: string, type: 'tool'}; export type BetaToolChoiceNone = {type: 'none'}; export type BetaToolChoice = BetaToolChoiceAuto | BetaToolChoiceAny | BetaToolChoiceTool | BetaToolChoiceNone; export type BetaCreateMessageParams = {model: Model, messages: Array, cache_control?: (BetaCacheControlEphemeral | null) | undefined, compaction?: ({instructions?: (string | null) | undefined, type: 'summarize'} | null) | undefined, container?: (BetaContainerParams | string | null) | undefined, context_management?: ({edits?: (Array) | undefined} | null) | undefined, diagnostics?: (BetaDiagnosticsParam | null) | undefined, fallback_credit_token?: (string | {mode?: ('strict' | 'best_effort') | undefined, token: string} | null) | undefined, fallbacks?: (Array | 'default' | null) | undefined, inference_geo?: (string | null) | undefined, max_tokens: number, mcp_servers?: Array | undefined, metadata?: BetaMetadata | undefined, output_config?: BetaOutputConfig | undefined, output_format?: ({schema: {[key: string]: unknown}, type: 'json_schema'} | null) | undefined, service_tier?: ('auto' | 'standard_only') | undefined, speed?: (BetaSpeed | null) | undefined, stop_sequences?: Array | undefined, stream?: boolean | undefined, system?: (string | Array) | undefined, thinking?: BetaThinkingConfigParam | undefined, thread?: ({type: 'create'} | {previous_message_id: string, type: 'continue'} | null) | undefined, tool_choice?: BetaToolChoice | undefined, tools?: Array | undefined}; export type BetaMessageBatchIndividualRequestParams = {custom_id: string, params: BetaCreateMessageParams}; export type BetaCreateMessageBatchParams = {requests: Array}; export type CreateApiV1MessagesBatchesBetaTrueArgs = {'anthropic-beta'?: Array | undefined, 'anthropic-version'?: string | undefined, 'anthropic-user-profile-id'?: string | undefined, 'anthropic-workspace-id'?: string | undefined, body: BetaCreateMessageBatchParams}; export type CreateApiV1MessagesBatchesBetaTrueOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; export const betaRequestCounts = z.object({canceled: z.number().int(), errored: z.number().int(), expired: z.number().int(), processing: z.number().int(), succeeded: z.number().int()}); export const betaMessageBatch = z.object({archived_at: z.string().nullable(), cancel_initiated_at: z.string().nullable(), created_at: z.string(), ended_at: z.string().nullable(), expires_at: z.string(), id: z.string(), processing_status: z.enum(["in_progress", "canceling", "ended"]), request_counts: betaRequestCounts, results_url: z.string().nullable(), type: z.literal("message_batch")}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Create a Message Batch * * POST /v1/messages/batches?beta=true */ export const createApiV1MessagesBatchesBetaTrue = async (args: CreateApiV1MessagesBatchesBetaTrueArgs, options?: CreateApiV1MessagesBatchesBetaTrueOptions) => { const {baseUrl = "https://api.anthropic.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['anthropic-beta'] != null) headers.set("anthropic-beta", args['anthropic-beta'].join(',')) if (args['anthropic-version'] != null) headers.set("anthropic-version", String(args['anthropic-version'])) if (args['anthropic-user-profile-id'] != null) headers.set("anthropic-user-profile-id", String(args['anthropic-user-profile-id'])) if (args['anthropic-workspace-id'] != null) headers.set("anthropic-workspace-id", String(args['anthropic-workspace-id'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/messages/batches?beta=true${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(betaMessageBatch, await res.json()) };