Skip to main content
POST
Messages
The Claude native protocol endpoint, fully compatible with Anthropic’s official API, with advanced features not in the OpenAI protocol such as cache_control and thinking.

Request

Headers

Body fields

content structure

Claude’s content can be a string or a block array. Block types:
  • text — plain text
  • image — image (source.type is base64 or url)
  • tool_use — a model-initiated tool call (assistant message)
  • tool_result — a tool’s returned result (user message)
  • thinking — a thinking block (thinking-mode response)
  • document — documents like PDF

Response

stop_reason: end_turn / max_tokens / stop_sequence / tool_use.

Streaming response

With stream: true, events are pushed as SSE:

Thinking mode

claude-sonnet-4-6 and claude-haiku-4-5 use extended thinking (thinking + budget_tokens); claude-opus-4-8 uses adaptive thinking (effort, defaults to high):
The response includes an extra thinking block:
See Reasoning & thinking.

Prompt caching

See Cache billing.

Vision

Or base64:

Tools

The assistant content in the response includes a tool_use block:
Return the execution result via a user message: