Skip to main content
POST
cURL
Beta FeatureThe Messages API is currently in beta. It provides Anthropic Messages API compatibility for clients like Claude Code. For production use, we recommend using the Responses API instead.

Overview

The Messages API provides compatibility with the Anthropic Messages API format. It’s designed primarily for clients that expect Anthropic’s API structure, such as Claude Code and other tools built for Claude’s API.

Body

application/json
messages
object[]
required
Minimum array length: 1
max_tokens
integer
required
Required range: 0 <= x <= 9007199254740991
model
string

Model identifier. Use /v1/models to list all available models. Supports canonical names (e.g. gpt-5.2, claude-opus-4-6), aliases, and provider-prefixed formats (e.g. openai/gpt-5.2). Use "auto" for automatic model selection.

provider
string
cache_control
object | null

Cache control settings for explicit prompt caching of this content.

compaction
object | null
container
context_management
object | null
diagnostics
object | null
fallback_credit_token
fallbacks
mcp_servers
object[]
metadata
object | null
output_config
object | null
output_format
object | null
stream
boolean | null
system
temperature
number | null
Required range: 0 <= x <= 1
thinking
Enabled · object
tool_choice
Auto · object
tools
(Custom Tool · object | Bash Tool · object | Code Execution Tool · object | Computer Use Tool · object | Computer Use Tool (2025-11-24) · object | Computer Toolset · object | Browser Toolset · object | Memory Tool · object | Text Editor Tool · object | Text Editor Tool (2025-04-29) · object | Text Editor Tool (2025-07-28) · object | Web Search Tool · object | Web Search Tool (2026-02-09) · object | Web Search Tool (2026-03-18) · object | Web Fetch Tool · object | Web Fetch Tool (2026-03-09) · object | Web Fetch Tool (2026-03-18) · object | Advisor Tool · object | Tool Search Tool (BM25) · object | Tool Search Tool (Regex) · object | MCP Toolset · object)[]
top_p
number | null
Required range: 0 <= x <= 1
inference_geo
string | null
service_tier
string | null
speed
enum<string> | null
Available options:
standard,
fast
stop_sequences
string[] | null
top_k
integer | null
Required range: 0 < x <= 9007199254740991
routing
object | null

Concentrate routing configuration controlling how requests are routed across models and providers. Learn more about routing.

Response

Default Response

id
string
required
type
enum<string>
required
Available options:
message
role
enum<string>
required
Available options:
assistant
model
string
required
content
(Text · object | Image · object | Document · object | Thinking · object | Redacted Thinking · object | Tool Use · object | Tool Result · object | Server Tool Use · object | Web Search Tool Result · object | Web Fetch Tool Result · object | Advisor Tool Result · object | Code Execution Tool Result · object | Bash Code Execution Tool Result · object | Text Editor Code Execution Tool Result · object | Tool Search Tool Result · object | Search Result · object | MCP Tool Use · object | MCP Tool Result · object | Container Upload · object | Compaction · object | Tool Addition · object | Tool Removal · object | MCP Tool Listing · object | Fallback · object)[]
required
usage
object
required
cost
object
required
stop_reason
enum<string> | null
Available options:
end_turn,
max_tokens,
stop_sequence,
tool_use,
pause_turn,
refusal
stop_sequence
string | null
redact
object | null
Last modified on February 8, 2026