Messages format
The request uses messages, max_tokens and the content blocks expected by this protocol.
Protocol · Claude Messages
This route is for clients that natively produce the Messages contract. It does not mean every catalog model is a Claude model.
Use this route only for models whose catalog entry carries the Claude Messages badge.
Generate a RouterLab key and keep it in a server-side environment variable.
In the catalog, choose a model explicitly compatible with Claude Messages.
Send model, max_tokens and messages using the Messages format.
Read the content blocks and usage information returned by the route.
These examples use the RouterLab contract currently exposed at /v1/messages.
curl https://api.routerlab.ch/v1/messages \
-H "Authorization: Bearer $ROUTERLAB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 512,
"messages": [{"role": "user", "content": "Hello"}]
}'const response = await fetch("https://api.routerlab.ch/v1/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ROUTERLAB_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "claude-sonnet-4-5",
max_tokens: 512,
messages: [{ role: "user", content: "Hello" }],
}),
});
const data = await response.json();import os
import requests
response = requests.post(
"https://api.routerlab.ch/v1/messages",
headers={"Authorization": f"Bearer {os.environ['ROUTERLAB_API_KEY']}"},
json={
"model": "claude-sonnet-4-5",
"max_tokens": 512,
"messages": [{"role": "user", "content": "Hello"}],
},
)
response.raise_for_status()
print(response.json())Claude Messages is an exchange format. The model remains a separate choice controlled by its identifier and capabilities.
The request uses messages, max_tokens and the content blocks expected by this protocol.
Only use models showing the Claude Messages badge in the catalog.
Tools, vision, context and reasoning depend on the selected model.
If your SDK expects chat/completions, use the OpenAI-compatible guide.
For the Claude Code tool, use the ScioNos wrapper: it configures the terminal and authentication. This page documents the direct HTTP API.
First check the Messages format and the model route compatibility.
| HTTP | Likely cause | Action |
|---|---|---|
| 400 | A required field is missing or content is malformed. | Check model, max_tokens and messages in particular. |
| 401 | Missing, invalid or revoked key. | Check the Bearer value sent in Authorization. |
| 404 | Unknown or unavailable model. | Choose an identifier exposed by GET /v1/models. |
| 429 | Rate or credit limit reached. | Reduce request rate and review the RouterLab account. |
| 503 | Route temporarily unavailable. | Retry with backoff or select another compatible route. |
ScioNos is the dedicated integration for terminal coding agents. It avoids rebuilding their configuration by hand.
Configure agents with ScioNos