Introduction
What the Sprite AI API does, what you can build with it, and how to generate your first game-ready pixel art sprite in three quick steps.
The Sprite AI API turns text prompts into game-ready sprites and sprite-sheet animations. Use it from a script, a build step, an MCP server, or an editor plugin.
Requests are JSON, authenticated with a Bearer key. Generated images come back inline as base64, so there's no file to download separately.
What you can do
| Action | Endpoint |
|---|---|
Generate a still sprite | POST /api/sprites |
Add a sprite you already have | POST /api/sprites/import |
Animate a sprite into a sheet | POST /api/animations |
Check your balance and limits | GET /api/balance, /api/limits |
Generate or import once and you get a sprite id. Animating a sprite (source_generation_id) and style-matching a new one to it (reference_asset_id) both take that id, so you never resend image bytes. To use a local file, import it first.
1. Create a key
Open the API keys tab and generate one. It starts with sai_sk_ and is shown once, so copy it now.
2. Send a request
POST a prompt and an asset type with your key as a Bearer token.
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();import 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()3. Save the image
The PNG is in image.pngBase64. Decode it and write it to a file.
echo "iVBORw0KGgoAAAANS..." | base64 -d > knight.pngimport { writeFile } from "fs/promises";
await writeFile("knight.png", Buffer.from(data.image.pngBase64, "base64"));with open("knight.png", "wb") as f:
f.write(base64.b64decode(data["image"]["pngBase64"]))Sync vs async
Still sprites are synchronous: one request, the finished image in the response. Animations take about 90 seconds, so they run as a job you start and then poll until it's done.
You don't pick a model. Describe what you want, and the request is routed for you based on the asset type and size.
Generating from your AI editor instead? The MCP server handles all of this for you. For the full HTTP surface, see the API reference; for key details and rate limits, see Authentication.