Anthropic Format
Anthropic Messages API
Chat with Claude models using the native Anthropic Messages API format
POST
Documentation Index
Fetch the complete documentation index at: https://docs.toapis.com/llms.txt
Use this file to discover all available pages before exploring further.
- Native Anthropic Messages API format
- Drop-in compatible with the official Anthropic SDK (Python / JavaScript) — just change
base_url - Supports streaming (SSE)
- Supports multi-turn conversations, system prompts, vision input, and tool use
If you are already using the OpenAI SDK, use the OpenAI-compatible endpoint instead.
If you are using the Anthropic SDK or Claude Code, this endpoint is recommended.
Authorizations
Bearer token authentication for direct HTTP calls
API key authentication, compatible with the Anthropic SDK
Anthropic API version. The Anthropic SDK sets this automatically.Recommended:
2023-06-01Body
Model nameAll Claude models are supported, for example:
claude-opus-4-6claude-sonnet-4-6claude-haiku-4-5
Conversation messages in chronological order. Only
user and assistant roles are allowed here — use the top-level system field for system prompts.Maximum number of tokens to generate
- Claude Sonnet 4-6: up to
64000 - Claude Opus 4-6: up to
32000
System prompt, set at the top level (not inside
messages)Accepts a plain string or an array of content blocks.Enable streaming output (Server-Sent Events)
true: tokens streamed incrementally following the Anthropic SSE event formatfalse: full response returned at once
Sampling temperature controlling output randomnessRange:
0 – 1Nucleus sampling thresholdRange:
0 – 1. Avoid setting both temperature and top_p simultaneously.Stop sequences — generation stops when any of these strings is produced
Response
Unique identifier for the request, prefixed with
msg_Object type, always
messageResponse role, always
assistantList of generated content blocks
content[].type: content type, typicallytextcontent[].text: generated text
The model that handled the request
Reason generation stopped
end_turn: model finished naturallymax_tokens:max_tokenslimit reachedstop_sequence: a stop sequence was triggered
Token usage for this request
usage.input_tokens: input token countusage.output_tokens: output token count