API Reference

Generate game art with a single API call

Pixel art, HD sprites, tilesets, and UI elements. Send a prompt, get production-ready assets back.

Paste the full reference into your AI assistant to wire up the API.
Authentication

API Keys

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...
Get Your API Key
Endpoints

Available Routes

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.

Reference

Generate Parameters

All parameters for POST /v1/api/generate and POST /v1/api/generate-sync. Only prompt is required.

ParameterTypeDescription
promptrequiredstringWhat to generate, e.g. "a medieval iron sword, side view"
widthintRequested/fallback width hint (16-512); final output can differ. With pixel-engine-image-v1 it is the exact output width (16-128)
heightintRequested/fallback height hint (16-512); final output can differ. With pixel-engine-image-v1 it is the exact output height (16-128)
variationsintNumber of variations (1-4). Free accounts can request up to 2.
pixelboolPixel art (true) or detailed HD art (false)
pixel_perfectboolGrid-aligned pixel post-processing
bg_modestring"transparent", "white", or "include"
themestringArt theme context, e.g. "dark fantasy medieval"
stylestringStyle direction, e.g. "16-bit SNES style"
aspect_ratiostring"1:1", "16:9", or "9:16"
smart_cropboolAuto-crop to content bounds
smart_crop_modestring"tightest" crops to the smallest even square around the content. "power_of_2" crops to 32, 64, 128 and so on.
modestring"assets", "texture", or "ui"
modelstringAI 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.
resolutionstring"1K", "2K", or "4K". 2K and 4K need the Adventurer plan or higher.
qualitystringQuality 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.
colorsstring[]Color palette, hex codes (max 64)
style_asset_idsstring[]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_idstringAsset ID for style reference (consistent art). Not supported by pixel-engine-image-v1
edit_asset_idstringAsset ID to edit/modify. Not supported by pixel-engine-image-v1
runpod_alpha_threshold_enabledboolAlpha threshold toggle for Basic background removal. When false, runpod_alpha_cutoff is ignored.
runpod_alpha_cutoffintBinary alpha cutoff for Basic background removal when runpod_alpha_threshold_enabled is true.
outline_repairboolSmart 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_idstringAssign output to a project (UUID)
Examples

Quick Examples

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-..."
  }'
Reference

Animate Parameters

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.

ParameterTypeDescription
asset_idrequiredstringExisting SpriteCook asset to animate. Must belong to the authenticated user.
promptrequiredstringWhat the animation should do, e.g. "walk cycle, side view" (up to 3000 characters)
auto_enhance_promptboolLooks at the source asset and expands short prompts like "Idle" into a fuller animation prompt.
pixelboolOptional mode override. When asset_id is used and pixel is omitted, SpriteCook infers pixel vs detailed mode from the source asset.
removebgstringBackground removal mode: "None", "Basic", or "Pro". "Basic" is the default and costs nothing extra. "Pro" uses Photoroom and adds 2 credits per frame.
modelstring"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_framesintFrame 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_formatstring"webp", "gif", or "spritesheet"
negative_promptstringOptional negative prompt. pixel-engine-v1.5 does not support it.
matte_colorstringHex matte color for flattening alpha
colorsintPixel palette size (2-256). Only valid when pixel=true.
edge_marginintSpace 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_alignstringPixel 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_seedboolPick a fresh random seed for each animation.
seedintSeed to reuse (1 to 9999999999). Required when use_random_seed is false.
runpod_alpha_threshold_enabledboolAlpha threshold toggle for Basic background removal during cleanup. When false, runpod_alpha_cutoff is ignored.
runpod_alpha_cutoffintBinary alpha cutoff for Basic background removal during cleanup when runpod_alpha_threshold_enabled is true.
outline_repairboolSmart 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.

Agent Setup

Using SpriteCook with AI agents?

If you're connecting SpriteCook to Cursor, VS Code, Claude, or another MCP-compatible editor, use the one-command installer. It configures everything automatically.

Reference

Tileset Parameters

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.

ParameterTypeDescription
promptrequiredstringWhat terrain to draw, e.g. "mossy dungeon floor" or "grass meeting sand" (up to 5000 characters).
style_modestring"pixel" for pixel art tilesets, "detailed" for HD tilesets.
perspectivestring"topdown", "platformer", or "isometric". Detailed tilesets are top-down only.
piece_setstringLayout. 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_sizeintTile 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.
elevationstring"no-elevation" or "minimal". Only pixel "17-piece-base" (default "no-elevation") and detailed "15-piece" (default "minimal") use it. Other layouts ignore it.
edgesstring"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.
variationsintNumber of tilesets to generate (1-4). Free accounts can request up to 2.
themestringTheme context, e.g. "cozy farm game" (up to 500 characters).
stylestringStyle direction, e.g. "16-bit SNES" (up to 500 characters).
modelstringOptional model override. "pixel-engine-image-v1" can't make tilesets and returns 400.
colorsstring[]Palette guidance as hex codes (up to 64).
force_enabledboolSnap the output to force_colors (or an automatic palette with force_automatic).
force_colorsstring[]Exact palette to snap to, as hex codes (up to 64).
force_automaticboolPick a limited palette automatically.
force_color_countintNumber of colors for the forced palette (1-64).
reference_asset_idstringExisting 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_idstringExisting 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_idstringAny asset to use only as a visual style guide.
project_idstringAssign the tilesets to a project (UUID).
Reference

Remove Background Parameters

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.

ParameterTypeDescription
asset_idstringOwned SpriteCook asset to process. Asset metadata is used to infer whether the source is a still image or animated WebP.
imagestringBase64 image data or data URL for an external upload, up to 5 MB. Supports still images and animated WebP.
filemultipart fileMultipart upload alternative for an external still image or animated WebP, up to 5 MB.
runpod_alpha_threshold_enabledboolAlpha threshold toggle for Basic background removal. When false, runpod_alpha_cutoff is ignored.
runpod_alpha_cutoffintBinary alpha cutoff for Basic background removal when runpod_alpha_threshold_enabled is true.
outline_repairboolSmart 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.
Terminal
# Run these inside Claude Code
>
>
Full agent setup guide
Billing

Credits & Errors

Credit Costs

  • Generation cost depends on model, resolution, quality, image size, reference/edit mode, and variation count
  • GET /v1/api/models returns current per-image model costs and quality-tier pricing
  • Animations cost 20 credits on pixel-engine-v1.1 and frame-engine-v1.1, and 26 on pixel-engine-v1.5
  • Tilesets cost 12 credits each with the default model
  • Multiple variations multiply the generation cost
  • POST /v1/api/remove-background costs 1 credit for still images and 2 credits for animated WebP by default
  • Animation background removal defaults to Basic; None skips it and Pro adds 2 credits per frame
  • Partner billing overrides can batch charges for specific API users, but the default public pricing stays the same
  • Animation jobs use the same generate scope and return output when they finish

Every response includes credits_used and credits_remaining.

Common Errors

Errors come back as {"error": {"code", "message", "details"}}. Validation errors (422) use {"detail": [...]} with one entry per field.

400invalid_request
400content_policy_violation
400image_too_large
401(no code)
402insufficient_credits
403scope_denied
403variation_limit
403resolution_limit
404job_not_found
422(validation)
429queue_limit_reached
429(no code)
503model_paused