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 used for the request
Value: spark_dream_5_5
input array required
Pass one object containing params. All model parameters below go in input[0].params.
prompt string required
Prompt used for image generation. Supports both Chinese and English.
For best results, use up to 300 Chinese characters or 600 English words.
image string | array
Input image information. Supports URL or Base64 encoding.
Image URL: make sure the URL is accessible.
Base64: use this format data:image/<image_format>;base64,<Base64_content>. Note that <image_format> must be lowercase, for example data:image/png;base64,<base64_image>.
- Omit
imagefor text-to-image generation. - Pass one image for single-image editing.
- Pass
2to10images for multi-reference generation.
Input image requirements
- Image formats:
jpeg,png,webp,bmp,tiff,gif,heic,heif - Width-to-height ratio:
1/16to16 - File size: up to
30 MBper image - Width and height: each greater than
14pixels - Total pixels: up to
36,000,000per image
size string
Specifies the output image size. Two methods are supported and cannot be mixed.
Use a resolution preset (1K, 1.5K, or 2K) or specify widthxheight, for example 2048x2048. Custom dimensions must have 921,600 to 4,624,220 total pixels and a width-to-height ratio of 1/16 to 16.
Default: 2K
Read the actual dimensions from output[].content[].size.
optimize_prompt_options object
Prompt optimization settings. mode accepts standard and defaults to standard.
output_format string
Specifies the output image file format.
Options: png, jpeg
Default: png
background string
Controls the alpha channel of generated images.
autolets the model use the prompt andoutput_formatto decide whether to include an alpha channel. JPEG output is opaque.opaqueproduces an image without an alpha channel.transparentproduces an image with an alpha channel and requiresoutput_format: "png".
Default: auto
Options: auto, opaque, transparent
response_format string
Response format for generated images. The platform always returns hosted image URLs.
Value: url
watermark boolean
Whether to add an “AI generated” watermark to generated images.
false: no watermark.
true: adds an “AI Generated” watermark in the bottom-right corner.
Default: true
Options: true, false
safety_identifier string
Optional stable identifier for the end user. Use a distinct value of up to 64 characters for each user, such as a hashed user ID. This is an upstream request field.
Request Examples
Synchronous reference-image editing
Send the same request body to POST /model/v1/generation for asynchronous submission or to POST /model/v1/generation/sync to wait for the result. Set an HTTP client timeout long enough for generation.
curl --location 'https://cloud.vtrix.ai/model/v1/generation/sync' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "spark_dream_5_5",
"input": [{"params": {
"prompt": "Restyle the reference image as a watercolor illustration",
"image": "https://example.com/reference.png",
"size": "1.5K",
"output_format": "png",
"watermark": false
}}]
}'
Polling
Since result generation takes time, you need to poll the task status after creating the task.
The initial response only returns information such as the task ID and initial status. The final result must be obtained by polling the task status endpoint using the task ID.
See the examples on the right for polling requests and responses.
In the asynchronous create response, status: "completed" means the submission finished. Use the returned id in GET /model/v1/generation/task/{task_id} to track generation.
| Task query status | Action |
|---|---|
in_progress | Poll the same task again. |
completed | Read output[].content[]. |
failed | Read error.code and error.message. |
Response Format
Images and usage
| Field | Type | Description |
|---|---|---|
output[].content[].type | string | image |
output[].content[].url | string | Platform-hosted image URL |
output[].content[].size | string | Actual dimensions in widthxheight format |
output[].content[].output_format | string | Actual image format, png or jpeg |
usage.input_images | integer | Number of input images |
usage.generated_images | integer | Number of successful outputs |
usage.output_tokens | integer | Output token count for reference |
usage.total_tokens | integer | Total token count for reference |
metadata | object | Task timing and additional metadata when returned |
Example completed result:
{
"id": "d5u5obte8783ap44qtj0",
"created_at": 1788451200000,
"status": "completed",
"model": "spark_dream_5_5",
"output": [
{
"content": [
{
"type": "image",
"url": "https://example.com/generated-image.png",
"size": "1366x1334",
"output_format": "png"
}
]
}
],
"usage": {
"input_images": 0,
"generated_images": 1,
"output_tokens": 16364,
"total_tokens": 16364
}
}
Pricing
Every input image is billable. Successful outputs are priced per image using the actual width × height. The two tiers are up to and including 2,610,000 pixels and over 2,610,000 pixels. A 2K request that returns 1366x1334 has 1,822,244 pixels and falls in the lower tier. Token counts do not add a separate charge.