APIMart
APIMart

How to Use Seedream 5.0 Pro to Generate Images

A step-by-step guide to calling Seedream 5.0 Pro on APIMart: authentication, request fields, task polling, reading results and saving images before links expire.

Tutorial

You can get Seedream 5.0 Pro working with one POST request, one API key, and one follow-up step: submit the job, get a task_id, then check the task until the image is ready. Seedream 5.0 Pro is asynchronous, so the image never comes back in the first response.

Here’s the short version:

  • I send requests to https://api.apimart.ai/v1/images/generations
  • I add Authorization: Bearer YOUR_API_KEY
  • I set model to seedream-5-0-pro
  • I include prompt, plus resolution (1K, 1.5K or 2K) and size (auto or an aspect ratio such as 16:9)
  • I add up to 10 reference images in image_urls when I want to edit or combine images
  • I poll GET /v1/tasks/{task_id} every 5–10 seconds until the status is completed
  • I download the result right away, because image links are valid for 72 hours

The main thing I’d remember: this is a single-image model. Each request returns one image, and n greater than 1 is rejected. You can try the Seedream 5.0 Pro API on APIMart, and the full field list is in the API reference.

APIMart
Seedream 5.0 Pro API: request and polling cheat sheet

Key Takeaways

  • Seedream 5.0 Pro is called with a POST request to https://api.apimart.ai/v1/images/generations, the header Authorization: Bearer YOUR_API_KEY, and model set to seedream-5-0-pro.
  • Choose the output tier with resolution (1K, 1.5K or 2K) and the shape with size: auto, one of ten aspect ratios, or exact pixels. 1.5K costs the same as 1K; 3K and 4K return 400.
  • Every request produces one image. n greater than 1, group generation, streaming and web search are rejected with 400, and no task is created.
  • Image editing sends up to 10 reference images through image_urls, as public URLs or Base64 data URIs.
  • The first response only contains a task_id. Poll the task endpoint every 5–10 seconds, then save the image within 72 hours.

Quick comparison

ItemWhat I use it forKey limit or note
Text-to-imageNew images from a prompt onlyNo input image needed
Single-reference editChange background, lighting or details of one imageOne item in image_urls
Multi-reference editCombine subjects, outfits or scenesUp to 10 reference images
Layer decompositionSplit a poster into editable layersExactly one input image, up to 16 PNG layers
Transparent backgroundEdit a layer while keeping alphaOne input image with alpha, output_format: "png"

In short: this guide shows how I set up auth, build the request body, poll the task, and save the result without losing files.

1. Set Up API Access and Authentication

1.1 Create Your APIMart Account and Generate an API Key

APIMart

Sign up on APIMart, open the API Key Management Page in your dashboard, and create a key. Copy it right away and store it on the server side, in a secret manager or an environment variable.

Never put the key in frontend code or a public repository. Anyone who has it can spend your balance. In Node.js, read it from process.env.APIMART_API_KEY; in a shell, use export APIMART_API_KEY="your-key-here".

1.2 Set the Base URL and Bearer Authentication Header

Every request goes to the base URL https://api.apimart.ai and carries two headers:

HeaderValue
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Keep the Bearer prefix with exactly one space. A missing or malformed token returns 401. If cURL works but your app does not, the bug is usually in how your app builds the headers.

2. Build a Seedream 5.0 Pro Image Request

APIMart

2.1 Core Fields: Model, Prompt, Resolution and Size

A text-to-image request needs model and prompt. Two more fields control the output:

  • model: seedream-5-0-pro (seedream-5.0-pro is also accepted).
  • prompt: a natural-language description. Besides Chinese and English, the model can render text natively in Japanese, Korean, Spanish, Portuguese, French, German, Russian, Indonesian, Vietnamese and several other languages. Keep it within about 600 English words; very long prompts can lose detail.
  • resolution: 1K (default), 1.5K or 2K. 1.5K costs the same as 1K, so it is usually the better choice.
  • size: auto (default), one of ten aspect ratios (1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3, 2:1, 1:2, 21:9), or exact pixels such as 2048x1024. Exact pixels must total between 921,600 and 4,624,220, with an aspect ratio between 1:16 and 16:1.

