Top.Mail.Ru
General icon
General
Галерея icon
Галерея
Unitool Labs icon
Unitool Labs
Блог icon
Блог
MCP icon
MCP
← All models

Seedream

seedream · Images · unitool

Seedream — модели генерации изображений от ByteDance (text-to-image и редактирование/image-to-image), версии 4.5 и 5.0 Lite, качество до 4K.

Generations are async: create, wait or poll, the result by link for 7 days. Details: Media generations

Seedream 4.5

Mode seedream-4-5 · seedream:seedream-4-5

Price

Depends on the parameters: 5 tokens for the example below, base 5. Get the exact price of your request from POST /v1/quotes.

Price make-up (pricing from GET /v1/models/{id})
JSON
{
  "unit": "tokens",
  "kind": "by_parameters",
  "base": 5,
  "example_price": 5
}

Parameters

ParameterTypeDescription
promptrequiredstring
aspect_ratio1:1 | 4:3 | 3:4 | 16:9 | 9:16 | 2:3 | 3:2 | 21:9Соотношение сторон. Соотношение сторон изображенияDefault "1:1"
qualitybasic | highКачествоDefault "basic"
image_urlsarray of file (≤ 14)A file_ref (asset:… or attachment:…), an https URL or a data: URL.

Example request

curl
curl https://api.unitool.ai/v1/generations \
  -H "Authorization: Bearer $UNITOOL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Prefer: wait=60" \
  -d '{
  "model": "seedream",
  "mode": "seedream-4-5",
  "input": {
    "prompt": "A red fox running through fresh snow at sunrise",
    "aspect_ratio": "1:1",
    "quality": "basic"
  }
}'
Python (requests)
import json, os, time, uuid, requests

API = "https://api.unitool.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['UNITOOL_API_KEY']}"}
body = json.loads(r'''{
  "model": "seedream",
  "mode": "seedream-4-5",
  "input": {
    "prompt": "A red fox running through fresh snow at sunrise",
    "aspect_ratio": "1:1",
    "quality": "basic"
  }
}''')
gen = requests.post(f"{API}/generations", json=body,
                    headers={**headers, "Idempotency-Key": str(uuid.uuid4()), "Prefer": "wait=60"}).json()
while gen["status"] in ("queued", "running"):
    time.sleep(5)
    gen = requests.get(f"{API}/generations/{gen['id']}", headers=headers).json()
print(gen["status"], [o["url"] for o in gen["outputs"]])
JavaScript (fetch)
const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
  "model": "seedream",
  "mode": "seedream-4-5",
  "input": {
    "prompt": "A red fox running through fresh snow at sunrise",
    "aspect_ratio": "1:1",
    "quality": "basic"
  }
};
let gen = await (await fetch(`${API}/generations`, {
  method: "POST", body: JSON.stringify(body),
  headers: { ...headers, "Idempotency-Key": crypto.randomUUID(), Prefer: "wait=60" },
})).json();
while (gen.status === "queued" || gen.status === "running") {
  await new Promise((resolve) => setTimeout(resolve, 5000));
  gen = await (await fetch(`${API}/generations/${gen.id}`, { headers })).json();
}
console.log(gen.status, gen.outputs.map((output) => output.url));

Seedream 5.0 Lite

Mode seedream-5-lite · seedream:seedream-5-lite

Price

Depends on the parameters: 4 tokens for the example below, base 4. Get the exact price of your request from POST /v1/quotes.

Price make-up (pricing from GET /v1/models/{id})
JSON
{
  "unit": "tokens",
  "kind": "by_parameters",
  "base": 4,
  "example_price": 4
}

Parameters

ParameterTypeDescription
promptrequiredstring
aspect_ratio1:1 | 4:3 | 3:4 | 16:9 | 9:16 | 2:3 | 3:2 | 21:9Соотношение сторон. Соотношение сторон изображенияDefault "1:1"
qualitybasic | highКачествоDefault "basic"
image_urlsarray of file (≤ 14)A file_ref (asset:… or attachment:…), an https URL or a data: URL.

Example request

curl
curl https://api.unitool.ai/v1/generations \
  -H "Authorization: Bearer $UNITOOL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Prefer: wait=60" \
  -d '{
  "model": "seedream",
  "mode": "seedream-5-lite",
  "input": {
    "prompt": "A red fox running through fresh snow at sunrise",
    "aspect_ratio": "1:1",
    "quality": "basic"
  }
}'
Python (requests)
import json, os, time, uuid, requests

API = "https://api.unitool.ai/v1"
headers = {"Authorization": f"Bearer {os.environ['UNITOOL_API_KEY']}"}
body = json.loads(r'''{
  "model": "seedream",
  "mode": "seedream-5-lite",
  "input": {
    "prompt": "A red fox running through fresh snow at sunrise",
    "aspect_ratio": "1:1",
    "quality": "basic"
  }
}''')
gen = requests.post(f"{API}/generations", json=body,
                    headers={**headers, "Idempotency-Key": str(uuid.uuid4()), "Prefer": "wait=60"}).json()
while gen["status"] in ("queued", "running"):
    time.sleep(5)
    gen = requests.get(f"{API}/generations/{gen['id']}", headers=headers).json()
print(gen["status"], [o["url"] for o in gen["outputs"]])
JavaScript (fetch)
const API = "https://api.unitool.ai/v1";
const headers = { Authorization: `Bearer ${process.env.UNITOOL_API_KEY}`, "Content-Type": "application/json" };
const body = {
  "model": "seedream",
  "mode": "seedream-5-lite",
  "input": {
    "prompt": "A red fox running through fresh snow at sunrise",
    "aspect_ratio": "1:1",
    "quality": "basic"
  }
};
let gen = await (await fetch(`${API}/generations`, {
  method: "POST", body: JSON.stringify(body),
  headers: { ...headers, "Idempotency-Key": crypto.randomUUID(), Prefer: "wait=60" },
})).json();
while (gen.status === "queued" || gen.status === "running") {
  await new Promise((resolve) => setTimeout(resolve, 5000));
  gen = await (await fetch(`${API}/generations/${gen.id}`, { headers })).json();
}
console.log(gen.status, gen.outputs.map((output) => output.url));

We use cookies

By continuing to use the site you agree to our Privacy Policy.