tokrouterdocs
API reference

Messages (Anthropic protocol)

Request fields and response shape for POST /v1/messages, including calling non-Anthropic models.

.mdOpen in Claude
POST https://api.tokrouter.dev/v1/messages
x-api-key: sk-…
anthropic-version: 2023-06-01
Content-Type: application/json

Request fields

FieldTypeRequiredNotes
modelstringYesModel id; any vendor's model works
max_tokensintegerYesRequired by the Anthropic protocol
messagesarrayYesrole is user / assistant; content may be a string or content blocks
systemstring / arrayNoSystem prompt (equivalent to OpenAI's system role)
streambooleanNoSSE streaming
temperaturenumberNo
toolsarrayNoAnthropic-shaped tool definitions
stop_sequencesarrayNo
curl https://api.tokrouter.dev/v1/messages \
  -H "x-api-key: $TOKROUTER_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-5-5",
    "max_tokens": 512,
    "system": "You are a concise assistant",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Response

{
  "id": "msg_...",
  "type": "message",
  "role": "assistant",
  "model": "claude-opus-5-5",
  "content": [{"type": "text", "text": "Hello"}],
  "stop_reason": "end_turn",
  "usage": {"input_tokens": 14, "output_tokens": 3}
}

Differences from OpenAI

AspectAnthropicOpenAI
System prompttop-level systemsystem role in messages
Output capmax_tokens requiredoptional
Response textcontent[0].textchoices[0].message.content
Auth headerx-api-keyAuthorization: Bearer

Calling a non-Anthropic model over the Anthropic protocol still returns an Anthropic-shaped response, so clients never branch on vendor.