Migrate

Migrate from Anthropic API / Claude Code

Change the base URL and key. Keep your SDK, prompts, and tools.

  1. Step 1

    Claude Code env

    Set ANTHROPIC_BASE_URL to the ModelAPI origin (no /v1). Claude Code will call /v1/messages.

    export ANTHROPIC_BASE_URL=https://api.aimodelapi.ai
    export ANTHROPIC_API_KEY=sk-ama-YOUR_KEY
  2. Step 2

    OpenAI SDK apps

    If the rest of your stack is OpenAI-compatible, use https://api.aimodelapi.ai/v1 and model claude-sonnet-5.

  3. Step 3

    Do not expect Anthropic-hosted web search

    Server-side Anthropic web search is not available through ModelAPI. Local tools still work.

curl · OpenAI compatible
curl https://api.aimodelapi.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-ama-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"ping"}]}'