Rates are the upstream official list price — zero markup, published line by line on pricing→

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.

Start the tutorial →

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.

~/.zshrc
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

claude

Endpoints & 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.

Minimal request
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.

The official names and per-line rates for all 60 models are on the models page. The aliases are just three defaults.

Video generation

An asynchronous API: POST a task and get a task_id, then GET until the status is SUCCEED and read the video URL. Text-to-video, first/last-frame keyframes and reference materials (images, videos, audio, documents, web pages) share one endpoint and are told apart by the fields you send. Up to 30 seconds with a generated sound track, at 480p / 720p / 1080p.

Rather not write code first? Try it in the Playground — every run shows the equivalent cURL / Python request.

POST

https://api.pixcode.ai/v1/video/generations

The model name is wan3.0 (described here) or seedance-2.5 (see its section below). Send {model, input, parameters}; the same fields flattened at the top level are accepted too.

GET

https://api.pixcode.ai/v1/video/generations/{task_id}

status goes QUEUED → PROCESSING → SUCCEED / FAILED; poll about every 15 seconds. Tasks nobody polls are still settled by the gateway on its own. The video URL is a temporary signed link — download it promptly.

Submit a task

cURL
curl https://api.pixcode.ai/v1/video/generations \
  -H "Authorization: Bearer sk-px-..." \
  -H "content-type: application/json" \
  -d '{
    "model": "wan3.0",
    "input": { "prompt": "A kitten running across a moonlit rooftop, neon city lights, cinematic" },
    "parameters": { "resolution": "720p", "ratio": "16:9", "duration": 5 }
  }'
Python
import requests, time

BASE = "https://api.pixcode.ai/v1"
H = {"Authorization": "Bearer sk-px-...", "Content-Type": "application/json"}

task = requests.post(f"{BASE}/video/generations", headers=H, json={
    "model": "wan3.0",
    "input": {"prompt": "The camera slowly pushes in; the person turns and smiles",
              "first_frame": "https://example.com/first.jpg"},
    "parameters": {"resolution": "1080p", "duration": 5},
}).json()
print("task", task["task_id"], "pre-charged", task["estimated_cost"])

while True:
    r = requests.get(f"{BASE}/video/generations/{task['task_id']}", headers=H).json()
    if r["status"] in ("SUCCEED", "FAILED"):
        break
    time.sleep(15)

print(r.get("videos", [{}])[0].get("video_url"), "billed", r["cost"])

Input fields (input)

FieldTypeDescription
promptstringText prompt, up to 20,000 characters. Refer to materials as Image 1, Video 1, Audio 1 (numbered per array, in order).
first_frame / last_framestringKeyframe mode. Public URL, data URI or raw base64 (JPEG/PNG/BMP/WEBP, up to 20MB, 240–8000px per side, aspect ratio within 8:1, no transparent PNG).
reference_imagesstring[]Reference mode. Up to 10 images (URL / data URI / base64); same size rules as keyframes.
reference_videosstring[]Up to 5 public mp4/mov URLs, 1–15s each and 15s in total. Their seconds are billed as input.
reference_audiosstring[]Up to 5 public wav/mp3 URLs, 15s in total.
file / linkstringA document URL (pdf/docx/pptx/txt/md, up to 100MB) or a public web page. Mutually exclusive; reference mode only.

Provide at least one of prompt, a keyframe (first_frame / last_frame) or reference materials. Keyframe mode and reference mode cannot be mixed; file and link are mutually exclusive.

Parameters (parameters)

FieldTypeDefaultDescription
resolutionstring1080p480p, 720p or 1080p; sets the per-second price. size is accepted as an alias.
durationinteger5An explicit integer, 2–30 seconds. -1 (let the model decide) is not supported — the pre-charge needs a length.
ratiostringadaptiveadaptive / 16:9 / 4:3 / 1:1 / 3:4 / 9:16
audiobooleantrueGenerate a sound track. Does not change the price.
seedintegerrandom0–2147483647
prompt_extendbooleantrueSmart prompt rewriting; false stays closer to the literal prompt.

