Authorizations
##All APIs require Bearer Token authentication##
Get API Key:
Visit API Key Management Page to get your API Key
Add to request header:
Authorization: Bearer YOUR_API_KEYBody
The model that will complete your prompt.
claude-haiku-4-5-20251001, claude-sonnet-4-5-20250929, claude-opus-4-1-20250805, claude-sonnet-4-20250514 "claude-sonnet-4-5-20250929"
Input messages.
Our models are trained to operate on alternating user and assistant conversational turns. When creating a new Message, you specify the prior conversational turns with the messages parameter, and the model then generates the next Message in the conversation. Consecutive user or assistant turns in your request will be combined into a single turn.
Each input message must be an object with a role and content. You can specify a single user-role message, or you can include multiple user and assistant messages.
The maximum number of tokens to generate before stopping.
Note that our models may stop before reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
x >= 11024
Container identifier for reuse across requests. Container parameters with skills to be loaded.
Context management configuration.
MCP servers to be utilized in this request
20An object describing metadata about the request.
Determines whether to use priority capacity (if available) or standard capacity for this request.
auto, standard_only Custom text sequences that will cause the model to stop generating.
Whether to incrementally stream the response using server-sent events.
System prompt.
"Today's date is 2024-06-01."
Amount of randomness injected into the response.
Defaults to 1.0. Ranges from 0.0 to 1.0.
0 <= x <= 11
Configuration for enabling Claude's extended thinking.
- Enabled
- Disabled
How the model should use the provided tools. The model will automatically decide whether to use tools.
- Auto
- Any
- Tool
- None
Definitions of tools that the model may use.
- Custom tool
- Bash tool (2024-10-22)
- Bash tool (2025-01-24)
- Code execution tool (2025-05-22)
- CodeExecutionTool_20250825
- Computer use tool (2024-01-22)
- MemoryTool_20250818
- Computer use tool (2025-01-24)
- Text editor tool (2024-10-22)
- Text editor tool (2025-01-24)
- Text editor tool (2025-04-29)
- TextEditor_20250728
- Web search tool (2025-03-05)
- WebFetchTool_20250910
Only sample from the top K options for each subsequent token.
x >= 05
Use nucleus sampling.
0 <= x <= 10.7
Response
Message object
Unique object identifier.
The format and length of IDs may change over time.
"msg_013Zva2CMHLNnXjNJJKqJ2EF"
Object type.
For Messages, this is always "message".
"message"Conversational role of the generated message.
This will always be "assistant".
"assistant"Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape.
- Text
- Thinking
- Redacted thinking
- Tool use
- Server tool use
- Web search tool result
- ResponseWebFetchToolResultBlock
- Code execution tool result
- ResponseBashCodeExecutionToolResultBlock
- ResponseTextEditorCodeExecutionToolResultBlock
- MCP tool use
- MCP tool result
- Container upload
The model that handled the request.
claude-haiku-4-5-20251001, claude-sonnet-4-5-20250929, claude-opus-4-1-20250805, claude-sonnet-4-20250514 "claude-sonnet-4-5-20250929"
The reason that we stopped.
end_turn, max_tokens, stop_sequence, tool_use, pause_turn, refusal, model_context_window_exceeded Which custom stop sequence was generated, if any.
Billing and rate-limit usage.
Context management response.
Information about the container used in this request. Information about the container used in the request (for the code execution tool)