PixCode documentation
One base URL, two protocols. Change one variable and your coding agent is connected.
Quickstart
Get a key from the console first, then wire it into whichever tool you already use.
QUICK~1 MIN
Get an API key first
Sign in to the console and click "New API key" in the API Keys section. The key is shown once — copy it into the environment variables of any tool below. Logging in with our CLI also issues one automatically.
GUIDED~5 MIN
Full configuration
Set the base URL, the auth header and all three aliases by hand: fast for chores, pro as the default, max for the run that has to land.
TUTORIAL~10 MIN
Run your first real task
Make a multi-file change in a real repository and watch when each alias gets called, and what the bill looks like once cache reads start hitting.
By tool
Pick the one you use and copy it across. Anything not listed works too, as long as it takes a custom endpoint.
Put these in your shell config or the env block of ~/.claude/settings.json. With a custom base URL, Claude Code does not validate model names.
export ANTHROPIC_BASE_URL="https://api.pixcode.ai/anthropic"
export ANTHROPIC_AUTH_TOKEN="sk-px-..."
export ANTHROPIC_DEFAULT_OPUS_MODEL="pixcode-max"
export ANTHROPIC_DEFAULT_SONNET_MODEL="pixcode-pro"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="pixcode-fast"
export API_TIMEOUT_MS=3000000
claudeEndpoints & auth
There are only two endpoints. Auth accepts both x-api-key and Authorization: Bearer — use whichever your tool sends. The gateway egresses from Singapore, one less hop to upstream.
Anthropic
https://api.pixcode.ai/anthropic
For tools on the Messages API: Claude Code, Cline, Zed and friends.
OpenAI compatible
https://api.pixcode.ai/v1
For anything that takes a custom OpenAI endpoint; /models lists the catalogue directly.
curl https://api.pixcode.ai/anthropic/v1/messages \
-H "x-api-key: sk-px-..." \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "pixcode-pro",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "hi" }]
}'Model aliases
All three aliases carry 1M context; pick by task length. Assign them by role in your agent config: titles and compaction to the cheap one, the run that has to land to the strong one.
pixcode-fast
Cheap enough to use freely
Cheap enough to use freely
context 1M
pixcode-pro
everyday driverThe one to put in your config
The everyday driver
context 1M
pixcode-max
Finishes the long runs
Finishes long tasks
context 1M
The official names and per-line rates for all 31 models are on the models page. The aliases are just three defaults.
Limits & errors
The concurrency cap stops a few always-on scripts from eating the upstream capacity. When you hit it you get a retry-after — wait for the in-flight requests. A single request is also hard-capped at 780 seconds on the gateway, however generous your client timeout.
Out of crystals
Returns 402 with a prompt to get more crystals. No silent fallback to a cheaper model. Top up and it continues.
Concurrency exceeded
Each plan caps concurrent agents. Running too many at once returns 429 with retry-after.
Live balance
curl https://api.pixcode.ai/v1/balance -H "x-api-key: sk-px-..."
What should the timeout be?
For long runs, widen the client timeout to 3000000ms (API_TIMEOUT_MS in Claude Code). Agent turns past twenty steps often take minutes on their own, and the default timeout cuts the connection mid-run.
Do I need to do anything for the prefix cache?
No extra parameters. Keep the system prompt and the file context in a stable order; once it hits, repeated context settles at the cache price rather than the input price — the biggest saving in a long session.
Can I use my own upstream key?
Yes. The CLI takes your own upstream key and the proxy is free, permanently. Through the gateway the price matches the vendor’s — the difference is who manages keys and billing.
Connected — now want to know what a turn costs?