API reference
Full Sprite AI REST API reference: endpoints for generating sprites and animations, request and response formats, parameters, and example calls.
Every endpoint below takes a bearer key, sent as Authorization: Bearer sai_sk_.... Generate one here, or manage your existing keys on the API keys page.
API key
Working in Claude Code, Cursor or another MCP client? The same key connects it in one step, and you get these endpoints as tools instead of HTTP calls. See Sprite AI on MCP.
GET/api/me
Your account: plan, balance, and rate limit.
curl https://www.sprite-ai.art/api/me \
-H "Authorization: Bearer sai_sk_your_key_here"const res = await fetch("https://www.sprite-ai.art/api/me", {
headers: { Authorization: "Bearer sai_sk_your_key_here" },
});
const account = await res.json();import requests
account = requests.get(
"https://www.sprite-ai.art/api/me",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
).json(){
"user_id": "...",
"email": "you@example.com",
"plan": "studio",
"rate_limit_per_minute": 300,
"monthly_token_allotment": 400,
"monthly_tokens_used": 140,
"purchased_token_balance": 0,
"total_token_balance": 260,
"monthly_renews_at": "2026-07-01T00:00:00.000Z",
"billing_period": "monthly"
}GET/api/balance
Token balance only, a subset of /api/me.
curl https://www.sprite-ai.art/api/balance \
-H "Authorization: Bearer sai_sk_your_key_here"const res = await fetch("https://www.sprite-ai.art/api/balance", {
headers: { Authorization: "Bearer sai_sk_your_key_here" },
});
const { total_token_balance } = await res.json();import requests
balance = requests.get(
"https://www.sprite-ai.art/api/balance",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
).json(){
"plan": "studio",
"total_token_balance": 260,
"purchased_token_balance": 0,
"monthly_token_allotment": 400,
"monthly_tokens_used": 140,
"monthly_renews_at": "2026-07-01T00:00:00.000Z",
"billing_period": "monthly"
}GET/api/asset-types
Every asset type with its token cost and the size range it draws at.
curl https://www.sprite-ai.art/api/asset-types \
-H "Authorization: Bearer sai_sk_your_key_here"const res = await fetch("https://www.sprite-ai.art/api/asset-types", {
headers: { Authorization: "Bearer sai_sk_your_key_here" },
});
const { asset_types } = await res.json();import requests
asset_types = requests.get(
"https://www.sprite-ai.art/api/asset-types",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
).json()["asset_types"]| Type | Token cost | Size (px) |
|---|---|---|
character | 1 | 32 to 400 |
creature | 1 | 32 to 400 |
prop | 1 | 32 to 400 |
weapon | 1 | 32 to 400 |
vehicle | 1 | 32 to 400 |
tile | 1 | 32 to 400 |
background | 1 | 32 to 400 |
ui | 1 | 32 to 400 |
effect | 1 | 32 to 400 |
item | 1 | 32 to 400 |
item is an older name for prop. It's still accepted here, but send prop in new code. The MCP tools leave item out.
GET/api/limits
Your key's rate limit, the generate bounds, and the price of every paid call.
curl https://www.sprite-ai.art/api/limits \
-H "Authorization: Bearer sai_sk_your_key_here"const res = await fetch("https://www.sprite-ai.art/api/limits", {
headers: { Authorization: "Bearer sai_sk_your_key_here" },
});
const limits = await res.json();import requests
limits = requests.get(
"https://www.sprite-ai.art/api/limits",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
).json(){
"rate_limit_per_minute": 60,
"sprite": { "min_size": 32, "max_size": 400, "prompt_max_length": 1500, "reference_supported": true },
"animation": { "min_frames": 4, "max_frames": 16, "frames_must_be_even": true },
"token_costs": {
"sprite": 1,
"animation": { "4": 14, "6": 14, "8": 14, "10": 16, "12": 16, "14": 18, "16": 20 },
"restyle": { "normal": 2, "pro": 9 },
"combine": { "normal": 3, "pro": 9 },
"touch_up": 1,
"rotation": 12,
"normal_map_per_frame": 1,
"background_removal": { "standard": 0, "refined": 1 }
}
}POST/api/sprites
Generate a still sprite. The PNG comes back inline in the response. Costs 1 token.
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | What to draw. Accepts 3 to 1500 characters. |
width | integer | No | Width in pixels. Accepts 32 to 400. Default 64. |
height | integer | No | Height in pixels. Accepts 32 to 400. Default 64. |
asset_type | string | No | Inferred from the prompt when omitted. Accepts character, creature, prop, weapon, vehicle, tile, background, ui, effect, item. |
direction | string | No | Facing direction. Accepts none, south, south-west, west, north-west, north, north-east, east, south-east. |
camera_perspective | string | No | Camera angle. Accepts none, front, side, top_down, three_quarter, isometric. |
public | boolean | No | Add to the public gallery. Default false. |
reference_asset_id | string (uuid) | No | UUID of a sprite you own. The new sprite is redrawn from it and keeps its subject and camera angle, so it is a starting image, not a style hint. |
palette_id | string (uuid) | No | A palette from your library (see Palettes). The sprite is drawn in it, held to it, and remembers it, so animations, restyles and combines keep the same colours. |
curl https://www.sprite-ai.art/api/sprites \
-H "Authorization: Bearer sai_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "prompt": "a knight with a blue cape", "asset_type": "character" }'const res = await fetch("https://www.sprite-ai.art/api/sprites", {
method: "POST",
headers: {
Authorization: "Bearer sai_sk_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "a knight with a blue cape",
asset_type: "character",
}),
});
const data = await res.json(); // data.image.pngBase64import base64, requests
res = requests.post(
"https://www.sprite-ai.art/api/sprites",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
json={"prompt": "a knight with a blue cape", "asset_type": "character"},
)
data = res.json()
with open("knight.png", "wb") as f:
f.write(base64.b64decode(data["image"]["pngBase64"])){
"id": "a1b2c3d4-...",
"status": "completed",
"width": 64,
"height": 64,
"assetType": "character",
"tokensSpent": 1,
"image": { "format": "png", "pngBase64": "iVBORw0KGgoAAAANS..." }
}The PNG is inline in image.pngBase64. GET /api/sprites/{id}/download serves the same PNG with no key.
A sprite that takes longer than the request can wait answers 504 with code: "provider_timeout" and the sprite's id in details.id. It keeps running, and it's charged only if it completes. Read GET /api/sprites/{id} until its status is completed or failed, then download it. Don't send the request again. That makes, and charges, a second sprite.
{
"code": "provider_timeout",
"message": "Generation is taking longer than usual and is still running. ...",
"details": { "id": "a1b2c3d4-..." }
}POST/api/sprites/import
Add a sprite you already have (a local PNG, or any pixel sprite) and get back an id you can animate (source_generation_id) or redraw a new sprite from (reference_asset_id). It's free. Importing spends no tokens and runs no AI.
The image must be a single sprite (PNG, JPEG, or WebP), 16–256px per side, not a sprite sheet. Imported sprites are always private.
| Field | Type | Required | Description |
|---|---|---|---|
image | string | Yes | The sprite, as base64 or a data:image/...;base64 URL. Accepts at least 1 characters. |
title | string | No | Label for the sprite. Omitted, it reads "Imported sprite". Accepts at most 200 characters. |
asset_type | string | No | Asset-type tag, metadata only. Accepts character, creature, prop, weapon, vehicle, tile, background, ui, effect, item. |
palette_id | string (uuid) | No | A palette from your library. The sprite is stamped with it so later tools hold to it. The pixels are not changed. |
curl https://www.sprite-ai.art/api/sprites/import \
-H "Authorization: Bearer sai_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "image": "<png base64>", "title": "hero" }'import { readFileSync } from "node:fs";
const image = readFileSync("hero.png").toString("base64");
const res = await fetch("https://www.sprite-ai.art/api/sprites/import", {
method: "POST",
headers: {
Authorization: "Bearer sai_sk_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({ image, title: "hero" }),
});
const { id } = await res.json(); // animate with source_generation_id: idimport base64, requests
image = base64.b64encode(open("hero.png", "rb").read()).decode()
res = requests.post(
"https://www.sprite-ai.art/api/sprites/import",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
json={"image": image, "title": "hero"},
).json()
sprite_id = res["id"] # animate with source_generation_id{
"id": "a1b2c3d4-...",
"status": "completed",
"width": 64,
"height": 64,
"title": "hero"
}GET/api/sprites/{id}
One of your sprites or animations, as metadata with no image bytes. A sprite still being made is moved along first, so reading it is how a generate that timed out gets delivered.
curl https://www.sprite-ai.art/api/sprites/a1b2c3d4-... \
-H "Authorization: Bearer sai_sk_your_key_here"const res = await fetch(
"https://www.sprite-ai.art/api/sprites/a1b2c3d4-...",
{ headers: { Authorization: "Bearer sai_sk_your_key_here" } },
);
const sprite = await res.json();import requests
sprite = requests.get(
"https://www.sprite-ai.art/api/sprites/a1b2c3d4-...",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
).json()GET/api/sprites/{id}/download
The PNG of a sprite, or the sheet of an animation, as bytes. It takes no key, because the id is the key, so a script or a game build saves the file in one fetch. An unknown id answers 404.
curl -o knight.png https://www.sprite-ai.art/api/sprites/a1b2c3d4-.../downloadimport { writeFile } from "node:fs/promises";
const res = await fetch("https://www.sprite-ai.art/api/sprites/" + id + "/download");
await writeFile("knight.png", Buffer.from(await res.arrayBuffer()));import requests
png = requests.get("https://www.sprite-ai.art/api/sprites/" + sprite_id + "/download").content
open("knight.png", "wb").write(png)GET/api/sprites
List your sprites and animations, newest first.
| Field | Type | Required | Description |
|---|---|---|---|
limit | integer | No | How many to return. Accepts 1 to 100. Default 20. |
offset | integer | No | How many to skip, for paging. Accepts at least 0. Default 0. |
status | string | No | Filter by status. Only delivered sprites are listed, so any value other than completed returns nothing. |
asset_type | string | No | Filter by type, e.g. animation. |
curl "https://www.sprite-ai.art/api/sprites?limit=20" \
-H "Authorization: Bearer sai_sk_your_key_here"const res = await fetch(
"https://www.sprite-ai.art/api/sprites?limit=20",
{ headers: { Authorization: "Bearer sai_sk_your_key_here" } },
);
const { sprites } = await res.json();import requests
sprites = requests.get(
"https://www.sprite-ai.art/api/sprites?limit=20",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
).json()["sprites"]POST/api/palettes/generate
A few palette options for a description, nothing saved. Show them to the person, let them pick one or ask again, then save the pick with POST /api/palettes. The prompt is read into a theme, a main colour and moods; a number in the text sets the colour count. Free.
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | What the palette is for, e.g. "mossy dungeon, 16 colours". Accepts 3 to 200 characters. |
count | integer | No | Colours per option. Omitted, it's the number in the prompt. With no number anywhere, the options come one per size, 8, 16, 24 and 32. Accepts 4 to 64. |
options | integer | No | How many options. Omitted, 4. Accepts 2 to 4. |
{
"prompt": "mossy dungeon, 16 colours",
"read_as": "theme forest, main colour green, mood dark",
"options": [
{ "option": 1, "colors": ["#1a2a1c", "..."], "recipe": { "count": 16, "seed": 91827364, "theme": "forest", "primary": "green", "moods": ["dark"] } },
{ "option": 2, "colors": ["..."], "recipe": { "count": 16, "seed": 5550123, "theme": "forest", "primary": "green", "moods": ["dark"] } }
]
}POST/api/palettes
Save the pick. Pass the chosen option's recipe exactly as returned, or explicit colors, and a name. A recipe is regenerated server-side, so the saved palette is exactly the option that was shown. The id that comes back is the palette_id for POST /api/sprites and POST /api/sprites/import. Free.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | A short name. Accepts 1 to 80 characters. |
recipe | object | No | The chosen option's recipe from /api/palettes/generate, exactly as returned. Send this or colors. |
colors | string[] | No | #rrggbb colours instead of a recipe. Send this or recipe. Accepts 2 to 256 items, each matches ^#[0-9a-fA-F]{6}$. |
{
"id": "5f0c2a7e-...",
"name": "Mossy dungeon",
"colors": ["#1a2a1c", "..."],
"count": 16,
"source": "generated",
"created_at": "2026-09-11T22:00:00.000Z"
}GET/api/palettes
Your palettes, newest first, as { "palettes": [ ... ] } with the same shape as above. GET /api/palettes/{id} returns one. Every sprite object carries paletteId, null when the sprite has no palette.
POST/api/animations
Start an animation job from a source sprite. It's asynchronous. You get an id at once, then you poll until it finishes (~15s). Animations run one at a time per account, so a batch of N finishes in about N x 15s. The token cost scales with frame_count.
Reference the source by source_generation_id, the id of a sprite you own, from POST /api/sprites (generate) or POST /api/sprites/import. No image bytes travel through this call. We fetch them server-side. The source must be a single still sprite, 32-256px per side, not a sprite sheet or an existing animation.
| Field | Type | Required | Description |
|---|---|---|---|
source_generation_id | string (uuid) | Yes | UUID of a still sprite you generated or imported. |
preset | string | Yes | Motion preset, or Custom for a motion in your own words. Every preset costs the same. Accepts Idle, Walk, Jump, Run, Attack, Hurt, Death, Custom. |
frame_count | integer | No | Even. Drives the token cost. Accepts 4 to 16. Default 8. |
custom_prompt | string | No | Free-form motion. Required when preset is Custom. Accepts at most 1500 characters. |
palette_extras | integer | No | Colours the animation may add beyond the source sprite's own. 0 keeps its palette exact. Raise it only when the motion brings colours the sprite lacks (fire, magic glow, sparks). Omitted, it takes the preset's default from the table below. Accepts 0 to 256. |
framing_margin | integer | No | Percentage the canvas grows by before animating, so a jump or a projected effect has room instead of being cropped at the sprite's edge. The result comes back at the grown size. Omitted, it takes the preset's default from the table below. Accepts 0 to 25. |
framing_anchor | string | No | Where the sprite sits in that grown canvas. bottom keeps feet grounded in a jump, and a bottom corner opposite the way the sprite faces opens room in front for a projected effect. Omitted, it takes the preset's default from the table below. Accepts top-left, top, top-right, left, center, right, bottom-left, bottom, bottom-right. |
public | boolean | No | Add to the public gallery. Default false. |
Each preset comes with its own defaults for the three fields you can leave out. Only Jump grows the canvas on its own.
| Preset | palette_extras | framing_margin | framing_anchor |
|---|---|---|---|
Idle | 0 | 0 | center |
Walk | 0 | 0 | center |
Jump | 0 | 25 | bottom |
Run | 0 | 0 | center |
Attack | 12 | 0 | center |
Hurt | 0 | 0 | center |
Death | 0 | 0 | center |
Custom | 12 | 0 | center |
curl https://www.sprite-ai.art/api/animations \
-H "Authorization: Bearer sai_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "source_generation_id": "a1b2c3d4-...", "preset": "Walk", "frame_count": 8 }'const res = await fetch("https://www.sprite-ai.art/api/animations", {
method: "POST",
headers: {
Authorization: "Bearer sai_sk_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
source_generation_id: spriteId, // from generate or import
preset: "Walk",
frame_count: 8,
}),
});
const { id } = await res.json(); // poll GET /api/animations/{id}import requests
job = requests.post(
"https://www.sprite-ai.art/api/animations",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
json={"source_generation_id": sprite_id, "preset": "Walk", "frame_count": 8},
).json()
job_id = job["id"] # poll GET /api/animations/{id}{ "id": "a1b2c3d4-...", "status": "processing" }GET/api/animations/{id}
Poll an animation job. While it runs, the answer is 200 with status: "processing" and an optional progress (0–1). When status is completed, the sheet is in image.spritesheetBase64. A job that failed answers with an error status and the error body instead, such as 502 provider_failure or 504 provider_timeout, and its tokens are refunded. Wait about 6 seconds, then poll every 4.
# poll every ~4s until status is completed, or the answer is an error
curl https://www.sprite-ai.art/api/animations/a1b2c3d4-... \
-H "Authorization: Bearer sai_sk_your_key_here"const headers = { Authorization: "Bearer sai_sk_your_key_here" };
await new Promise((r) => setTimeout(r, 6000));
while (true) {
const res = await fetch("https://www.sprite-ai.art/api/animations/" + id, { headers });
const job = await res.json();
if (!res.ok) { console.error(job.code, job.message); break; } // failed, tokens refunded
if (job.status === "completed") { console.log(job.image.spritesheetBase64); break; }
await new Promise((r) => setTimeout(r, 4000));
}import time, requests
headers = {"Authorization": "Bearer sai_sk_your_key_here"}
time.sleep(6)
while True:
res = requests.get("https://www.sprite-ai.art/api/animations/" + job_id, headers=headers)
job = res.json()
if not res.ok:
print(job["code"], job["message"]); break # failed, tokens refunded
if job["status"] == "completed":
print(job["image"]["spritesheetBase64"]); break
time.sleep(4){
"id": "a1b2c3d4-...",
"status": "completed",
"frameWidth": 64,
"frameHeight": 64,
"frameCount": 8,
"fps": 12,
"image": { "format": "png", "spritesheetBase64": "iVBORw0KGgoAAAANS..." }
}A single horizontal-strip PNG. Slice it with frameCount, frameWidth, frameHeight.
POST/api/animations/{id}/cancel
Cancel a running job and refund its tokens. A job that already completed or failed answers 409 with code: "job_finished", and an id that isn't yours answers 404.
curl -X POST https://www.sprite-ai.art/api/animations/a1b2c3d4-.../cancel \
-H "Authorization: Bearer sai_sk_your_key_here"await fetch(
"https://www.sprite-ai.art/api/animations/" + id + "/cancel",
{ method: "POST", headers: { Authorization: "Bearer sai_sk_your_key_here" } },
);import requests
requests.post(
"https://www.sprite-ai.art/api/animations/" + job_id + "/cancel",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
){ "id": "a1b2c3d4-...", "status": "cancelled" }POST/api/restyles
Change a sprite you own and keep the character. Restyle its look, put it in a new pose, or swap the item it holds. mode says which. It's asynchronous like animations. You get an id at once, then you poll until it finishes (~15s on the normal tier, up to a minute on pro). The tier sets the cost, 2 tokens on normal and 9 on pro. Presets and custom prompts cost the same.
Reference the source by source_generation_id: the id of a sprite you own, from POST /api/sprites (generate) or POST /api/sprites/import. No image bytes travel through this call; we fetch them server-side. The source must be 32-256px on each side; the result comes back at the source's size, unless framing_margin grows the canvas first.
| Field | Type | Required | Description |
|---|---|---|---|
source_generation_id | string (uuid) | Yes | UUID of a sprite you generated or imported, 32-256px per side. |
preset | string | No | Locked style. A preset always means mode restyle. Send this or custom_prompt, not both. Accepts fire, ice, gold, zombie, holy, cursed, poison, royal, shadow, steampunk. |
custom_prompt | string | No | What to change, in your own words, read together with mode. Send this or preset, not both. Accepts 1 to 500 characters. |
mode | string | No | restyle repaints it and colours may change. pose moves the character and keeps everything else. item swaps one named object. custom is anything else. Accepts restyle, pose, item, custom. Default restyle. |
tier | string | No | Pro holds the character closer and wins item swaps. Normal wins poses. Changes the price. Accepts normal, pro. Default normal. |
palette_extras | integer | No | Colours the edit may use beyond the sprite's own. 0 keeps its palette exact. Omitted, it takes the mode's default from the table below. Accepts 0 to 256. |
framing_margin | integer | No | Percentage the canvas grows by before the edit, so a pose has room. The result comes back at the grown size. Omitted, 0. Accepts 0 to 25. |
framing_anchor | string | No | Where the sprite sits in that grown canvas, e.g. bottom to keep a character's feet planted. Omitted, center. Accepts top-left, top, top-right, left, center, right, bottom-left, bottom, bottom-right. |
public | boolean | No | Add to the public gallery. Default false. |
Each mode has its own palette_extras default. The combine row is the default for POST /api/combines.
| Mode | palette_extras |
|---|---|
restyle | 16 |
pose | 4 |
item | 12 |
custom | 12 |
combine | 4 |
curl https://www.sprite-ai.art/api/restyles \
-H "Authorization: Bearer sai_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "source_generation_id": "a1b2c3d4-...", "preset": "gold" }'const res = await fetch("https://www.sprite-ai.art/api/restyles", {
method: "POST",
headers: {
Authorization: "Bearer sai_sk_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
source_generation_id: spriteId, // from generate or import
preset: "gold", // or custom_prompt: "obsidian armor, glowing runes"
}),
});
const { id } = await res.json(); // poll GET /api/restyles/{id}import requests
job = requests.post(
"https://www.sprite-ai.art/api/restyles",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
json={"source_generation_id": sprite_id, "preset": "gold"},
).json()
job_id = job["id"] # poll GET /api/restyles/{id}{ "id": "a1b2c3d4-...", "status": "processing" }GET/api/restyles/{id}
Poll a restyle job. While it runs, the answer is 200 with status: "processing". When status is completed, the sprite is in image.pngBase64 at native resolution. A job that failed answers with an error status and the error body instead, and its tokens are refunded. Wait about 4 seconds, then poll every 3.
# poll every ~3s until status is completed, or the answer is an error
curl https://www.sprite-ai.art/api/restyles/a1b2c3d4-... \
-H "Authorization: Bearer sai_sk_your_key_here"const headers = { Authorization: "Bearer sai_sk_your_key_here" };
await new Promise((r) => setTimeout(r, 4000));
while (true) {
const res = await fetch("https://www.sprite-ai.art/api/restyles/" + id, { headers });
const job = await res.json();
if (!res.ok) { console.error(job.code, job.message); break; } // failed, tokens refunded
if (job.status === "completed") { console.log(job.image.pngBase64); break; }
await new Promise((r) => setTimeout(r, 3000));
}import time, requests
headers = {"Authorization": "Bearer sai_sk_your_key_here"}
time.sleep(4)
while True:
res = requests.get("https://www.sprite-ai.art/api/restyles/" + job_id, headers=headers)
job = res.json()
if not res.ok:
print(job["code"], job["message"]); break # failed, tokens refunded
if job["status"] == "completed":
print(job["image"]["pngBase64"]); break
time.sleep(3){
"id": "a1b2c3d4-...",
"status": "completed",
"width": 64,
"height": 64,
"isPublic": false,
"slug": null,
"image": { "format": "png", "pngBase64": "iVBORw0KGgoAAAANS..." }
}POST/api/restyles/{id}/cancel
Cancel a running restyle and refund its tokens. A job that already completed or failed answers 409 with code: "job_finished", and an id that isn't yours answers 404.
curl -X POST https://www.sprite-ai.art/api/restyles/a1b2c3d4-.../cancel \
-H "Authorization: Bearer sai_sk_your_key_here"await fetch(
"https://www.sprite-ai.art/api/restyles/" + id + "/cancel",
{ method: "POST", headers: { Authorization: "Bearer sai_sk_your_key_here" } },
);import requests
requests.post(
"https://www.sprite-ai.art/api/restyles/" + job_id + "/cancel",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
){ "id": "a1b2c3d4-...", "status": "cancelled" }POST/api/combines
Put an item from one sprite you own into another sprite you own. The first sprite keeps its identity and its exact dimensions. The second is where the item is copied from, so its shape and its colours are what you get. The result is locked to both sprites' palettes, so an item never comes back repainted in the character's colours. It's asynchronous like restyles. You get an id at once, then you poll until it finishes (~20s on normal, 3-4 minutes on pro). The tier sets the cost, 3 tokens on normal and 9 on pro.
Reach for this when the item exists as a sprite. To swap for something you only have words for, use POST /api/restyles with mode: "item" instead.
Both sprites are referenced by id, from POST /api/sprites (generate) or POST /api/sprites/import. No image bytes travel through this call; we fetch them server-side, which also means both sprites must be yours. Each must be 32-256px on each side, and the two ids must differ. The result comes back at the first sprite's size even when framing_margin grows the canvas first.
| Field | Type | Required | Description |
|---|---|---|---|
source_generation_id | string (uuid) | Yes | UUID of the sprite that keeps its identity. Its dimensions are the output's. |
item_generation_id | string (uuid) | Yes | UUID of the sprite the item is copied from. Must differ from source_generation_id. |
prompt | string | Yes | Where the item goes. Say the placement, not the item, because the item comes from the image. Accepts 1 to 500 characters. |
tier | string | No | Normal puts the item in the character's hands. Pro holds the character closer but places the item worse. Changes the price. Accepts normal, pro. Default normal. |
palette_extras | integer | No | Colours the combine may use beyond the two sprites' union. 0 locks it to exactly their palettes. Omitted, it takes the combine row of the mode table under POST /api/restyles. Accepts 0 to 256. |
framing_margin | integer | No | Percentage the canvas grows by before the edit, so a reaching item has room. The sprite still returns at the first sprite's size. Omitted, 0. Accepts 0 to 25. |
framing_anchor | string | No | Where the sprite sits in that grown canvas, e.g. bottom to keep a character's feet planted. Omitted, center. Accepts top-left, top, top-right, left, center, right, bottom-left, bottom, bottom-right. |
public | boolean | No | Add to the public gallery. Default false. |
curl https://www.sprite-ai.art/api/combines \
-H "Authorization: Bearer sai_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "source_generation_id": "a1b2c3d4-...", "item_generation_id": "e5f6a7b8-...", "prompt": "holding this shield in his free hand" }'const res = await fetch("https://www.sprite-ai.art/api/combines", {
method: "POST",
headers: {
Authorization: "Bearer sai_sk_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
source_generation_id: characterId, // keeps its identity and its size
item_generation_id: shieldId, // where the item comes from
prompt: "holding this shield in his free hand",
}),
});
const { id } = await res.json(); // poll GET /api/combines/{id}import requests
job = requests.post(
"https://www.sprite-ai.art/api/combines",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
json={
"source_generation_id": character_id,
"item_generation_id": shield_id,
"prompt": "holding this shield in his free hand",
},
).json()
job_id = job["id"] # poll GET /api/combines/{id}{ "id": "a1b2c3d4-...", "status": "processing" }GET/api/combines/{id}
Poll a combine job. While it runs, the answer is 200 with status: "processing". When status is completed, the sprite is in image.pngBase64 at the first sprite's size. A job that failed answers with an error status and the error body instead, and its tokens are refunded. Wait about 4 seconds, then poll every 4. A normal-tier run is usually done on the first or second poll. Pro takes minutes.
# poll every ~4s until status is completed, or the answer is an error
curl https://www.sprite-ai.art/api/combines/a1b2c3d4-... \
-H "Authorization: Bearer sai_sk_your_key_here"const headers = { Authorization: "Bearer sai_sk_your_key_here" };
let res, job;
do {
await new Promise((r) => setTimeout(r, 4000));
res = await fetch("https://www.sprite-ai.art/api/combines/" + id, { headers });
job = await res.json();
} while (res.ok && job.status === "processing");
if (!res.ok) console.error(job.code, job.message); // failed, tokens refundedimport time, requests
headers = {"Authorization": "Bearer sai_sk_your_key_here"}
while True:
time.sleep(4)
res = requests.get("https://www.sprite-ai.art/api/combines/" + job_id, headers=headers)
job = res.json()
if not res.ok:
print(job["code"], job["message"]); break # failed, tokens refunded
if job["status"] == "completed":
break{
"id": "a1b2c3d4-...",
"status": "completed",
"width": 64,
"height": 64,
"isPublic": false,
"slug": null,
"image": { "format": "png", "pngBase64": "iVBORw0KGgo..." }
}POST/api/combines/{id}/cancel
Cancel a running combine and refund its tokens. A job that already completed or failed answers 409 with code: "job_finished", and an id that isn't yours answers 404.
curl -X POST https://www.sprite-ai.art/api/combines/a1b2c3d4-.../cancel \
-H "Authorization: Bearer sai_sk_your_key_here"await fetch(
"https://www.sprite-ai.art/api/combines/" + id + "/cancel",
{ method: "POST", headers: { Authorization: "Bearer sai_sk_your_key_here" } },
);import requests
requests.post(
"https://www.sprite-ai.art/api/combines/" + job_id + "/cancel",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
){ "id": "a1b2c3d4-...", "status": "cancelled" }POST/api/touch-ups
Repair one part of a sprite you own and leave every other pixel alone. Give it a region and a sentence, and the selected area is redrawn in the sprite's own colors while everything outside it comes back byte-identical. The result is saved as a new sprite id you can animate, rotate or restyle. Synchronous, about 15 to 30 seconds. Cost: 1 token.
This repairs a detail. It is not an item-swap tool: asked to change a weapon it drew the new one once in four tries, while POST /api/restyles with the item preset did it every time. Use touch-ups for eyes, a face, a hand, a dent in a helmet. The sprite comes back at its original size, and the price is the same whether it is 64px or 512px.
| Field | Type | Required | Description |
|---|---|---|---|
source_generation_id | string (uuid) | Yes | UUID of a still sprite you own, 32-1024px per side. |
prompt | string | Yes | What to fix, e.g. "glowing red eyes in the visor". Accepts 1 to 300 characters. |
region | object | Yes | The area to repair, in sprite pixels, with the origin at the top left. |
region.x | integer | Yes | Left edge. Accepts 0 to 4096. |
region.y | integer | Yes | Top edge. Accepts 0 to 4096. |
region.width | integer | Yes | Width. Accepts 1 to 4096. |
region.height | integer | Yes | Height. Accepts 1 to 4096. |
public | boolean | No | Opt the result into the public gallery. Default false. |
The region is clipped to the sprite, and the clipped box is echoed back in the response so you can draw it over the result. Roughly 200x200 pixels is the ceiling on the region, whatever the sprite's own size: a window is cropped around it and composited back, so a large sprite is fine but a large region is refused. To change a whole sprite, use POST /api/restyles.
curl https://www.sprite-ai.art/api/touch-ups \
-H "Authorization: Bearer sai_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"source_generation_id": "a1b2c3d4-...",
"prompt": "glowing red eyes in the visor",
"region": { "x": 32, "y": 10, "width": 12, "height": 11 }
}'const res = await fetch("https://www.sprite-ai.art/api/touch-ups", {
method: "POST",
headers: {
Authorization: "Bearer sai_sk_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
source_generation_id: spriteId,
prompt: "glowing red eyes in the visor",
region: { x: 32, y: 10, width: 12, height: 11 },
}),
});
const fixed = await res.json(); // completed inline, no polling
// fixed.id is a new sprite; fixed.region is what was actually repairedimport base64, requests
fixed = requests.post(
"https://www.sprite-ai.art/api/touch-ups",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
json={
"source_generation_id": sprite_id,
"prompt": "glowing red eyes in the visor",
"region": {"x": 32, "y": 10, "width": 12, "height": 11},
},
).json()
with open("sprite_fixed.png", "wb") as f:
f.write(base64.b64decode(fixed["image"]["pngBase64"])){
"id": "f7a8b9c0-...",
"status": "completed",
"width": 64,
"height": 64,
"region": { "x": 32, "y": 10, "width": 12, "height": 11 },
"isPublic": false,
"slug": null,
"image": { "format": "png", "pngBase64": "iVBORw0KGgoAAAANS..." }
}POST/api/rotations
Turn one still sprite you own into a full 8-direction set: S, SE, E, NE, N, NW, W, SW, same character and same palette. Returns a horizontal strip of 8 equal frames in that spin order plus a fidelity score: the sheet is calibrated against the source and a low-scoring roll is redone automatically. Synchronous: one request, the finished strip inline, about a minute and up to 2.5 minutes when the quality gate forces a second roll. Cost: 12 tokens.
The source must be a still sprite, 32-256px per side, not an animation. The result is saved as an animation row, so GET /api/sprites/{id} and the download URL treat the strip like a spritesheet. Slice it every frameWidth pixels for the individual directions.
| Field | Type | Required | Description |
|---|---|---|---|
source_generation_id | string (uuid) | Yes | UUID of a still sprite you own, 32-256px per side. |
public | boolean | No | Opt the set into the public gallery. Default false. |
curl https://www.sprite-ai.art/api/rotations \
-H "Authorization: Bearer sai_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "source_generation_id": "a1b2c3d4-..." }'const res = await fetch("https://www.sprite-ai.art/api/rotations", {
method: "POST",
headers: {
Authorization: "Bearer sai_sk_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({ source_generation_id: spriteId }), // a still, 32-256px
});
const set = await res.json(); // completed inline, ~1-2 minutes
// set.directions lists the 8 frames left to right: s, se, e, ne, n, nw, w, swimport base64, requests
rotation = requests.post(
"https://www.sprite-ai.art/api/rotations",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
json={"source_generation_id": sprite_id},
).json()
with open("knight_8dir.png", "wb") as f:
f.write(base64.b64decode(rotation["image"]["spritesheetBase64"])){
"id": "c9d0e1f2-...",
"status": "completed",
"frameWidth": 64,
"frameHeight": 64,
"frameCount": 8,
"fps": 6,
"directions": ["s", "se", "e", "ne", "n", "nw", "w", "sw"],
"calibrationScore": 0.94,
"isPublic": false,
"image": { "format": "png", "spritesheetBase64": "iVBORw0KGgoAAAANS..." }
}POST/api/normal-maps
Generate a tangent-space normal map for a sprite or animation you own, for dynamic lighting in a game engine. Our own model, trained on real 3D geometry rather than edge-detect heuristics: the output encodes the subject's actual form, and its alpha channel is a pixel-exact copy of the source silhouette. Synchronous: the finished PNG comes back inline in a few seconds, no job to poll. Cost: 1 token per frame.
An animation source is normal-mapped per frame automatically (the model is deterministic, so frames never flicker) and comes back as the same-layout horizontal strip. Load it in your engine exactly like the animation itself.
| Field | Type | Required | Description |
|---|---|---|---|
source_generation_id | string (uuid) | Yes | UUID of a sprite or animation you own. Frames must be 32-256px per side. |
strength | number | No | Detail injection. 0 is truest to the geometry. Around 2.5 re-adds the sprite's drawn shading for a hand-crafted look. Accepts 0 to 5. Default 0. |
flip_green | boolean | No | Flip green for DirectX and +Y-down engines (Unreal). false is OpenGL and +Y-up (Godot, Unity, WebGL). Default false. |
columns | integer | No | Only for a still that is really a sprite sheet, its column count. Ignored for animations, whose layout is known. columns x rows is at most 24. Accepts 1 to 24. Default 1. |
rows | integer | No | The sheet's row count, with columns. Accepts 1 to 24. Default 1. |
curl https://www.sprite-ai.art/api/normal-maps \
-H "Authorization: Bearer sai_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "source_generation_id": "a1b2c3d4-..." }'const res = await fetch("https://www.sprite-ai.art/api/normal-maps", {
method: "POST",
headers: {
Authorization: "Bearer sai_sk_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
source_generation_id: spriteId, // a sprite OR an animation
}),
});
const map = await res.json(); // completed inline, no polling
// convention most engines auto-detect: save as <sprite-name>_n.pngimport base64, requests
map = requests.post(
"https://www.sprite-ai.art/api/normal-maps",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
json={"source_generation_id": sprite_id},
).json()
with open("sprite_n.png", "wb") as f:
f.write(base64.b64decode(map["image"]["pngBase64"])){
"id": "e5f6a7b8-...",
"status": "completed",
"width": 64,
"height": 64,
"frameCount": 1,
"tokensSpent": 1,
"image": { "format": "png", "pngBase64": "iVBORw0KGgoAAAANS..." }
}POST/api/background-removals
Remove a flat, single-color background from a sprite or animation you own and get back a transparent PNG, saved as a new sprite id you can animate, restyle or normal-map. It takes up to 400px per side, per frame for an animation. Two methods, the same two the studio's Remove background tool runs: standard is a chroma key and is free, refined is palette matting against the sprite's own colors and costs 1 token. Refined gives the cleaner edge on AI-generated pixel art. The background color is sampled from the four corners unless you pass matte_color. Synchronous, well under a second.
Sprites generated here already have transparent backgrounds. This endpoint is for imported screenshots and renders on a flat color, and a source whose corners are already transparent is refused. An animation is keyed as one strip and comes back as an animation. Cutouts are always private.
| Field | Type | Required | Description |
|---|---|---|---|
source_generation_id | string (uuid) | Yes | UUID of a sprite or animation you own. |
method | string | No | standard is a free chroma key. refined is palette matting and costs 1 token. Accepts standard, refined. Default standard. |
matte_color | string | No | Background color to remove, as #rrggbb. Omitted, it's sampled from the corners. Must match ^#?[0-9a-fA-F]{6}$. |
tolerance | integer | No | standard only. How far from the background color a pixel may be and still be removed. Accepts 0 to 300. Default 200. |
palette_size | integer | No | refined only. Cap on the sprite colors used for matting. Accepts 16 to 256. Default 64. |
alpha_threshold | number | No | refined only. Coverage above which an edge pixel stays opaque. Accepts 0.3 to 0.9. Default 0.7. |
curl https://www.sprite-ai.art/api/background-removals \
-H "Authorization: Bearer sai_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "source_generation_id": "a1b2c3d4-...", "method": "refined" }'const res = await fetch("https://www.sprite-ai.art/api/background-removals", {
method: "POST",
headers: {
Authorization: "Bearer sai_sk_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
source_generation_id: spriteId, // an imported screenshot or render
method: "refined", // omit for the free standard method
}),
});
const cutout = await res.json(); // completed inline, no polling
// cutout.id is a new sprite: animate or restyle it like any otherimport base64, requests
cutout = requests.post(
"https://www.sprite-ai.art/api/background-removals",
headers={"Authorization": "Bearer sai_sk_your_key_here"},
json={"source_generation_id": sprite_id, "method": "refined"},
).json()
with open("sprite_cutout.png", "wb") as f:
f.write(base64.b64decode(cutout["image"]["pngBase64"])){
"id": "f7a8b9c0-...",
"status": "completed",
"method": "refined",
"width": 64,
"height": 64,
"frameCount": null,
"matteColor": "#ff00ff",
"tokensSpent": 1,
"image": { "format": "png", "pngBase64": "iVBORw0KGgoAAAANS..." }
}Retries and Idempotency-Key
Every POST that can charge takes an optional Idempotency-Key header, so a request you send again after a dropped connection never makes or charges a second sprite. That's POST /api/sprites, /api/animations, /api/restyles, /api/combines, /api/touch-ups, /api/rotations, /api/normal-maps and /api/background-removals. Use a fresh key, such as a UUID, for each new request, and send the same key with the same body when you retry.
curl https://www.sprite-ai.art/api/sprites \
-H "Authorization: Bearer sai_sk_your_key_here" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 3f1c6a52-8d4e-4c1b-9f0a-2b7e5d9c4a10" \
-d '{ "prompt": "a knight with a blue cape", "asset_type": "character" }'- The same key and the same body within 24 hours get the first answer back, and nothing runs again.
- A resend while the first request is still running answers
409withcode: "idempotency_key_in_use"and aRetry-Afterheader. Send it again after that many seconds. - The same key with a different body answers
422withcode: "idempotency_key_reused". A new request needs a new key. - A key must be 1 to 255 visible characters with no spaces. Anything else answers
400withcode: "invalid_idempotency_key". - A request that failed and charged nothing frees its key, so a retry with it runs again.
- Keys belong to your account, whichever API key sends them.
A request with no header runs every time it's sent.
Errors
Every error returns the same JSON shape. Branch on code, not message.
{ "code": "invalid_request", "message": "...", "details": {} }| HTTP | Code | When |
|---|---|---|
400 | invalid_json | The body is not valid JSON. |
400 | invalid_request | The body failed validation (details.issues lists each problem), or a source sprite is missing, not yours, not ready or the wrong size. |
400 | invalid_palette | The palette could not be saved. |
400 | run_not_approvable | The agent run is not waiting for approval. |
400 | run_not_cancellable | The agent run can no longer be cancelled. |
400 | invalid_idempotency_key | The Idempotency-Key is empty, too long or has spaces. |
401 | missing_api_key | No Authorization header. |
401 | invalid_api_key | The key is not recognized. |
401 | unauthorized | An agent route got neither a key nor a signed-in session. |
402 | insufficient_tokens | Not enough tokens. Nothing ran. |
402 | limit_reached | Reserved for a plan limit. No route sends it today. |
402 | upgrade_required | Reserved for a tool that needs a higher plan, named in details.required_plan. No tool needs one today. |
403 | api_key_revoked | The key was revoked. |
403 | api_key_expired | The key has expired. |
404 | not_found | No such sprite or job, or it isn't yours. |
409 | idempotency_key_in_use | A request with this Idempotency-Key is still running. Send it again after Retry-After seconds. |
409 | job_finished | The job already completed or failed, so there is nothing to cancel. |
422 | content_policy | The prompt was refused by the content filter or the provider. No tokens were spent. |
422 | feature_unavailable | The ask belongs to another tool, such as an animation typed into POST /api/sprites. The message names the tool. |
422 | plan_failed | The agent could not plan the prompt, or the plan costs more than cap. |
422 | idempotency_key_reused | This Idempotency-Key came with a different body before. |
429 | rate_limited | Too many requests. Wait Retry-After seconds. |
500 | internal_error | Something unexpected went wrong. Try again. |
502 | provider_failure | The render failed. Tokens are refunded. |
503 | service_unavailable | Generation is paused. Try again after Retry-After seconds. |
504 | provider_timeout | The render ran out of time. On POST /api/sprites, the sprite is still being made and details.id names it. |
Asset packs
One prompt can plan a whole pack: the anchor sprite, its facing directions, an animation per direction, restyles and lighting maps, priced step by step and run only after you approve the total. The four endpoints (POST /api/agent, POST /api/agent/{id}/run, GET /api/agent/{id}, POST /api/agent/{id}/cancel) are on the Sprite Agent page.
Last updated October 22, 2026