For example, resolution: "1.5K" with size: "16:9" returns a 2048×1152 image.

2.2 Optional Fields

Optional ParameterTypeWhen to Use
image_urlsArrayEditing and multi-reference composition; up to 10 public URLs or Base64 data URIs
output_formatStringjpeg (default) or png
backgroundStringtransparent to keep alpha when editing one image that already has an alpha channel (requires png)
layer_decompositionBooleanSplit one image into a base image and up to 16 transparent PNG layers
optimize_prompt_optionsObjectPrompt optimization; only {"mode": "standard"} is supported
watermarkBooleanAdd an “AI generated” mark at the bottom right
nsfw_checkBooleanModerate the prompt and input images before the task is submitted

Each reference image can be jpeg, png, webp, bmp, tiff, gif, heic or heif, up to 30 MB and 36 million pixels. The first reference image is free; each additional one adds a fixed surcharge.

To target an edit precisely, put coordinates in the prompt: <point>x y</point> for a single point or <bbox>x1 y1 x2 y2</bbox> for an area.

2.3 Fields This Model Rejects

Seedream 5.0 Pro is a single-image model. These requests return 400, create no task and are not charged:

  • n greater than 1, or sequential_image_generation (use Seedream 5.0 Lite for group images)
  • stream or tools (streaming and web search are not supported)
  • more than 10 items in image_urls
  • unsupported tiers such as 3K or 4K, or aspect ratios outside the list above

2.4 Sample API Calls in cURL and JavaScript

Here’s a minimal cURL request for one 16:9 image at the 1.5K tier:

curl --request POST \
  --url https://api.apimart.ai/v1/images/generations \
  --header "Authorization: Bearer $APIMART_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "seedream-5-0-pro",
    "prompt": "A sunlit mountain trail in autumn, photorealistic, wide angle",
    "resolution": "1.5K",
    "size": "16:9"
  }'

The response only confirms the task:

{
  "code": 200,
  "data": [{ "status": "submitted", "task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K" }]
}

And here’s a multi-reference edit in Node.js with fetch:

const response = await fetch("https://api.apimart.ai/v1/images/generations", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.APIMART_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "seedream-5-0-pro",
    prompt: "Replace the outfit in image 1 with the outfit in image 2",
    image_urls: ["https://example.com/person.jpg", "https://example.com/dress.jpg"],
    resolution: "2K",
    size: "auto",
  }),
});

const { data } = await response.json();
const taskId = data[0].task_id;

Keep these calls on your server, never in client-side code.

3. Poll the Task and Save the Image

3.1 Check the Task Status

Send GET https://api.apimart.ai/v1/tasks/{task_id} with the same Authorization header. Seedream 5.0 Pro is quality-first, so a task can take a few minutes. Poll every 5–10 seconds and set your client timeout to about 5 minutes.

Stop polling when status is completed, failed or cancelled. Failed tasks are fully refunded.

3.2 Read the Result

A finished task looks like this:

{
  "code": 200,
  "data": {
    "id": "task_01JFXYZ123456789ABCDEF",
    "status": "completed",
    "progress": 100,
    "result": {
      "images": [
        {
          "url": ["https://cdn.example.com/images/image_task_xxx_0.png"],
          "expires_at": 1784696685
        }
      ]
    }
  }
}

Read the image from data.result.images[0].url[0]. The response also includes the task cost. Links are valid for 72 hours (expires_at is a Unix timestamp), so download the file and move it to your own storage instead of saving the URL.

3.3 End-to-End Example in Python

import os
import time

import requests

BASE_URL = "https://api.apimart.ai"
headers = {
    "Authorization": f"Bearer {os.environ['APIMART_API_KEY']}",
    "Content-Type": "application/json",
}

