Messages
Count tokens in a Message
Create a Message
ModelsExpand Collapse
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class Base64PDFSource { data, media_type, type }
media_type: :"application/pdf"
type: :base64
class CacheControlEphemeral { type, ttl }
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CacheCreation { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsConfigParam { enabled }
class CitationsDelta { citation, type }
citation: CitationCharLocation { cited_text, document_index, document_title, 4 more } | CitationPageLocation { cited_text, document_index, document_title, 4 more } | CitationContentBlockLocation { cited_text, document_index, document_title, 4 more } | 2 more
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :citations_delta
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
ContentBlock = TextBlock { citations, text, type } | ThinkingBlock { signature, thinking, type } | RedactedThinkingBlock { data, type } | 3 more
class TextBlock { citations, text, type }
Citations supporting the text block.
The 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.
Citations supporting the text block.
The 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.
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :text
class ThinkingBlock { signature, thinking, type }
type: :thinking
class RedactedThinkingBlock { data, type }
type: :redacted_thinking
class ToolUseBlock { id, input, name, type }
type: :tool_use
class ServerToolUseBlock { id, input, name, type }
name: :web_search
type: :server_tool_use
class WebSearchToolResultBlock { content, tool_use_id, type }
class WebSearchToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
Array[WebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
type: :web_search_result
type: :web_search_tool_result
ContentBlockParam = TextBlockParam { text, type, cache_control, citations } | ImageBlockParam { source, type, cache_control } | DocumentBlockParam { source, type, cache_control, 3 more } | 7 moreRegular text content.
Regular text content.
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class DocumentBlockParam { source, type, cache_control, 3 more }
source: Base64PDFSource { data, media_type, type } | PlainTextSource { data, media_type, type } | ContentBlockSource { content, type } | URLPDFSource { type, url }
class Base64PDFSource { data, media_type, type }
media_type: :"application/pdf"
type: :base64
class PlainTextSource { data, media_type, type }
media_type: :"text/plain"
type: :text
class ContentBlockSource { content, type }
Array[ContentBlockSourceContent]
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type: :content
class URLPDFSource { type, url }
type: :url
type: :document
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class SearchResultBlockParam { content, source, title, 3 more }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :search_result
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ThinkingBlockParam { signature, thinking, type }
type: :thinking
class RedactedThinkingBlockParam { data, type }
type: :redacted_thinking
class ToolUseBlockParam { id, input, name, 2 more }
type: :tool_use
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ToolResultBlockParam { tool_use_id, type, cache_control, 2 more }
type: :tool_result
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
content: String | Array[TextBlockParam { text, type, cache_control, citations } | ImageBlockParam { source, type, cache_control } | SearchResultBlockParam { content, source, title, 3 more } | DocumentBlockParam { source, type, cache_control, 3 more } ]
Array[TextBlockParam { text, type, cache_control, citations } | ImageBlockParam { source, type, cache_control } | SearchResultBlockParam { content, source, title, 3 more } | DocumentBlockParam { source, type, cache_control, 3 more } ]
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class SearchResultBlockParam { content, source, title, 3 more }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :search_result
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class DocumentBlockParam { source, type, cache_control, 3 more }
source: Base64PDFSource { data, media_type, type } | PlainTextSource { data, media_type, type } | ContentBlockSource { content, type } | URLPDFSource { type, url }
class Base64PDFSource { data, media_type, type }
media_type: :"application/pdf"
type: :base64
class PlainTextSource { data, media_type, type }
media_type: :"text/plain"
type: :text
class ContentBlockSource { content, type }
Array[ContentBlockSourceContent]
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type: :content
class URLPDFSource { type, url }
type: :url
type: :document
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ServerToolUseBlockParam { id, input, name, 2 more }
name: :web_search
type: :server_tool_use
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class WebSearchToolResultBlockParam { content, tool_use_id, type, cache_control }
Array[WebSearchResultBlockParam { encrypted_content, title, type, 2 more } ]
type: :web_search_result
class WebSearchToolRequestError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
type: :web_search_tool_result
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ContentBlockSource { content, type }
Array[ContentBlockSourceContent]
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type: :content
ContentBlockSourceContent = TextBlockParam { text, type, cache_control, citations } | ImageBlockParam { source, type, cache_control }
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class DocumentBlockParam { source, type, cache_control, 3 more }
source: Base64PDFSource { data, media_type, type } | PlainTextSource { data, media_type, type } | ContentBlockSource { content, type } | URLPDFSource { type, url }
class Base64PDFSource { data, media_type, type }
media_type: :"application/pdf"
type: :base64
class PlainTextSource { data, media_type, type }
media_type: :"text/plain"
type: :text
class ContentBlockSource { content, type }
Array[ContentBlockSourceContent]
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type: :content
class URLPDFSource { type, url }
type: :url
type: :document
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class InputJSONDelta { partial_json, type }
type: :input_json_delta
class Message { id, content, model, 5 more }
Unique object identifier.
The format and length of IDs may change over time.
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If 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.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If 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.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
class TextBlock { citations, text, type }
Citations supporting the text block.
The 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.
Citations supporting the text block.
The 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.
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :text
class ThinkingBlock { signature, thinking, type }
type: :thinking
class RedactedThinkingBlock { data, type }
type: :redacted_thinking
class ToolUseBlock { id, input, name, type }
type: :tool_use
class ServerToolUseBlock { id, input, name, type }
name: :web_search
type: :server_tool_use
class WebSearchToolResultBlock { content, tool_use_id, type }
class WebSearchToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
Array[WebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
type: :web_search_result
type: :web_search_tool_result
:"claude-3-7-sonnet-latest" | :"claude-3-7-sonnet-20250219" | :"claude-3-5-haiku-latest" | 15 moreThe model that will complete your prompt.
See models for additional details and options.
The model that will complete your prompt.
See models for additional details and options.
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
role: :assistantConversational role of the generated message.
This will always be "assistant".
Conversational role of the generated message.
This will always be "assistant".
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point
"max_tokens": we exceeded the requested max_tokens or the model's maximum
"stop_sequence": one of your provided custom stop_sequences was generated
"tool_use": the model invoked one or more tools
"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.
"refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point"max_tokens": we exceeded the requestedmax_tokensor the model's maximum"stop_sequence": one of your provided customstop_sequenceswas generated"tool_use": the model invoked one or more tools"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."refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
type: :messageObject type.
For Messages, this is always "message".
Object type.
For Messages, this is always "message".
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Breakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The number of input tokens which were used.
The number of output tokens which were used.
The number of server tool requests.
The number of server tool requests.
The number of web search tool requests.
service_tier: :standard | :priority | :batchIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
MessageCountTokensTool = Tool { input_schema, name, cache_control, 2 more } | ToolBash20250124 { name, type, cache_control } | ToolTextEditor20250124 { name, type, cache_control } | 3 more
class Tool { input_schema, name, cache_control, 2 more }
input_schema: { type, properties, required}JSON schema for this tool's input.
This defines the shape of the input that your tool accepts and that the model will produce.
JSON schema for this tool's input.
This defines the shape of the input that your tool accepts and that the model will produce.
type: :object
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Description of what this tool does.
Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
type: :custom
class ToolBash20250124 { name, type, cache_control }
name: :bashName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :bash_20250124
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ToolTextEditor20250124 { name, type, cache_control }
name: :str_replace_editorName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :text_editor_20250124
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ToolTextEditor20250429 { name, type, cache_control }
name: :str_replace_based_edit_toolName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :text_editor_20250429
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ToolTextEditor20250728 { name, type, cache_control, max_characters }
name: :str_replace_based_edit_toolName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :text_editor_20250728
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.
class WebSearchTool20250305 { name, type, allowed_domains, 4 more }
name: :web_searchName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :web_search_20250305
If provided, only these domains will be included in results. Cannot be used alongside blocked_domains.
If provided, these domains will never appear in results. Cannot be used alongside allowed_domains.
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Maximum number of times the tool can be used in the API request.
user_location: { type, city, country, 2 more}Parameters for the user's location. Used to provide more relevant search results.
Parameters for the user's location. Used to provide more relevant search results.
type: :approximate
The city of the user.
The region of the user.
class MessageDeltaUsage { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more }
The cumulative number of input tokens used to create the cache entry.
The cumulative number of input tokens read from the cache.
The cumulative number of input tokens which were used.
The cumulative number of output tokens which were used.
The number of server tool requests.
The number of server tool requests.
The number of web search tool requests.
class MessageParam { content, role }
Array[ContentBlockParam]
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class DocumentBlockParam { source, type, cache_control, 3 more }
source: Base64PDFSource { data, media_type, type } | PlainTextSource { data, media_type, type } | ContentBlockSource { content, type } | URLPDFSource { type, url }
class Base64PDFSource { data, media_type, type }
media_type: :"application/pdf"
type: :base64
class PlainTextSource { data, media_type, type }
media_type: :"text/plain"
type: :text
class ContentBlockSource { content, type }
Array[ContentBlockSourceContent]
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type: :content
class URLPDFSource { type, url }
type: :url
type: :document
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class SearchResultBlockParam { content, source, title, 3 more }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :search_result
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ThinkingBlockParam { signature, thinking, type }
type: :thinking
class RedactedThinkingBlockParam { data, type }
type: :redacted_thinking
class ToolUseBlockParam { id, input, name, 2 more }
type: :tool_use
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ToolResultBlockParam { tool_use_id, type, cache_control, 2 more }
type: :tool_result
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
content: String | Array[TextBlockParam { text, type, cache_control, citations } | ImageBlockParam { source, type, cache_control } | SearchResultBlockParam { content, source, title, 3 more } | DocumentBlockParam { source, type, cache_control, 3 more } ]
Array[TextBlockParam { text, type, cache_control, citations } | ImageBlockParam { source, type, cache_control } | SearchResultBlockParam { content, source, title, 3 more } | DocumentBlockParam { source, type, cache_control, 3 more } ]
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class SearchResultBlockParam { content, source, title, 3 more }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :search_result
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class DocumentBlockParam { source, type, cache_control, 3 more }
source: Base64PDFSource { data, media_type, type } | PlainTextSource { data, media_type, type } | ContentBlockSource { content, type } | URLPDFSource { type, url }
class Base64PDFSource { data, media_type, type }
media_type: :"application/pdf"
type: :base64
class PlainTextSource { data, media_type, type }
media_type: :"text/plain"
type: :text
class ContentBlockSource { content, type }
Array[ContentBlockSourceContent]
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type: :content
class URLPDFSource { type, url }
type: :url
type: :document
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ServerToolUseBlockParam { id, input, name, 2 more }
name: :web_search
type: :server_tool_use
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class WebSearchToolResultBlockParam { content, tool_use_id, type, cache_control }
Array[WebSearchResultBlockParam { encrypted_content, title, type, 2 more } ]
type: :web_search_result
class WebSearchToolRequestError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
type: :web_search_tool_result
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
role: :user | :assistant
class MessageTokensCount { input_tokens }
The total number of tokens across the provided list of messages, system prompt, and tools.
class Metadata { user_id }
An external identifier for the user who is associated with the request.
This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.
Model = :"claude-3-7-sonnet-latest" | :"claude-3-7-sonnet-20250219" | :"claude-3-5-haiku-latest" | 15 more | StringThe model that will complete your prompt.
See models for additional details and options.
The model that will complete your prompt.
See models for additional details and options.
:"claude-3-7-sonnet-latest" | :"claude-3-7-sonnet-20250219" | :"claude-3-5-haiku-latest" | 15 moreThe model that will complete your prompt.
See models for additional details and options.
The model that will complete your prompt.
See models for additional details and options.
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
class PlainTextSource { data, media_type, type }
media_type: :"text/plain"
type: :text
RawContentBlockDelta = TextDelta { text, type } | InputJSONDelta { partial_json, type } | CitationsDelta { citation, type } | 2 more
class TextDelta { text, type }
type: :text_delta
class InputJSONDelta { partial_json, type }
type: :input_json_delta
class CitationsDelta { citation, type }
citation: CitationCharLocation { cited_text, document_index, document_title, 4 more } | CitationPageLocation { cited_text, document_index, document_title, 4 more } | CitationContentBlockLocation { cited_text, document_index, document_title, 4 more } | 2 more
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :citations_delta
class ThinkingDelta { thinking, type }
type: :thinking_delta
class SignatureDelta { signature, type }
type: :signature_delta
class RawContentBlockDeltaEvent { delta, index, type }
class TextDelta { text, type }
type: :text_delta
class InputJSONDelta { partial_json, type }
type: :input_json_delta
class CitationsDelta { citation, type }
citation: CitationCharLocation { cited_text, document_index, document_title, 4 more } | CitationPageLocation { cited_text, document_index, document_title, 4 more } | CitationContentBlockLocation { cited_text, document_index, document_title, 4 more } | 2 more
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :citations_delta
class ThinkingDelta { thinking, type }
type: :thinking_delta
class SignatureDelta { signature, type }
type: :signature_delta
type: :content_block_delta
class RawContentBlockStartEvent { content_block, index, type }
content_block: TextBlock { citations, text, type } | ThinkingBlock { signature, thinking, type } | RedactedThinkingBlock { data, type } | 3 more
class TextBlock { citations, text, type }
Citations supporting the text block.
The 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.
Citations supporting the text block.
The 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.
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :text
class ThinkingBlock { signature, thinking, type }
type: :thinking
class RedactedThinkingBlock { data, type }
type: :redacted_thinking
class ToolUseBlock { id, input, name, type }
type: :tool_use
class ServerToolUseBlock { id, input, name, type }
name: :web_search
type: :server_tool_use
class WebSearchToolResultBlock { content, tool_use_id, type }
class WebSearchToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
Array[WebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
type: :web_search_result
type: :web_search_tool_result
type: :content_block_start
class RawContentBlockStopEvent { index, type }
type: :content_block_stop
class RawMessageDeltaEvent { delta, type, usage }
delta: { stop_reason, stop_sequence}
type: :message_delta
usage: MessageDeltaUsage { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more } Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
The cumulative number of input tokens used to create the cache entry.
The cumulative number of input tokens read from the cache.
The cumulative number of input tokens which were used.
The cumulative number of output tokens which were used.
The number of server tool requests.
The number of server tool requests.
The number of web search tool requests.
class RawMessageStartEvent { message, type }
Unique object identifier.
The format and length of IDs may change over time.
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If 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.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If 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.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
class TextBlock { citations, text, type }
Citations supporting the text block.
The 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.
Citations supporting the text block.
The 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.
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :text
class ThinkingBlock { signature, thinking, type }
type: :thinking
class RedactedThinkingBlock { data, type }
type: :redacted_thinking
class ToolUseBlock { id, input, name, type }
type: :tool_use
class ServerToolUseBlock { id, input, name, type }
name: :web_search
type: :server_tool_use
class WebSearchToolResultBlock { content, tool_use_id, type }
class WebSearchToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
Array[WebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
type: :web_search_result
type: :web_search_tool_result
:"claude-3-7-sonnet-latest" | :"claude-3-7-sonnet-20250219" | :"claude-3-5-haiku-latest" | 15 moreThe model that will complete your prompt.
See models for additional details and options.
The model that will complete your prompt.
See models for additional details and options.
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
role: :assistantConversational role of the generated message.
This will always be "assistant".
Conversational role of the generated message.
This will always be "assistant".
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point
"max_tokens": we exceeded the requested max_tokens or the model's maximum
"stop_sequence": one of your provided custom stop_sequences was generated
"tool_use": the model invoked one or more tools
"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.
"refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point"max_tokens": we exceeded the requestedmax_tokensor the model's maximum"stop_sequence": one of your provided customstop_sequenceswas generated"tool_use": the model invoked one or more tools"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."refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
type: :messageObject type.
For Messages, this is always "message".
Object type.
For Messages, this is always "message".
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Breakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The number of input tokens which were used.
The number of output tokens which were used.
The number of server tool requests.
The number of server tool requests.
The number of web search tool requests.
service_tier: :standard | :priority | :batchIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
type: :message_start
class RawMessageStopEvent { type }
type: :message_stop
RawMessageStreamEvent = RawMessageStartEvent { message, type } | RawMessageDeltaEvent { delta, type, usage } | RawMessageStopEvent { type } | 3 more
class RawMessageStartEvent { message, type }
Unique object identifier.
The format and length of IDs may change over time.
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If 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.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If 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.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
class TextBlock { citations, text, type }
Citations supporting the text block.
The 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.
Citations supporting the text block.
The 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.
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :text
class ThinkingBlock { signature, thinking, type }
type: :thinking
class RedactedThinkingBlock { data, type }
type: :redacted_thinking
class ToolUseBlock { id, input, name, type }
type: :tool_use
class ServerToolUseBlock { id, input, name, type }
name: :web_search
type: :server_tool_use
class WebSearchToolResultBlock { content, tool_use_id, type }
class WebSearchToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
Array[WebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
type: :web_search_result
type: :web_search_tool_result
:"claude-3-7-sonnet-latest" | :"claude-3-7-sonnet-20250219" | :"claude-3-5-haiku-latest" | 15 moreThe model that will complete your prompt.
See models for additional details and options.
The model that will complete your prompt.
See models for additional details and options.
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
role: :assistantConversational role of the generated message.
This will always be "assistant".
Conversational role of the generated message.
This will always be "assistant".
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point
"max_tokens": we exceeded the requested max_tokens or the model's maximum
"stop_sequence": one of your provided custom stop_sequences was generated
"tool_use": the model invoked one or more tools
"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.
"refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point"max_tokens": we exceeded the requestedmax_tokensor the model's maximum"stop_sequence": one of your provided customstop_sequenceswas generated"tool_use": the model invoked one or more tools"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."refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
type: :messageObject type.
For Messages, this is always "message".
Object type.
For Messages, this is always "message".
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Breakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The number of input tokens which were used.
The number of output tokens which were used.
The number of server tool requests.
The number of server tool requests.
The number of web search tool requests.
service_tier: :standard | :priority | :batchIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
type: :message_start
class RawMessageDeltaEvent { delta, type, usage }
delta: { stop_reason, stop_sequence}
type: :message_delta
usage: MessageDeltaUsage { cache_creation_input_tokens, cache_read_input_tokens, input_tokens, 2 more } Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
The cumulative number of input tokens used to create the cache entry.
The cumulative number of input tokens read from the cache.
The cumulative number of input tokens which were used.
The cumulative number of output tokens which were used.
The number of server tool requests.
The number of server tool requests.
The number of web search tool requests.
class RawMessageStopEvent { type }
type: :message_stop
class RawContentBlockStartEvent { content_block, index, type }
content_block: TextBlock { citations, text, type } | ThinkingBlock { signature, thinking, type } | RedactedThinkingBlock { data, type } | 3 more
class TextBlock { citations, text, type }
Citations supporting the text block.
The 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.
Citations supporting the text block.
The 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.
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :text
class ThinkingBlock { signature, thinking, type }
type: :thinking
class RedactedThinkingBlock { data, type }
type: :redacted_thinking
class ToolUseBlock { id, input, name, type }
type: :tool_use
class ServerToolUseBlock { id, input, name, type }
name: :web_search
type: :server_tool_use
class WebSearchToolResultBlock { content, tool_use_id, type }
class WebSearchToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
Array[WebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
type: :web_search_result
type: :web_search_tool_result
type: :content_block_start
class RawContentBlockDeltaEvent { delta, index, type }
class TextDelta { text, type }
type: :text_delta
class InputJSONDelta { partial_json, type }
type: :input_json_delta
class CitationsDelta { citation, type }
citation: CitationCharLocation { cited_text, document_index, document_title, 4 more } | CitationPageLocation { cited_text, document_index, document_title, 4 more } | CitationContentBlockLocation { cited_text, document_index, document_title, 4 more } | 2 more
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :citations_delta
class ThinkingDelta { thinking, type }
type: :thinking_delta
class SignatureDelta { signature, type }
type: :signature_delta
type: :content_block_delta
class RawContentBlockStopEvent { index, type }
type: :content_block_stop
class RedactedThinkingBlock { data, type }
type: :redacted_thinking
class RedactedThinkingBlockParam { data, type }
type: :redacted_thinking
class SearchResultBlockParam { content, source, title, 3 more }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :search_result
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ServerToolUsage { web_search_requests }
The number of web search tool requests.
class ServerToolUseBlock { id, input, name, type }
name: :web_search
type: :server_tool_use
class ServerToolUseBlockParam { id, input, name, 2 more }
name: :web_search
type: :server_tool_use
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class SignatureDelta { signature, type }
type: :signature_delta
StopReason = :end_turn | :max_tokens | :stop_sequence | 3 more
class TextBlock { citations, text, type }
Citations supporting the text block.
The 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.
Citations supporting the text block.
The 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.
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :text
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
TextCitation = CitationCharLocation { cited_text, document_index, document_title, 4 more } | CitationPageLocation { cited_text, document_index, document_title, 4 more } | CitationContentBlockLocation { cited_text, document_index, document_title, 4 more } | 2 more
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
TextCitationParam = CitationCharLocationParam { cited_text, document_index, document_title, 3 more } | CitationPageLocationParam { cited_text, document_index, document_title, 3 more } | CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more } | 2 more
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class TextDelta { text, type }
type: :text_delta
class ThinkingBlock { signature, thinking, type }
type: :thinking
class ThinkingBlockParam { signature, thinking, type }
type: :thinking
class ThinkingConfigDisabled { type }
type: :disabled
class ThinkingConfigEnabled { budget_tokens, type }
Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.
Must be ≥1024 and less than max_tokens.
See extended thinking for details.
type: :enabled
ThinkingConfigParam = ThinkingConfigEnabled { budget_tokens, type } | ThinkingConfigDisabled { type } Configuration for enabling Claude's extended thinking.
When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your max_tokens limit.
See extended thinking for details.
Configuration for enabling Claude's extended thinking.
When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your max_tokens limit.
See extended thinking for details.
class ThinkingConfigEnabled { budget_tokens, type }
Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.
Must be ≥1024 and less than max_tokens.
See extended thinking for details.
type: :enabled
class ThinkingConfigDisabled { type }
type: :disabled
class ThinkingDelta { thinking, type }
type: :thinking_delta
class Tool { input_schema, name, cache_control, 2 more }
input_schema: { type, properties, required}JSON schema for this tool's input.
This defines the shape of the input that your tool accepts and that the model will produce.
JSON schema for this tool's input.
This defines the shape of the input that your tool accepts and that the model will produce.
type: :object
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Description of what this tool does.
Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
type: :custom
class ToolBash20250124 { name, type, cache_control }
name: :bashName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :bash_20250124
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
ToolChoice = ToolChoiceAuto { type, disable_parallel_tool_use } | ToolChoiceAny { type, disable_parallel_tool_use } | ToolChoiceTool { name, type, disable_parallel_tool_use } | ToolChoiceNone { type } How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
class ToolChoiceAuto { type, disable_parallel_tool_use } The model will automatically decide whether to use tools.
The model will automatically decide whether to use tools.
type: :auto
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output at most one tool use.
class ToolChoiceAny { type, disable_parallel_tool_use } The model will use any available tools.
The model will use any available tools.
type: :any
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output exactly one tool use.
class ToolChoiceTool { name, type, disable_parallel_tool_use } The model will use the specified tool with tool_choice.name.
The model will use the specified tool with tool_choice.name.
The name of the tool to use.
type: :tool
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output exactly one tool use.
class ToolChoiceNone { type } The model will not be allowed to use tools.
The model will not be allowed to use tools.
type: :none
class ToolChoiceAny { type, disable_parallel_tool_use } The model will use any available tools.
The model will use any available tools.
type: :any
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output exactly one tool use.
class ToolChoiceAuto { type, disable_parallel_tool_use } The model will automatically decide whether to use tools.
The model will automatically decide whether to use tools.
type: :auto
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output at most one tool use.
class ToolChoiceNone { type } The model will not be allowed to use tools.
The model will not be allowed to use tools.
type: :none
class ToolChoiceTool { name, type, disable_parallel_tool_use } The model will use the specified tool with tool_choice.name.
The model will use the specified tool with tool_choice.name.
The name of the tool to use.
type: :tool
Whether to disable parallel tool use.
Defaults to false. If set to true, the model will output exactly one tool use.
class ToolResultBlockParam { tool_use_id, type, cache_control, 2 more }
type: :tool_result
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
content: String | Array[TextBlockParam { text, type, cache_control, citations } | ImageBlockParam { source, type, cache_control } | SearchResultBlockParam { content, source, title, 3 more } | DocumentBlockParam { source, type, cache_control, 3 more } ]
Array[TextBlockParam { text, type, cache_control, citations } | ImageBlockParam { source, type, cache_control } | SearchResultBlockParam { content, source, title, 3 more } | DocumentBlockParam { source, type, cache_control, 3 more } ]
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class SearchResultBlockParam { content, source, title, 3 more }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :search_result
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class DocumentBlockParam { source, type, cache_control, 3 more }
source: Base64PDFSource { data, media_type, type } | PlainTextSource { data, media_type, type } | ContentBlockSource { content, type } | URLPDFSource { type, url }
class Base64PDFSource { data, media_type, type }
media_type: :"application/pdf"
type: :base64
class PlainTextSource { data, media_type, type }
media_type: :"text/plain"
type: :text
class ContentBlockSource { content, type }
Array[ContentBlockSourceContent]
class TextBlockParam { text, type, cache_control, citations }
type: :text
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class CitationCharLocationParam { cited_text, document_index, document_title, 3 more }
type: :char_location
class CitationPageLocationParam { cited_text, document_index, document_title, 3 more }
type: :page_location
class CitationContentBlockLocationParam { cited_text, document_index, document_title, 3 more }
type: :content_block_location
class CitationWebSearchResultLocationParam { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationSearchResultLocationParam { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
class ImageBlockParam { source, type, cache_control }
class Base64ImageSource { data, media_type, type }
media_type: :"image/jpeg" | :"image/png" | :"image/gif" | :"image/webp"
type: :base64
class URLImageSource { type, url }
type: :url
type: :image
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
type: :content
class URLPDFSource { type, url }
type: :url
type: :document
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ToolTextEditor20250124 { name, type, cache_control }
name: :str_replace_editorName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :text_editor_20250124
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ToolTextEditor20250429 { name, type, cache_control }
name: :str_replace_based_edit_toolName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :text_editor_20250429
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ToolTextEditor20250728 { name, type, cache_control, max_characters }
name: :str_replace_based_edit_toolName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :text_editor_20250728
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.
ToolUnion = Tool { input_schema, name, cache_control, 2 more } | ToolBash20250124 { name, type, cache_control } | ToolTextEditor20250124 { name, type, cache_control } | 3 more
class Tool { input_schema, name, cache_control, 2 more }
input_schema: { type, properties, required}JSON schema for this tool's input.
This defines the shape of the input that your tool accepts and that the model will produce.
JSON schema for this tool's input.
This defines the shape of the input that your tool accepts and that the model will produce.
type: :object
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Description of what this tool does.
Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
type: :custom
class ToolBash20250124 { name, type, cache_control }
name: :bashName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :bash_20250124
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ToolTextEditor20250124 { name, type, cache_control }
name: :str_replace_editorName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :text_editor_20250124
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ToolTextEditor20250429 { name, type, cache_control }
name: :str_replace_based_edit_toolName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :text_editor_20250429
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class ToolTextEditor20250728 { name, type, cache_control, max_characters }
name: :str_replace_based_edit_toolName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :text_editor_20250728
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.
class WebSearchTool20250305 { name, type, allowed_domains, 4 more }
name: :web_searchName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :web_search_20250305
If provided, only these domains will be included in results. Cannot be used alongside blocked_domains.
If provided, these domains will never appear in results. Cannot be used alongside allowed_domains.
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Maximum number of times the tool can be used in the API request.
user_location: { type, city, country, 2 more}Parameters for the user's location. Used to provide more relevant search results.
Parameters for the user's location. Used to provide more relevant search results.
type: :approximate
The city of the user.
The region of the user.
class ToolUseBlock { id, input, name, type }
type: :tool_use
class ToolUseBlockParam { id, input, name, 2 more }
type: :tool_use
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
class URLImageSource { type, url }
type: :url
class URLPDFSource { type, url }
type: :url
class Usage { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }
Breakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The number of input tokens which were used.
The number of output tokens which were used.
The number of server tool requests.
The number of server tool requests.
The number of web search tool requests.
service_tier: :standard | :priority | :batchIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
class WebSearchResultBlock { encrypted_content, page_age, title, 2 more }
type: :web_search_result
class WebSearchResultBlockParam { encrypted_content, title, type, 2 more }
type: :web_search_result
class WebSearchTool20250305 { name, type, allowed_domains, 4 more }
name: :web_searchName of the tool.
This is how the tool will be called by the model and in tool_use blocks.
Name of the tool.
This is how the tool will be called by the model and in tool_use blocks.
type: :web_search_20250305
If provided, only these domains will be included in results. Cannot be used alongside blocked_domains.
If provided, these domains will never appear in results. Cannot be used alongside allowed_domains.
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
Maximum number of times the tool can be used in the API request.
user_location: { type, city, country, 2 more}Parameters for the user's location. Used to provide more relevant search results.
Parameters for the user's location. Used to provide more relevant search results.
type: :approximate
The city of the user.
The region of the user.
class WebSearchToolRequestError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
class WebSearchToolResultBlock { content, tool_use_id, type }
class WebSearchToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
Array[WebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
type: :web_search_result
type: :web_search_tool_result
WebSearchToolResultBlockContent = WebSearchToolResultError { error_code, type } | Array[WebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
class WebSearchToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
Array[WebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
type: :web_search_result
class WebSearchToolResultBlockParam { content, tool_use_id, type, cache_control }
Array[WebSearchResultBlockParam { encrypted_content, title, type, 2 more } ]
type: :web_search_result
class WebSearchToolRequestError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
type: :web_search_tool_result
Create a cache control breakpoint at this content block.
Create a cache control breakpoint at this content block.
type: :ephemeral
ttl: :"5m" | :"1h"The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes
1h: 1 hour
Defaults to 5m.
The time-to-live for the cache control breakpoint.
This may be one the following values:
5m: 5 minutes1h: 1 hour
Defaults to 5m.
WebSearchToolResultBlockParamContent = Array[WebSearchResultBlockParam { encrypted_content, title, type, 2 more } ] | WebSearchToolRequestError { error_code, type }
Array[WebSearchResultBlockParam { encrypted_content, title, type, 2 more } ]
type: :web_search_result
class WebSearchToolRequestError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
class WebSearchToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
MessagesBatches
Cancel a Message Batch
Create a Message Batch
Delete a Message Batch
List Message Batches
Retrieve Message Batch results
Retrieve a Message Batch
ModelsExpand Collapse
class DeletedMessageBatch { id, type }
ID of the Message Batch.
type: :message_batch_deletedDeleted object type.
For Message Batches, this is always "message_batch_deleted".
Deleted object type.
For Message Batches, this is always "message_batch_deleted".
class MessageBatch { id, archived_at, cancel_initiated_at, 7 more }
Unique object identifier.
The format and length of IDs may change over time.
RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.
RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.
RFC 3339 datetime string representing the time at which the Message Batch was created.
RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.
Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.
RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.
processing_status: :in_progress | :canceling | :endedProcessing status of the Message Batch.
Processing status of the Message Batch.
Tallies requests within the Message Batch, categorized by their status.
Requests start as processing and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch.
Tallies requests within the Message Batch, categorized by their status.
Requests start as processing and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch.
Number of requests in the Message Batch that have been canceled.
This is zero until processing of the entire Message Batch has ended.
Number of requests in the Message Batch that encountered an error.
This is zero until processing of the entire Message Batch has ended.
Number of requests in the Message Batch that have expired.
This is zero until processing of the entire Message Batch has ended.
Number of requests in the Message Batch that are processing.
Number of requests in the Message Batch that have completed successfully.
This is zero until processing of the entire Message Batch has ended.
URL to a .jsonl file containing the results of the Message Batch requests. Specified only once processing ends.
Results in the file are not guaranteed to be in the same order as requests. Use the custom_id field to match results to requests.
type: :message_batchObject type.
For Message Batches, this is always "message_batch".
Object type.
For Message Batches, this is always "message_batch".
class MessageBatchCanceledResult { type }
type: :canceled
class MessageBatchErroredResult { error, type }
class InvalidRequestError { message, type }
type: :invalid_request_error
class AuthenticationError { message, type }
type: :authentication_error
class BillingError { message, type }
type: :billing_error
class PermissionError { message, type }
type: :permission_error
class NotFoundError { message, type }
type: :not_found_error
class RateLimitError { message, type }
type: :rate_limit_error
class GatewayTimeoutError { message, type }
type: :timeout_error
class APIErrorObject { message, type }
type: :api_error
class OverloadedError { message, type }
type: :overloaded_error
type: :error
type: :errored
class MessageBatchExpiredResult { type }
type: :expired
class MessageBatchIndividualResponse { custom_id, result } This is a single line in the response .jsonl file and does not represent the response as a whole.
This is a single line in the response .jsonl file and does not represent the response as a whole.
Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.
Must be unique for each request within the Message Batch.
Processing result for this request.
Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.
Processing result for this request.
Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.
class MessageBatchSucceededResult { message, type }
Unique object identifier.
The format and length of IDs may change over time.
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If 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.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If 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.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
class TextBlock { citations, text, type }
Citations supporting the text block.
The 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.
Citations supporting the text block.
The 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.
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :text
class ThinkingBlock { signature, thinking, type }
type: :thinking
class RedactedThinkingBlock { data, type }
type: :redacted_thinking
class ToolUseBlock { id, input, name, type }
type: :tool_use
class ServerToolUseBlock { id, input, name, type }
name: :web_search
type: :server_tool_use
class WebSearchToolResultBlock { content, tool_use_id, type }
class WebSearchToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
Array[WebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
type: :web_search_result
type: :web_search_tool_result
:"claude-3-7-sonnet-latest" | :"claude-3-7-sonnet-20250219" | :"claude-3-5-haiku-latest" | 15 moreThe model that will complete your prompt.
See models for additional details and options.
The model that will complete your prompt.
See models for additional details and options.
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
role: :assistantConversational role of the generated message.
This will always be "assistant".
Conversational role of the generated message.
This will always be "assistant".
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point
"max_tokens": we exceeded the requested max_tokens or the model's maximum
"stop_sequence": one of your provided custom stop_sequences was generated
"tool_use": the model invoked one or more tools
"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.
"refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point"max_tokens": we exceeded the requestedmax_tokensor the model's maximum"stop_sequence": one of your provided customstop_sequenceswas generated"tool_use": the model invoked one or more tools"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."refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
type: :messageObject type.
For Messages, this is always "message".
Object type.
For Messages, this is always "message".
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Breakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The number of input tokens which were used.
The number of output tokens which were used.
The number of server tool requests.
The number of server tool requests.
The number of web search tool requests.
service_tier: :standard | :priority | :batchIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
type: :succeeded
class MessageBatchErroredResult { error, type }
class InvalidRequestError { message, type }
type: :invalid_request_error
class AuthenticationError { message, type }
type: :authentication_error
class BillingError { message, type }
type: :billing_error
class PermissionError { message, type }
type: :permission_error
class NotFoundError { message, type }
type: :not_found_error
class RateLimitError { message, type }
type: :rate_limit_error
class GatewayTimeoutError { message, type }
type: :timeout_error
class APIErrorObject { message, type }
type: :api_error
class OverloadedError { message, type }
type: :overloaded_error
type: :error
type: :errored
class MessageBatchCanceledResult { type }
type: :canceled
class MessageBatchExpiredResult { type }
type: :expired
class MessageBatchRequestCounts { canceled, errored, expired, 2 more }
Number of requests in the Message Batch that have been canceled.
This is zero until processing of the entire Message Batch has ended.
Number of requests in the Message Batch that encountered an error.
This is zero until processing of the entire Message Batch has ended.
Number of requests in the Message Batch that have expired.
This is zero until processing of the entire Message Batch has ended.
Number of requests in the Message Batch that are processing.
Number of requests in the Message Batch that have completed successfully.
This is zero until processing of the entire Message Batch has ended.
MessageBatchResult = MessageBatchSucceededResult { message, type } | MessageBatchErroredResult { error, type } | MessageBatchCanceledResult { type } | MessageBatchExpiredResult { type } Processing result for this request.
Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.
Processing result for this request.
Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.
class MessageBatchSucceededResult { message, type }
Unique object identifier.
The format and length of IDs may change over time.
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If 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.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If 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.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
class TextBlock { citations, text, type }
Citations supporting the text block.
The 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.
Citations supporting the text block.
The 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.
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :text
class ThinkingBlock { signature, thinking, type }
type: :thinking
class RedactedThinkingBlock { data, type }
type: :redacted_thinking
class ToolUseBlock { id, input, name, type }
type: :tool_use
class ServerToolUseBlock { id, input, name, type }
name: :web_search
type: :server_tool_use
class WebSearchToolResultBlock { content, tool_use_id, type }
class WebSearchToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
Array[WebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
type: :web_search_result
type: :web_search_tool_result
:"claude-3-7-sonnet-latest" | :"claude-3-7-sonnet-20250219" | :"claude-3-5-haiku-latest" | 15 moreThe model that will complete your prompt.
See models for additional details and options.
The model that will complete your prompt.
See models for additional details and options.
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
role: :assistantConversational role of the generated message.
This will always be "assistant".
Conversational role of the generated message.
This will always be "assistant".
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point
"max_tokens": we exceeded the requested max_tokens or the model's maximum
"stop_sequence": one of your provided custom stop_sequences was generated
"tool_use": the model invoked one or more tools
"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.
"refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point"max_tokens": we exceeded the requestedmax_tokensor the model's maximum"stop_sequence": one of your provided customstop_sequenceswas generated"tool_use": the model invoked one or more tools"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."refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
type: :messageObject type.
For Messages, this is always "message".
Object type.
For Messages, this is always "message".
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Breakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The number of input tokens which were used.
The number of output tokens which were used.
The number of server tool requests.
The number of server tool requests.
The number of web search tool requests.
service_tier: :standard | :priority | :batchIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.
type: :succeeded
class MessageBatchErroredResult { error, type }
class InvalidRequestError { message, type }
type: :invalid_request_error
class AuthenticationError { message, type }
type: :authentication_error
class BillingError { message, type }
type: :billing_error
class PermissionError { message, type }
type: :permission_error
class NotFoundError { message, type }
type: :not_found_error
class RateLimitError { message, type }
type: :rate_limit_error
class GatewayTimeoutError { message, type }
type: :timeout_error
class APIErrorObject { message, type }
type: :api_error
class OverloadedError { message, type }
type: :overloaded_error
type: :error
type: :errored
class MessageBatchCanceledResult { type }
type: :canceled
class MessageBatchExpiredResult { type }
type: :expired
class MessageBatchSucceededResult { message, type }
Unique object identifier.
The format and length of IDs may change over time.
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If 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.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
Example:
[{"type": "text", "text": "Hi, I'm Claude."}]
If 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.
For example, if the input messages were:
[
{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
{"role": "assistant", "content": "The best answer is ("}
]
Then the response content might be:
[{"type": "text", "text": "B)"}]
class TextBlock { citations, text, type }
Citations supporting the text block.
The 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.
Citations supporting the text block.
The 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.
class CitationCharLocation { cited_text, document_index, document_title, 4 more }
type: :char_location
class CitationPageLocation { cited_text, document_index, document_title, 4 more }
type: :page_location
class CitationContentBlockLocation { cited_text, document_index, document_title, 4 more }
type: :content_block_location
class CitationsWebSearchResultLocation { cited_text, encrypted_index, title, 2 more }
type: :web_search_result_location
class CitationsSearchResultLocation { cited_text, end_block_index, search_result_index, 4 more }
type: :search_result_location
type: :text
class ThinkingBlock { signature, thinking, type }
type: :thinking
class RedactedThinkingBlock { data, type }
type: :redacted_thinking
class ToolUseBlock { id, input, name, type }
type: :tool_use
class ServerToolUseBlock { id, input, name, type }
name: :web_search
type: :server_tool_use
class WebSearchToolResultBlock { content, tool_use_id, type }
class WebSearchToolResultError { error_code, type }
error_code: :invalid_tool_input | :unavailable | :max_uses_exceeded | 2 more
type: :web_search_tool_result_error
Array[WebSearchResultBlock { encrypted_content, page_age, title, 2 more } ]
type: :web_search_result
type: :web_search_tool_result
:"claude-3-7-sonnet-latest" | :"claude-3-7-sonnet-20250219" | :"claude-3-5-haiku-latest" | 15 moreThe model that will complete your prompt.
See models for additional details and options.
The model that will complete your prompt.
See models for additional details and options.
High-performance model with early extended thinking
High-performance model with early extended thinking
Fastest and most compact model for near-instant responsiveness
Our fastest model
Hybrid model, capable of near-instant responses and extended thinking
Hybrid model, capable of near-instant responses and extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
High-performance model with extended thinking
Our best model for real-world agents and coding
Our best model for real-world agents and coding
Our most capable model
Our most capable model
Our most capable model
Our most capable model
Excels at writing and complex tasks
Excels at writing and complex tasks
Our previous most fast and cost-effective
role: :assistantConversational role of the generated message.
This will always be "assistant".
Conversational role of the generated message.
This will always be "assistant".
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point
"max_tokens": we exceeded the requested max_tokens or the model's maximum
"stop_sequence": one of your provided custom stop_sequences was generated
"tool_use": the model invoked one or more tools
"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.
"refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
The reason that we stopped.
This may be one the following values:
"end_turn": the model reached a natural stopping point"max_tokens": we exceeded the requestedmax_tokensor the model's maximum"stop_sequence": one of your provided customstop_sequenceswas generated"tool_use": the model invoked one or more tools"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."refusal": when streaming classifiers intervene to handle potential policy violations
In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.
Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
type: :messageObject type.
For Messages, this is always "message".
Object type.
For Messages, this is always "message".
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Billing and rate-limit usage.
Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under 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.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Breakdown of cached tokens by TTL
Breakdown of cached tokens by TTL
The number of input tokens used to create the 1 hour cache entry.
The number of input tokens used to create the 5 minute cache entry.
The number of input tokens used to create the cache entry.
The number of input tokens read from the cache.
The number of input tokens which were used.
The number of output tokens which were used.
The number of server tool requests.
The number of server tool requests.
The number of web search tool requests.
service_tier: :standard | :priority | :batchIf the request used the priority, standard, or batch tier.
If the request used the priority, standard, or batch tier.