Generate Image
This document describes the /v1/platform API series, supporting image and video generation for Tencent Cloud Hunyuan, Jimeng, Kling and other AIGC models. All APIs are wrapped in a unified format, abstracting underlying differences.
POST /v1/platform/image
Submit an AI image generation task. Tasks execute asynchronously; the API returns task_id. Poll for results via the Query Task API
⚠️ File URLs generated by this API are only retained for 7 days. Please download and save them promptly.
Request Parameters
application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Required | Model identifier, must start with image-. Format: image-{model_name}-{version}, e.g. image-kling-2.1. |
prompt | string | Required | Positive text description for image generation. Supports Chinese and English. Recommend describing scene content, style, composition, etc. in detail. |
negative_prompt | string | Optional | Negative prompt describing content you don't want in the image, e.g. blurry, low quality, watermark. |
enhance_prompt | string | Optional | Whether to enable automatic prompt optimization and enhancement. 可选值: enabled / disabled |
generation_mode | string | Optional | Generation mode. Refer to the model documentation for available values. Examples: image-to-image, inpainting, etc. |
inputs | array | Optional | List of input files for reference images, style images, etc. (image-to-image). ↳ inputs[i] child fields |
output | object | Optional | Output configuration controlling image resolution, storage mode, etc. ↳ output child fields |
input_region | string | Optional | Source region of input material. 可选值: mainland / oversea |
session_id | string | Optional | Deduplication identifier. If a request with the same session_id was made within 3 days, this request returns an error. Max 50 characters. Leave empty to skip deduplication. |
session_context | string | Optional | Source context for passing user request info. The field value is returned in task callbacks. Max 1000 characters. |
ext_info | object | Optional | Reserved field for special purposes. The specific format is determined by the model used. |
inputs[i] child fields
| Field Name | Type | Required | Description |
|---|---|---|---|
url | string | Required | Publicly accessible URL of the input image. Recommend images under 7 MB. Supported formats: jpeg, jpg, png, webp. |
text | string | Optional | Description of the input image to help the model understand the content. Currently only GEM 2.5 and GEM 3.0 are effective. |
output child fields
| Field Name | Type | Required | Description |
|---|---|---|---|
resolution | string | Optional | Resolution of the generated image. Available values per model: • GEM 2.5 / 3.0: 1K、2K、4K,Default 1K• Vidu q2: 1080p、2K、4K,Default 1080p• Kling 2.1: 1k、2k,Default 1k• Hunyuan 3.0: 720P、1080P、2K、4K |
aspect_ratio | string | Optional | Specify the aspect ratio of the generated image. Mutually exclusive with width/height, takes priority. Available values per model:• GEM: 1:1、3:2、2:3、3:4、4:3、4:5、5:4、9:16、16:9、21:9• Qwen:Not supported yet • Hunyuan: 16:9、9:16、1:1、4:3、3:4、3:2、2:3、21:9• Vidu: 16:9、9:16、1:1、3:4、4:3、21:9、2:3、3:2• Kling: 16:9、9:16、1:1、4:3、3:4、3:2、2:3、21:9 |
width | integer | Optional | Output image width (pixels). Auto-calculates aspect ratio when specified with height. Ignored if aspect_ratio is set. |
height | integer | Optional | Output image height (pixels). Used together with width. |
media_name | string | Optional | Output media filename, max 64 characters. Defaults to a system-generated filename. |
class_id | integer | Optional | Category ID for media classification management. Default: 0 (other). |
input_compliance_check | string | Optional | Whether to enable compliance check on input content. 可选值: enabled / disabled |
output_compliance_check | string | Optional | Whether to enable compliance check on output content. 可选值: enabled / disabled |
person_generation | string | Optional | Whether to allow generation of people or faces. 可选值: allow_adult / disallowedallow_adult allows generating adults; disallowed prohibits people or faces in the image. |
Request Example
JSON (Text-to-Image)
{
"model": "image-kling-2.1",
"prompt": "A cute orange cat sitting under a cherry blossom tree, watercolor style, high detail",
"negative_prompt": "blurry, low quality, watermark, distorted",
"enhance_prompt": "enabled",
"output": {
"aspect_ratio": "1:1",
}
}
JSON (Image-to-Image)
{
"model": "image-jimeng-3.0",
"prompt": "Transform the image into cyberpunk neon style",
"generation_mode": "image_to_image",
"inputs": [
{
"url": "https://example.com/source.jpg"
}
],
"output": {
"aspect_ratio": "16:9"
}
}
Response Parameters
| Field Name | Type | Description |
|---|---|---|
task_id | string | Unique task ID for subsequent task status queries. |
status | string | Initial task status, usually queued. |
Response Example
JSON · 200 OK
{
"task_id": "img_abc123xyz456",
"status": "queued"
}