Seedream API: Generate and Edit Images with One Request

Make and edit images with Seedream through the OpenAI images endpoint. Sizes, aspect ratios, input images, links versus inline output, and the price per image.

3 min read

seedreamimagestutorial

A picture forming inside a floating frame while a glowing brush retouches one corner

Seedream image models answer POST /images/generations, the same request the OpenAI images API uses. One request, one answer: the picture comes back in the response, as a link or inline. This post covers making an image from a prompt, editing your own picture, and the options that matter.

Your first image

bash
curl https://api.apistore.cloud/v1/images/generations \
  -H "Authorization: Bearer $APISTORE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedream-5.0-flash",
    "prompt": "A ceramic teapot on a linen tablecloth, morning window light, product photo",
    "size": "1K",
    "aspect_ratio": "4:3",
    "response_format": "url"
  }'

The answer follows the OpenAI format:

json
{ "created": 1763450000, "data": [ { "url": "https://..." } ] }

The link works for one hour, so save the file if you need it longer. Ask for "response_format": "b64_json" to get the picture inline as base64 instead.

With the OpenAI SDK

python
from openai import OpenAI
import base64

client = OpenAI(base_url="https://api.apistore.cloud/v1", api_key="sk-...")

res = client.images.generate(
    model="seedream-5.5",
    prompt="Isometric illustration of a small bookshop at dusk, warm lights",
    size="2K",
    response_format="b64_json",
    extra_body={"aspect_ratio": "16:9", "output_format": "png"},
)
open("bookshop.png", "wb").write(base64.b64decode(res.data[0].b64_json))

Fields the SDK does not know about, such as aspect_ratio, go in extra_body.

Sizes and aspect ratio

size can be exact pixels such as "1024x1024", or a resolution name the model offers: "1K", "1.5K", "2K", "3K" or "4K". Add aspect_ratio (for example "16:9" or "9:16") to shape it. Leave size out to get the model's standard size. Each model offers different sizes:

ModelSizesInput images, at most
seedream-5.0-flash1K, 1.5K10
seedream-5.0-pro1K, 1.5K, 2K10
seedream-5.51K, 1.5K, 2K10
seedream-5.0-lite2K, 3K, 4K14

Asking for a size a model does not make returns 400 size_not_available, with the sizes it does accept in the message.

n makes 1 to 4 pictures in one request, and output_format is "jpeg" (the default) or "png".

Editing your own picture

Send image with a link or a data URL, and say in the prompt what should change:

json
{
  "model": "seedream-5.0-pro",
  "prompt": "Replace the background with a sunlit beach. Keep the person and their clothes unchanged.",
  "image": "https://example.com/portrait.jpg",
  "size": "2K"
}

image can also be a list, to combine several pictures: a product and a scene, a character and a pose, or a style reference. Refer to them in order in the prompt ("the bag from the first image on the table in the second image").

Writing prompts that work

  • Lead with the subject, then the setting, the light, the style and the framing.
  • Name the medium: product photo, watercolour, flat vector illustration, 35mm film still.
  • For text inside the picture, put the exact words in quotes and say where they go.
  • For edits, say what stays the same as well as what changes. "Keep the face and pose unchanged" saves a lot of retries.

Prices

You pay per image produced. Today seedream-5.0-flash costs $0.0144 per image, seedream-5.5 costs $0.016, seedream-5.0-pro costs $0.036 and seedream-5.0-lite costs $0.0252. Some models add a price for large images and for input images (on some, the first input image is free); the price list shows each one. A request that fails is not charged.

Choosing a Seedream model goes through when to use which.

Try it without code

The playground in your dashboard runs the same models with a form: pick a model, type a prompt, add pictures and generate. It is the quickest way to find a prompt that works before you write code, and it is billed at the same prices as the API.

Also in Tiếng Việt, Español, Português, Bahasa Indonesia