API reference

Generate sprites and animations from your own tools and scripts.

GET/api/me

Your account: plan, balance, and rate limit.

curl https://sprite-ai.art/api/me \
-H "Authorization: Bearer sai_sk_your_key_here"
200 OK
{
"user_id": "...",
"email": "you@example.com",
"plan": "studio",
"rate_limit_per_minute": 60,
"monthly_token_allotment": 1000,
"monthly_tokens_used": 340,
"purchased_token_balance": 0,
"total_token_balance": 660,
"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://sprite-ai.art/api/balance \
-H "Authorization: Bearer sai_sk_your_key_here"
200 OK
{
"plan": "studio",
"total_token_balance": 660,
"purchased_token_balance": 0,
"monthly_token_allotment": 1000,
"monthly_tokens_used": 340,
"monthly_renews_at": "2026-07-01T00:00:00.000Z",
"billing_period": "monthly"
}

GET/api/asset-types

Asset types with their token cost and size range.

curl https://sprite-ai.art/api/asset-types \
-H "Authorization: Bearer sai_sk_your_key_here"
TypeToken costSize
character132–400 px
item132–400 px
creature132–400 px
tile48–512 px
background48–512 px
ui48–512 px
effect48–512 px

GET/api/limits

Request bounds and token costs for your key.

curl https://sprite-ai.art/api/limits \
-H "Authorization: Bearer sai_sk_your_key_here"
200 OK
{
"rate_limit_per_minute": 60,
"sprite": { "min_size": 8, "max_size": 512, "prompt_max_length": 1500 },
"animation": { "min_frames": 4, "max_frames": 24, "frames_must_be_even": true }
}

POST/api/sprites

Generate a still sprite. Synchronous — the PNG comes back inline. Costs 1 token (4 for tile, background, ui, effect).

FieldTypeRequiredDescription
promptstringYesWhat to draw. 3–1500 chars.
asset_typestringNoInferred from the prompt when omitted.
widthintegerNo8–512 px. Default 64.
heightintegerNo8–512 px. Default 64.
directionstringNoFacing direction, e.g. south.
camera_perspectivestringNoe.g. side, top_down, isometric.
publicbooleanNoAdd to the public gallery. Default false.
referenceobjectNoStyle reference: { base64, mime }.
curl https://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" }'
201 Created
{
"id": "a1b2c3d4-...",
"status": "completed",
"width": 64,
"height": 64,
"assetType": "character",
"tokensSpent": 1,
"image": { "format": "png", "pngBase64": "iVBORw0KGgoAAAANS..." }
}

The PNG is inline in image.pngBase64 — there is no hosted URL.

GET/api/sprites/{id}

Fetch one of your past sprites.

curl https://sprite-ai.art/api/sprites/a1b2c3d4-... \
-H "Authorization: Bearer sai_sk_your_key_here"

GET/api/sprites

List your sprites and animations, newest first.

ParameterTypeDescription
limitinteger1–100. Default 20.
offsetintegerFor pagination. Default 0.
statusstringFilter by status.
asset_typestringFilter by type, e.g. animation.
curl "https://sprite-ai.art/api/sprites?limit=20" \
-H "Authorization: Bearer sai_sk_your_key_here"

POST/api/animations

Start an animation job from a source sprite. Asynchronous — returns an id immediately, then you poll until it finishes (~90s). The token cost scales with frame_count.

The source must be a single sprite, no larger than 256px on either side. Pass one frame, not a sprite sheet. Anything larger returns 422 invalid_request.

FieldTypeRequiredDescription
source_image_base64stringYesThe sprite to animate, PNG base64 (no data: prefix).
presetstringYesMotion preset (Walk, Run, Idle, ...) or Custom.
frame_countintegerNoEven, 4–24. Default 8. Drives the token cost.
custom_promptstringCustom onlyFree-form motion. Required when preset is Custom.
source_generation_idstringNoUUID of a prior sprite, for lineage + better matching.
publicbooleanNoAdd to the public gallery. Default false.

The Custom preset requires a paid (Creator or higher) plan. On a free plan it returns 402 with code upgrade_required. Built-in presets work on any plan.

curl https://sprite-ai.art/api/animations \
-H "Authorization: Bearer sai_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "source_image_base64": "<png base64>", "preset": "Walk", "frame_count": 8 }'
202 Accepted
{ "id": "a1b2c3d4-...", "status": "processing" }

GET/api/animations/{id}

Poll an animation job. While running it returns processing with an optional progress (0–1). When status is completed, the sheet is in image.spritesheetBase64. On failed, tokens are refunded automatically. Poll about every 5 seconds.

# poll every ~5s until status is completed or failed
curl https://sprite-ai.art/api/animations/a1b2c3d4-... \
-H "Authorization: Bearer sai_sk_your_key_here"
200 OK — completed
{
"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. If the job already completed or failed, it returns an error since there is nothing to cancel.

curl -X POST https://sprite-ai.art/api/animations/a1b2c3d4-.../cancel \
-H "Authorization: Bearer sai_sk_your_key_here"
200 OK
{ "id": "a1b2c3d4-...", "status": "cancelled" }

Errors

Every error returns the same JSON shape. Branch on code, not message.

{ "code": "invalid_request", "message": "...", "details": {} }
HTTPCodeCause
400invalid_requestBody failed validation.
401invalid_api_keyKey missing or not recognized.
402insufficient_tokensNot enough tokens.
402upgrade_requiredNeeds a paid plan.
403api_key_revokedThe key was revoked.
404not_foundNot found, or not yours.
422nsfw_promptPrompt rejected by the filter.
429rate_limitedToo many requests.
500provider_failureRender failed. Tokens refunded.

We use cookies to enhance your experience. Essential cookies are required for the site to function. You can choose to accept all cookies or only essential ones.

Learn more