How to Use Seedgream 4.5 API
Source: Dev.to
What is Seedream 4.5?
Seedream 4.5 is the latest iteration of the Seedream family — a multimodal image generation and editing model designed for high‑fidelity text‑to‑image creation and context‑aware image editing (image‑to‑image, multi‑reference editing, inpainting/outpainting, typography and dense‑text handling). Compared with earlier Seedream releases, 4.5 focuses on:
- Improved subject consistency across multi‑image workflows
- Stricter preservation of reference details
- Higher typographic fidelity (text in images)
- Better output quality up to 4K/ultra‑HD in “high quality” settings
These improvements stem from a scaled architecture and updated prompt‑tuning / engine‑side heuristics.
Why this matters: 4.5 is built for professional creative tasks—batch product variations, brand‑consistent multi‑image edits, and high‑res print assets—while enabling finer control with reference images and specialized editing operations.
Core capabilities
- Text‑to‑image generation (single and batch): generate 1–15 images per API call, with selectable quality modes (Basic vs High) that trade off speed and resolution.
- Image editing (i2i / inpainting / outpainting): use one or more reference images; preserves detail and spatial relationships across multiple references.
- Multi‑reference blending & element copy: up to ~10 reference images can be used in a single job to transplant elements while keeping lighting/perspective coherent.
- High typography/dense‑text rendering: better handling for images with text or signage (useful for mockups, product labels, UI screenshots).
- Streaming / progressive output: some deployment endpoints support streaming results so clients can receive partial results while generation continues.
How do I Use Seedream 4.5 API through CometAPI?
Below is a practical, copy‑pasteable walkthrough for generating images through CometAPI (an aggregator that exposes the Seedream 4.5 model as a model parameter). Use CometAPI when you want one API key to access dozens/hundreds of models and a stable, easy‑to‑integrate REST surface. The CometAPI documentation shows the doubao‑seedream‑4‑5‑251128 model alias and a standard images generation endpoint.
High‑level steps
- Sign up for CometAPI and get an API key.
- Use the images generation endpoint (
POST https://api.cometapi.com/v1/images/generations) with the model param set to the Seedream 4.5 identifier (e.g.,doubao‑seedream‑4‑5‑251128). - Include prompt, optional reference images (URLs or multipart uploads depending on the aggregator), output size/quality, and other parameters.
- Receive a JSON response containing generated image URLs (or base64) and metadata.
Request types and modes
Seedream 4.5 commonly supports:
- Text → Image – text prompts → novel images
- Image → Image – reference images + prompts for stylized transforms
- Image Editing / Inpainting – mask + edit instructions for targeted changes
Hosted APIs often support asynchronous task modes (submit job → poll with taskId), which fits long‑running renders and batch workflows. Generated links are frequently time‑limited (e.g., valid for 24 hours), so plan for storage/export.
curl example (text‑to‑image, single prompt)
curl -X POST "https://api.cometapi.com/v1/images/generations" \
-H "Authorization: Bearer COMETAPI_KEY_GOES_HERE" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-4-5-251128",
"prompt": "A cinematic portrait of a cyberpunk fox in neon rain, 4k, detailed lighting, film grain",
"n": 3,
"width": 2048,
"height": 2048,
"quality": "high", # or "basic"
"seed": 12345,
"style": "photorealistic"
}'
Notes
- Replace
COMETAPI_KEY_GOES_HEREwith your CometAPI key. - The
nparameter generates multiple variations in one call (saves overhead). quality: "high"typically maps to a higher resolution / higher compute cost (often 4K‑capable).
Python requests example (text‑to‑image + saving results)
import requests, base64, os
API_URL = "https://api.cometapi.com/v1/images/generations"
API_KEY = os.environ.get("COMETAPI_KEY") # set env var for safety
payload = {
"model": "doubao-seedream-4-5-251128",
"prompt": "Studio shot of a ceramic mug on a wooden table, warm natural light, ultra-detailed, 2k",
"n": 2,
"width": 1024,
"height": 1024,
"quality": "basic"
}
resp = requests.post(
API_URL,
json=payload,
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
)
resp.raise_for_status()
data = resp.json()
# Each item may contain 'b64_json' or 'url' depending on provider
for i, item in enumerate(data.get("data", [])):
img_b64 = item.get("b64_json")
if img_b64:
img_bytes = base64.b64decode(img_b64)
with open(f"seedream_result_{i}.png", "wb") as f:
f.write(img_bytes)
else:
print("Image URL:", item.get("url"))
Why this pattern? Aggregators commonly return either a base64 payload or hosted URLs; the code handles both. The endpoint will typically return a task_id. Poll GET /tasks/{task_id} until the status is succeeded, then download the result. Many providers include SDKs with built‑in helpers for this workflow.
How do I optimize image quality and keep text legible?
- Use reference images for consistent context and color matching.
- Call out typography explicitly in the prompt (font family, weight, alignment) and consider adding the exact text as an overlay in a secondary step to ensure legibility.
- Run a two‑step process:
- Generate the base composition.
- Re‑render or edit in a second pass focused on close‑ups or label areas with higher resolution.
How should you write prompts for Seedream 4.5?
Prompt engineering principles
- Be explicit: list subject, action, style, lens/camera, time of day, and desired color palette.
- Use identity anchors: if you need the same face/prop across images, include persistent descriptors (e.g., “the same woman with short wavy hair, green jacket, scar on left eyebrow”) and supply 1–3 reference images. Seedream 4.5’s multi‑reference fusion improves, but anchors help.
- Negative prompts: explicitly state what to avoid (e.g., “no text”, “no watermarks”, “no extra limbs”).
- Short + long hybrid: give a short canonical instruction then extend with a few lines of detail and constraints.
Example prompt templates
-
Product hero shot (photoreal):
"A clean product hero shot of a matte black wireless speaker placed on a white tabletop, softbox lighting, 50mm, shallow depth of field, studio background, photoreal, no text" -
Fantasy illustration (stylized):
"Epic fantasy landscape, towering glass castle on a cliff, golden hour, volumetric fog, painterly, highly detailed, concept art" -
Image edit (remove object):
"Remove the person on the left and extend the background to fill the space, keep lighting consistent, no artifacts" -
Typography‑heavy mockup:
"Mobile app landing screen mockup on an iPhone 14, with bold sans‑serif heading 'Welcome', centered, high‑contrast colors, realistic device rendering"