{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://raw.githubusercontent.com/api-evangelist/anthropic/main/json-schema/anthropic-beta-message-schema.json", "title": "Message", "x-generated": "2026-09-23", "x-method": "derived", "x-generator": "derive-json-schema.py", "x-source": "openapi/anthropic-messages-beta-true-api-openapi.yml#/components/schemas/BetaMessage", "properties": { "id": { "description": "Unique object identifier.\n\nThe format and length of IDs may change over time.", "title": "Id", "type": "string" }, "type": { "const": "message", "default": "message", "description": "Object type.\n\nFor Messages, this is always `\"message\"`.", "title": "Type", "type": "string" }, "role": { "const": "assistant", "default": "assistant", "description": "Conversational role of the generated message.\n\nThis will always be `\"assistant\"`.", "title": "Role", "type": "string" }, "content": { "description": "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```", "items": { "$ref": "#/$defs/BetaContentBlock" }, "title": "Content", "type": "array" }, "model": { "$ref": "#/$defs/Model" }, "stop_reason": { "anyOf": [ { "$ref": "#/$defs/BetaStopReason" }, { "type": "null" } ], "description": "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* `\"model_context_window_exceeded\"`: we exceeded the model's context window\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.", "title": "Stop Reason" }, "stop_sequence": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "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.", "title": "Stop Sequence" }, "stop_details": { "anyOf": [ { "$ref": "#/$defs/BetaRefusalStopDetails" }, { "type": "null" } ], "default": null, "description": "Structured information about why model output stopped.\n\nThis is `null` when the `stop_reason` has no additional detail to report." }, "usage": { "$ref": "#/$defs/BetaUsage", "description": "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`." }, "diagnostics": { "anyOf": [ { "$ref": "#/$defs/BetaDiagnostics" }, { "type": "null" } ], "default": null, "description": "Request-level diagnostics. Present only when `diagnostics` was supplied on the request; `null` when no prompt-cache divergence was detected.", "x-anthropic-beta-required": [ "cache-diagnosis-2026-04-07" ] }, "context_management": { "anyOf": [ { "$ref": "#/$defs/BetaResponseContextManagement" }, { "type": "null" } ], "default": null, "description": "Context management response.\n\nInformation about context management strategies applied during the request.", "x-anthropic-beta-required": [ "context-management-2025-06-27", "compact-2026-01-12" ] }, "container": { "anyOf": [ { "$ref": "#/$defs/BetaContainer" }, { "type": "null" } ], "default": null, "description": "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used." } }, "required": [ "id", "type", "role", "content", "model", "stop_reason", "stop_sequence", "stop_details", "usage", "diagnostics", "context_management", "container" ], "type": "object", "x-stainless-python-custom-imports": [ "from .beta_content_block import BetaContentBlock as BetaContentBlock" ], "$defs": { "BetaAdvisorMessageIterationUsage": { "description": "Token usage for an advisor sub-inference iteration.", "properties": { "cache_creation": { "anyOf": [ { "$ref": "#/$defs/BetaCacheCreation" }, { "type": "null" } ], "default": null, "description": "Breakdown of cached tokens by TTL" }, "cache_creation_input_tokens": { "default": 0, "description": "The number of input tokens used to create the cache entry.", "minimum": 0, "title": "Cache Creation Input Tokens", "type": "integer" }, "cache_read_input_tokens": { "default": 0, "description": "The number of input tokens read from the cache.", "minimum": 0, "title": "Cache Read Input Tokens", "type": "integer" }, "input_tokens": { "description": "The number of input tokens which were used.", "minimum": 0, "title": "Input Tokens", "type": "integer" }, "model": { "$ref": "#/$defs/Model" }, "output_tokens": { "description": "The number of output tokens which were used.", "minimum": 0, "title": "Output Tokens", "type": "integer" }, "type": { "const": "advisor_message", "default": "advisor_message", "description": "Usage for an advisor sub-inference iteration", "title": "Type", "type": "string" } }, "required": [ "cache_creation", "cache_creation_input_tokens", "cache_read_input_tokens", "input_tokens", "model", "output_tokens", "type" ], "title": "AdvisorMessageIterationUsage", "type": "object" }, "BetaAdvisorToolResultErrorCode": { "enum": [ "max_uses_exceeded", "prompt_too_long", "too_many_requests", "overloaded", "unavailable", "execution_time_exceeded", "model_not_found" ], "title": "AdvisorToolResultErrorCode", "type": "string" }, "BetaBase64PDFSource": { "additionalProperties": false, "properties": { "data": { "format": "byte", "title": "Data", "type": "string" }, "media_type": { "const": "application/pdf", "title": "Media Type", "type": "string" }, "type": { "const": "base64", "title": "Type", "type": "string" } }, "required": [ "data", "media_type", "type" ], "title": "Base64PDFSource", "type": "object" }, "BetaBashCodeExecutionToolResultErrorCode": { "enum": [ "invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded", "output_file_too_large" ], "title": "BashCodeExecutionToolResultErrorCode", "type": "string" }, "BetaCacheCreation": { "properties": { "ephemeral_1h_input_tokens": { "default": 0, "description": "The number of input tokens used to create the 1 hour cache entry.", "minimum": 0, "title": "Ephemeral 1H Input Tokens", "type": "integer" }, "ephemeral_5m_input_tokens": { "default": 0, "description": "The number of input tokens used to create the 5 minute cache entry.", "minimum": 0, "title": "Ephemeral 5M Input Tokens", "type": "integer" } }, "required": [ "ephemeral_1h_input_tokens", "ephemeral_5m_input_tokens" ], "title": "CacheCreation", "type": "object" }, "BetaCacheMissMessagesChanged": { "properties": { "cache_missed_input_tokens": { "description": "Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.", "title": "Cache Missed Input Tokens", "type": "integer" }, "type": { "const": "messages_changed", "default": "messages_changed", "title": "Type", "type": "string" } }, "required": [ "cache_missed_input_tokens", "type" ], "title": "CacheMissMessagesChanged", "type": "object" }, "BetaCacheMissModelChanged": { "properties": { "cache_missed_input_tokens": { "description": "Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.", "title": "Cache Missed Input Tokens", "type": "integer" }, "type": { "const": "model_changed", "default": "model_changed", "title": "Type", "type": "string" } }, "required": [ "cache_missed_input_tokens", "type" ], "title": "CacheMissModelChanged", "type": "object" }, "BetaCacheMissPreviousMessageNotFound": { "properties": { "type": { "const": "previous_message_not_found", "default": "previous_message_not_found", "title": "Type", "type": "string" } }, "required": [ "type" ], "title": "CacheMissPreviousMessageNotFound", "type": "object" }, "BetaCacheMissSystemChanged": { "properties": { "cache_missed_input_tokens": { "description": "Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.", "title": "Cache Missed Input Tokens", "type": "integer" }, "type": { "const": "system_changed", "default": "system_changed", "title": "Type", "type": "string" } }, "required": [ "cache_missed_input_tokens", "type" ], "title": "CacheMissSystemChanged", "type": "object" }, "BetaCacheMissToolsChanged": { "properties": { "cache_missed_input_tokens": { "description": "Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.", "title": "Cache Missed Input Tokens", "type": "integer" }, "type": { "const": "tools_changed", "default": "tools_changed", "title": "Type", "type": "string" } }, "required": [ "cache_missed_input_tokens", "type" ], "title": "CacheMissToolsChanged", "type": "object" }, "BetaCacheMissUnavailable": { "properties": { "type": { "const": "unavailable", "default": "unavailable", "title": "Type", "type": "string" } }, "required": [ "type" ], "title": "CacheMissUnavailable", "type": "object" }, "BetaCodeExecutionToolResultErrorCode": { "enum": [ "invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded" ], "title": "CodeExecutionToolResultErrorCode", "type": "string" }, "BetaCompactionIterationUsage": { "description": "Token usage for a compaction iteration.", "properties": { "cache_creation": { "anyOf": [ { "$ref": "#/$defs/BetaCacheCreation" }, { "type": "null" } ], "default": null, "description": "Breakdown of cached tokens by TTL" }, "cache_creation_input_tokens": { "default": 0, "description": "The number of input tokens used to create the cache entry.", "minimum": 0, "title": "Cache Creation Input Tokens", "type": "integer" }, "cache_read_input_tokens": { "default": 0, "description": "The number of input tokens read from the cache.", "minimum": 0, "title": "Cache Read Input Tokens", "type": "integer" }, "input_tokens": { "description": "The number of input tokens which were used.", "minimum": 0, "title": "Input Tokens", "type": "integer" }, "output_tokens": { "description": "The number of output tokens which were used.", "minimum": 0, "title": "Output Tokens", "type": "integer" }, "type": { "const": "compaction", "default": "compaction", "description": "Usage for a compaction iteration", "title": "Type", "type": "string" } }, "required": [ "cache_creation", "cache_creation_input_tokens", "cache_read_input_tokens", "input_tokens", "output_tokens", "type" ], "title": "CompactionIterationUsage", "type": "object" }, "BetaContainer": { "description": "Information about the container used in the request (for the code execution tool)", "properties": { "expires_at": { "description": "The time at which the container will expire.", "format": "date-time", "title": "Expires At", "type": "string" }, "id": { "description": "Identifier for the container used in this request", "title": "Id", "type": "string" }, "skills": { "anyOf": [ { "items": { "$ref": "#/$defs/BetaSkill" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Skills loaded in the container", "title": "Skills" } }, "required": [ "expires_at", "id", "skills" ], "title": "Container", "type": "object" }, "BetaContentBlock": { "oneOf": [ { "$ref": "#/$defs/BetaResponseTextBlock" }, { "$ref": "#/$defs/BetaResponseThinkingBlock" }, { "$ref": "#/$defs/BetaResponseRedactedThinkingBlock" }, { "$ref": "#/$defs/BetaResponseToolUseBlock" }, { "$ref": "#/$defs/BetaResponseServerToolUseBlock" }, { "$ref": "#/$defs/BetaResponseWebSearchToolResultBlock" }, { "$ref": "#/$defs/BetaResponseWebFetchToolResultBlock" }, { "$ref": "#/$defs/BetaResponseAdvisorToolResultBlock", "x-anthropic-beta-required": [ "advisor-tool-2026-03-01" ] }, { "$ref": "#/$defs/BetaResponseCodeExecutionToolResultBlock" }, { "$ref": "#/$defs/BetaResponseBashCodeExecutionToolResultBlock" }, { "$ref": "#/$defs/BetaResponseTextEditorCodeExecutionToolResultBlock" }, { "$ref": "#/$defs/BetaResponseToolSearchToolResultBlock" }, { "$ref": "#/$defs/BetaResponseMCPToolUseBlock", "x-anthropic-beta-required": [ "mcp-client-2025-04-04", "mcp-client-2025-11-20" ] }, { "$ref": "#/$defs/BetaResponseMCPToolResultBlock", "x-anthropic-beta-required": [ "mcp-client-2025-04-04", "mcp-client-2025-11-20" ] }, { "$ref": "#/$defs/BetaResponseContainerUploadBlock" }, { "$ref": "#/$defs/BetaResponseCompactionBlock", "x-anthropic-beta-required": [ "compact-2026-01-12" ] }, { "$ref": "#/$defs/BetaResponseFallbackBlock", "x-anthropic-beta-required": [ "server-side-fallback-2026-06-01", "server-side-fallback-2026-07-01" ] } ] }, "BetaDiagnostics": { "description": "Response envelope for request-level diagnostics. Present (possibly\nnull) whenever the caller supplied `diagnostics` on the request.", "properties": { "cache_miss_reason": { "anyOf": [ { "oneOf": [ { "$ref": "#/$defs/BetaCacheMissModelChanged" }, { "$ref": "#/$defs/BetaCacheMissSystemChanged" }, { "$ref": "#/$defs/BetaCacheMissToolsChanged" }, { "$ref": "#/$defs/BetaCacheMissMessagesChanged" }, { "$ref": "#/$defs/BetaCacheMissPreviousMessageNotFound" }, { "$ref": "#/$defs/BetaCacheMissUnavailable" } ] }, { "type": "null" } ], "default": null, "description": "Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.", "title": "Cache Miss Reason" } }, "required": [ "cache_miss_reason" ], "title": "Diagnostics", "type": "object" }, "BetaDirectCaller": { "additionalProperties": false, "description": "Tool invocation directly from the model.", "properties": { "type": { "const": "direct", "title": "Type", "type": "string" } }, "required": [ "type" ], "title": "DirectCaller", "type": "object" }, "BetaFallbackCreditNotApplied": { "description": "No reprice was applied; ``reason`` says why.", "properties": { "reason": { "description": "Why the reprice was not applied.\n\nA closed enum; additions to the redemption-check vocabulary arrive as\ndeliberate schema updates.", "enum": [ "body_mismatch", "continuation_excluded", "continuation_only", "expired", "invalid_target_model", "not_enabled", "reprice_unavailable", "temporarily_unavailable", "variant_fields_present", "wrong_organization", "wrong_platform", "wrong_workspace" ], "title": "Reason", "type": "string" }, "remove_to_redeem": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Request fields to remove before retrying, so the retry can redeem this\ntoken.\n\nPresent exactly when `reason` is `variant_fields_present` — never null,\nnever an empty array; absent otherwise. Fields are named only from your own request, and only after\nthe sealed variant hash matched. A served best-effort retry has already\nbeen billed at normal price; nothing redeems retroactively, but a corrected\nre-send inside the token's five-minute window can still redeem.", "title": "Remove To Redeem" }, "type": { "const": "not_applied", "default": "not_applied", "title": "Type", "type": "string" } }, "required": [ "reason", "type" ], "title": "FallbackCreditNotApplied", "type": "object" }, "BetaFallbackCreditRedeemed": { "description": "The reprice was applied: the retry is billed as if the conversation\nhad been on the retry model all along.", "properties": { "type": { "const": "redeemed", "default": "redeemed", "title": "Type", "type": "string" } }, "required": [ "type" ], "title": "FallbackCreditRedeemed", "type": "object" }, "BetaFallbackCreditUsage": { "description": "Outcome of the ``fallback_credit_token`` presented on this request.", "properties": { "status": { "description": "Whether the fallback-credit reprice was applied to this response's billing.\n\nA union discriminated on `type`. `redeemed`: the retry is billed as if\nthe conversation had been on the retry model all along — including when the\nresulting shift is zero because there was nothing to move. `not_applied`:\nno reprice was applied; the arm's `reason` says why.", "oneOf": [ { "$ref": "#/$defs/BetaFallbackCreditRedeemed" }, { "$ref": "#/$defs/BetaFallbackCreditNotApplied" } ], "title": "Status" } }, "required": [ "status" ], "title": "FallbackCreditUsage", "type": "object" }, "BetaFallbackMessageIterationUsage": { "description": "Token usage for the fallback-model attempt of a server-side fallback request.\n\nProduced in place of a `message` entry for whichever hop served the\nresponse. A declined hop produces the existing `message` entry. Whether\na fallback model served the response is signalled by the presence of this\nentry in `usage.iterations`.", "properties": { "cache_creation": { "anyOf": [ { "$ref": "#/$defs/BetaCacheCreation" }, { "type": "null" } ], "default": null, "description": "Breakdown of cached tokens by TTL" }, "cache_creation_input_tokens": { "default": 0, "description": "The number of input tokens used to create the cache entry.", "minimum": 0, "title": "Cache Creation Input Tokens", "type": "integer" }, "cache_read_input_tokens": { "default": 0, "description": "The number of input tokens read from the cache.", "minimum": 0, "title": "Cache Read Input Tokens", "type": "integer" }, "input_tokens": { "description": "The number of input tokens which were used.", "minimum": 0, "title": "Input Tokens", "type": "integer" }, "model": { "$ref": "#/$defs/Model" }, "output_tokens": { "description": "The number of output tokens which were used.", "minimum": 0, "title": "Output Tokens", "type": "integer" }, "type": { "const": "fallback_message", "default": "fallback_message", "description": "Usage for the fallback-model attempt that served the response", "title": "Type", "type": "string" } }, "required": [ "cache_creation", "cache_creation_input_tokens", "cache_read_input_tokens", "input_tokens", "model", "output_tokens", "type" ], "title": "FallbackMessageIterationUsage", "type": "object" }, "BetaFallbackRefusalTrigger": { "description": "The `from` model declined for policy reasons.", "properties": { "category": { "anyOf": [ { "$ref": "#/$defs/BetaRefusalCategory" }, { "type": "null" } ], "default": null, "description": "The policy category that triggered the `from` model's refusal at this hop. `null` when the refusal doesn't map to a named category. Same vocabulary as `stop_details.category`.", "x-stainless-naming": { "csharp": { "type_name": "BetaFallbackRefusalTriggerCategory" } } }, "type": { "const": "refusal", "default": "refusal", "title": "Type", "type": "string" } }, "required": [ "category", "type" ], "title": "FallbackRefusalTrigger", "type": "object" }, "BetaIterationsUsage": { "anyOf": [ { "items": { "oneOf": [ { "$ref": "#/$defs/BetaMessageIterationUsage" }, { "$ref": "#/$defs/BetaCompactionIterationUsage" }, { "$ref": "#/$defs/BetaAdvisorMessageIterationUsage", "x-anthropic-beta-required": [ "advisor-tool-2026-03-01" ] }, { "$ref": "#/$defs/BetaFallbackMessageIterationUsage", "x-anthropic-beta-required": [ "server-side-fallback-2026-06-01", "server-side-fallback-2026-07-01" ] } ], "x-stainless-naming": { "java": { "type_name": "BetaIterationsUsageItems" }, "csharp": { "type_name": "BetaIterationsUsageItems" } } }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Per-iteration token usage breakdown.\n\nEach entry represents one sampling iteration, with its own input/output token counts and cache statistics, discriminated by `type`. For `message` entries (model sampling iterations, such as the turns of a server-side tool use loop), this allows you to:\n- Determine which iterations exceeded long context thresholds (>=200k tokens)\n- Calculate the context window size from the last `message` entry\n- Understand token accumulation across server-side tool use loops\n\nA `compaction` entry reports the token usage of the compaction operation itself — the server-side request that summarizes the context being closed — NOT the size of the context that was compacted away, and its token counts can be much smaller than that closed context (for example, a compaction that closes a ~200k-token context can report only a few thousand tokens). Do not derive the context window size from a `compaction` entry, even when it is the last entry. A `compaction` entry's tokens are not included in the top-level `usage` fields. When an input-token trigger is in effect (the default — 150,000 tokens unless configured otherwise), each `compaction` entry closes a context that had reached at least that threshold, though the context can exceed it by the final iteration's output and tool results.", "title": "Iterations", "x-anthropic-beta-required": [ "compact-2026-01-12", "advisor-tool-2026-03-01", "task-budgets-2026-03-13", "server-side-fallback-2026-06-01", "server-side-fallback-2026-07-01" ] }, "BetaMessageIterationUsage": { "description": "Token usage for a sampling iteration.", "properties": { "cache_creation": { "anyOf": [ { "$ref": "#/$defs/BetaCacheCreation" }, { "type": "null" } ], "default": null, "description": "Breakdown of cached tokens by TTL" }, "cache_creation_input_tokens": { "default": 0, "description": "The number of input tokens used to create the cache entry.", "minimum": 0, "title": "Cache Creation Input Tokens", "type": "integer" }, "cache_read_input_tokens": { "default": 0, "description": "The number of input tokens read from the cache.", "minimum": 0, "title": "Cache Read Input Tokens", "type": "integer" }, "input_tokens": { "description": "The number of input tokens which were used.", "minimum": 0, "title": "Input Tokens", "type": "integer" }, "model": { "$ref": "#/$defs/Model" }, "output_tokens": { "description": "The number of output tokens which were used.", "minimum": 0, "title": "Output Tokens", "type": "integer" }, "type": { "const": "message", "default": "message", "description": "Usage for a sampling iteration", "title": "Type", "type": "string" } }, "required": [ "cache_creation", "cache_creation_input_tokens", "cache_read_input_tokens", "input_tokens", "model", "output_tokens", "type" ], "title": "MessageIterationUsage", "type": "object" }, "BetaOutputTokensDetails": { "properties": { "thinking_tokens": { "default": 0, "description": "Number of output tokens the model generated as internal reasoning, including\nthe thinking-block delimiter tokens.\n\nReflects the raw reasoning the model produced, not the (possibly shorter)\nsummarized thinking text returned in the response body. Computed by\nre-tokenizing the raw reasoning text, so it may differ from the model's exact\ngeneration count by a small number of tokens. Always ≤ `output_tokens`;\n`output_tokens - thinking_tokens` approximates the non-reasoning output.", "minimum": 0, "title": "Thinking Tokens", "type": "integer" } }, "required": [ "thinking_tokens" ], "title": "OutputTokensDetails", "type": "object" }, "BetaPlainTextSource": { "additionalProperties": false, "properties": { "data": { "title": "Data", "type": "string" }, "media_type": { "const": "text/plain", "title": "Media Type", "type": "string" }, "type": { "const": "text", "title": "Type", "type": "string" } }, "required": [ "data", "media_type", "type" ], "title": "PlainTextSource", "type": "object" }, "BetaRefusalCategory": { "description": "The policy category that triggered a refusal.", "enum": [ "cyber", "bio", "frontier_llm", "reasoning_extraction", "general_harms" ], "title": "RefusalCategory", "type": "string", "x-enum-descriptions": [ "The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.", "The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.", "The request could assist the development of competing AI models, which is restricted under [Anthropic's commercial terms](https://www.anthropic.com/legal/commercial-terms). Benign machine learning work can also trigger this category.", "The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking).", "The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category." ] }, "BetaRefusalStopDetails": { "description": "Structured information about a refusal.", "properties": { "category": { "anyOf": [ { "$ref": "#/$defs/BetaRefusalCategory" }, { "type": "null" } ], "default": null, "description": "The policy category that triggered the refusal.\n\n`null` when the refusal doesn't map to a named category." }, "explanation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Human-readable explanation of the refusal.\n\nThis text is not guaranteed to be stable. `null` when no explanation is available for the category.", "title": "Explanation" }, "fallback_credit_token": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Opaque code that refunds the cache-miss cost when retrying this refused\nrequest on the fallback model. Pass it as `fallback_credit_token` on the\nretry request. Expires 5 minutes after the refusal.\n\nThe retry is sent either with the same request body (`system`, `messages`,\n`tools`, and other render-shaping fields), or with the same body plus one\nappended `assistant` message whose content is the partial text (with any\ntrailing whitespace stripped from the final text block) and paired\nserver-tool blocks from this refusal — which also authorizes that\nappended turn as an assistant-prefill continuation on models that otherwise\ndisallow prefill. A token minted mid-server-tool-loop whose partial content\nwas continuable may only be redeemed the second way — if a same-body retry\nis rejected with a 400 saying the token must be redeemed by continuing the\npartial response, retry the second way instead. Either way: same workspace,\nsame platform; a mismatch is a 400. Resending a token for an already-warm\nprefix is permitted but yields no additional credit.\n\n`null` when the refused model isn't eligible for a fallback credit.", "title": "Fallback Credit Token", "x-anthropic-beta-required": [ "fallback-credit-2026-06-01", "fallback-credit-2026-07-01", "server-side-fallback-2026-06-01", "server-side-fallback-2026-07-01" ] }, "fallback_has_prefill_claim": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Whether the accompanying `fallback_credit_token` may be redeemed with the\nappended-assistant retry form. Only set when `fallback_credit_token` is\npresent.\n\n`true`: retry by resending the same request body plus one appended\n`assistant` message whose content is this response's `content` with any\ntrailing whitespace stripped from the final text block and unpaired\n`tool_use` blocks omitted (the same appended-turn shape described on\n`fallback_credit_token`), with the token attached. `false`: retry by\nresending the original request body unchanged, with the token attached —\nthe appended-assistant form is not available for this refusal (no\ncontinuable partial content, or the request uses `output_format` or a\n`tool_choice` that forces tool use). One exception: when the request used\n`output_format` or a forced `tool_choice` and the refusal arrived after\nserver tools (including MCP connector tools) had already executed, the\ntoken may not be redeemable by either retry form; if the exact-body retry\nis then rejected with a 400 saying the token must be redeemed by\ncontinuing the partial response, discard the token and retry without it.\n\nAdvisory: if an appended-assistant retry is rejected with a 400 despite\n`true`, fall back to resending the original request body with the token.", "title": "Fallback Has Prefill Claim", "x-anthropic-beta-required": [ "fallback-credit-2026-06-01", "fallback-credit-2026-07-01", "server-side-fallback-2026-06-01", "server-side-fallback-2026-07-01" ] }, "recommended_model": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The server's suggested retry target for this refusal. Populated when a fallback attempt could not be made (the fallback model's rate limit was exhausted, or it was overloaded); names the fallback model the caller can retry directly. Null otherwise.", "title": "Recommended Model", "x-anthropic-beta-required": [ "server-side-fallback-2026-06-01", "server-side-fallback-2026-07-01" ] }, "type": { "const": "refusal", "default": "refusal", "title": "Type", "type": "string" } }, "required": [ "category", "explanation", "fallback_credit_token", "fallback_has_prefill_claim", "recommended_model", "type" ], "title": "RefusalStopDetails", "type": "object" }, "BetaResponseAdvisorRedactedResultBlock": { "properties": { "encrypted_content": { "description": "Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify.", "title": "Encrypted Content", "type": "string" }, "stop_reason": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`).", "title": "Stop Reason" }, "type": { "const": "advisor_redacted_result", "default": "advisor_redacted_result", "title": "Type", "type": "string" } }, "required": [ "encrypted_content", "stop_reason", "type" ], "title": "ResponseAdvisorRedactedResultBlock", "type": "object" }, "BetaResponseAdvisorResultBlock": { "properties": { "stop_reason": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The advisor sub-inference's stop reason (same values as the top-level message `stop_reason`). `max_tokens` indicates the advisor's output was truncated at the tool's `max_tokens` value or the advisor model's policy cap.", "title": "Stop Reason" }, "text": { "title": "Text", "type": "string" }, "type": { "const": "advisor_result", "default": "advisor_result", "title": "Type", "type": "string" } }, "required": [ "stop_reason", "text", "type" ], "title": "ResponseAdvisorResultBlock", "type": "object" }, "BetaResponseAdvisorToolResultBlock": { "properties": { "content": { "anyOf": [ { "$ref": "#/$defs/BetaResponseAdvisorToolResultError" }, { "$ref": "#/$defs/BetaResponseAdvisorResultBlock" }, { "$ref": "#/$defs/BetaResponseAdvisorRedactedResultBlock" } ], "title": "Content" }, "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, "type": { "const": "advisor_tool_result", "default": "advisor_tool_result", "title": "Type", "type": "string" } }, "required": [ "content", "tool_use_id", "type" ], "title": "ResponseAdvisorToolResultBlock", "type": "object" }, "BetaResponseAdvisorToolResultError": { "properties": { "error_code": { "$ref": "#/$defs/BetaAdvisorToolResultErrorCode" }, "type": { "const": "advisor_tool_result_error", "default": "advisor_tool_result_error", "title": "Type", "type": "string" } }, "required": [ "error_code", "type" ], "title": "ResponseAdvisorToolResultError", "type": "object" }, "BetaResponseBashCodeExecutionOutputBlock": { "properties": { "file_id": { "title": "File Id", "type": "string" }, "type": { "const": "bash_code_execution_output", "default": "bash_code_execution_output", "title": "Type", "type": "string" } }, "required": [ "file_id", "type" ], "title": "ResponseBashCodeExecutionOutputBlock", "type": "object" }, "BetaResponseBashCodeExecutionResultBlock": { "properties": { "content": { "items": { "$ref": "#/$defs/BetaResponseBashCodeExecutionOutputBlock" }, "title": "Content", "type": "array" }, "return_code": { "title": "Return Code", "type": "integer" }, "stderr": { "title": "Stderr", "type": "string" }, "stdout": { "title": "Stdout", "type": "string" }, "type": { "const": "bash_code_execution_result", "default": "bash_code_execution_result", "title": "Type", "type": "string" } }, "required": [ "content", "return_code", "stderr", "stdout", "type" ], "title": "ResponseBashCodeExecutionResultBlock", "type": "object" }, "BetaResponseBashCodeExecutionToolResultBlock": { "properties": { "content": { "anyOf": [ { "$ref": "#/$defs/BetaResponseBashCodeExecutionToolResultError" }, { "$ref": "#/$defs/BetaResponseBashCodeExecutionResultBlock" } ], "title": "Content" }, "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, "type": { "const": "bash_code_execution_tool_result", "default": "bash_code_execution_tool_result", "title": "Type", "type": "string" } }, "required": [ "content", "tool_use_id", "type" ], "title": "ResponseBashCodeExecutionToolResultBlock", "type": "object" }, "BetaResponseBashCodeExecutionToolResultError": { "properties": { "error_code": { "$ref": "#/$defs/BetaBashCodeExecutionToolResultErrorCode" }, "type": { "const": "bash_code_execution_tool_result_error", "default": "bash_code_execution_tool_result_error", "title": "Type", "type": "string" } }, "required": [ "error_code", "type" ], "title": "ResponseBashCodeExecutionToolResultError", "type": "object" }, "BetaResponseCharLocationCitation": { "properties": { "cited_text": { "title": "Cited Text", "type": "string" }, "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, "document_title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Document Title" }, "end_char_index": { "title": "End Char Index", "type": "integer" }, "file_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "File Id" }, "start_char_index": { "minimum": 0, "title": "Start Char Index", "type": "integer" }, "type": { "const": "char_location", "default": "char_location", "title": "Type", "type": "string" } }, "required": [ "cited_text", "document_index", "document_title", "end_char_index", "file_id", "start_char_index", "type" ], "title": "ResponseCharLocationCitation", "type": "object" }, "BetaResponseCitationsConfig": { "properties": { "enabled": { "default": false, "title": "Enabled", "type": "boolean" } }, "required": [ "enabled" ], "title": "ResponseCitationsConfig", "type": "object" }, "BetaResponseClearThinking20251015Edit": { "properties": { "cleared_input_tokens": { "description": "Number of input tokens cleared by this edit.", "minimum": 0, "title": "Cleared Input Tokens", "type": "integer" }, "cleared_thinking_turns": { "description": "Number of thinking turns that were cleared.", "minimum": 0, "title": "Cleared Thinking Turns", "type": "integer" }, "type": { "const": "clear_thinking_20251015", "default": "clear_thinking_20251015", "description": "The type of context management edit applied.", "title": "Type", "type": "string" } }, "required": [ "cleared_input_tokens", "cleared_thinking_turns", "type" ], "title": "ResponseClearThinking20251015Edit", "type": "object" }, "BetaResponseClearToolUses20250919Edit": { "properties": { "cleared_input_tokens": { "description": "Number of input tokens cleared by this edit.", "minimum": 0, "title": "Cleared Input Tokens", "type": "integer" }, "cleared_tool_uses": { "description": "Number of tool uses that were cleared.", "minimum": 0, "title": "Cleared Tool Uses", "type": "integer" }, "type": { "const": "clear_tool_uses_20250919", "default": "clear_tool_uses_20250919", "description": "The type of context management edit applied.", "title": "Type", "type": "string" } }, "required": [ "cleared_input_tokens", "cleared_tool_uses", "type" ], "title": "ResponseClearToolUses20250919Edit", "type": "object" }, "BetaResponseCodeExecutionOutputBlock": { "properties": { "file_id": { "title": "File Id", "type": "string" }, "type": { "const": "code_execution_output", "default": "code_execution_output", "title": "Type", "type": "string" } }, "required": [ "file_id", "type" ], "title": "ResponseCodeExecutionOutputBlock", "type": "object" }, "BetaResponseCodeExecutionResultBlock": { "properties": { "content": { "items": { "$ref": "#/$defs/BetaResponseCodeExecutionOutputBlock" }, "title": "Content", "type": "array" }, "return_code": { "title": "Return Code", "type": "integer" }, "stderr": { "title": "Stderr", "type": "string" }, "stdout": { "title": "Stdout", "type": "string" }, "type": { "const": "code_execution_result", "default": "code_execution_result", "title": "Type", "type": "string" } }, "required": [ "content", "return_code", "stderr", "stdout", "type" ], "title": "ResponseCodeExecutionResultBlock", "type": "object" }, "BetaResponseCodeExecutionToolResultBlock": { "properties": { "content": { "anyOf": [ { "$ref": "#/$defs/BetaResponseCodeExecutionToolResultError" }, { "$ref": "#/$defs/BetaResponseCodeExecutionResultBlock" }, { "$ref": "#/$defs/BetaResponseEncryptedCodeExecutionResultBlock" } ], "title": "Content" }, "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, "type": { "const": "code_execution_tool_result", "default": "code_execution_tool_result", "title": "Type", "type": "string" } }, "required": [ "content", "tool_use_id", "type" ], "title": "ResponseCodeExecutionToolResultBlock", "type": "object" }, "BetaResponseCodeExecutionToolResultError": { "properties": { "error_code": { "$ref": "#/$defs/BetaCodeExecutionToolResultErrorCode" }, "type": { "const": "code_execution_tool_result_error", "default": "code_execution_tool_result_error", "title": "Type", "type": "string" } }, "required": [ "error_code", "type" ], "title": "ResponseCodeExecutionToolResultError", "type": "object" }, "BetaResponseCompactionBlock": { "description": "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.", "properties": { "content": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Summary of compacted content, or null if compaction failed", "title": "Content" }, "encrypted_content": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Opaque metadata from prior compaction, to be round-tripped verbatim", "title": "Encrypted Content", "x-anthropic-beta-required": [ "task-budgets-2026-03-13" ] }, "type": { "const": "compaction", "default": "compaction", "title": "Type", "type": "string" } }, "required": [ "content", "encrypted_content", "type" ], "title": "ResponseCompactionBlock", "type": "object" }, "BetaResponseContainerUploadBlock": { "description": "Response model for a file uploaded to the container.", "properties": { "file_id": { "title": "File Id", "type": "string" }, "type": { "const": "container_upload", "default": "container_upload", "title": "Type", "type": "string" } }, "required": [ "file_id", "type" ], "title": "ResponseContainerUploadBlock", "type": "object" }, "BetaResponseContentBlockLocationCitation": { "properties": { "cited_text": { "description": "The full text of the cited block range, concatenated.\n\nAlways equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.", "title": "Cited Text", "type": "string" }, "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, "document_title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Document Title" }, "end_block_index": { "description": "Exclusive 0-based end index of the cited block range in the source's `content` array.\n\nAlways greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.", "title": "End Block Index", "type": "integer" }, "file_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "File Id" }, "start_block_index": { "description": "0-based index of the first cited block in the source's `content` array.", "minimum": 0, "title": "Start Block Index", "type": "integer" }, "type": { "const": "content_block_location", "default": "content_block_location", "title": "Type", "type": "string" } }, "required": [ "cited_text", "document_index", "document_title", "end_block_index", "file_id", "start_block_index", "type" ], "title": "ResponseContentBlockLocationCitation", "type": "object" }, "BetaResponseContextManagement": { "properties": { "applied_edits": { "description": "List of context management edits that were applied.", "items": { "oneOf": [ { "$ref": "#/$defs/BetaResponseClearToolUses20250919Edit" }, { "$ref": "#/$defs/BetaResponseClearThinking20251015Edit", "x-anthropic-beta-required": [ "context-management-2025-06-27" ] } ] }, "title": "Applied Edits", "type": "array" } }, "required": [ "applied_edits" ], "title": "ResponseContextManagement", "type": "object" }, "BetaResponseDocumentBlock": { "properties": { "citations": { "anyOf": [ { "$ref": "#/$defs/BetaResponseCitationsConfig" }, { "type": "null" } ], "default": null, "description": "Citation configuration for the document" }, "source": { "oneOf": [ { "$ref": "#/$defs/BetaBase64PDFSource" }, { "$ref": "#/$defs/BetaPlainTextSource" } ], "title": "Source" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the document", "title": "Title" }, "type": { "const": "document", "default": "document", "title": "Type", "type": "string" } }, "required": [ "citations", "source", "title", "type" ], "title": "ResponseDocumentBlock", "type": "object" }, "BetaResponseEncryptedCodeExecutionResultBlock": { "description": "Code execution result with encrypted stdout for PFC + web_search results.", "properties": { "content": { "items": { "$ref": "#/$defs/BetaResponseCodeExecutionOutputBlock" }, "title": "Content", "type": "array" }, "encrypted_stdout": { "title": "Encrypted Stdout", "type": "string" }, "return_code": { "title": "Return Code", "type": "integer" }, "stderr": { "title": "Stderr", "type": "string" }, "type": { "const": "encrypted_code_execution_result", "default": "encrypted_code_execution_result", "title": "Type", "type": "string" } }, "required": [ "content", "encrypted_stdout", "return_code", "stderr", "type" ], "title": "ResponseEncryptedCodeExecutionResultBlock", "type": "object" }, "BetaResponseFallbackBlock": { "description": "Marks the point in `content` where one model's output gives way to the next.\n\nOne block appears per hop where a preceding model actually ran this turn and\ndeclined. A turn where no preceding model ran and declined has no such\nboundary and carries no block — the signal for whether a fallback model\nserved the response is the presence of a `fallback_message` entry in\n`usage.iterations`, not this block.\n\nThe block is treated like a server-tool content block for streaming: it\narrives via the standard `content_block_start` / `content_block_stop`\npair and carries no deltas.", "properties": { "from": { "$ref": "#/$defs/BetaResponseFallbackHopInfo", "description": "The model whose output ends at this point — the model that declined at this hop. When the declining hop is the requested model, its `model` echoes the top-level `model` string the caller sent (alias or canonical); when the declining hop is a fallback model, its `model` is that model's canonical id." }, "to": { "$ref": "#/$defs/BetaResponseFallbackHopInfo", "description": "The fallback model producing the content that follows this block. Its `model` is always the canonical id." }, "trigger": { "$ref": "#/$defs/BetaFallbackRefusalTrigger", "description": "What caused the `from` model to hand over at this hop." }, "type": { "const": "fallback", "default": "fallback", "title": "Type", "type": "string" } }, "required": [ "from", "to", "trigger", "type" ], "title": "ResponseFallbackBlock", "type": "object" }, "BetaResponseFallbackHopInfo": { "description": "Identifies one hop of a fallback transition.", "properties": { "model": { "$ref": "#/$defs/Model" } }, "required": [ "model" ], "title": "ResponseFallbackHopInfo", "type": "object" }, "BetaResponseMCPToolResultBlock": { "properties": { "content": { "anyOf": [ { "type": "string" }, { "items": { "$ref": "#/$defs/BetaResponseTextBlock", "title": "beta_mcp_tool_result_block_content_item" }, "type": "array", "title": "beta_mcp_tool_result_block_content" } ], "title": "Content" }, "is_error": { "default": false, "title": "Is Error", "type": "boolean" }, "tool_use_id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Tool Use Id", "type": "string" }, "type": { "const": "mcp_tool_result", "default": "mcp_tool_result", "title": "Type", "type": "string" } }, "required": [ "content", "is_error", "tool_use_id", "type" ], "title": "ResponseMCPToolResultBlock", "type": "object" }, "BetaResponseMCPToolUseBlock": { "properties": { "id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Id", "type": "string" }, "input": { "additionalProperties": true, "title": "Input", "type": "object" }, "name": { "description": "The name of the MCP tool", "title": "Name", "type": "string" }, "server_name": { "description": "The name of the MCP server", "title": "Server Name", "type": "string" }, "type": { "const": "mcp_tool_use", "default": "mcp_tool_use", "title": "Type", "type": "string" } }, "required": [ "id", "input", "name", "server_name", "type" ], "title": "ResponseMCPToolUseBlock", "type": "object" }, "BetaResponsePageLocationCitation": { "properties": { "cited_text": { "title": "Cited Text", "type": "string" }, "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, "document_title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Document Title" }, "end_page_number": { "title": "End Page Number", "type": "integer" }, "file_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "File Id" }, "start_page_number": { "minimum": 1, "title": "Start Page Number", "type": "integer" }, "type": { "const": "page_location", "default": "page_location", "title": "Type", "type": "string" } }, "required": [ "cited_text", "document_index", "document_title", "end_page_number", "file_id", "start_page_number", "type" ], "title": "ResponsePageLocationCitation", "type": "object" }, "BetaResponseRedactedThinkingBlock": { "properties": { "data": { "description": "The contents of this redacted thinking block, returned when portions of the model's thinking were safety-redacted. This field is opaque and encrypted, with no readable content.\n\nPass `redacted_thinking` blocks back to the API unchanged when continuing a multi-turn conversation.\n\nSee [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#redacted-thinking-blocks) for details.", "title": "Data", "type": "string" }, "type": { "const": "redacted_thinking", "default": "redacted_thinking", "title": "Type", "type": "string" } }, "required": [ "data", "type" ], "title": "ResponseRedactedThinkingBlock", "type": "object" }, "BetaResponseSearchResultLocationCitation": { "properties": { "cited_text": { "description": "The full text of the cited block range, concatenated.\n\nAlways equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.", "title": "Cited Text", "type": "string" }, "end_block_index": { "description": "Exclusive 0-based end index of the cited block range in the source's `content` array.\n\nAlways greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.", "title": "End Block Index", "type": "integer" }, "search_result_index": { "description": "0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.\n\nCounted separately from `document_index`; server-side web search results are not included in this count.", "minimum": 0, "title": "Search Result Index", "type": "integer" }, "source": { "title": "Source", "type": "string" }, "start_block_index": { "description": "0-based index of the first cited block in the source's `content` array.", "minimum": 0, "title": "Start Block Index", "type": "integer" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Title" }, "type": { "const": "search_result_location", "default": "search_result_location", "title": "Type", "type": "string" } }, "required": [ "cited_text", "end_block_index", "search_result_index", "source", "start_block_index", "title", "type" ], "title": "ResponseSearchResultLocationCitation", "type": "object" }, "BetaResponseServerToolUseBlock": { "properties": { "caller": { "oneOf": [ { "$ref": "#/$defs/BetaDirectCaller" }, { "$ref": "#/$defs/BetaServerToolCaller" }, { "$ref": "#/$defs/BetaServerToolCaller_20260120" } ], "title": "Caller" }, "id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Id", "type": "string" }, "input": { "additionalProperties": true, "title": "Input", "type": "object" }, "name": { "enum": [ "advisor", "web_search", "web_fetch", "code_execution", "bash_code_execution", "text_editor_code_execution", "tool_search_tool_regex", "tool_search_tool_bm25" ], "title": "Name", "type": "string", "x-anthropic-beta-required-values": { "advisor": [ "advisor-tool-2026-03-01" ] } }, "type": { "const": "server_tool_use", "default": "server_tool_use", "title": "Type", "type": "string" } }, "required": [ "id", "input", "name", "type" ], "title": "ResponseServerToolUseBlock", "type": "object" }, "BetaResponseTextBlock": { "properties": { "citations": { "anyOf": [ { "items": { "oneOf": [ { "$ref": "#/$defs/BetaResponseCharLocationCitation" }, { "$ref": "#/$defs/BetaResponsePageLocationCitation" }, { "$ref": "#/$defs/BetaResponseContentBlockLocationCitation" }, { "$ref": "#/$defs/BetaResponseWebSearchResultLocationCitation" }, { "$ref": "#/$defs/BetaResponseSearchResultLocationCitation" } ] }, "type": "array" }, { "type": "null" } ], "default": null, "description": "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`.", "title": "Citations" }, "text": { "maxLength": 5000000, "minLength": 0, "title": "Text", "type": "string" }, "type": { "const": "text", "default": "text", "title": "Type", "type": "string" } }, "required": [ "citations", "text", "type" ], "title": "ResponseTextBlock", "type": "object" }, "BetaResponseTextEditorCodeExecutionCreateResultBlock": { "properties": { "is_file_update": { "title": "Is File Update", "type": "boolean" }, "type": { "const": "text_editor_code_execution_create_result", "default": "text_editor_code_execution_create_result", "title": "Type", "type": "string" } }, "required": [ "is_file_update", "type" ], "title": "ResponseTextEditorCodeExecutionCreateResultBlock", "type": "object" }, "BetaResponseTextEditorCodeExecutionStrReplaceResultBlock": { "properties": { "lines": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Lines" }, "new_lines": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "New Lines" }, "new_start": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "New Start" }, "old_lines": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Old Lines" }, "old_start": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Old Start" }, "type": { "const": "text_editor_code_execution_str_replace_result", "default": "text_editor_code_execution_str_replace_result", "title": "Type", "type": "string" } }, "required": [ "lines", "new_lines", "new_start", "old_lines", "old_start", "type" ], "title": "ResponseTextEditorCodeExecutionStrReplaceResultBlock", "type": "object" }, "BetaResponseTextEditorCodeExecutionToolResultBlock": { "properties": { "content": { "anyOf": [ { "$ref": "#/$defs/BetaResponseTextEditorCodeExecutionToolResultError" }, { "$ref": "#/$defs/BetaResponseTextEditorCodeExecutionViewResultBlock" }, { "$ref": "#/$defs/BetaResponseTextEditorCodeExecutionCreateResultBlock" }, { "$ref": "#/$defs/BetaResponseTextEditorCodeExecutionStrReplaceResultBlock" } ], "title": "Content" }, "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, "type": { "const": "text_editor_code_execution_tool_result", "default": "text_editor_code_execution_tool_result", "title": "Type", "type": "string" } }, "required": [ "content", "tool_use_id", "type" ], "title": "ResponseTextEditorCodeExecutionToolResultBlock", "type": "object" }, "BetaResponseTextEditorCodeExecutionToolResultError": { "properties": { "error_code": { "$ref": "#/$defs/BetaTextEditorCodeExecutionToolResultErrorCode" }, "error_message": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Error Message" }, "type": { "const": "text_editor_code_execution_tool_result_error", "default": "text_editor_code_execution_tool_result_error", "title": "Type", "type": "string" } }, "required": [ "error_code", "error_message", "type" ], "title": "ResponseTextEditorCodeExecutionToolResultError", "type": "object" }, "BetaResponseTextEditorCodeExecutionViewResultBlock": { "properties": { "content": { "title": "Content", "type": "string" }, "file_type": { "enum": [ "text", "image", "pdf" ], "title": "File Type", "type": "string" }, "num_lines": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Num Lines" }, "start_line": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Start Line" }, "total_lines": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Total Lines" }, "type": { "const": "text_editor_code_execution_view_result", "default": "text_editor_code_execution_view_result", "title": "Type", "type": "string" } }, "required": [ "content", "file_type", "num_lines", "start_line", "total_lines", "type" ], "title": "ResponseTextEditorCodeExecutionViewResultBlock", "type": "object" }, "BetaResponseThinkingBlock": { "properties": { "signature": { "description": "A value used to verify that this thinking block was generated by Claude when it is passed back to the API.\n\nThis is an opaque field and should not be interpreted or parsed. When passing thinking blocks back to the API (required when using tools with extended thinking), pass them back exactly as received, with this field intact.\n\nSee [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.", "title": "Signature", "type": "string" }, "thinking": { "description": "The text of Claude's thinking process for this block.", "title": "Thinking", "type": "string" }, "type": { "const": "thinking", "default": "thinking", "title": "Type", "type": "string" } }, "required": [ "signature", "thinking", "type" ], "title": "ResponseThinkingBlock", "type": "object" }, "BetaResponseToolReferenceBlock": { "properties": { "tool_name": { "maxLength": 256, "minLength": 1, "pattern": "^[a-zA-Z0-9_-]{1,256}$", "title": "Tool Name", "type": "string" }, "type": { "const": "tool_reference", "default": "tool_reference", "title": "Type", "type": "string" } }, "required": [ "tool_name", "type" ], "title": "ResponseToolReferenceBlock", "type": "object" }, "BetaResponseToolSearchToolResultBlock": { "properties": { "content": { "anyOf": [ { "$ref": "#/$defs/BetaResponseToolSearchToolResultError" }, { "$ref": "#/$defs/BetaResponseToolSearchToolSearchResultBlock" } ], "title": "Content" }, "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, "type": { "const": "tool_search_tool_result", "default": "tool_search_tool_result", "title": "Type", "type": "string" } }, "required": [ "content", "tool_use_id", "type" ], "title": "ResponseToolSearchToolResultBlock", "type": "object" }, "BetaResponseToolSearchToolResultError": { "properties": { "error_code": { "$ref": "#/$defs/BetaToolSearchToolResultErrorCode" }, "error_message": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Error Message" }, "type": { "const": "tool_search_tool_result_error", "default": "tool_search_tool_result_error", "title": "Type", "type": "string" } }, "required": [ "error_code", "error_message", "type" ], "title": "ResponseToolSearchToolResultError", "type": "object" }, "BetaResponseToolSearchToolSearchResultBlock": { "properties": { "tool_references": { "items": { "$ref": "#/$defs/BetaResponseToolReferenceBlock" }, "title": "Tool References", "type": "array" }, "type": { "const": "tool_search_tool_search_result", "default": "tool_search_tool_search_result", "title": "Type", "type": "string" } }, "required": [ "tool_references", "type" ], "title": "ResponseToolSearchToolSearchResultBlock", "type": "object" }, "BetaResponseToolUseBlock": { "properties": { "caller": { "oneOf": [ { "$ref": "#/$defs/BetaDirectCaller" }, { "$ref": "#/$defs/BetaServerToolCaller" }, { "$ref": "#/$defs/BetaServerToolCaller_20260120" } ], "title": "Caller" }, "id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Id", "type": "string" }, "input": { "additionalProperties": true, "title": "Input", "type": "object" }, "name": { "minLength": 1, "title": "Name", "type": "string" }, "toolset_name": { "anyOf": [ { "maxLength": 64, "minLength": 1, "pattern": "^[a-zA-Z0-9_-]+$", "type": "string" }, { "type": "null" } ], "description": "For a toolset member tool_use, the toolset family.", "title": "Toolset Name" }, "type": { "const": "tool_use", "default": "tool_use", "title": "Type", "type": "string" } }, "required": [ "id", "input", "name", "type" ], "title": "ResponseToolUseBlock", "type": "object" }, "BetaResponseWebFetchResultBlock": { "properties": { "content": { "$ref": "#/$defs/BetaResponseDocumentBlock" }, "retrieved_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "ISO 8601 timestamp when the content was retrieved", "title": "Retrieved At" }, "type": { "const": "web_fetch_result", "default": "web_fetch_result", "title": "Type", "type": "string" }, "url": { "description": "Fetched content URL", "title": "Url", "type": "string" } }, "required": [ "content", "retrieved_at", "type", "url" ], "title": "ResponseWebFetchResultBlock", "type": "object" }, "BetaResponseWebFetchToolResultBlock": { "properties": { "caller": { "oneOf": [ { "$ref": "#/$defs/BetaDirectCaller" }, { "$ref": "#/$defs/BetaServerToolCaller" }, { "$ref": "#/$defs/BetaServerToolCaller_20260120" } ], "title": "Caller" }, "content": { "anyOf": [ { "$ref": "#/$defs/BetaResponseWebFetchToolResultError" }, { "$ref": "#/$defs/BetaResponseWebFetchResultBlock" } ], "title": "Content" }, "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, "type": { "const": "web_fetch_tool_result", "default": "web_fetch_tool_result", "title": "Type", "type": "string" } }, "required": [ "content", "tool_use_id", "type" ], "title": "ResponseWebFetchToolResultBlock", "type": "object" }, "BetaResponseWebFetchToolResultError": { "properties": { "error_code": { "$ref": "#/$defs/BetaWebFetchToolResultErrorCode" }, "type": { "const": "web_fetch_tool_result_error", "default": "web_fetch_tool_result_error", "title": "Type", "type": "string" } }, "required": [ "error_code", "type" ], "title": "ResponseWebFetchToolResultError", "type": "object" }, "BetaResponseWebSearchResultBlock": { "properties": { "encrypted_content": { "title": "Encrypted Content", "type": "string" }, "page_age": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Page Age" }, "title": { "title": "Title", "type": "string" }, "type": { "const": "web_search_result", "default": "web_search_result", "title": "Type", "type": "string" }, "url": { "title": "Url", "type": "string" } }, "required": [ "encrypted_content", "page_age", "title", "type", "url" ], "title": "ResponseWebSearchResultBlock", "type": "object" }, "BetaResponseWebSearchResultLocationCitation": { "properties": { "cited_text": { "title": "Cited Text", "type": "string" }, "encrypted_index": { "title": "Encrypted Index", "type": "string" }, "title": { "anyOf": [ { "maxLength": 512, "type": "string" }, { "type": "null" } ], "title": "Title" }, "type": { "const": "web_search_result_location", "default": "web_search_result_location", "title": "Type", "type": "string" }, "url": { "title": "Url", "type": "string" } }, "required": [ "cited_text", "encrypted_index", "title", "type", "url" ], "title": "ResponseWebSearchResultLocationCitation", "type": "object" }, "BetaResponseWebSearchToolResultBlock": { "properties": { "caller": { "oneOf": [ { "$ref": "#/$defs/BetaDirectCaller" }, { "$ref": "#/$defs/BetaServerToolCaller" }, { "$ref": "#/$defs/BetaServerToolCaller_20260120" } ], "title": "Caller" }, "content": { "anyOf": [ { "$ref": "#/$defs/BetaResponseWebSearchToolResultError" }, { "items": { "$ref": "#/$defs/BetaResponseWebSearchResultBlock" }, "type": "array" } ], "title": "Content" }, "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, "type": { "const": "web_search_tool_result", "default": "web_search_tool_result", "title": "Type", "type": "string" } }, "required": [ "content", "tool_use_id", "type" ], "title": "ResponseWebSearchToolResultBlock", "type": "object" }, "BetaResponseWebSearchToolResultError": { "properties": { "error_code": { "$ref": "#/$defs/BetaWebSearchToolResultErrorCode" }, "type": { "const": "web_search_tool_result_error", "default": "web_search_tool_result_error", "title": "Type", "type": "string" } }, "required": [ "error_code", "type" ], "title": "ResponseWebSearchToolResultError", "type": "object" }, "BetaServerToolCaller": { "additionalProperties": false, "description": "Tool invocation generated by a server-side tool.", "properties": { "tool_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Id", "type": "string" }, "type": { "const": "code_execution_20250825", "title": "Type", "type": "string" } }, "required": [ "tool_id", "type" ], "title": "ServerToolCaller", "type": "object" }, "BetaServerToolCaller_20260120": { "additionalProperties": false, "properties": { "tool_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Id", "type": "string" }, "type": { "const": "code_execution_20260120", "title": "Type", "type": "string" } }, "required": [ "tool_id", "type" ], "title": "ServerToolCaller_20260120", "type": "object" }, "BetaServerToolUsage": { "properties": { "web_fetch_requests": { "default": 0, "description": "The number of web fetch tool requests.", "minimum": 0, "title": "Web Fetch Requests", "type": "integer" }, "web_search_requests": { "default": 0, "description": "The number of web search tool requests.", "minimum": 0, "title": "Web Search Requests", "type": "integer" } }, "required": [ "web_fetch_requests", "web_search_requests" ], "title": "ServerToolUsage", "type": "object" }, "BetaSkill": { "description": "A skill that was loaded in a container (response model).", "properties": { "skill_id": { "description": "Skill ID", "maxLength": 64, "minLength": 1, "title": "Skill Id", "type": "string" }, "type": { "description": "Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)", "enum": [ "anthropic", "custom" ], "title": "Type", "type": "string" }, "version": { "description": "The resolved version: a skill version ID for custom skills.", "maxLength": 64, "minLength": 1, "title": "Version", "type": "string" } }, "required": [ "skill_id", "type", "version" ], "title": "Skill", "type": "object" }, "BetaSpeed": { "type": "string", "description": "Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.", "enum": [ "standard", "fast" ] }, "BetaStopReason": { "enum": [ "end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn", "compaction", "refusal", "model_context_window_exceeded" ], "type": "string" }, "BetaTextEditorCodeExecutionToolResultErrorCode": { "enum": [ "invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded", "file_not_found" ], "title": "TextEditorCodeExecutionToolResultErrorCode", "type": "string" }, "BetaToolSearchToolResultErrorCode": { "enum": [ "invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded" ], "title": "ToolSearchToolResultErrorCode", "type": "string" }, "BetaUsage": { "properties": { "cache_creation": { "anyOf": [ { "$ref": "#/$defs/BetaCacheCreation" }, { "type": "null" } ], "default": null, "description": "Breakdown of cached tokens by TTL" }, "cache_creation_input_tokens": { "anyOf": [ { "minimum": 0, "type": "integer" }, { "type": "null" } ], "default": null, "description": "The number of input tokens used to create the cache entry.", "title": "Cache Creation Input Tokens" }, "cache_read_input_tokens": { "anyOf": [ { "minimum": 0, "type": "integer" }, { "type": "null" } ], "default": null, "description": "The number of input tokens read from the cache.", "title": "Cache Read Input Tokens" }, "fallback_credit": { "anyOf": [ { "$ref": "#/$defs/BetaFallbackCreditUsage" }, { "type": "null" } ], "default": null, "description": "Outcome of the `fallback_credit_token` presented on this request.\n\nPresent on every response to a non-batch request that carried a\n`fallback_credit_token`, in either redemption mode; absent otherwise (batch\nitems accept and ignore the token and carry no outcome object).", "x-anthropic-beta-required": [ "fallback-credit-2026-07-01" ] }, "inference_geo": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The geographic region where inference was performed for this request.", "title": "Inference Geo" }, "input_tokens": { "description": "The number of input tokens which were used.", "minimum": 0, "title": "Input Tokens", "type": "integer" }, "iterations": { "$ref": "#/$defs/BetaIterationsUsage" }, "output_tokens": { "description": "The number of output tokens which were used.", "minimum": 0, "title": "Output Tokens", "type": "integer" }, "output_tokens_details": { "anyOf": [ { "$ref": "#/$defs/BetaOutputTokensDetails" }, { "type": "null" } ], "default": null, "description": "Breakdown of output tokens by category.\n\n`output_tokens` remains the inclusive, authoritative total used for billing.\nThis object provides a read-only decomposition for observability — for example,\nhow many of the billed output tokens were spent on internal reasoning that may\nhave been summarized before being returned to you." }, "server_tool_use": { "anyOf": [ { "$ref": "#/$defs/BetaServerToolUsage" }, { "type": "null" } ], "default": null, "description": "The number of server tool requests." }, "service_tier": { "anyOf": [ { "enum": [ "standard", "priority", "batch" ], "type": "string" }, { "type": "null" } ], "default": null, "description": "If the request used the priority, standard, or batch tier.", "title": "Service Tier" }, "speed": { "anyOf": [ { "$ref": "#/$defs/BetaSpeed" }, { "type": "null" } ], "default": null, "description": "The inference speed mode used for this request.", "x-anthropic-beta-required": [ "fast-mode-2026-02-01" ] } }, "required": [ "cache_creation", "cache_creation_input_tokens", "cache_read_input_tokens", "fallback_credit", "inference_geo", "input_tokens", "iterations", "output_tokens", "output_tokens_details", "server_tool_use", "service_tier", "speed" ], "title": "Usage", "type": "object" }, "BetaWebFetchToolResultErrorCode": { "enum": [ "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" ], "title": "WebFetchToolResultErrorCode", "type": "string" }, "BetaWebSearchToolResultErrorCode": { "enum": [ "invalid_tool_input", "unavailable", "max_uses_exceeded", "too_many_requests", "query_too_long", "request_too_large" ], "title": "WebSearchToolResultErrorCode", "type": "string" }, "Model": { "title": "Model", "description": "The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.", "anyOf": [ { "type": "string" }, { "const": "claude-sonnet-5", "description": "High-performance model for coding and agents", "x-stainless-nominal": false }, { "const": "claude-fable-5", "description": "Next generation of intelligence for the hardest knowledge work and coding problems", "x-stainless-nominal": false }, { "const": "claude-mythos-5", "description": "Most capable model for cybersecurity and biology research", "x-stainless-nominal": false }, { "const": "claude-opus-5", "description": "Powerful intelligence for long-running agents and coding", "x-stainless-nominal": false }, { "const": "claude-opus-4-8", "description": "Powerful intelligence for long-running agents and coding", "x-stainless-nominal": false }, { "const": "claude-opus-4-7", "description": "Powerful intelligence for long-running agents and coding", "x-stainless-nominal": false }, { "const": "claude-mythos-preview", "description": "New class of intelligence, strongest in coding and cybersecurity", "x-stainless-nominal": false, "deprecated": true, "x-stainless-deprecation-message": "Will reach end-of-life on June 30, 2026. Please migrate to claude-mythos-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information." }, { "const": "claude-opus-4-6", "description": "Powerful intelligence for long-running agents and coding", "x-stainless-nominal": false }, { "const": "claude-sonnet-4-6", "description": "Best combination of speed and intelligence", "x-stainless-nominal": false }, { "const": "claude-haiku-4-5", "description": "Fastest model with near-frontier intelligence", "x-stainless-nominal": false }, { "const": "claude-haiku-4-5-20251001", "description": "Fastest model with near-frontier intelligence", "x-stainless-nominal": false }, { "const": "claude-opus-4-5", "description": "Powerful intelligence for long-running agents and coding", "x-stainless-nominal": false }, { "const": "claude-opus-4-5-20251101", "description": "Powerful intelligence for long-running agents and coding", "x-stainless-nominal": false }, { "const": "claude-sonnet-4-5", "description": "High-performance model for agents and coding", "x-stainless-nominal": false }, { "const": "claude-sonnet-4-5-20250929", "description": "High-performance model for agents and coding", "x-stainless-nominal": false } ] } } }