tencent cloud

LLM Service TokenHub

MiniMax Image Generation API Guide

ダウンロード
フォーカスモード
フォントサイズ
最終更新日: 2026-11-25 16:56:04
AI翻訳

Overview

MiniMax H3-Image is a series of image generation models launched by MiniMax. This document describes how to call MiniMax image generation models (minimax-image-h3 / minimax-image-h3-highspeed) through TokenHub: submit text-to-image or image editing requests using an OpenAI Images-style protocol, receive image results synchronously, and leverage capabilities such as text-based image generation, multi-image reference editing, custom dimensions/aspect ratios, and output format control.
Note:
This API uses synchronous calls: a single request directly returns the generated result without requiring task submission or polling. The server performs asynchronous inference internally and waits until the final state is reached, then returns the original final image from the model provider to the caller as is.

Prerequisites

You have registered a Tencent Cloud account and activated the TokenHub service.
You have obtained an API Key from the TokenHub console.
Enable postpaid billing for the corresponding model in Console - Online Inference - Vision Models.
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
Brief Description
MiniMax H3-Image
minimax-image-h3
Text-to-image generation/image editing (synchronous)
Standard quality. Supports text-to-image generation and multi-image reference editing, with balanced overall performance.
MiniMax H3-Image Highspeed
minimax-image-h3-highspeed
Text-to-image generation/image editing (synchronous)
High-speed version. Provides faster generation speed and is suitable for latency-sensitive scenarios.

Text-to-Image Generation

1. API Description

Describe the target image with a text prompt, and generate the image synchronously. You can specify parameters such as output size, aspect ratio, and output format.
API: POST https://tokenhub-intl.tencentcloudmaas.com/v1/wand/minimax-image/generation

2. Input Parameters

Parameter Name
Required
Type
Description
model
Yes
string
Model ID. Values: minimax-image-h3 or minimax-image-h3-highspeed. Cannot be empty.
prompt
No
string
Text description of the image. Maximum 32,000 characters (counted by Unicode characters, excluding leading and trailing whitespace). Returns 400 if empty or containing only whitespace. When Prompt enhancement is disabled (disable_prompt_enhanced is true), the model reads only approximately the first 4,096 tokens, and the excess part does not take effect.
n
No
integer
Number of generated images. Value range: [1,10]. Default value: 1.
size
No
string
Generated size. Format: ${width}x${height} (for example, 2720x1536). Width and height are positive integers. The area (width × height) must be between 655,360 and 20,000,000 pixels, and the aspect ratio must be between 1:3 and 3:1, both inclusive. If these conditions are not met, 400 is returned, and the image is not automatically scaled or rounded. In this case, aspect_ratio or area cannot be passed. If neither is passed, the model determines the size. Alternatively, "auto" can be passed to let the model automatically select the optimal size based on the prompt semantics.
aspect_ratio
No
string
Output aspect ratio. Default value: auto. Can only be passed when size is not passed or is auto. auto: determined by Prompt enhancement based on the reference image and content to decide X:Y. X and Y are integers from 1 to 300, and the aspect ratio is between 1:3 and 3:1 (inclusive), such as 16:9, 3:4, 21:9, 3:1.
area
No
string
Output area tier. Supported values: 1K, 2K, 4K. Default value: 4K. Can only be passed when size is not passed or is auto. If size is in width x height format, 400 is returned. The target areas for 1K, 2K, and 4K are 1024 × 1024, 2048 × 2048, and 4096 × 4096 pixels respectively. The width and height are calculated by the server based on the aspect ratio. For example, 2K with 16:9 outputs 2720 × 1536. For the actual width and height of each image, see data[].size.
output_format
No
string
Output image format. Supported values: "jpeg", "png", "webp". Default value: "jpeg".
response_format
No
string
Image return format. Supported values: "url" (returns the image URL, default) and "b64_json" (returns base64 encoding).
output_compression
No
integer
Output image compression quality. Value range: [0, 100]. Default value: 95. A higher value indicates higher quality. Only effective for jpeg/webp formats.
aigc_watermark
No
boolean
Whether to overlay a visible AIGC watermark on the generated image. false: Do not add a watermark (default); true: Add a watermark.
disable_prompt_enhanced
No
boolean
Whether to disable Prompt enhancement (automatic prompt optimization on the model side). false: Enable enhancement (default); true: Disable enhancement and generate images strictly based on the original prompt.

