Anthropic Messages compatible — anthropic-native clients such as Claude Code connect as-is.
Internally it runs through the same chat pipeline and supports stream.
Body
modelstringYes- Model ID
messagesarrayYesroleisuser/assistant. content is a string or an array of blocks (text, image, tool_use, tool_result, thinking, document)max_tokensintegerYes- 1–200000 (required by the Anthropic spec)
systemstring | arrayNo- A string or an array of text blocks
temperaturenumberNo- 0–1
top_pnumberNo- 0–1
top_kintegerNo- Positive integer
stop_sequencesstring[]No- Up to 8
streambooleanNo- Defaults to
false toolsarrayNo{name, description, input_schema}tool_choiceobjectNo{"type":"auto"|"any"|"none"}or{"type":"tool","name":"..."}metadataobjectNo{"user_id": "..."}thinkingobjectNo{"type":"enabled","budget_tokens":N}(N <max_tokens) ·{"type":"adaptive"}·{"type":"disabled"}everyaisobjectNo- Gateway caching options
If you attach cache_control directly to a block, it is passed through as-is (see prompt caching).
Model-specific thinking and tools
Check capabilities and limits in GET /v1/models. Omitted fields mean unverified support; unsupported options and combinations return 400. See the model table under Chat options.
- Latest models such as Claude Opus 5 use
thinking: {"type":"adaptive"}. Manualthinking: {"type":"enabled","budget_tokens":N}is not universal. Opus/Sonnet 4.6 support both modes. - Manual budgets require
1024 ≤ budget_tokens < max_tokens. Unsupported manual budgets are not resized or converted to adaptive thinking. Fable/Mythos rejectthinking: {"type":"disabled"}with 400. - Latest Claude on Bedrock rejects explicit
temperature,top_p, andtop_kwith 400. Checkcapabilities.samplingbefore setting sampling options. tool_choice.disable_parallel_tool_use: truedisables parallel calls. Claude native strict tools requirecapabilities.structured_outputs: true; for other models, see the strict function-tool restrictions in the Chat documentation; unsupportedstrict: truereturns 400.- Web search is exclusive to
/v1/chat/completions. Messages tools are client-executed function tools.
POST /v1/messages/count_tokens
Estimates the input token count before you send a request. Claude Code calls this endpoint automatically.
- Free — no credit is deducted.
- Returns a heuristic estimate without calling the upstream provider (it may differ from the exact tokenizer result).
- The request body takes the same shape as
/v1/messages.
json
{
"input_tokens": 1234
}