anoman
Migrate · From Anthropic

Two env vars to migrate from Anthropic.

Use our /anthropic endpoint to keep your existing Claude SDK code working unchanged. Same request shape, same response shape, plus guardrails + observability.

The full diff

Before vs after

# BEFORE: raw Anthropic
from anthropic import Anthropic

client = Anthropic(api_key="sk-ant-...")

response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hi"}],
)

# AFTER: through Anoman
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.anoman.io/anthropic",  # ← 1
    api_key="anm-sk-...",                          # ← 2
)

response = client.messages.create(
    model="claude-sonnet-4-6",  # same slug — works unchanged
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hi"}],
)

Endpoint choice

Which base URL?

Anoman exposes the same models via TWO endpoints:

  https://api.anoman.io/v1         → OpenAI Messages format
  https://api.anoman.io/anthropic  → Anthropic Messages format

Use /anthropic when:
  - You're migrating from the Anthropic SDK
  - You're using Claude Code, Agent TARS, or any tool that expects
    Anthropic's request/response shape
  - You want to keep using Anthropic-specific features like
    cache_control markers in your message content

Use /v1 when:
  - You're migrating from OpenAI / LangChain / CrewAI / etc.
  - You want a vendor-neutral interface

You can mix: same API key works on both endpoints.

What stays the same

  • Every Anthropic SDK method works unchanged.
  • Streaming via stream=True — identical SSE event sequence (message_start, content_block_delta, etc.).
  • Tool calling — identical Anthropic tool_use blocks.
  • Vision (image inputs) — identical content-block array format.
  • cache_control markers — passed through transparently, the upstream still respects them.
  • Async clients (AsyncAnthropic) — fully supported.
  • Error handling — same exception classes.

What you gain automatically

// Anthropic's response shape — unchanged.
// Plus an _anoman extension field that the SDK harmlessly ignores.

{
  "id": "msg_01...",
  "type": "message",
  "role": "assistant",
  "content": [{"type": "text", "text": "..."}],
  "stop_reason": "end_turn",
  "usage": {"input_tokens": 12, "output_tokens": 8},
  "_anoman": {
    "guardrails": {
      "injection": { "status": "pass", "score": 0.02 },
      "pii":       { "status": "pass" }
    },
    "routing": { "region": "id" },
    "cost_usd": "0.000045",
    "weighted_tokens": 80
  }
}

Same gains as the OpenAI migration — guardrails on every request, observability, cost capture, regional residency disclosure, multi-provider failover.

Claude Code + agent CLIs

No code changes — just env vars

Claude Code, Agent TARS, and other tools that use Anthropic’s SDK read ANTHROPIC_BASE_URL from the environment. Two env vars and your existing CLI runs through Anoman:

# Drop-in for Claude Code / Anthropic CLI:
export ANTHROPIC_BASE_URL=https://api.anoman.io/anthropic
export ANTHROPIC_API_KEY=anm-sk-...

claude

# Every prompt now goes through:
#   - DeBERTa prompt injection detection
#   - PII masking (per your policy group's mode)
#   - Content moderation
#   - Tool policy enforcement (if you've set one)
# Cached, traced, billed transparently.

Full Claude Code integration walkthrough at /docs/agents/claude-code.

Beyond Claude

The /anthropic endpoint accepts model slugs from non-Anthropic providers too — we translate the request shape automatically. So model: gpt-4o or model: deepseek-v3 work on this endpoint as well. Useful when you want to A/B test alternatives without changing your Anthropic-SDK call site.

Try it — free API key + zero code change.

Two env vars. Five-minute integration.