Skip to content
Router One
Router One

Create Message

Create a Claude / Anthropic Messages compatible request — the shape Claude Code uses — for Claude and DeepSeek V4 models. Streaming and non-streaming responses are supported; call other models via /v1/chat/completions. A model outside those two families is rejected the same way 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.

POST
/v1/messages
AuthorizationBearer <token>

Authenticate with your API Key. Get your API Key in the Router One console; the format is sk-xxx.

In: header

modelstring

Model ID. Set to auto for Router One routing, or specify a concrete model.

messages

Conversation messages in the Claude / Anthropic Messages format.

Items1 <= items
system?string

Optional system prompt.

max_tokensinteger

Maximum number of output tokens.

Range1 <= value
stream?boolean

Whether to enable streaming response.

Defaultfalse
temperature?number

Sampling temperature, range 0-2.

Default1
Range0 <= value <= 2

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"
}