Skip to content
Rapid Router
← API reference

Anthropic format

Part of the Rapid Router API reference. One OpenAI-compatible endpoint, https://rapidrouter.ai/api/v1, in front of every model in the catalog.

21/v1/messages (Anthropic format)

POST /v1/messages speaks the native Anthropic Messages API: content blocks, a top-level system, tools with input_schema, tool_choice, thinking budgets, stop_sequences and a required max_tokens. Auth is your normal Rapid Router key, as a bearer token or in x-api-key, which is where Anthropic's SDKs put it. The request runs through the same routing, failover and billing as chat completions, and the answer comes back in the Anthropic shape, streaming included, whichever provider actually served it, so a client built on Anthropic's SDK works by changing the base URL and key. The reply's usage.cost and provider say what was billed and who served it; on a stream they ride the final message_delta.

curl https://rapidrouter.ai/api/v1/messages \
  -H "Authorization: Bearer $RAPIDROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "max_tokens": 256,
    "messages": [{ "role": "user", "content": "Hi" }]
  }'

Provider routing preferences pass through the same provider object as chat completions, and :free works here too. Validation errors from this endpoint use Anthropic's error envelope; errors from deeper in the pipeline keep the gateway's usual shape.