Responses

Task accepted
{
  "task_id": "9ba60b6a-21c6-4fcc-b7a2-250386a4277a",
  "model": "wan3.0",
  "status": "QUEUED",
  "resolution": "720p",
  "duration": 5,
  "input_seconds": 0,
  "billed_seconds": 5,
  "estimated_cost": 0.5
}
Terminal state
{
  "task_id": "9ba60b6a-21c6-4fcc-b7a2-250386a4277a",
  "model": "wan3.0",
  "status": "SUCCEED",
  "progress_percent": 100,
  "resolution": "720p",
  "duration": 5,
  "cost": 0.5,
  "actual_seconds": 5,
  "videos": [{ "video_url": "https://…signed-url…/video.mp4", "video_type": "mp4" }]
}

How it is billed

Per second of video: (reference-video seconds + output seconds) × the per-second price of the chosen resolution. Your crystals are pre-charged for the requested duration when you submit and settled to the real length when the video is ready. Failed tasks (including content-moderation failures) are fully refunded.

Per-second prices: 480p $0.05, 720p $0.10, 1080p $0.20 — the upstream list price; the live rate on the models page is authoritative.

Not enough balance for the whole pre-charge returns 402 with the amount needed; an invalid parameter returns 400 with a code naming the field. Neither is charged.

Seedance 2.5

Same submit and poll endpoints; set model to seedance-2.5. Text-to-video, first-frame or first-and-last-frame video, and reference-image video (up to 10 images), at 480p / 720p / 1080p / 4k, 4–30 seconds, with a generated sound track. Reference videos, reference audio, documents and web pages are not offered for this model yet. The video URL is valid for 24 hours and can be downloaded up to 100 times — save it promptly.

cURL
curl https://api.pixcode.ai/v1/video/generations \
  -H "Authorization: Bearer sk-px-..." \
  -H "content-type: application/json" \
  -d '{
    "model": "seedance-2.5",
    "input": { "prompt": "A paper lantern swaying gently in the wind, soft evening light" },
    "parameters": { "resolution": "720p", "ratio": "16:9", "duration": 5 }
  }'
FieldTypeDefaultDescription
resolutionstring720p480p / 720p / 1080p / 4k, default 720p. 1080p and 4k are 10-bit H.265, which some players cannot open.
durationinteger5An explicit integer, 4–30 seconds. Default 5.
ratiostringadaptive16:9 / 4:3 / 1:1 / 3:4 / 9:16 / 21:9 / adaptive. With first_frame the output follows that image, so ratio cannot be set.
audiobooleantrueGenerate a sound track. Default true.
seed / watermark / camera_fixed——seed (-1–2147483647), watermark (default false), camera_fixed (lock the camera).
Task accepted
{
  "task_id": "cgt-20261123113211-3uh14",
  "model": "seedance-2.5",
  "status": "QUEUED",
  "resolution": "720p",
  "ratio": "16:9",
  "duration": 5,
  "billing": "token",
  "estimated_tokens": 108900,
  "estimated_cost": 1.16523
}
Terminal state
{
  "task_id": "cgt-20261123113211-3uh14",
  "model": "seedance-2.5",
  "status": "SUCCEED",
  "progress_percent": 100,
  "resolution": "720p",
  "ratio": "16:9",
  "duration": 5,
  "cost": 1.16523,
  "billing": "token",
  "estimated_tokens": 108900,
  "usage_tokens": 108900,
  "actual_seconds": 5,
  "videos": [{ "video_url": "https://…signed-url…/video.mp4", "video_type": "mp4" }]
}

By tokens: tokens = width × height × frames ÷ 1024 (24 fps). Per 1M tokens: $10.70 at 480p and 720p, $11.70 at 1080p, $4.70 at 4k. A 5-second 16:9 video comes to about $0.51 at 480p, $1.16 at 720p, $2.84 at 1080p and $4.57 at 4k. Pre-charged from that formula on submit (estimated_tokens in the response) and settled to the usage the task reports (usage_tokens), up or down. Failed tasks are fully refunded.