created = requests.post(
    f"{BASE_URL}/v1/images/generations",
    headers=headers,
    json={
        "model": "seedream-5-0-pro",
        "prompt": "A product poster with the headline SUMMER SALE in bold letters",
        "resolution": "1.5K",
        "size": "3:4",
        "output_format": "png",
    },
    timeout=30,
)
created.raise_for_status()
task_id = created.json()["data"][0]["task_id"]

while True:
    task = requests.get(f"{BASE_URL}/v1/tasks/{task_id}", headers=headers, timeout=30).json()["data"]
    if task["status"] == "completed":
        image_url = task["result"]["images"][0]["url"][0]
        break
    if task["status"] in {"failed", "cancelled"}:
        raise RuntimeError(task.get("error", {}).get("message", task["status"]))
    time.sleep(5)

with open("seedream-5-0-pro.png", "wb") as f:
    f.write(requests.get(image_url, timeout=60).content)

4. Three Common Image Workflows

  • Posters and graphics with text. Put the exact words in quotes inside the prompt, describe the layout (for example “portrait poster, headline at the top”), and use resolution: "1.5K" with a fixed ratio such as 3:4. Move to 2K only for final assets, since the 2K tier costs more.

  • Multi-reference editing. Pass the person, product or scene images in image_urls and refer to them by order in the prompt (“image 1”, “image 2”). With size: "auto", the output ratio follows the references. You can add <bbox> coordinates to say exactly where something should go.

  • Layer decomposition and transparent edits. Send one PNG or JPEG with layer_decomposition: true to get a base image plus up to 16 transparent PNG layers with position and stacking data. To edit one layer, send that layer back with background: "transparent" and output_format: "png". Layer tasks are billed per output image after a preauthorization, and any excess is refunded.

5. Final Checklist for a Reliable Seedream 5.0 Pro Integration

Authentication and key security. Keep the key in an environment variable or a secrets manager, and call the API only from your backend.

Validate parameters before you send them. Use seedream-5-0-pro, leave out n (or set it to 1), keep image_urls at 10 or fewer, and use only 1K, 1.5K or 2K with a supported size.

Plan for the async flow. Poll every 5–10 seconds, set a client timeout of about 5 minutes, and handle failed and cancelled.

Treat delivery as a storage problem. Download each image as soon as the task succeeds; links expire after 72 hours.

Check cost before you scale. Output is billed per image by pixel tier (1K and 1.5K share the lower price, 2K costs more), and each reference image after the first adds a surcharge. See the live pricing table before running large batches.

FAQs

How do I check an image task after I get a task_id?

Send GET https://api.apimart.ai/v1/tasks/{task_id} with your Authorization: Bearer header.

Poll every 5–10 seconds until status becomes completed, then read the image from data.result.images[0].url[0]. If the status is failed or cancelled, read the error field; failed tasks are refunded.

Can I get several images or Base64 output in one request?

No. Seedream 5.0 Pro returns one image per request, and n greater than 1 is rejected with 400. For several variations, send several requests, or use Seedream 5.0 Lite for group generation.

The result is always a URL; choose jpeg or png with output_format. Base64 is supported for input images in image_urls, not for output.

What’s the best way to avoid losing generated images?

Image links are valid for 72 hours, and expires_at in the result tells you exactly when.

Download each image to your own storage as soon as the task reaches completed, and keep your own record of the task_id. Don’t treat the returned URL as permanent storage.

Tags#Seedream 5.0 Pro#image generation#API tutorial#developers

About APIMart Team

APIMart Team writes model guides, side-by-side comparisons and pricing breakdowns for developers building with AI. APIMart gives you one API for 500+ chat, image and video models, so you can test the models covered here against each other before you ship.

Ready to build?

Choose the model you want in the model marketplace

Try chat, image and video models in the APIMart model marketplace, and experience model capabilities quickly with one unified API.

Chat modelsImage modelsVideo models
Explore model marketplace