BYOK is live — 1,000,000 free BYOK requests every month, no top-up requiredLearn more

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

FieldTypeNotes
modelstring, requiredA text model id from the Models page.
max_tokensinteger, required1 or more. 0 (cache warm-up) is not supported and returns 400.
messagesarray, requiredSee Content blocks.
systemstring or text blocks
toolsarrayCustom 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_choiceobjectauto, any, none, or tool with name. disable_parallel_tool_use is honored.
stop_sequences, temperature, top_pPassed on.
streambooleanAnthropic streaming events: message_start, content block events, message_delta with usage, message_stop.
metadataobjectmetadata.user_id is used as a session id for routing (see Session affinity).
thinkingobjectTranslated for the route serving the model. When that route cannot apply it, it is named in x-boostrail-degraded.

Content blocks

BlockWhereHandling
textuser, assistantSupported.
image (base64 or url source)userSupported on models that accept images.
tool_useassistantSupported.
tool_resultusercontent 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_thinkingassistant turns in historyAccepted and dropped; reported as thinking_blocks in x-boostrail-degraded.
Any other type, such as documentReturns 400.

Not supported

  • output_format (structured outputs) returns 400. Use tools, or response_format on Chat Completions.
  • mcp_servers returns 400.
  • POST /v1/messages/count_tokens returns 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.

Last updated: 2026-10-03