Skip to content
APMIX.AI

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-compatible

    Chat Completions and Responses. Codex, Cursor, OpenCode, Kilo Code, Pi, Kimi, Grok, Hermes and SDKs.

  • https://api.apmix.aiAnthropic-compatible

    Messages 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

  1. Install Claude Code

    Needs Node.js 18 or newer. Skip this if it is already on your machine.

    Terminal
    npm install -g @anthropic-ai/claude-code
  2. Point 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

  3. Make it permanent

    Put the same values in ~/.claude/settings.json so every new terminal is ready. The script backs up an existing file first; if you already have settings, merge the env block 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"
      }
    }
    EOF

    Paste your key above to fill this in

  4. Run it

    Start Claude Code inside your project. Switch models any time with /model, using any Claude id from the catalog.

    Terminal
    cd 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

OpenAI-compatible endpoints (/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
  }
}
Anthropic-compatible endpoints (/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"
  }
}
400Bad request
  • invalid_json

    invalid_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/json header.

  • missing_model

    invalid_request_error

    When it happens: The request has no model field.

    What to do: Add a model id from the catalog, e.g. claude-sonnet-4-6.

  • bad_request

    invalid_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.

401Authentication
  • missing_api_key

    authentication_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_… (or x-api-key on Anthropic endpoints).

  • invalid_api_key

    authentication_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.

  • key_expired

    authentication_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.

403Permission
  • model_not_in_plan

    permission_error

    When it happens: The model exists but is above your plan, or the account has no plan yet. The message names the model, the plan it needs and the plan your key is on.

    What to do: Call GET /v1/models with the same key — it lists only what your plan can call — or upgrade in Dashboard → Billing.

  • event_not_started

    permission_error

    When it happens: The model belongs to a community event that has not opened yet. The message gives the start time.

    What to do: Wait for the countdown on apmix.ai/event, or use another model meanwhile.

  • event_ended

    permission_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.

  • account_suspended

    permission_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.

  • account_on_hold

    permission_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.

404Not found
  • model_not_found

    not_found_error

    When it happens: The model id is unknown or was retired.

    What to do: Use an id from /v1/models or the Models page. Vendor prefixes like anthropic/ are accepted.

  • not_found

    not_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/models or GET /v1/usage.

429Limits
  • allowance_exhausted

    insufficient_quota · rate_limit_error

    When it happens: Your monthly weighted tokens are used up. The type is insufficient_quota, like OpenAI's.

    What to do: Upgrade in Dashboard → Billing or wait for the renewal date shown on the Overview page.

  • daily_limit_reached

    rate_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.

  • weekly_limit_reached

    rate_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.

  • rate_limit_exceeded

    rate_limit_error

    Safe to retry

    When it happens: More than 60 requests in one minute on a single key (120 on Max).

    What to do: Wait retry-after seconds. Spread heavy jobs over several keys.

  • upstream_rate_limited

    rate_limit_error

    Safe to retry

    When it happens: The model itself is saturated right now.

    What to do: Retry with back-off (1s, 2s, 4s). Nothing was charged.

502Upstream
  • upstream_error

    api_error

    Safe to retry

    When it happens: The model returned a broken or unexpected reply.

    What to do: Retry once; if it repeats, try another model. Nothing was charged.

503Unavailable
  • upstream_unavailable

    api_error · overloaded_error

    Safe to retry

    When it happens: The model timed out or is down for maintenance.

    What to do: Retry in a moment or switch models. Nothing was charged.

  • no_provider

    api_error · overloaded_error

    Safe to retry

    When 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.