Pixel art, HD sprites, tilesets, and UI elements. Send a prompt, get production-ready assets back.
All requests use Bearer token authentication. Create a key in your SpriteCook dashboard and include it in the Authorization header. Each key has scopes (generate, read_assets, read_credits), so give it only the ones you need.
Authorization: Bearer sc_live_xxxxxxxxxxxxxxxxxxxx...
Every route, parameter, response, and required scope is also in the OpenAPI spec, which you can load into Postman, an SDK generator, or an AI agent.
All parameters for POST /v1/api/generate and POST /v1/api/generate-sync. Only prompt is required.
| Parameter | Type | Description |
|---|---|---|
promptrequired | string | What to generate, e.g. "a medieval iron sword, side view" |
width | int | Requested/fallback width hint (16-512); final output can differ. With pixel-engine-image-v1 it is the exact output width (16-128) |
height | int | Requested/fallback height hint (16-512); final output can differ. With pixel-engine-image-v1 it is the exact output height (16-128) |
variations | int | Number of variations (1-4). Free accounts can request up to 2. |
pixel | bool | Pixel art (true) or detailed HD art (false) |
pixel_perfect | bool | Grid-aligned pixel post-processing |
bg_mode | string | "transparent", "white", or "include" |
theme | string | Art theme context, e.g. "dark fantasy medieval" |
style | string | Style direction, e.g. "16-bit SNES style" |
aspect_ratio | string | "1:1", "16:9", or "9:16" |
smart_crop | bool | Auto-crop to content bounds |
smart_crop_mode | string | "tightest" crops to the smallest even square around the content. "power_of_2" crops to 32, 64, 128 and so on. |
mode | string | "assets", "texture", or "ui" |
model | string | AI model to use. Call GET /v1/api/models for current options. "pixel-engine-image-v1" draws exactly width x height (16-128 px, longest side at most 4x the shortest) with the background already removed. Above 64 px both sides are rounded up to even numbers, and larger requests are scaled down to fit 128. It is pixel art only (pixel: true, mode "assets" or "ui") and text only: requests with reference_asset_id, edit_asset_id or style_asset_ids are rejected. The prompt, style and theme together can be up to 700 characters and 100 words. |
resolution | string | "1K", "2K", or "4K". 2K and 4K need the Adventurer plan or higher. |
quality | string | Quality for the GPT models (gpt-image-2, gpt-image-2.5-flare, gpt-image-2.5-sunburst): "low", "medium", or "high". Higher quality costs more credits. |
colors | string[] | Color palette, hex codes (max 64) |
style_asset_ids | string[] | Your own assets to use as style guides (up to 14). Together with reference_asset_id and edit_asset_id they must fit the model's max_reference_images from GET /v1/api/models. Not supported by pixel-engine-image-v1 |
reference_asset_id | string | Asset ID for style reference (consistent art). Not supported by pixel-engine-image-v1 |
edit_asset_id | string | Asset ID to edit/modify. Not supported by pixel-engine-image-v1 |
runpod_alpha_threshold_enabled | bool | Alpha threshold toggle for Basic background removal. When false, runpod_alpha_cutoff is ignored. |
runpod_alpha_cutoff | int | Binary alpha cutoff for Basic background removal when runpod_alpha_threshold_enabled is true. |
outline_repair | bool | Smart outline repair for pixel art with a transparent background. Restores outline pixels clipped by background removal and cleans leftover background at the edges. Set false for the raw cutout. |
project_id | string | Assign output to a project (UUID) |
curl -X POST https://api.spritecook.ai/v1/api/generate-sync \ -H "Authorization: Bearer sc_live_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "a medieval iron sword, side view", "width": 64, "height": 64, "pixel": true, "bg_mode": "transparent", "model": "gpt-image-2", "quality": "medium" }'
Standalone background removal uses the same async polling pattern, but returns a temporary file result instead of owned assets.
curl -X POST https://api.spritecook.ai/v1/api/remove-background \ -H "Authorization: Bearer sc_live_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "asset_id": "b9fce2d4-..." }'
All parameters for POST /v1/api/animate and POST /v1/api/animate-sync. These endpoints expect an existing asset_id. If you only have local image bytes, import them first with POST /v1/api/assets/import. When pixel is omitted, SpriteCook infers the correct animation mode from the asset.
| Parameter | Type | Description |
|---|---|---|
asset_idrequired | string | Existing SpriteCook asset to animate. Must belong to the authenticated user. |
promptrequired | string | What the animation should do, e.g. "walk cycle, side view" (up to 3000 characters) |
auto_enhance_prompt | bool | Looks at the source asset and expands short prompts like "Idle" into a fuller animation prompt. |
pixel | bool | Optional mode override. When asset_id is used and pixel is omitted, SpriteCook infers pixel vs detailed mode from the source asset. |
removebg | string | Background removal mode: "None", "Basic", or "Pro". "Basic" is the default and costs nothing extra. "Pro" uses Photoroom and adds 2 credits per frame. |
model | string | "pixel-engine-v1.1", "frame-engine-v1.1", or "pixel-engine-v1.5". When omitted, pixel assets use pixel-engine-v1.1 and detailed assets use frame-engine-v1.1. pixel-engine-v1.5 works in both modes. pixel-engine-v1.1 and frame-engine-v1.1 cost 20 credits; pixel-engine-v1.5 costs 26. |
output_frames | int | Frame count. pixel-engine-v1.1 takes even counts from 2 to 16. frame-engine-v1.1 takes even counts from 2 to 24. pixel-engine-v1.5 takes any whole number from 3 to 16. |
output_format | string | "webp", "gif", or "spritesheet" |
negative_prompt | string | Optional negative prompt. pixel-engine-v1.5 does not support it. |
matte_color | string | Hex matte color for flattening alpha |
colors | int | Pixel palette size (2-256). Only valid when pixel=true. |
edge_margin | int | Space added around the sprite before animating, as a percentage of its size (0-25). It goes on the sides and top, so the subject keeps standing on the bottom edge. |
vertical_align | string | Pixel art only. "bottom" keeps the ground line. "center" centers the subject so edge_margin applies on all sides, for flying, floating or bouncing subjects. |
use_random_seed | bool | Pick a fresh random seed for each animation. |
seed | int | Seed to reuse (1 to 9999999999). Required when use_random_seed is false. |
runpod_alpha_threshold_enabled | bool | Alpha threshold toggle for Basic background removal during cleanup. When false, runpod_alpha_cutoff is ignored. |
runpod_alpha_cutoff | int | Binary alpha cutoff for Basic background removal during cleanup when runpod_alpha_threshold_enabled is true. |
outline_repair | bool | Smart outline repair on every frame of a pixel art animation with a transparent background. All frames share one decision about whether the sprite has an outline, so they do not flicker. |
Pixel mode constraints
PNG only. Sources can be up to 256x256 on pixel-engine-v1.1 and up to 320x320 on pixel-engine-v1.5, with width and height within 2:1 of each other. `output_frames` is an even count from 2 to 16 on v1.1, or any whole number from 3 to 16 on v1.5. This mode is used automatically for pixel assets unless you explicitly override it.
Detailed mode constraints
PNG or JPEG, source dimensions between 256x256 and 2048x2048, with width and height within 2:1 of each other. `output_frames` is an even count from 2 to 24 on frame-engine-v1.1, or any whole number from 3 to 16 on pixel-engine-v1.5. If a source is smaller than 256x256, SpriteCook rejects the request before it reaches the provider.
If you're connecting SpriteCook to Cursor, VS Code, Claude, or another MCP-compatible editor, use the one-command installer. It configures everything automatically.
For POST /v1/api/tilesets and POST /v1/api/tilesets-sync. Only prompt is required. GET /v1/api/tilesets/options lists every valid combination of style, perspective, piece set and tile size. Tilesets always render at 1K with a fixed quality and cost 12 credits each with the default model. Want to see the 15-piece layout? Try the dual grid tester.
| Parameter | Type | Description |
|---|---|---|
promptrequired | string | What terrain to draw, e.g. "mossy dungeon floor" or "grass meeting sand" (up to 5000 characters). |
style_mode | string | "pixel" for pixel art tilesets, "detailed" for HD tilesets. |
perspective | string | "topdown", "platformer", or "isometric". Detailed tilesets are top-down only. |
piece_set | string | Layout. Top-down: "15-piece" (dual grid, the default) or "17-piece-base". Platformer: "autotile-16-set". Isometric: "isometric-3x5-32" by default, or "isometric-2x4-64" (also picked when tile_size is 64). |
tile_size | int | Tile size in pixels. Pixel top-down: 16 or 32 (default 32 for 15-piece, 16 for 17-piece-base). Pixel platformer: 16, 32 or 64 (default 16). Isometric: 32 or 64, set by the piece_set. Detailed: 64, 128 or 256 (default 64). GET /v1/api/tilesets/options lists every valid combination. |
elevation | string | "no-elevation" or "minimal". Only pixel "17-piece-base" (default "no-elevation") and detailed "15-piece" (default "minimal") use it. Other layouts ignore it. |
edges | string | "transparent" draws terrain over nothing. "two_surfaces" draws terrain A meeting terrain B and keeps the background. two_surfaces only works with "15-piece"; other layouts return 400. |
variations | int | Number of tilesets to generate (1-4). Free accounts can request up to 2. |
theme | string | Theme context, e.g. "cozy farm game" (up to 500 characters). |
style | string | Style direction, e.g. "16-bit SNES" (up to 500 characters). |
model | string | Optional model override. "pixel-engine-image-v1" can't make tilesets and returns 400. |
colors | string[] | Palette guidance as hex codes (up to 64). |
force_enabled | bool | Snap the output to force_colors (or an automatic palette with force_automatic). |
force_colors | string[] | Exact palette to snap to, as hex codes (up to 64). |
force_automatic | bool | Pick a limited palette automatically. |
force_color_count | int | Number of colors for the forced palette (1-64). |
reference_asset_id | string | Existing tileset to start from. It must be a tileset. Its style, perspective, piece set, tile size and elevation are inherited, and setting a different value returns 400. Can't be combined with edit_asset_id. |
edit_asset_id | string | Existing tileset to edit. It must be a tileset. Its settings are inherited the same way. Can't be combined with reference_asset_id. |
style_asset_id | string | Any asset to use only as a visual style guide. |
project_id | string | Assign the tilesets to a project (UUID). |
POST /v1/api/remove-background accepts exactly one input source: either an owned asset_id or raw uploaded media. Raw uploads can be a still image or animated WebP. The endpoint always runs the current basic cleanup backend and returns a temporary file result through job polling. Download it within 24 hours: file.expires_at says when it goes away.
| Parameter | Type | Description |
|---|---|---|
asset_id | string | Owned SpriteCook asset to process. Asset metadata is used to infer whether the source is a still image or animated WebP. |
image | string | Base64 image data or data URL for an external upload, up to 5 MB. Supports still images and animated WebP. |
file | multipart file | Multipart upload alternative for an external still image or animated WebP, up to 5 MB. |
runpod_alpha_threshold_enabled | bool | Alpha threshold toggle for Basic background removal. When false, runpod_alpha_cutoff is ignored. |
runpod_alpha_cutoff | int | Binary alpha cutoff for Basic background removal when runpod_alpha_threshold_enabled is true. |
outline_repair | bool | Smart outline repair after removal. Applies when asset_id is a pixel art asset (import with pixel: true first); raw image and file uploads have no known style, so they are not repaired. |
GET /v1/api/models returns current per-image model costs and quality-tier pricingPOST /v1/api/remove-background costs 1 credit for still images and 2 credits for animated WebP by defaultBasic; None skips it and Pro adds 2 credits per framegenerate scope and return output when they finishEvery response includes credits_used and credits_remaining.
Errors come back as {"error": {"code", "message", "details"}}. Validation errors (422) use {"detail": [...]} with one entry per field.
invalid_requestcontent_policy_violationimage_too_large(no code)insufficient_creditsscope_deniedvariation_limitresolution_limitjob_not_found(validation)queue_limit_reached(no code)model_paused