Image generation

An asynchronous API: POST a task and get a task_id, then GET until the status is SUCCEEDED and read the image URLs. Text-to-image and editing are two endpoints; editing takes the same fields plus one or more source images. Low quality usually returns in 10–30 seconds; high can take a few minutes.

POST

https://api.pixcode.ai/v1/images/generations

Text-to-image. The model name is gpt-image-2 and may be omitted.

POST

https://api.pixcode.ai/v1/images/edits

Edit an image, or generate from reference images. Adds image (one or several) and an optional mask; everything else is the same.

GET

https://api.pixcode.ai/v1/images/generations/{task_id}

status goes RUNNING → SUCCEEDED / FAILED; poll about every 5 seconds. Tasks from both endpoints are read here. Image URLs are temporary signed links valid for 48 hours — download them promptly.

Text to image

cURL
curl https://api.pixcode.ai/v1/images/generations \
  -H "Authorization: Bearer sk-px-..." \
  -H "content-type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "An orange cat sitting on a wooden desk next to a laptop, soft morning light",
    "quality": "medium",
    "size": "1024x1024"
  }'
Python
import requests, time

BASE = "https://api.pixcode.ai/v1"
H = {"Authorization": "Bearer sk-px-...", "Content-Type": "application/json"}

task = requests.post(f"{BASE}/images/generations", headers=H, json={
    "prompt": "A red paper lantern on a plain white background, flat illustration",
    "quality": "low",
    "size": "1536x1024",
}).json()
print("task", task["task_id"], "pre-charged", task["estimated_cost"])

while True:
    r = requests.get(f"{BASE}/images/generations/{task['task_id']}", headers=H).json()
    if r["status"] in ("SUCCEEDED", "FAILED"):
        break
    time.sleep(5)

print(r.get("images"), r.get("error"), "billed", r["cost"])

Edit an image

cURL
curl https://api.pixcode.ai/v1/images/edits \
  -H "Authorization: Bearer sk-px-..." \
  -H "content-type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "Make the cat wear a tiny red scarf",
    "image": "https://example.com/cat.png",
    "quality": "medium",
    "size": "1024x1536"
  }'

Request fields

FieldTypeDefaultDescription
promptstring—Text prompt, required, up to 32,000 characters.
modelstringgpt-image-2gpt-image-2 (the default when omitted), gpt-image-2.5-flare, gpt-image-2.5-sunburst, seedream-5.5 or seedream-5.0-pro. This table describes gpt-image-2; what differs for the others is in the two sections below.
qualitystringmediumlow / medium / high. Higher is slower and costs more.
sizestring1024x10241024x1024 / 1024x1536 / 1536x1024. "auto" is not offered: the price follows the size, so pick one.
ninteger11–10 images. The upstream occasionally returns fewer; you pay for what is returned.
imagestring | string[]—Edits only, required. A public http(s) URL or a data URL starting with data:image/png|jpeg|webp;base64. Pass an array for several (up to 10): the first is the image being edited, the rest are references.
maskstring—Edits only, optional. A PNG whose transparent area marks what to change.
backgroundstringautotransparent / opaque / auto
output_formatstringpngpng / jpeg / webp

Responses

Submitted (HTTP 202)
{
  "task_id": "img_19b677438687cd9ffc9241a0473bbf03",
  "model": "gpt-image-2",
  "status": "RUNNING",
  "quality": "medium",
  "size": "1024x1024",
  "n": 1,
  "estimated_cost": 0.053
}
Polled to a final state
{
  "task_id": "img_19b677438687cd9ffc9241a0473bbf03",
  "model": "gpt-image-2",
  "status": "SUCCEEDED",
  "quality": "medium",
  "size": "1024x1024",
  "n": 1,
  "cost": 0.053,
  "duration_ms": 41830,
  "created_at": "2026-11-19T08:21:07.000Z",
  "updated_at": "2026-11-19T08:21:49.000Z",
  "images": ["https://…signed-url…/image.png"]
}

