Docs
Messages (Anthropic format)
POST/v1/messages
The Anthropic Messages format, served for every text model in the catalog, not only Claude. Point the Anthropic SDK or Claude Code at https://api.boostrail.com and use your BoostRail key.
Example
curl https://api.boostrail.com/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello"}]
}'import anthropic
client = anthropic.Anthropic(api_key="YOUR_API_KEY", base_url="https://api.boostrail.com")
message = client.messages.create(
model="deepseek-v4.1-flash",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(message.content[0].text)Authenticate with x-api-key or Authorization: Bearer; if both are sent, the Bearer token is used. Claude Code settings are on the Coding agents page.
Request body
| Field | Type | Notes |
|---|---|---|
model | string, required | A text model id from the Models page. |
max_tokens | integer, required | 1 or more. 0 (cache warm-up) is not supported and returns 400. |
messages | array, required | See Content blocks. |
system | string or text blocks | |
tools | array | Custom tools with name, description and input_schema. Server tool types return 400. strict, defer_loading, cache_control and input_examples on a tool are dropped and named in x-boostrail-degraded. |
tool_choice | object | auto, any, none, or tool with name. disable_parallel_tool_use is honored. |
stop_sequences, temperature, top_p | Passed on. | |
stream | boolean | Anthropic streaming events: message_start, content block events, message_delta with usage, message_stop. |
metadata | object | metadata.user_id is used as a session id for routing (see Session affinity). |
thinking | object | Translated for the route serving the model. When that route cannot apply it, it is named in x-boostrail-degraded. |
Content blocks
| Block | Where | Handling |
|---|---|---|
text | user, assistant | Supported. |
image (base64 or url source) | user | Supported on models that accept images. |
tool_use | assistant | Supported. |
tool_result | user | content as a string or text blocks. An image inside a tool result is replaced with a short text placeholder; other block types inside it return 400. |
thinking, redacted_thinking | assistant turns in history | Accepted and dropped; reported as thinking_blocks in x-boostrail-degraded. |
Any other type, such as document | Returns 400. |
Not supported
output_format(structured outputs) returns 400. Use tools, orresponse_formaton Chat Completions.mcp_serversreturns 400.POST /v1/messages/count_tokensreturns 404. Claude Code falls back to its local estimate.
Accepted but not applied
cache_control markers and any top-level field not listed above are dropped and named in x-boostrail-degraded. Cache reads that do happen are reported in usage.cache_read_input_tokens and billed at the model's cache-read price.
Errors
Errors come in Anthropic's envelope: {"type": "error", "error": {"type": ..., "message": ...}, "request_id": ...}, with a request-id header of the same value. The HTTP status and message match the codes on Errors and failover; error.type follows Anthropic's mapping for that status.