Authentication
authorization string required
All APIs require authentication via Bearer Token.
Get API Key:
Visit API Key Management Page to get your API Key.
Usage:
Add to request header:
Authorization: Bearer YOUR_API_KEY
Parameters
model string required
Model ID to use for the request
Value: spark_dream_3_0
prompt string required
Text prompt for image generation, supports both Chinese and English input
Do not use special symbols like $ except for ""
Image description tips: Use coherent natural language to describe the image content (subject + behavior + environment, etc.), and use short phrases to describe image aesthetics (style, color, lighting, composition, etc.)
Professional vocabulary: Recommend using source language or English for professional terms for more precise results
Image usage description: Recommend specifying image usage and type, e.g., PPT cover background, advertising poster design, documentary photography
Text layout: Place text content in double quotes "", and describe text size, font, color, style and position through instructions
use_pre_llm boolean
Enable text expansion. Will expand and optimize the input prompt. Recommended to enable if input prompt is short, recommended to disable if input prompt is long
Options: true, false
Default: false
seed integer
Random seed as the basis for determining the initial diffusion state. If the random seed is the same positive integer and other parameters are consistent, the generated images will most likely have consistent results
Default: -1 (random)
scale number
Affects the degree of text description influence
Range: 1 to 10
Default: 2.5
width integer
Width of the generated image
Recommended resolution around 1.3K for more delicate image quality and better balanced overall indicators
1K and 2K images perform relatively weaker
Recommended ratios and corresponding width*height for 1.3K:
1:1: 1328*1328
4:3: 1472*1104
3:2: 1584*1056
16:9: 1664*936
21:9: 2016*864
Width and height product less than 2048*2048 can produce images normally
Range: 512 to 2048
Default: 1328
height integer
Height of the generated image
Recommended resolution around 1.3K for more delicate image quality and better balanced overall indicators
1K and 2K images perform relatively weaker
Recommended ratios and corresponding width*height for 1.3K:
1:1: 1328*1328
4:3: 1472*1104
3:2: 1584*1056
16:9: 1664*936
21:9: 2016*864
Width and height product less than 2048*2048 can produce images normally
Range: 512 to 2048
Default: 1328
Polling
Since image generation takes time, you need to poll the task status after creation
The initial response returns the task ID and initial status. The actual generation results must be obtained through polling the task status endpoint
Response Format
error object
Error information. Only present when status is failed
code
stringError code
error_message
stringDetailed error message
output array
Generation results. Only present when status is completed
content
arrayList of generated content
type
stringResource type
Value:
imageurl
stringGenerated content URL
size
integerImage size
jobId
stringRemote task ID
usage object
Usage statistics. Only present when status is completed
cost
stringTotal cost in USD
discount
numberDiscount amount
metadata object
Metadata information
Error Codes
| Error Code | Description |
|---|---|
| 003019001 | Prompt missing |
| 003019002 | Invalid prompt length, must be 1-800 characters |
| 003019003 | Invalid use_pre_llm parameter |
| 003019004 | Invalid seed parameter, must be -1 or positive integer |
| 003019005 | Invalid scale parameter, must be between 1-10 |
| 003019006 | Invalid width/height parameters, must be between 512-2048 and both must be provided |
| 003019007 | Invalid aspect ratio, must be between 1:3 and 3:1 |
| 003019095 | Internal generation error |
| 003019096 | Result parsing error |
| 003019097 | HTTP error response |
| 003019098 | Status check error |
| 003019099 | Task creation error |