⌘K

Kirin Image 4.0

kirin_v4_image

Generate independent images or related image series from text, with optional reference images and elements.

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 typeFieldsPurpose
prompttext (string)Describe the image or series to generate
refer_imageurl (string), id (string)Supply a reference image
elementelement_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

FieldOptions or rangeDefault
result_type (string)single for independent images, series for related imagessingle
n (integer)1 to 9 in single mode1
series_amount (integer or string)2 to 10 or "auto" in series mode. With "auto", the model selects the image count4
resolution (string)2k, 4k, 8k2k
aspect_ratio (string)auto, 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9auto

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 responseWhat to do
in_progressContinue polling
completedRead the image URLs from output[].content[].url
failedRead 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.

FieldDescription
idPlatform task ID
created_atUnix timestamp in milliseconds
modelRequested model ID
request_idRequest identifier returned on submission
output[].content[].typeimage for generated images
output[].content[].urlGenerated image URL
output[].content[].group_idSeries 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.