DOC 10APIs and capabilities
Seedream 5.5 Image Guide
Generate images with Seedream 5.5: a first image in one command, then sizes and ratios, reference images, transparent backgrounds, layer splitting and billing.
Seedream 5.5 is ByteDance’s image model. On spiderai it is served by the Seedream Images group and billed per image. Start with one command for a first image, then see how to set sizes, pass reference images, get a transparent background and split a picture into layers.
Before you start
- Open API Keys and create a key in the Seedream Images group. Keys from other groups cannot call this model.
- The model name is
seedream-5-5. Send it with every request. - The endpoint is
https://api.spiderai.fun. Send the headerAuthorization: Bearer <your key>.
| Entry | Path | When to use it |
|---|---|---|
| General | POST /v1/images/generations | Use this in most cases: sizes can be given as a ratio, reference images are passed as links, and ready-made image tools take this address too. |
| Upload local files | POST /v1/images/edits | When the reference image is a file on your machine, upload it as a form. |
| Asynchronous | POST /v1/images/generations/async | For slow requests: returns a task ID at once, the result is fetched later. |
| Volcengine Ark native | POST /api/v3/images/generations | Same parameters and response as the official Volcengine Ark documentation: with existing official code, change only the address and the key. |
Your first image
Replace YOUR_API_KEY with your key. One image usually takes about 10 seconds; set the client timeout to 180 seconds.
curl https://api.spiderai.fun/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-5",
"prompt": "An orange cat sunbathing on a windowsill, film grain, warm tones",
"size": "1920x1080"
}'import json, urllib.request
API_KEY = "YOUR_API_KEY"
body = {
"model": "seedream-5-5",
"prompt": "An orange cat sunbathing on a windowsill, film grain, warm tones",
"size": "1920x1080",
}
req = urllib.request.Request(
"https://api.spiderai.fun/v1/images/generations",
data=json.dumps(body).encode("utf-8"),
headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
)
with urllib.request.urlopen(req, timeout=180) as resp:
result = json.load(resp)
image = result["data"][0]
print(image["size"], result["usage"])
urllib.request.urlretrieve(image["url"], "seedream.png") # the link is temporary: save the file right away
print("saved seedream.png")import { writeFile } from "node:fs/promises";
const API_KEY = "YOUR_API_KEY";
const res = await fetch("https://api.spiderai.fun/v1/images/generations", {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
model: "seedream-5-5",
prompt: "An orange cat sunbathing on a windowsill, film grain, warm tones",
size: "1920x1080",
}),
signal: AbortSignal.timeout(180_000),
});
const result = await res.json();
if (!res.ok) throw new Error(JSON.stringify(result));
const image = result.data[0];
console.log(image.size, result.usage);
// the link is temporary: save the file right away
await writeFile("seedream.png", Buffer.from(await (await fetch(image.url)).arrayBuffer()));
console.log("saved seedream.png");In the response, data[0].url is the picture, data[0].size is the actual width × height, and usage holds the counts this request is billed for:
{
"model": "doubao-seedream-5-5-261028",
"created": 1796042673,
"data": [
{ "url": "https://…/….png?…", "size": "1920x1080", "output_format": "png", "background": "opaque" }
],
"usage": { "input_images": 0, "generated_images": 1, "output_tokens": 8100, "total_tokens": 8100 }
}Choosing a size
- Exact pixels:
"size": "1920x1080". Width × height must be between 921,600 and 8,294,400 pixels, with an aspect ratio of at most 16:1. - A ratio plus a tier (general entry):
"size": "16:9"with"resolution": "1.5K"is turned into the pixels in the table below; withoutresolutionthe 2K column applies. - No
size: the image is 2048×2048.
| Ratio | 1K | 1.5K | 2K | 3K |
|---|---|---|---|---|
| 1:1 | 1024x1024 | 1536x1536 | 2048x2048 | 2880x2880 |
| 16:9 | 1280x720 | 1920x1080 | 2560x1440 | 3840x2160 |
| 9:16 | 720x1280 | 1080x1920 | 1440x2560 | 2160x3840 |
| 4:3 | 1152x864 | 1728x1296 | 2304x1728 | 3200x2400 |
| 3:4 | 864x1152 | 1296x1728 | 1728x2304 | 2400x3200 |
| 3:2 | 1248x832 | 1920x1280 | 2496x1664 | 3456x2304 |
| 2:3 | 832x1248 | 1280x1920 | 1664x2496 | 2304x3456 |
| 21:9 | 1512x648 | 2268x972 | 3024x1296 | 4200x1800 |
| 2:1 | 1440x720 | 2048x1024 | 2880x1440 | 4000x2000 |
| 1:2 | 720x1440 | 1024x2048 | 1440x2880 | 2000x4000 |
The price depends only on which tier the actual pixels of the output fall into, not on how you wrote the size. Under Image models on Pricing you can pick a ratio and a tier and read the size to send and the price of that image.
Reference images
A request can carry up to 10 reference images, to edit a picture or to blend several into one. Reference images are billed per image on top of the output.
import json, urllib.request
API_KEY = "YOUR_API_KEY"
body = {
"model": "seedream-5-5",
"prompt": "Replace the background of image 1 with the pattern from image 2 and keep the subject unchanged",
"image": ["https://spiderai.fun/og.png", "https://spiderai.fun/logo.png"], # 1 to 10 pictures; their order is image 1, image 2 …
"size": "16:9",
"resolution": "1.5K",
}
req = urllib.request.Request(
"https://api.spiderai.fun/v1/images/generations",
data=json.dumps(body).encode("utf-8"),
headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
)
with urllib.request.urlopen(req, timeout=180) as resp:
result = json.load(resp)
print(result["data"][0]["url"])
print(result["usage"]) # input_images = the reference images billed for this requestconst API_KEY = "YOUR_API_KEY";
const res = await fetch("https://api.spiderai.fun/v1/images/generations", {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
model: "seedream-5-5",
prompt: "Replace the background of image 1 with the pattern from image 2 and keep the subject unchanged",
image: ["https://spiderai.fun/og.png", "https://spiderai.fun/logo.png"], // 1 to 10 pictures; their order is image 1, image 2 …
size: "16:9",
resolution: "1.5K",
}),
signal: AbortSignal.timeout(180_000),
});
const result = await res.json();
if (!res.ok) throw new Error(JSON.stringify(result));
console.log(result.data[0].url);
console.log(result.usage); // input_images = the reference images billed for this requestcurl https://api.spiderai.fun/v1/images/edits \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=seedream-5-5" \
-F "prompt=Change the background to light blue and keep the subject and text unchanged" \
-F "size=1K" \
-F "image=@photo.png"import { readFile } from "node:fs/promises";
const API_KEY = "YOUR_API_KEY";
const form = new FormData();
form.append("model", "seedream-5-5");
form.append("prompt", "Change the background to light blue and keep the subject and text unchanged");
form.append("size", "1K");
form.append("image", new Blob([await readFile("photo.png")], { type: "image/png" }), "photo.png");
const res = await fetch("https://api.spiderai.fun/v1/images/edits", {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}` },
body: form,
signal: AbortSignal.timeout(180_000),
});
const result = await res.json();
if (!res.ok) throw new Error(JSON.stringify(result));
console.log(result.data[0].url);For several pictures, repeat the image field. Use PNG or JPEG files.
Transparent background
Add "background": "transparent" and "output_format": "png" to get a PNG with an alpha channel directly, with no cut-out step.
curl https://api.spiderai.fun/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-5",
"prompt": "A glassy blue fox badge with a thin white outline, a single isolated subject",
"size": "1024x1024",
"background": "transparent",
"output_format": "png"
}'Layer splitting
Send one poster or design, switch on layer_decomposition, and you get back a base image with the gaps filled in plus several transparent layers, each with a name, a description and a position.
curl https://api.spiderai.fun/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-5",
"image": "https://spiderai.fun/og.png",
"layer_decomposition": true,
"layer_decomposition_options": { "max_images": 4 }
}'- Billed per returned image: the base image and every layer count as one image each, plus one reference image.
max_images(2 to 100, default 30) caps how many are returned, and with it the cost. - Exactly one input image;
sizemust be omitted or one of1K,1.5K,2K;backgroundcannot be used at the same time. - A layer’s position is in
bounding_box.absolute: left, top, right and bottom in pixels, ready for placing the layer back on the base image.
Asynchronous requests
Slow requests such as layer splitting can be sent asynchronously: you get a task ID at once and fetch the result with it a little later, without keeping the connection open. The body is the same as for the synchronous endpoint; only the address ends in /async.
curl https://api.spiderai.fun/v1/images/generations/async \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-5",
"image": "https://spiderai.fun/og.png",
"layer_decomposition": true,
"layer_decomposition_options": { "max_images": 4 }
}'The reply comes back immediately with HTTP 202 and a task_id:
{
"object": "image.generation.task",
"task_id": "imgtask_d0049e2bb7364a4baa70d0e71ac42fcb",
"status": "processing",
"poll_url": "/v1/images/tasks/imgtask_d0049e2bb7364a4baa70d0e71ac42fcb",
"created_at": 1796046134,
"expires_at": 1796132534
}Then ask for the result with the same key (the reply below shows only the first two images):
curl https://api.spiderai.fun/v1/images/tasks/imgtask_d0049e2bb7364a4baa70d0e71ac42fcb \
-H "Authorization: Bearer YOUR_API_KEY"{
"object": "image.generation.task",
"task_id": "imgtask_d0049e2bb7364a4baa70d0e71ac42fcb",
"status": "completed",
"http_status": 200,
"image_url": "https://…/….png?…",
"result": {
"model": "doubao-seedream-5-5-261028",
"data": [
{ "url": "https://…/….png?…", "size": "1413x742", "z_index": 0, "background": "opaque" },
{ "url": "https://…/….png?…", "size": "1033x1015", "z_index": 1, "background": "transparent", "name": "…",
"bounding_box": { "absolute": [101, 165, 513, 570], "normalized": [71, 222, 363, 768] } }
],
"usage": { "input_images": 1, "generated_images": 4 }
},
"created_at": 1796046134,
"completed_at": 1796046152,
"expires_at": 1796132552
}- While
statusisprocessing, ask again every 3 seconds or so. When it iscompleted,resultholds the same response as the synchronous endpoint.failedmeans the request failed, and a failed task is not billed. - Use the key that submitted the task; other keys cannot see it.
- Results are kept for 24 hours.
- To upload local files asynchronously, use
POST /v1/images/edits/async. - Asynchronous and synchronous requests cost the same. GPT and Grok image models can be submitted this way too.
If you already have Volcengine Ark code
The native entry does not rewrite parameters: write the body as in the official documentation, and change the address and the key to spiderai’s. On this entry size is exact pixels, or 1K, 1.5K or 2K.
curl https://api.spiderai.fun/api/v3/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-5",
"prompt": "An orange cat sunbathing on a windowsill, film grain, warm tones",
"size": "2K"
}'Billing
- Output images are billed per image; the price depends on which tier the width × height falls into (1K, 1.5K, 2K, 3K).
- Reference images are billed per image, for as many as you send.
- Prompts are not billed separately.
- Per-tier prices are under Image models on Pricing.
Common errors
| Message | Cause and fix |
|---|---|
No available Seedream accounts | model is missing, or it is not seedream-5-5. |
… only supported for seedream groups | The native entry was called with a key from another group. Use a key from the Seedream Images group. |
… requires total pixels within [921600, 8294400] | The size is too small or too large; pick one from the table above. |
… does not support n > 1 … | One request returns one image; send several requests for several images. |
… cannot combine background=transparent with output_format=jpeg | A transparent background needs PNG. |
… layer_decomposition=true requires exactly 1 input image | Layer splitting takes exactly one input image. |
image task not found | The task ID is wrong, older than 24 hours, or the key is not the one that submitted the task. |
For general errors such as insufficient balance or an invalid key, see Troubleshooting.