Developer API

Pixraft for developers and AI agents

One API key gives your code and your AI agent the same 710+ models as the studios, billed in the same credits at the same prices.

Quick start

  1. Create a key in Profile → API keys.
  2. Find a model.
    curl "https://pixraft.app/api/v1/models?type=image"
  3. Generate.
    curl -X POST https://pixraft.app/api/v1/generations \
      -H "Authorization: Bearer $PIXRAFT_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"modelId":"<id>","params":{"prompt":"a red fox in snow"},"maxCredits":20}'
  4. Poll GET /api/v1/generations/{generationId} until status is completed, failed or moderated.

Authentication

Send your key in the Authorization header of every request that needs an account, or, in Claude's connector window, the connector link shown when you create a key.

Authorization: Bearer pxr_…
  • Each key is shown once, when you create it. You can revoke it at any time.
  • You can have up to 10 keys per account.
  • Keys are created and revoked in Profile → API keys, from a signed-in browser session. An API key cannot manage keys.
  • Never put a key in browser code. Keep it on a server or in your terminal.

Endpoints

MethodPathDescription
GET/api/v1/modelsSearch the catalog. Query: type (image, video, audio or lipsync) and q. Public.
GET/api/v1/models/{id}One model with its inputs and required fields. Public.
GET/api/v1/balanceYour credit balance.
POST/api/v1/quoteSend { modelId, params } and get the credits it would cost. Free.
POST/api/v1/generationsSend { modelId, params, maxCredits? }. Returns 202 { generationId, creditsCharged }. An instant model returns 200 { generationId, creditsCharged, status: 'completed', url }, or 200 { generationId, creditsCharged: 0, status: 'moderated' } with no url when the output is blocked and refunded.
GET/api/v1/generations/{id}Returns { status, url?, creditsCharged }. Output URLs are temporary signed links, so download them promptly.

Credits and safety

  • API calls spend the same credits at the same prices as the studios.
  • Set maxCredits on a generation. If the price is above it, the call is refused with 409 price_above_max before anything is charged.
  • Failed and moderated generations are refunded.
  • Rate limits, per account: 20 generations per minute, 60 quotes per minute, 120 status polls per minute and 60 balance checks per minute.
StatusMeaning
400Bad input.
401Missing or invalid API key.
402Not enough credits.
409price_above_max: the price is above your maxCredits. Nothing is charged.
413storage_full: your storage is full.
429Rate limited. Retry shortly.
502The model provider is unavailable.

MCP server

Connect Claude, Cursor and other AI agents to https://pixraft.app/api/mcp (Streamable HTTP). There is no OAuth sign-in yet. In Claude (web or desktop), add a custom connector and paste your connector link: https://pixraft.app/api/mcp/k/<your API key>, which Profile shows when you create a key. Other clients send the key in the Authorization header.

Claude — Settings → Connectors → Add custom connector

https://pixraft.app/api/mcp/k/pxr_…

The connector link contains your key: keep it private, and revoke the key to disable the link.

Claude Code

claude mcp add --transport http pixraft https://pixraft.app/api/mcp --header "Authorization: Bearer pxr_…"

Cursor and other clients

{"mcpServers":{"pixraft":{"url":"https://pixraft.app/api/mcp","headers":{"Authorization":"Bearer pxr_…"}}}}

Stdio-only clients

npx -y mcp-remote https://pixraft.app/api/mcp --header "Authorization: Bearer pxr_…"

Tools: list_models, get_model, quote_price, generate, get_generation, get_balance. The generate tool requires max_credits, so an agent can never spend more than you allow.

Command-line tool

The pixraft command-line tool is coming to npm soon. Until then, use the REST API or connect the MCP server above.

Get 50 free credits after signup