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
- Create a key in Profile → API keys.
- Find a model.
curl "https://pixraft.app/api/v1/models?type=image" - 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}' - Poll
GET /api/v1/generations/{generationId}untilstatusiscompleted,failedormoderated.
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
| Method | Path | Description |
|---|---|---|
| GET | /api/v1/models | Search 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/balance | Your credit balance. |
| POST | /api/v1/quote | Send { modelId, params } and get the credits it would cost. Free. |
| POST | /api/v1/generations | Send { 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
maxCreditson a generation. If the price is above it, the call is refused with 409price_above_maxbefore 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.
| Status | Meaning |
|---|---|
| 400 | Bad input. |
| 401 | Missing or invalid API key. |
| 402 | Not enough credits. |
| 409 | price_above_max: the price is above your maxCredits. Nothing is charged. |
| 413 | storage_full: your storage is full. |
| 429 | Rate limited. Retry shortly. |
| 502 | The 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.