3. Sample Request

Text-to-Image (Basic):
curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/minimax-image/generation' \\
-H 'Authorization: Bearer YOUR_API_KEY' \\
-H 'Content-Type: application/json' \\
-d '{
"model": "minimax-image-h3",
"prompt": "An orange cat basking in the sun on a windowsill, blurred city street in the background, warm tones, realistic style"
}'
Text-to-Image (Specified Size and Format):
curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/minimax-image/generation' \\
-H 'Authorization: Bearer YOUR_API_KEY' \\
-H 'Content-Type: application/json' \\
-d '{
"model": "minimax-image-h3",
"prompt": "A cyberpunk city at night, neon lights reflected on the streets after the rain",
"size": "2720x1536",
"output_format": "jpeg",
"response_format": "url"
}'
Text-to-Image (High-Speed, Specified Aspect Ratio):
curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/minimax-image/generation' \\
-H 'Authorization: Bearer YOUR_API_KEY' \\
-H 'Content-Type: application/json' \\
-d '{
"model": "minimax-image-h3-highspeed",
"prompt": "A minimalist product poster with a white background and a bottle of perfume in the center",
"aspect_ratio": "9:16",
"output_format": "png"
}'

Image Editing

1. API Description

Describe your editing intent with a text prompt, provide one or more reference images, and generate the edited image synchronously. This feature supports scenarios such as background replacement, style transfer, partial editing, and multi-image fusion.
API: POST https://tokenhub-intl.tencentcloudmaas.com/v1/wand/minimax-image/edits

2. Input Parameters

In addition to the text-to-image parameters, the following parameters are also supported:
Parameter Name
Required
Type
Description
images
No
array[object]
Reference image list, 1 to 16 images. Each element is structured as {"image_url": "..."} or {"url": "..."} (both field names are compatible). Supports http(s) public network URLs or the data:image/...;base64,... format. In multi-image scenarios, the model comprehensively uses all reference images for editing.
Other parameters (model, prompt, n, size, aspect_ratio, output_format, and so on) are exactly the same as those of the text-to-image API. See the parameter table above.

3. Sample Request

Single-Image Reference Editing:
curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/minimax-image/edits' \\
-H 'Authorization: Bearer YOUR_API_KEY' \\
-H 'Content-Type: application/json' \\
-d '{
"model": "minimax-image-h3",
"prompt": "Keep the person unchanged and replace the background with a beach at sunset",
"images": [
{"image_url": "https://your-domain/portrait.jpg"}
],
"response_format": "url"
}'

Output Parameters

The response structure of the text-to-image and image editing APIs is the same. Both are directly passed through as the original MiniMax raw response.
Parameter Name
Type
Description
created
integer
Unix timestamp in seconds.
data
array
List of generated results. Each element contains url (image URL, when response_format=url) or b64_json (base64 encoding, when response_format=b64_json).
tokenhub_usage
object
Number of tokens consumed by this task, used for billing/reconciliation.
request_id
string
Request id. Include it when troubleshooting.

Response Example

Success Response:
{
"created": 1794385455,
"data": [
{
"revised_prompt": "The image is a realistic ......",
"size": "3552x4736",
"url": "https://xxx.png"
}
],
"output_format": "jpeg",
"request_id": "6e44b701-e024-426a-bb00-839553cb58c9",
"tokenhub_usage": {
"total_tokens": 44547
}
}

FAQs

Do Links to Generated Result Images Expire?

The generated result is a temporary address that expires in 12 hours. Download and save it promptly after the task succeeds.



ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック