Create Message
Create a Claude / Anthropic Messages compatible request — the shape Claude Code uses — for currently listed Claude models. Streaming and non-streaming responses are supported; call other models via /v1/chat/completions. A model sent to an unsupported endpoint is rejected before any model runs: 400 invalid_request_error, model '<id>' must be called via /v1/chat/completions. Error bodies use the Anthropic envelope {"type":"error","error":{type,message,code},"request_id"} rather than the OpenAI {"error":{…}} shape used by the other endpoints. Function tools are forwarded as sent (`tools` with `input_schema`, `tool_choice`; `tool_use` / `tool_result` blocks round-trip). Anthropic server tools: `web_search` and `code_execution` — including its `bash_*` / `text_editor_*` sub-tools and container reuse across turns — are accepted and metered at the model's standard token rate (container time is not passed through per call); `web_fetch`, `mcp_toolset` and `mcp_servers` are rejected before any model runs with 400 invalid_request_error.
Authenticate with your API Key. Get your API Key in the Router One console; the format is sk-xxx.
In: header
Model ID. Set to auto for Router One routing, or specify a concrete model. Most official bare names (for example gpt-5.5 or claude-sonnet-5) are accepted as aliases of the catalog id; copy the catalog id from /models to be safe.
Conversation messages in the Claude / Anthropic Messages format.
1 <= itemsOptional system prompt.
Maximum number of output tokens.
1 <= valueWhether to enable streaming response.
falseSampling temperature, range 0-2.
10 <= value <= 2Anthropic tool declarations, forwarded as sent. Function tools carry input_schema; the server tools web_search and code_execution are accepted, while web_fetch and mcp_toolset are rejected with 400 invalid_request_error.
How the model may use the declared tools (auto, any, tool, none), forwarded as sent.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.router.one/v1/messages" \ -H "Content-Type: application/json" \ -d '{ "model": "auto", "max_tokens": 1024, "messages": [ { "role": "user", "content": "Hello" } ] }'{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"model": "anthropic/claude-sonnet-5",
"content": [
{
"type": "text",
"text": "Hello! How can I help you?"
}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 9,
"output_tokens": 12
}
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "model 'openai/gpt-5.5' must be called via /v1/chat/completions",
"code": "INVALID_REQUEST"
}
}{
"type": "error",
"error": {
"type": "authentication_error",
"message": "invalid api key",
"code": "AUTH_INVALID_API_KEY"
},
"request_id": "86bc1f64e4bcdfc3cc516e51cc419418"
}{
"type": "error",
"error": {
"type": "billing_error",
"message": "insufficient balance: top up at https://router.one/deposit"
}
}{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "rate limit exceeded",
"code": "RATE_LIMIT_EXCEEDED"
},
"request_id": "86bc1f64e4bcdfc3cc516e51cc419418"
}{
"type": "error",
"error": {
"type": "api_error",
"message": "internal error",
"code": "INTERNAL_ERROR"
},
"request_id": "86bc1f64e4bcdfc3cc516e51cc419418"
}