Skip to content
APMIX.AI

Any SDK or curl with apmix

Any SDK or curl runs on your apmix key in about 1 min. Paste the key once and every snippet below is ready to copy, with any model from the catalog.

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/v1
api_key
apx_live_YOUR_KEY
model
gpt-5.6-luna
  1. Make a request

    Same paths and same JSON as OpenAI. Only the host and the key change.

    curl https://api.apmix.ai/v1/chat/completions \
      -H "Authorization: Bearer apx_live_YOUR_KEY" \
      -H "Content-Type: application/json" \
      -d '{"model":"gpt-5.6-luna","messages":[{"role":"user","content":"Say hello in five words."}]}'

    Paste your key above to fill this in

  2. OpenAI SDK

    Change base_url and api_key; everything else stays as it is.

    from openai import OpenAI
    
    client = OpenAI(base_url="https://api.apmix.ai/v1", api_key="apx_live_YOUR_KEY")
    
    reply = client.chat.completions.create(
        model="gpt-5.6-luna",
        messages=[{"role": "user", "content": "Say hello in five words."}],
    )
    print(reply.choices[0].message.content)

    Paste your key above to fill this in

  3. Anthropic SDK

    For Claude models through the Anthropic protocol, point base_url at the Anthropic-compatible URL.

    from anthropic import Anthropic
    
    client = Anthropic(base_url="https://api.apmix.ai", api_key="apx_live_YOUR_KEY")
    
    reply = client.messages.create(
        model="gpt-5.6-luna",
        max_tokens=256,
        messages=[{"role": "user", "content": "Say hello in five words."}],
    )
    print(reply.content[0].text)

    Paste your key above to fill this in

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.

See the plain API recipe

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.

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

  • key_limit_reached

    insufficient_quota · rate_limit_error

    When it happens: The key reached the usage limit its owner set on it in Dashboard → API keys. The type is insufficient_quota.

    What to do: Ask the key's owner to raise or remove its usage limit; the key works again at once.

  • 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-key-remaining
Weighted tokens left on this key, when it has a usage limit.
x-apmix-weighted-tokens
What this request cost, after the model's multiplier.
retry-after
Seconds to wait; sent with rate_limit_exceeded.