Migrate from Anthropic
If your code already calls api.anthropic.com today, the entire migration is one environment variable. Existing requests and responses are byte-for-byte identical.
What changes (and what does not)
Nothing about the request schema, the response shape, the streaming events, or the SDK you’re already using needs to change. The only diff is where the bytes go:
| Concern | Anthropic | API-AI |
|---|---|---|
| Base URL | https://api.anthropic.com | https://api-ai.app |
| Auth header | x-api-key | x-api-key or Authorization: Bearer |
| Version header | anthropic-version: 2023-06-01 | anthropic-version: 2023-06-01 |
| Request schema | Anthropic Messages API | Identical |
| Response schema | Anthropic Messages API | Identical |
| Streaming events | SSE: message_start, content_block_delta... | Identical, no buffering |
Prompt caching (cache_control) | Native | Native — pass-through |
| Models | ~15 historical aliases | Generated Claude allowlist — see Models |
| Billing | Card, post-paid, monthly | Prepaid top-up (card, Apple Pay, crypto), no subscription |
Environment-only migration
If your code reads credentials from env vars (it should), this is the whole change:
# Before
export ANTHROPIC_API_KEY=sk-ant-...
# After
export ANTHROPIC_API_KEY=mdf-... # API-AI key
export ANTHROPIC_BASE_URL=https://api-ai.appBoth the official Anthropic Python and Node SDKs read ANTHROPIC_BASE_URL with no other code changes required.
Python — explicit form
# Before
from anthropic import Anthropic
client = Anthropic()
# After
from anthropic import Anthropic
client = Anthropic(
api_key=os.environ["ANTHROPIC_API_KEY"],
base_url="https://api-ai.app",
)Node — explicit form
// Before
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
// After
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
baseURL: "https://api-ai.app",
});Model id swap
The Anthropic-native surface exposes 16 current Claude ids. If your code references an older Anthropic alias (claude-3-5-sonnet, claude-3-opus-20240229, etc.) you’ll get a 400 invalid_request_error — replace it with the current canonical id:
| Old alias | Use instead |
|---|---|
claude-3-5-sonnet*, claude-sonnet-3-5 | claude-sonnet-5-5 |
claude-3-opus*, claude-opus-3 | claude-opus-4-8 |
claude-3-haiku*, claude-haiku-3-5 | claude-haiku-4-5 |
Verify the swap
# Should print the current Claude model ids
curl -s https://api-ai.app/v1/models \
-H "x-api-key: $ANTHROPIC_API_KEY" | jq '.data[].id'
# Should return HTTP 200 and a short text message
curl -s https://api-ai.app/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-haiku-4-5","max_tokens":32,"messages":[{"role":"user","content":"hi"}]}'