Skip to main content
Docs · API reference

Anthropic Messages

POST /v1/messages. The Anthropic Messages shape, for Anthropic SDKs and Claude Code, over the same router.

Browse docs · API referenceAnthropic Messages
On this page
  1. Setup
  2. Request
  3. Example
  4. Response
  5. Errors
Method and pathPOST /v1/messages, relative to https://api.inferbase.ai
PurposeThe same router in Anthropic's dialect. An Anthropic SDK, or Claude Code, routes through Inferbase unchanged.
AuthenticationAPI key as a bearer token. The SDK's default x-api-key header is not read; set the SDK's auth token.
LimitsAs chat completions.

Setup

Point ANTHROPIC_BASE_URL at https://api.inferbase.ai, and pass the Inferbase key as the auth token.

python
from anthropic import Anthropic

client = Anthropic(auth_token="inf_your_api_key", base_url="https://api.inferbase.ai")

Request

model takes the same values as the OpenAI surface, auto included, so an Anthropic client can route. Tool loops work in both directions: tool_use and tool_result blocks, streamed tool calls as input_json_delta events, and cumulative usage with the cache split on message_delta. Images are accepted.

Not translated yet, and refused with a 400 naming the field rather than dropped: thinking, document blocks, and images inside a tool result.

A session is named with the X-Inferbase-Session header, since the Messages shape has no routing field.

Example

bash
curl https://api.inferbase.ai/v1/messages \
  -H "Authorization: Bearer inf_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Response

The Anthropic Messages shape. model names the model that served the request.

Errors

Errors use Anthropic's envelope on this path: {"type": "error", "error": {...}, "request_id": "..."}, with 400 for a malformed request as Anthropic answers it. The conditions are the same as on chat completions. See Errors.

Last updated September 10, 2026.