https://api.rodiumai.io/v1/messagesCreate message
Native Anthropic request/response (and SSE). Auth with x-api-key or Bearer rd_sk_…
Auth
Request body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | Claude catalogue id (e.g. anthropic/claude-sonnet-4-6). Only anthropic/* models are served on this endpoint. POST /v1/messages/count_tokens takes the same body and returns input_tokens for free. |
| messages | array | Required | Anthropic Messages array (role + content blocks or text). |
| max_tokens | integer | Required | Maximum output tokens (required by Anthropic Messages). |
| system | string | array | Optional | Optional system prompt. |
| stream | boolean | Optional | When true, returns native Anthropic SSE (message_start, content_block_delta, …). |
| temperature | number | Optional | Sampling temperature when supported. |
| tools | array | Optional | Anthropic tool definitions; tool_use / tool_result blocks round-trip unchanged. |
Examples
…Scope of /v1/messages
- Only Claude models (
anthropic/*) are served here; RodiumAI may route them through Anthropic, Amazon Bedrock or Azure without changing the response shape. Other models are not available on this endpoint: call them with/v1/chat/completions. - On routes without a native Messages API (Amazon Bedrock), the gateway translates the request: client tools,
tool_use/tool_resultturns and images are kept. Provider-hosted tools (web search, code execution) only run on native Anthropic routes; elsewhere they are skipped. - Smart aliases (
rodiumai/smart,rodium/*) and custom models are chat-completions only. - Authenticate with
x-api-key(what the Anthropic SDK sends) orAuthorization: Bearer.anthropic-versionis optional. - Set
max_tokens: it is required by the Messages format and bounds the cost.speedvalues other thanstandardare not forwarded, so requests run at standard speed and price. - Searches made by Anthropic's hosted web search tool (
usage.server_tool_use.web_search_requests) are billed per call on top of tokens, see Pricing.
POST /v1/messages/count_tokens
Anthropic-compatible token counting, so clients such as Claude Code can size their context window. Send the same body as /v1/messages (model is required; max_tokens is not); the answer is {"input_tokens": N}. Same authentication as /v1/messages (x-api-key or Authorization: Bearer). The call is free: nothing is reserved or billed.
…input_tokens is the gateway's own estimate (the one used to size pre-flight holds), not the provider's tokenizer: use it to size prompts, not to predict the bill exactly. Errors use the Anthropic format; an invalid key returns 401 authentication_error.
Errors
Body validation and streaming errors use Anthropic's {"type": "error", "error": {…}} format; errors raised before the call (authentication, balance, quota, rate limit) use the OpenAI-style envelope. Details: API errors.