asV3 localized example text (snake_case Request Body +, return image).in use endpointSeedream 5.0 Lite V2 endpointlocalized example text.task and, can.
Overview
Seedream 5.0 Lite Seedream height Resolution, supported Text-to-Image (text-to-image) and Image-to-Image (image-to-image), and supported SSE return.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 14 images Reference image)
-📡 output:supported SSE return, images images
-🇨🇳 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-lite` | height Resolution,| 14 images| `2K` / `3K` | `2048x2048` | ❌ | ✅ |
in in the`model` will return HTTP 400`InvalidParameter`.Seedream Model[Seedream 5.0 Pro](/docs/seedream-5-0-pro), [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-lite` |
| prompt | string | Yes | Prompt.recommendedin exceeds 300, exceeds 600|
| image | string / string[] | No | Reference image.single imagecharacters, multiple images, up to 14 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) |
| response_format | string | No | return Format:`url` (default)/ `b64_json` |
| stream | boolean | No | output, default`false`, localized example text[output](#output )|
| sequential_image_generation | string | No | `disabled` (default)/ `auto`.`auto` when return 1 images image|
| sequential_image_generation_options.max_images | integer | No | 1~ 15 |
| 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|
> - `optimize_prompt_options`, `tools`, `seed` etc. field can, will, image.
> - Model supported image,`layer_decomposition` only [Seedream 5.0 Pro](/docs/seedream-5-0-pro) supported.
### size Description
supported,:**Method 1:Resolutionlocalized example text** (`2K` / `3K`, size )
- output Aspect ratio as 1:1.
- Aspect ratio when, use Method 2.
- supported`4K`, return 400.
**Method 2:width and height** (`width x height`, localized example text`2848x1600`, default `2048x2048`)
| range| Aspect ratiorange | localized example text|
|-----------|-----------|---------|
| [2560x1440, 4096x4096] | [1/16, 16] | localized example text≤ 2048x3072 localized example text`2K`, localized example text`3K` |
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.after Resolution.
---
## 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-lite",
"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-lite",
"prompt": ",,,",
"size": "2848x1600"
}'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-lite",
"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-lite", "prompt": "will image 1 as image 2", "image": [ "https://example.com/person.png", "https://example.com/clothes.png" ], "size": "2K" }'
### Scenario4:Python (OpenAI SDK)
V3 and OpenAI SDK imageendpoint,`base_url` localized example text`https://mm-internal-cn.leonecloud.com/api/v3` can, field`extra_body`:
```pythonfrom 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-lite",
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-lite",
"created": 1792235741,
"data": [
{
"url": "https://fc-gw-sh.oss-accelerate.aliyuncs.com/downloads/20261017/task_20261017191541_lwqp1vgb_0.jpg",
"size": "2048x2048"
}
],
"usage": {
"generated_images": 1,
"output_tokens": 16384,
"total_tokens": 16384
}
}| 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 |
| usage.generated_images | integer | image images |
| usage.output_tokens | integer | sum(width× height ) / 256 localized example text |
| usage.total_tokens | integer | andoutput_tokens localized example text |
localized example textX-Task-Id as Request Task ID, when provide.
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"
}
}
---
## output`"stream": true` when SSE (`text/event-stream`)return:```bash
curl -N -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-lite",
"prompt": "Reference image1, image",
"image": "https://example.com/person.png",
"size": "2K",
"stream": true
}'
event: image_generation.partial_succeeded
data: {"type":"image_generation.partial_succeeded","model":"seedream-5-0-lite","created":1792235800,"image_index":0,"url":"https://...","size":"2048x2048"}
event: image_generation.completed
data: {"type":"image_generation.completed","model":"seedream-5-0-lite","created":1792235800,"usage":{"generated_images":1,"output_tokens":16384,"total_tokens":16384}}
data: [DONE]| localized example text | Description |
|---|---|
image_generation.partial_succeeded | images image Success,image_index, url (orb64_json), size |
image_generation.partial_failed | images image Failure,image_index, error.code, error.message |
image_generation.completed | ,usage |
error | Failure ( when ),error.code, error.message |
- etc. 15 seconds
: keep-alive, can; - ParameterError, Insufficient balance etc. in first will JSON Error return ( SSE).
Error Codes
Failurereturned when applicableHTTP Status Code+ localized example texterror:```json
{
"error": {
"code": "InvalidParameter",
"message": "size supported 4K, use 2K, 3K or width and height",
"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](#when )|
---
## Migrating from V2
| localized example text| V2 | V3 ()|
|------|----|-------------|
| create Path| `POST /api/v2/open/aigc/seedream-5.0-lite`, PathModel| localized example text`POST /api/v3/images/generations`, Modellocalized example text`model` localized example text|
| Method| Create Taskafter Polling query|, return image; can`stream` localized example text|
| fieldlocalized example text| camelCase (`imageUrls`, `aspectRatio`) | snake_case (`image`, `size`) |
| Generation type | `genType` (`t2i` / `i2i`) | localized example text`image` localized example text|
| dimensions Parameter| `aspectRatio` + `quality` (`basic`=2K / `high`=3K) | and as`size`, localized example text[size Description](#size-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.fieldDescription[Seedream 5.0 Lite V2 endpointlocalized example text](/docs/seedream-5-0-lite-v2).
---
## Best Practices
1. **when**:image Usually 10~ 60 seconds, when recommended at least 120 seconds; height Resolution, Reference image when.
2. **etc.**:localized example text`stream` can images images, etc.,[output](#output ).
3. **Aspect ratio**:Resolutionoutput 1:1,[size Description](#size-Description).
4. **and when store**:return image URL and when, when.
5. **Reference imageURL**:Base64 will Request Body, multiple images image when Request Body.