tencent cloud

LLM Service TokenHub

Hy Image Generation API Guide

Unduh
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-09-10 22:08:17
Diterjemahkan oleh AI

Overview

Hunyuan Image Generation is a series of image generation models launched by Tencent Hunyuan. This document describes how to call the Hunyuan image generation model Hy-Image-3.0 (hy-image-v3) through TokenHub: generate images synchronously from text prompts, with support for custom dimensions, generation seeds, automatic prompt rewriting, and image watermark footnotes.
Note:
This API uses synchronous calls: a single request directly returns the generated result without requiring task submission or polling.

Prerequisites

You have registered a Tencent Cloud account and activated the TokenHub service.
You have obtained an API Key from the TokenHub console.
Note:
In all examples below, YOUR_API_KEY must be replaced with your own API Key. The authentication method is the request header Authorization: Bearer YOUR_API_KEY.

Model List

Model Name
model Parameter Value
Supported Capability
Prompt Limit
Size Range
Brief Description
Hy-Image-3.0
hy-image-v3
Text-to-image/reference-based image generation (synchronous)
8192 characters
Width and height [512, 2048], area ≤ 1024×1024
Supports automatic prompt rewriting, 37 preset sizes, and custom watermark footnotes.

Text-to-Image Generation

1. API Description

Enter a text prompt to generate an image synchronously. If size is not passed and the prompt specifies a size or aspect ratio, the model selects the closest match from 37 preset combinations. If neither is specified, the model predicts automatically. For details, see Appendix: Preset Size List.
API: POST https://tokenhub-intl.tencentcloudmaas.com/v1/wand/hunyuan-image/v3-generation

2. Input Parameters

Parameter Name
Required
Type
Description
model
Yes
string
Model ID. Value: hy-image-v3
prompt
Yes
string
Text used for image generation. The string length cannot exceed 8192 characters.
images
No
array[string]
Reference images, 0 to 3. Supports image URL or Base64. Format png/jpeg/jpg; size no more than 10 MB.
size
No
string
Generated size, format ${width}x${height}.
Constraints:
1. Both width and height must be within the range of [512, 2048] pixels.
2. The product of width and height (image area) must not exceed 1024×1024 pixels.
If not specified, the model selects/predicts from 37 preset combinations. For details, see Appendix: Preset Size List.
seed
No
integer
Generation seed. Range [1, 4294967295]. Takes effect only when the number of generated images is 1. If not specified or set to 0, a random seed is used by default.
footnote
No
string
Custom watermark content, limited to 16 characters (regardless of Chinese or English), generated in the lower right corner of the image.
revise
No
boolean
Whether to rewrite the prompt.

3. Sample Request

curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/hunyuan-image/v3-generation' \\
-H 'Authorization: Bearer YOUR_API_KEY' \\
-H 'Content-Type: application/json' \\
-d '{
"model": "hy-image-v3",
"prompt": "An orange kitten on the windowsill looks toward the camera",
"size": "1024x1024"
}'

4. Output Parameters

Parameter Name
Type
Description
id
string
id of this request.
created
integer
Unix timestamp.
data
list
Array of returned image generation content.
data[n].url
string
The generated image URL is a temporary address valid for 12 hours. Download and save it promptly.
data[n].revised_prompt
string
The revised prompt, returned when revise is enabled.
request_id
string
Unique request identifier used for troubleshooting.
tokenhub_usage
object
Usage consumption.
tokenhub_usage.total_tokens
integer
Number of tokens consumed by this task, used for billing/reconciliation.

5. Sample Response

{
"id": "4-WandImage-a786becfdc80433b8cff4aa344c8fd3d",
"created": 1785125529,
"data": [
{
"url": "https://aigc-image.cos.myqcloud.com/xxx/result.png",
"revised_prompt": "An orange kitten sits on a sunlit windowsill, turns to look at the camera, with detailed fur and a blurred background"
}
],
"request_id": "3aec3299-06ad-4654-8b45-c57b823a15d2",
"tokenhub_usage": {
"total_tokens": 1024
}
}
The returned url is a temporary address valid for 12 hours. Because the address includes authentication checks, accessing it directly through the browser address bar may be rejected. We recommend downloading it in the following ways:
curl -o generated_image.png 'https://aigc-image.cos.myqcloud.com/xxx/result.png'
Or use an HTTP client in your code to download and save it to local storage.

6. Error Codes

HTTP Status Code
Description
Handling Recommendation
400
The request format is incorrect.
Check the field types/values in the request body (such as size constraints, prompt length, and model name).
401
Authentication failed.
Check whether the API_KEY is valid and whether Authorization uses the Bearer format.
422
Input or output moderation failed (content security interception).
Input or output triggers content security moderation. Adjust the prompt or business policy.
429
The number of concurrent requests exceeds the limit.
The concurrency limit is reached. Retry with backoff and control the call concurrency.
500
Internal error.
A server exception occurs. Retry the request. If the failure persists, contact technical support and provide the request_id.

Appendix

Preset Size List

When size is not passed, the model selects/predicts from the following 37 combinations. When size is passed, the constraints must be met (width and height ∈ [512, 2048], product ≤ 1024×1024). The format is "width x height":
2048 x 512
1984 x 512
1920 x 512
1856 x 512
1792 x 512
1728 x 512
1664 x 512
1600 x 512
1536 x 512
1472 x 576
1408 x 640
1344 x 704
1280 x 768
1216 x 832
1152 x 896
1088 x 960
1024 x 1024
960 x 1088
896 x 1152
832 x 1216
768 x 1280
704 x 1344
640 x 1408
576 x 1472
512 x 1536
512 x 1600
512 x 1664
512 x 1728
512 x 1792
512 x 1856
512 x 1920
512 x 1984
512 x 2048
768 x 1024
720 x 1280
1024 x 768
1280 x 720
-
-

FAQs

1. How Do I Pass the size Parameter?

The format of size is ${width}x${height} (for example, 1024x1024). Both width and height must be within the range of [512, 2048], and the area must not exceed 1024×1024. We recommend using the combinations in Appendix: Preset Size List directly. If size is not passed, you can describe the aspect ratio in the prompt (for example, "landscape 16:9"), and the model will automatically select the closest preset size.

2. Should revise (prompt Rewriting) Be Disabled?

When rewriting is enabled, the model automatically rewrites and optimizes the prompt to improve image generation results, which takes about 11 seconds. We recommend disabling it only if you have implemented your own prompt rewriting logic. Otherwise, image generation results may be significantly affected.

3. When Does seed Take Effect?

This parameter takes effect only when the number of generated images is 1, with a range of [1, 4294967295]. If it is not passed or is set to 0, a random seed is used. To reproduce the same result, fix the seed and prompt.

4. Do Generated Image Links Expire?

The generated result is a temporary address that expires in 12 hours. Download the image from data[n].url promptly after generation and save it to your own storage. Do not rely on this link for a long time.


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan