Skip to main content

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
ParameterTypeRequiredDescription
modelstringRequiredModel identifier, must start with image-. Format: image-{model_name}-{version}, e.g. image-kling-2.1.
promptstringRequiredPositive text description for image generation. Supports Chinese and English. Recommend describing scene content, style, composition, etc. in detail.
negative_promptstringOptionalNegative prompt describing content you don't want in the image, e.g. blurry, low quality, watermark.
enhance_promptstringOptionalWhether to enable automatic prompt optimization and enhancement.
可选值:enabled / disabled
generation_modestringOptionalGeneration mode. Refer to the model documentation for available values. Examples: image-to-image, inpainting, etc.
inputsarrayOptionalList of input files for reference images, style images, etc. (image-to-image).
↳ inputs[i] child fields
outputobjectOptionalOutput configuration controlling image resolution, storage mode, etc.
↳ output child fields
input_regionstringOptionalSource region of input material.
可选值:mainland / oversea
session_idstringOptionalDeduplication 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_contextstringOptionalSource context for passing user request info. The field value is returned in task callbacks. Max 1000 characters.
ext_infoobjectOptionalReserved field for special purposes. The specific format is determined by the model used.
inputs[i] child fields
Field NameTypeRequiredDescription
urlstringRequiredPublicly accessible URL of the input image. Recommend images under 7 MB. Supported formats: jpeg, jpg, png, webp.
textstringOptionalDescription 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 NameTypeRequiredDescription
resolutionstringOptionalResolution 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_ratiostringOptionalSpecify 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
widthintegerOptionalOutput image width (pixels). Auto-calculates aspect ratio when specified with height. Ignored if aspect_ratio is set.
heightintegerOptionalOutput image height (pixels). Used together with width.
media_namestringOptionalOutput media filename, max 64 characters. Defaults to a system-generated filename.
class_idintegerOptionalCategory ID for media classification management. Default: 0 (other).
input_compliance_checkstringOptionalWhether to enable compliance check on input content.
可选值:enabled / disabled
output_compliance_checkstringOptionalWhether to enable compliance check on output content.
可选值:enabled / disabled
person_generationstringOptionalWhether to allow generation of people or faces.
可选值:allow_adult / disallowed
allow_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 NameTypeDescription
task_idstringUnique task ID for subsequent task status queries.
statusstringInitial task status, usually queued.

Response Example​

JSON · 200 OK
{
"task_id": "img_abc123xyz456",
"status": "queued"
}