How it is billed

Per image: the price of the chosen quality and size × the number of images. Your crystals are pre-charged for the requested count when you submit and settled to the number actually returned. Failed tasks (including content-moderation rejections and upstream timeouts) are fully refunded.

Per 1024x1024 image: low $0.006, medium $0.053, high $0.211; the other two sizes are slightly cheaper. Same as the upstream list price — see the live rates on the models page.

Not enough balance for the whole pre-charge returns 402 with the amount required; invalid parameters return 400 with a code naming the field; more than 4 tasks running at once returns 429. None of these are charged. The request body is JSON; multipart uploads are not supported.

GPT Image 2.5 Flare / Sunburst

Same two endpoints and the same polling; set model to gpt-image-2.5-flare (fast) or gpt-image-2.5-sunburst (most capable). What differs from GPT Image 2: billed by tokens instead of per image; one image per request (n above 1 is rejected: submit in parallel instead, up to 4 tasks at once); two more quality levels, xhigh and max; any WIDTHxHEIGHT up to 3840x2160; image URLs are on api.pixcode.ai and valid for 24 hours, so download promptly. Measured at 1024x1024: low takes about 20 seconds, high 30–60 seconds, max just over a minute.

cURL · Text to image
curl https://api.pixcode.ai/v1/images/generations \
  -H "Authorization: Bearer sk-px-..." \
  -H "content-type: application/json" \
  -d '{
    "model": "gpt-image-2.5-flare",
    "prompt": "A red paper lantern on a plain white background, flat illustration",
    "quality": "medium",
    "size": "1536x1024"
  }'
cURL · Edit an image
curl https://api.pixcode.ai/v1/images/edits \
  -H "Authorization: Bearer sk-px-..." \
  -H "content-type: application/json" \
  -d '{
    "model": "gpt-image-2.5-sunburst",
    "prompt": "Turn the scene into a snowy winter evening",
    "image": "https://example.com/street.png",
    "quality": "high",
    "size": "1024x1024"
  }'
FieldTypeDefaultDescription
qualitystringmediumlow / medium / high / xhigh / max, default medium. "auto" is not offered: the price follows the quality, so pick one.
sizestring1024x1024WIDTHxHEIGHT, default 1024x1024. Both sides divisible by 16, longest side up to 3840, aspect ratio up to 3:1, 655,360–8,294,400 total pixels. Common: 1024x1024, 1536x1024, 1024x1536, 2048x2048, 2560x1440, 3840x2160.
imagestring | string[]—Edits only, required. Up to 16 images, each a URL or a data URL; the OpenAI-native form images: [{ "image_url": "…" }] is accepted too.
maskstring—Edits only, optional. A PNG the same size as the first input image; its transparent area marks what to change.
output_formatstringpngpng (default) / jpeg. With jpeg you may also set output_compression (0–100).
backgroundstringautoauto / opaque / transparent. A transparent background needs png.
Submitted (HTTP 202)
{
  "task_id": "img_fd1801e677ee7ec4011fe6dfd3b968e0",
  "model": "gpt-image-2.5-flare",
  "status": "RUNNING",
  "quality": "medium",
  "size": "1536x1024",
  "n": 1,
  "billing": "token",
  "estimated_cost": 0.011095
}
Polled to a final state
{
  "task_id": "img_fd1801e677ee7ec4011fe6dfd3b968e0",
  "model": "gpt-image-2.5-flare",
  "status": "SUCCEEDED",
  "quality": "medium",
  "size": "1536x1024",
  "n": 1,
  "cost": 0.010745,
  "output_sizes": ["1536x1024"],
  "usage": { "input_text_tokens": 19, "input_image_tokens": 0, "output_image_tokens": 355 },
  "duration_ms": 18420,
  "created_at": "2026-11-23T08:14:12.000Z",
  "updated_at": "2026-11-23T08:14:31.000Z",
  "images": ["https://api.pixcode.ai/v1/files/g/tox1ab/5b0da35215a1f314b85cf178d8cea7ba.png"]
}

