Claude Code
On this page
Claude Code speaks Anthropic Messages, and we answer in kind: streaming, tools, thinking and prompt caching work as with the official API. The stream is passed through, not translated or repacked.
Setup#
Set the environment variables and run claude:
unset ANTHROPIC_API_KEY
export ANTHROPIC_BASE_URL=https://api.aicreator.app
export ANTHROPIC_AUTH_TOKEN=sk-aic-…
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-5-5
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-5-5
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-5-5
claudeunset ANTHROPIC_API_KEY— required when the variable is set. Claude Code sends its value in thex-api-keyheader, which we read beforeAuthorization: with an old Anthropic key in it the answer is 401.ANTHROPIC_BASE_URL—https://api.aicreator.app, without/v1: Claude Code adds the path itself.ANTHROPIC_AUTH_TOKEN— yoursk-aic-…key.ANTHROPIC_DEFAULT_OPUS_MODEL,ANTHROPIC_DEFAULT_SONNET_MODEL,ANTHROPIC_DEFAULT_HAIKU_MODEL— the models behind the names Opus, Sonnet and Haiku. We accept only the ids of our own list, so pin them.
Settings file#
A shell export lasts until the terminal closes. To make the setup hold wherever Claude Code runs, background agents included, put the same variables in the env block of ~/.claude/settings.json. When a variable is set both there and in the shell, the file wins.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.aicreator.app",
"ANTHROPIC_AUTH_TOKEN": "sk-aic-…",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5"
}
}Keep the key out of a project’s .claude/settings.json: that file is committed to the repository.
Check#
Run claude and type /status: the Anthropic base URL line should show https://api.aicreator.app, and the Auth token line should name ANTHROPIC_AUTH_TOKEN.
Models#
Short names in the model field are resolved on our side:
| Name in Claude Code | Model |
|---|---|
opus | claude-opus-5-5 |
sonnet | claude-sonnet-5-5 |
haiku | claude-haiku-5-5 |
fable | claude-fable-5-1 |
Other models on the Claude Code protocol take their full id: in ANTHROPIC_MODEL or with the /model command. Which models work on this protocol is in the Protocols column of the pricing page. An id that is not on our list gets 400 model_not_available.
To have the models of our list show up in the /model picker, add the variable CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1: Claude Code will ask us for /v1/models at startup.
Background model#
Claude Code runs session titles and other housekeeping on its Haiku model, not on the one picked for the work. Which model that is comes from ANTHROPIC_DEFAULT_HAIKU_MODEL. In the setup above it is claude-haiku-5-5, which we carry for this role.
To run background tasks on another model, put its id in this variable: any model on the Claude Code protocol will do. What the background model spends is its own line in the stats.
Subagents and parallel requests#
One key runs up to 4 requests at a time. Claude Code with subagents easily opens more: the extra request gets 429 concurrent_requests with a retry-after header, and Claude Code retries it by itself. The work goes on, only slower.
A second ceiling counts by IP address, not by key: 60 requests per minute and 1,200 per hour from one machine. A long session with subagents can reach it; the answer is the same, a 429 with retry-after, and Claude Code waits by itself.
If something is off#
- 401 means the key was copied in part or revoked, or
ANTHROPIC_API_KEYis still set in the environment. - 400
model_not_availablemeans Claude Code asked for a model id that is not on our list: pin the models with the variables of the setup. - 402 means the balance ran out: top it up in the dashboard.
- 429 means a key, IP address or provider limit hit; Claude Code retries by itself following the
retry-afterheader.
A step-by-step walk-through is in Troubleshooting, and every code in Errors and limits.