anoman
Reference · Anthropic Messages

POST /anthropic/v1/messages

The Anthropic Messages API, translated to the OpenAI path internally with the full Anoman pipeline. Point any Anthropic SDK client — or Claude Code — at Anoman.

Overview

Anthropic-compatible endpoint

POST /anthropic/v1/messages accepts the Anthropic Messages format and runs it through the same guardrails and metering as every other request. It exists so Anthropic SDK clients and Claude Code can route through Anoman with no code changes.

Set ANTHROPIC_BASE_URL=https://api.anoman.io/anthropic and ANTHROPIC_API_KEY=anm-sk-.... Authentication uses your Anoman API key (the x-api-key header the Anthropic SDK sends, or a Bearer token).

Request

Request body

The body follows the Anthropic Messages format:

curl https://api.anoman.io/anthropic/v1/messages \
  -H "x-api-key: anm-sk-..." \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "system": "You are a concise assistant.",
    "messages": [
      {"role": "user", "content": "Explain data residency in one sentence."}
    ]
  }'
FieldDescription
modelThe model id (e.g. claude-sonnet-4-6). Required.
max_tokensMaximum tokens to generate. Required (Anthropic convention).
messagesThe conversation — an array of {role, content} turns.
systemOptional top-level system prompt.
streamSet true for SSE streaming in the Anthropic event format.
temperatureOptional sampling temperature.

Streaming & guardrails

Behavior

  • Streaming: set stream: true and the response is SSE in the Anthropic event format (message_startcontent_block_deltamessage_stop). See /docs/streaming for the wire format.
  • Guardrails: the full pre-call pipeline applies. A blocked request returns 403 before any tokens stream.

Response

Response body

The response is the Anthropic message shape — text lives in content[].text and token counts in usage.

{
  "id": "msg_01AbC...",
  "type": "message",
  "role": "assistant",
  "model": "claude-sonnet-4-6",
  "content": [
    {"type": "text", "text": "Data residency keeps a customer's data processed and stored within a specified jurisdiction."}
  ],
  "stop_reason": "end_turn",
  "usage": {"input_tokens": 24, "output_tokens": 19}
}

Claude Code

Route Claude Code through Anoman

Set two environment variables and every Claude Code request flows through Anoman's guardrails and metering — no config file, no code change:

# Route Claude Code (or any Anthropic SDK client) through Anoman
export ANTHROPIC_BASE_URL=https://api.anoman.io/anthropic
export ANTHROPIC_API_KEY=anm-sk-...

claude   # every request now passes through Anoman guardrails + metering

The same two env vars work for any Anthropic SDK client. For per-agent setup guides see /docs/agents.

Route your Anthropic client through Anoman.

Full guardrails and metering on the Messages API you already use.