By tokens: text input $5, image input $8, image output $30 per 1M tokens, the same for both models. The output tokens of an image depend on quality and size; at 1024x1024 we measured low 196 / medium 439 / high 1,756 / xhigh 3,122 / max 7,024, which is about $0.006 / $0.013 / $0.053 / $0.094 / $0.21. Larger and squarer images use more tokens (1536x1024 uses about 20% fewer than 1024x1024, 2048x2048 twice as many). Edits add roughly 1,000–1,500 input tokens per input image (about $0.008–0.012). Pre-charged from an estimate on submit (estimated_cost) and settled to actual usage when the image is ready (usage and cost in the response); the difference is refunded or charged, and failed tasks are fully refunded.

Seedream 5.5 / 5.0 Pro

Same two endpoints and the same polling; set model to seedream-5.5 or seedream-5.0-pro. What differs from GPT Image 2: one image per request (n above 1 is rejected); no quality levels; size is a preset (1K / 1.5K / 2K, the model picks the aspect ratio from your prompt) or an explicit WIDTHxHEIGHT with 921,600–4,624,220 total pixels; no mask; image URLs are valid for 24 hours. Seedream 5.5 usually returns in 10–20 seconds, 5.0 Pro in about a minute.

cURL · Text to image
curl https://api.pixcode.ai/v1/images/generations \
  -H "Authorization: Bearer sk-px-..." \
  -H "content-type: application/json" \
  -d '{
    "model": "seedream-5.5",
    "prompt": "A poster for a jazz night, 2:3 portrait, bold typography",
    "size": "2K"
  }'
cURL · Edit, or generate from reference images
curl https://api.pixcode.ai/v1/images/edits \
  -H "Authorization: Bearer sk-px-..." \
  -H "content-type: application/json" \
  -d '{
    "model": "seedream-5.0-pro",
    "prompt": "Dress the person from image 1 in the outfit from image 2",
    "image": ["https://example.com/person.png", "https://example.com/outfit.png"],
    "size": "1.5K"
  }'
FieldTypeDefaultDescription
sizestring2K1K / 1.5K / 2K (default 2K), or WIDTHxHEIGHT such as 2048x2048 or 1280x720.
imagestring | string[]—Optional (required on /edits). Up to 10 images, each a URL or a data URL. With images the request becomes an edit or a reference-guided generation; say what to change in the prompt.
output_formatstring—png / jpeg. 5.5 defaults to png, 5.0 Pro to jpeg.
backgroundstring—5.5: auto / transparent / opaque. 5.0 Pro: transparent / opaque.
watermarkbooleanfalseAdd the "AI generated" watermark. Default false.
Polled to a final state
{
  "task_id": "img_c6f1361e7566fb4f509e83b931c6a836",
  "model": "seedream-5.5",
  "status": "SUCCEEDED",
  "quality": "standard",
  "size": "2K",
  "n": 1,
  "cost": 0.035,
  "output_sizes": ["1664x2496"],
  "duration_ms": 22601,
  "created_at": "2026-11-23T03:14:12.000Z",
  "updated_at": "2026-11-23T03:14:35.000Z",
  "images": ["https://…signed-url…/image.png"]
}

Per image, priced by the total pixels of the image actually produced (the 1K and 1.5K presets stay under 2.6 MP, 2K is above it). Seedream 5.5: $0.020 / $0.035, plus $0.008 per input image. Seedream 5.0 Pro: $0.045 / $0.09; the first input image is free, each one after it $0.003. Pre-charged for the chosen preset on submit and settled to the real size when the image is ready (output_sizes in the response). Failed tasks are fully refunded.

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.

402

Out of crystals

Returns 402 with a prompt to get more crystals. No silent fallback to a cheaper model. Top up and it continues.

429

Concurrency exceeded

Each plan caps concurrent agents. Running too many at once returns 429 with retry-after.

GET

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?