Docs
Two lines. Any tool.
Every tool below needs the same two things: the apmix base URL and your API key. Paste your key once and every snippet on this page is ready to copy.
Base URLs
https://api.apmix.ai/v1OpenAI-compatibleChat Completions and Responses. Codex, Cursor, OpenCode, Kilo Code, Pi, Kimi, Grok, Hermes and SDKs.
https://api.apmix.aiAnthropic-compatibleMessages API. Claude Code and the Anthropic SDKs.
Your setup
Get a key →- base_url
- https://api.apmix.ai
- api_key
- apx_live_YOUR_KEY
- model
- claude-sonnet-5
Choose your tool
12 tools
Install Claude Code
Needs Node.js 18 or newer. Skip this if it is already on your machine.
Terminalnpm install -g @anthropic-ai/claude-codePoint it at apmix
Claude Code speaks the Anthropic protocol, so the base URL has no
/v1. Set the three variables in the terminal you run it from.export ANTHROPIC_BASE_URL="https://api.apmix.ai" export ANTHROPIC_AUTH_TOKEN="apx_live_YOUR_KEY" export ANTHROPIC_MODEL="claude-sonnet-5"Paste your key above to fill this in
Make it permanent
Put the same values in
~/.claude/settings.jsonso every new terminal is ready. The script backs up an existing file first; if you already have settings, merge theenvblock into them instead of replacing the file.mkdir -p ~/.claude [ -f ~/.claude/settings.json ] && cp ~/.claude/settings.json ~/.claude/settings.json.bak cat > ~/.claude/settings.json <<'EOF' { "env": { "ANTHROPIC_BASE_URL": "https://api.apmix.ai", "ANTHROPIC_AUTH_TOKEN": "apx_live_YOUR_KEY", "ANTHROPIC_MODEL": "claude-sonnet-5" } } EOFPaste your key above to fill this in
Run it
Start Claude Code inside your project. Switch models any time with
/model, using any Claude id from the catalog.Terminalcd your-project claude
Verify
Check that the key works.
List the models your key can reach. A JSON list back means the key and the URL are right; a 401 means the key is wrong or expired.
curl https://api.apmix.ai/v1/models -H "Authorization: Bearer apx_live_YOUR_KEY"Paste your key above to fill this in
Your tool isn't listed?
Any tool that lets you set an OpenAI or Anthropic base URL works with apmix. Look for a Base URL or Custom provider field, paste the URL and your key, and use a model id from the catalog.
Still stuck? Email support@apmix.ai with the tool name and your request id.
Errors
Every error, its number, and what to do.
The API answers with a standard HTTP status and a JSON body that names the error. The code never changes, so you can match on it; the message is written for humans. Every response also carries an x-apmix-request-id header — quote it when you write to support@apmix.ai.
Two shapes, depending on the endpoint
/v1/chat/completions, /v1/responses, /v1/models, /v1/usage)HTTP/1.1 429 Too Many Requests
x-apmix-request-id: req_5b1f…
{
"error": {
"message": "Your monthly allowance is used up. …",
"type": "insufficient_quota",
"code": "allowance_exhausted",
"param": null
}
}/v1/messages, /v1/messages/count_tokens)HTTP/1.1 429 Too Many Requests
x-apmix-request-id: req_5b1f…
{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "Your monthly allowance is used up. …",
"code": "allowance_exhausted"
}
}- 400
invalid_jsoninvalid_request_error
When it happens: The request body could not be parsed as JSON.
What to do: Check quotes, commas and the
Content-Type: application/jsonheader. - 400
missing_modelinvalid_request_error
When it happens: The request has no
modelfield.What to do: Add a model id from the catalog, e.g.
claude-sonnet-4-6. - 400
bad_requestinvalid_request_error
When it happens: The model rejected a parameter (wrong type, unsupported option, content too long).
What to do: Read the
message; it repeats the model's reason. Fix the parameter and resend.
- 401
missing_api_keyauthentication_error
When it happens: No key was sent. Every endpoint needs one, including
GET /v1/models, because the catalog is scoped to your plan.What to do: Send
Authorization: Bearer apx_live_…(orx-api-keyon Anthropic endpoints). - 401
invalid_api_keyauthentication_error
When it happens: The key does not exist or was deleted.
What to do: Copy it again from Dashboard → API keys, or create a new one.
- 401
key_expiredauthentication_error
When it happens: The key passed the expiry date you set when you created it.
What to do: Create a new key; expiry cannot be extended.
- 403
model_not_in_planpermission_error
When it happens: The model exists but is above your plan, or the account has no plan yet. The
messagenames the model, the plan it needs and the plan your key is on.What to do: Call
GET /v1/modelswith the same key — it lists only what your plan can call — or upgrade in Dashboard → Billing. - 403
event_not_startedpermission_error
When it happens: The model belongs to a community event that has not opened yet. The
messagegives the start time.What to do: Wait for the countdown on apmix.ai/event, or use another model meanwhile.
- 403
event_endedpermission_error
When it happens: The event's shared token pool is spent, or the event was closed.
What to do: Switch to another model. The next event is announced on apmix.ai/event.
- 403
account_suspendedpermission_error
When it happens: The account was suspended for breaking the terms.
What to do: Email support@apmix.ai from the address on the account.
- 403
account_on_holdpermission_error
When it happens: A payment on the account is being checked; requests pause until it is cleared.
What to do: Nothing on your side. Watch for an email, or write to support@apmix.ai if it takes longer than a day.
- 404
model_not_foundnot_found_error
When it happens: The model id is unknown or was retired.
What to do: Use an id from
/v1/modelsor the Models page. Vendor prefixes likeanthropic/are accepted. - 404
not_foundnot_found_error
When it happens: The path or method does not exist.
What to do: Use
POST /v1/chat/completions,POST /v1/responses,POST /v1/messages,GET /v1/modelsorGET /v1/usage.
- 429
allowance_exhaustedinsufficient_quota · rate_limit_error
When it happens: Your monthly weighted tokens are used up. The
typeisinsufficient_quota, like OpenAI's.What to do: Upgrade in Dashboard → Billing or wait for the renewal date shown on the Overview page.
- 429
daily_limit_reachedrate_limit_error
When it happens: You reached the daily cap you set yourself in Settings → Limits.
What to do: Raise or remove the cap, or wait for midnight UTC.
- 429
weekly_limit_reachedrate_limit_error
When it happens: You reached the weekly cap you set yourself in Settings → Limits.
What to do: Raise or remove the cap, or wait for Monday 00:00 UTC.
- 429
rate_limit_exceededrate_limit_error
Safe to retryWhen it happens: More than 60 requests in one minute on a single key (120 on Max).
What to do: Wait
retry-afterseconds. Spread heavy jobs over several keys. - 429
upstream_rate_limitedrate_limit_error
Safe to retryWhen it happens: The model itself is saturated right now.
What to do: Retry with back-off (1s, 2s, 4s). Nothing was charged.
- 502
upstream_errorapi_error
Safe to retryWhen it happens: The model returned a broken or unexpected reply.
What to do: Retry once; if it repeats, try another model. Nothing was charged.
- 503
upstream_unavailableapi_error · overloaded_error
Safe to retryWhen it happens: The model timed out or is down for maintenance.
What to do: Retry in a moment or switch models. Nothing was charged.
- 503
no_providerapi_error · overloaded_error
Safe to retryWhen it happens: The model has no active route on our side (rare, during maintenance).
What to do: Retry in a few minutes or pick another model.
Errors marked “safe to retry” are transient: wait a second or two, then send the same request again (most SDKs do this automatically on 429 and 5xx). Everything else needs a change on your side first.
Useful response headers
- x-apmix-request-id
- Unique id of this request. Include it when you email support@apmix.ai.
- x-apmix-remaining
- Weighted tokens left in your monthly allowance after this request.
- x-apmix-weighted-tokens
- What this request cost, after the model's multiplier.
- retry-after
- Seconds to wait; sent with
rate_limit_exceeded.

