asV3 localized example text (snake_case Request Body +, return image).Model when provide V2 endpointPOST /api/v2/open/aigc/seedream-5.0-flash (camelCase + Pollingquery ), task and, can; recommended V3.Overview
Seedream 5.0 Flash Seedream height, supported Text-to-Image (text-to-image) and Image-to-Image (image-to-image), and supported images image image+ image.Requestand field as snake_case.
localized example text:
- ⚡ return:Requestimage complete, return image, no Polling
-🖼️ Method:Text-to-Image, Image-to-Image, image reference image (up to 10 images Reference image)
-🧩 image:images image image+ can image
-🎯 Resolution:1K / 1.5K / 2K,
-🇨🇳 localized example text:asBase URL: https://mm-internal-cn.leonecloud.com ()
---## Authentication
All endpoints require a token in the request header for authentication:
Authorization: Bearer {YOUR_AUTH_TOKEN}Failurereturned when applicable HTTP 401:```json
{
"error": {
"code": "AuthenticationError",
"message": "API Key no",
"type": "Unauthorized"
}
}
---
## model Values
`model` as**Required**field, as:| model | Description | Reference imagelocalized example text| size Resolutionlocalized example text| size Default | image| output|
|-------|------|-----------|--------------|------------|---------|---------|
| `seedream-5-0-flash` | height,| 10 images| `1K` / `1.5K` / `2K` | `2K` | ✅ | ❌ |
in in the`model` will return HTTP 400`InvalidParameter`.Seedream Model[Seedream 5.0 Pro](/docs/seedream-5-0-pro), [Seedream 5.0 Lite](/docs/seedream-5-0-lite), [Seedream 4.5](/docs/seedream-4-5),,`model`.
---
## endpoint:Image Generation
**POST** `/api/v3/images/generations`
### Request Parameters
| Parameter | Type | Required | Description |
|-----|------|-----|------|
| model | string | Yes | localized example text`seedream-5-0-flash` |
| prompt | string | localized example text* | Prompt.recommendedin exceeds 300, exceeds 600.*image Optional|
| image | string / string[] | No | Reference image.single imagecharacters, multiple images, up to 10 images; supported image URL or Base64 (Format`data:image/png;base64,<data>`, imageFormat).single imageexceeds 30MB|
| size | string | No | output dimensions,[size Description](#size-Description) |
| layer_decomposition | boolean | No | image, default`false`, localized example text[image](#image )|
| response_format | string | No | return Format:`url` (default)/ `b64_json` |
| output_format | string | No | `png` / `jpeg`.can, first Output format, Format as|
| watermark | boolean | No | can, first output|
| background | string | No | onlysupported`opaque` (default); `transparent` supported, return 400|
> **Model supported Parameter** (will return 400, will ):> - `sequential_image_generation: auto` (image ):only[Seedream 5.0 Lite](/docs/seedream-5-0-lite), [Seedream 4.5](/docs/seedream-4-5) supported;> - `stream: true` (output ):only Seedream 5.0 Lite, Seedream 4.5 supported.
>
> `optimize_prompt_options`, `tools`, `seed` etc. field can, will, image.
### size Description
supported,:**Method 1:Resolutionlocalized example text** (`1K` / `1.5K` / `2K`, default `2K`, size )
- output Aspect ratio as 1:1.
- Aspect ratio when, use Method 2.
- localized example text**localized example text**, height.
**Method 2:width and height** (`width x height`, localized example text`2560x1440`)
| range| Aspect ratiorange |
|-----------|-----------|
| [921600, 4624220] | [1/16, 16] |
will Resolution, and Aspect ratio (`1:1` / `4:3` / `3:4` / `16:9` / `9:16` / `3:2` / `2:3` / `21:9`)image,, dimensions in the`size` as.:| Aspect ratio | 1K | 1.5K | 2K |
|-------|----|------|----|
| 1:1 | 1024x1024 | 1536x1536 | 2048x2048 |
| 4:3 | 1152x864 | 1728x1296 | 2304x1728 |
| 3:4 | 864x1152 | 1296x1728 | 1728x2304 |
| 16:9 | 1280x720 | 1920x1080 | 2560x1440 |
| 9:16 | 720x1280 | 1080x1920 | 1440x2560 |
| 3:2 | 1248x832 | 1872x1248 | 2496x1664 |
| 2:3 | 832x1248 | 1248x1872 | 1664x2496 |
| 21:9 | 1512x648 | 2268x972 | 3024x1296 |
### image
images image as 1 images image+ can image (PNG).
- `layer_decomposition` localized example text`true`;
- `image` **mustonly supported 1 images**;
- `prompt` Optional:If omittedwhen image in, can use Description;
-`size` onlysupported`1K` / `1.5K` / `2K` / `auto` (default `auto`, localized example text`2K` output ), supported width and height;
-**output image images**( image+ image ): create when, complete after.
localized example text`data` in as image: image`z_index` as`0`, image`1` (); image will return`bounding_box`, `name`, `description`, localized example text[Response Parameters](#Response Parameters).
---
## Supported Scenarios
### Scenario1:Text-to-Image
```bashcurl -X POST "https://mm-internal-cn.leonecloud.com/api/v3/images/generations" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-0-flash",
"prompt": "in,",
"size": "2K"
}'
Aspect ratio (16:9):```bash
curl -X POST "https://mm-internal-cn.leonecloud.com/api/v3/images/generations" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-0-flash",
"prompt": ",,,",
"size": "2560x1440"
}'Scenario2:Image-to-Image
curl -X POST "https://mm-internal-cn.leonecloud.com/api/v3/images/generations" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-0-flash",
"prompt": ", as",
"image": "https://example.com/input.png",
"size": "2K"
}'Scenario3:image reference image```bash curl -X POST "https://mm-internal-cn.leonecloud.com/api/v3/images/generations" \ -H "Authorization: Bearer your_auth_token_here" \ -H "Content-Type: application/json" \ -d '{ "model": "seedream-5-0-flash", "prompt": "will image 1 as image 2", "image": [ "https://example.com/person.png", "https://example.com/clothes.png" ], "size": "2K" }'
### Scenario4:image```bash
curl -X POST "https://mm-internal-cn.leonecloud.com/api/v3/images/generations" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-0-flash",
"prompt": "image",
"image": "https://example.com/poster.png",
"layer_decomposition": true,
"size": "2K"
}'Scenario5:Python (OpenAI SDK)
V3 and OpenAI SDK imageendpoint,base_url localized example texthttps://mm-internal-cn.leonecloud.com/api/v3 can, fieldextra_body:
from openai import OpenAI
client = OpenAI(
base_url="https://mm-internal-cn.leonecloud.com/api/v3",
api_key="your_auth_token_here",
)
resp = client.images.generate(
model="seedream-5-0-flash",
prompt="in,",
size="2K",
response_format="url",
extra_body={
"image": "https://example.com/input.png",
},
)
print(resp.data[0].url)Response Parameters
Success(HTTP 200)```json { "model": "seedream-5-0-flash", "created": 1792235741, "data": [ { "url": "https://.../task_20261111191541_lwqp1vgb_0.jpeg", "size": "2048x2048", "output_format": "jpeg" } ], "usage": { "generated_images": 1, "input_images": 0, "output_tokens": 16384, "total_tokens": 16384 } }
image:```json
{
"model": "seedream-5-0-flash",
"created": 1792235741,
"data": [
{
"url": "https://.../layer_0.jpeg",
"size": "2048x2048",
"output_format": "jpeg",
"z_index": 0
},
{
"url": "https://.../layer_1.png",
"size": "1981x924",
"output_format": "png",
"z_index": 1,
"bounding_box": {
"absolute": [33, 561, 2014, 1485],
"normalized": [16, 274, 983, 725]
},
"name": "localized example text",
"description": "in"
}
],
"usage": {
"generated_images": 5,
"input_images": 1,
"output_tokens": 79476,
"total_tokens": 79476
}
}| Parameter | Type | Description |
|---|---|---|
| model | string | Request in themodel |
| created | integer | taskCreated Time (Unix seconds) |
| data[].url | string | image URL (response_format=url returned when applicable), and when |
| data[].b64_json | string | image Base64 (response_format=b64_json returned when applicable) |
| data[].size | string | imagewidth and height,2048x2048 |
| data[].output_format | string | imageFormat, localized example textjpeg; image when image asjpeg, image aspng |
| data[].z_index | integer | image (only image ): image as0, localized example text |
| data[].bounding_box.absolute | int[] | image in image in the[left, top, right, bottom] (onlyimage, image return ) |
| data[].bounding_box.normalized | int[] | localized example text[left, top, right, bottom], 0~ 1000 |
| data[].name | string | image (only image ) |
| data[].description | string | image (only image ) |
| usage.generated_images | integer | image images ( image when as image+ image, images ) |
| usage.input_images | integer | Reference image images |
| usage.output_tokens | integer | sum(width× height ) / 256 localized example text |
| usage.total_tokens | integer | andoutput_tokens localized example text |
image URL can, in the as, in encoded.
localized example textX-Task-Id as Request Task ID, when provide.
image:will image(right - left) × (bottom - top), image(left, top) Location, imagez_index localized example text.( widthW, heightH)whennormalized:x = left / 1000 × W, y = top / 1000 × H.
when
Request maximum 10 minutes.returned when applicable HTTP 504, task will execute and, canmessage in the Task ID ( orX-Task-Id)localized example textGET /v1/images/generations/{taskId} query results, returnImage Generation API (Unified Endpoint) Query Taskendpoint:```json
{
"error": {
"code": "RequestTimeout",
"message": "Image Generationwhen, task in processing, GET /v1/images/generations/task_xxx query results",
"type": "GatewayTimeout"
}
}
---
## Error Codes
Failurereturned when applicableHTTP Status Code+ localized example text`error`:```json
{
"error": {
"code": "InvalidParameter",
"message": "size in[921600, 4624220], first 640x480",
"type": "BadRequest"
}
}| HTTP Status Code | error.code | Description |
|---|---|---|
| 400 | InvalidParameter | ParameterError (prompt, size no, Model supported Parameter etc. ) |
| 400 | SensitiveContentDetected etc. | input or output not, Prompt or Reference image |
| 401 | AuthenticationError | API Key invalid or missing |
| 402 | InsufficientBalance | Insufficient balance |
| 403 | PermissionDenied | no |
| 404 | ModelNotOpen | Modelnot |
| 413 | InvalidParameter | Request Bodylocalized example text |
| 500 | InternalServiceError | Image GenerationFailure, can |
| 504 | RequestTimeout | when, task in,when |
Migrating from V2
| localized example text | V2 | V3 () |
|---|---|---|
| create Path | POST /api/v2/open/aigc/seedream-5.0-flash, PathModel | localized example textPOST /api/v3/images/generations, Modellocalized example textmodel localized example text |
| Method | Create Taskafter Polling query | , return Image |
| fieldlocalized example text | camelCase (imageUrls, aspectRatio) | snake_case (image, size) |
| Generation type | genType (t2i / i2i / t2i-layer / i2i-layer) | localized example textimage; imagelayer_decomposition: true |
| dimensions Parameter | aspectRatio + resolution (1K / 1.5K / 2K) | and assize, localized example textsize Description |
| create | {code, msg, data} localized example text | ,data[].url |
| Errorlocalized example text | Error Codes (code: 40001) | HTTP Status Code+ {"error": {...}} |
| Callback Notification | callbackUrl | return, no |
V2 endpointcan use, task and.V2 localized example textresolution and Resolution (1K / 1.5K / 2K, default 2K).
Best Practices
- when:image Usually 10~ 60 seconds, when recommended at least 120 seconds; height Resolution, Reference image when.
- localized example text:, default
2K; in (list image ) when1K, as. - Aspect ratio:Resolutionoutput 1:1,size Description.
- image images:Request image+ image, images
usage.generated_imagesas; image whenlayer_decomposition. - and when store:return image URL and when, when.
- Reference imageURL:Base64 will Request Body, multiple images image when Request Body.