API Notes
kirin_v4_image uses n for independent images (single) and series_amount for a series of related images (series).
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
Value: kirin_v4_image
input array required
Send one object containing params to POST https://cloud.vtrix.ai/model/v1/generation. The fields below belong to input[0].params.
contents array required
Include a prompt item with nonempty text. Reference images and elements are optional and count toward a combined limit of 10. Use a unique material id within the task for each reference, then refer to it in the prompt with @id.
Item type | Fields | Purpose |
|---|---|---|
prompt | text (string) | Describe the image or series to generate |
refer_image | url (string), id (string) | Supply a reference image |
element | element_id (string), id (string) | Reference an existing element created from images |
For reference images, use an accessible URL or Base64-encoded image data in url. Each image must be JPEG or PNG, no larger than 30 MB, at least 300 px on both sides, and have a width-to-height ratio from 2:5 to 5:2.
English-only prompts have a limit of 50,000 characters. Non-English-only prompts have a limit of 21,000 characters. For mixed prompts, divide each character count by its respective limit. The sum must be at most 1.
settings object
| Field | Options or range | Default |
|---|---|---|
result_type (string) | single for independent images, series for related images | single |
n (integer) | 1 to 9 in single mode | 1 |
series_amount (integer or string) | 2 to 10 or "auto" in series mode. With "auto", the model selects the image count | 4 |
resolution (string) | 2k, 4k, 8k | 2k |
aspect_ratio (string) | auto, 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9 | auto |
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.
Poll GET https://cloud.vtrix.ai/model/v1/generation/task/{task_id} with the platform API key used to submit the request. Replace {task_id} with the id from the creation response.
| Status in the query response | What to do |
|---|---|
in_progress | Continue polling |
completed | Read the image URLs from output[].content[].url |
failed | Read error for details |
Response format
In the creation response, status: "completed" means the submission was accepted. Check the query response for the generation status. All responses shown are examples.
| Field | Description |
|---|---|
id | Platform task ID |
created_at | Unix timestamp in milliseconds |
model | Requested model ID |
request_id | Request identifier returned on submission |
output[].content[].type | image for generated images |
output[].content[].url | Generated image URL |
output[].content[].group_id | Series identifier. Images in the same series share this value and are returned in series order |
A query can return generated images while billing is pending. During that time, usage.cost and usage.quantity may be null.