Author’s note: This article explains how to use Tencent Hunyuan Hy-Image 3.5 Preview — with a real photo of the same SKU as the baseline — to generate a croppable, sign-off-ready 4K e-commerce hero image master.
Bottom line up front: When producing 4K e-commerce hero images with Tencent Hunyuan Hy-Image 3.5 Preview, it’s best to work through a fixed sequence. First lock in the 4096×4096 master and the safe area, then use one clean, front-facing real photo as “Image 1” to pin down the product’s appearance. Only add “Image 2” when there’s a specific gap to fill, then send the reference-image request through hy-image-v3.5-preview-4k, and finally check every item against actual pixels and the real photo. The answer depends on three conditions: first, whether the reference image is sharp and shows a single SKU; second, whether content that must match character for character — labels, barcodes — is allowed to be redrawn by the model, and if it isn’t, you should use the “generate the background, composite the real product” approach; third, what the publishing channel requires in terms of aspect ratio and file size.
The API fields, size limits, and pricing in this article follow the public documentation as of 2026-11-25 (Beijing time). The sample product is a fictional dark green pump bottle, and the composition numbers here are production assumptions, not measured results.

Knowledge Map: Hy-Image 3.5 Preview 4K E-commerce Main Image Generation Workflow

Diagram note: The main path is 1→2→3→4. If acceptance fails, there are two routes: composition-related issues go back to step 3 for single-variable revision; text-related issues switch to “background generation + real-shot compositing”. Section 6 covers cost and stability control across steps 3 and 5, while Section 7 is for readers using Tencent’s native API to consult and compare.
Index: How the Sections of the Tencent Hunyuan Hy-Image 3.5 Preview Tutorial Fit Together
| No. | Section Short Name | What It Provides for Later Sections | How to Read |
|---|---|---|---|
| 1 | Set the Delivery Canvas | Master image dimensions and safe area; the baseline for prompt composition and validation | Must-read; do this first |
| 2 | Prepare Reference Images | The division of roles and input specs for “Image 1 / Image 2” | Must-read |
| 3 | Send the Request and Prompt | Copy-ready request body, prompt structure, and code | Must-read |
| 4 | Retrieve and Validate | File checks, content proofreading, and upload requirements | Must-read |
| 5 | Rework and Composite | How to handle failure branches | Read when validation fails |
| 6 | Budget, Timeouts, and Retries | Cost estimation and error handling | Read before launch |
| 7 | Vendor Convention Comparison | Field differences between the APIYI compatibility layer and TokenHub | Consult as needed |
The reason the canvas comes first is that a phrase like “about three-quarters of the canvas height” in the prompt has to be converted into pixels before you can validate it. If the dimensions change later, all the earlier composition and crop calculations have to be redone.
To Know: Terms Related to Hy-Image 3.5 Preview
| Term | Quick Explanation |
|---|---|
| Master image | The highest-resolution original used to check details and crop; in this case, 4096×4096 |
| Safe area | An area reserved on the master image. The subject, labels, and shadows all stay inside it so they won’t be cut off when channels crop the image |
| Image 1 / Image 2 | The 1st and 2nd reference images in the images array, referenced by position in the prompt |
| 4K tier | Billing and size tier where the output pixel area doesn’t exceed 16,777,216 |
| data URI | Encode a local image into a data:image/png;base64,... string and pass it directly |
1 How to Set the 4K Delivery Canvas in Hy-Image 3.5 Preview
1.1 Master Dimensions and the 4K Tier Upper Limit
This example delivers a 1:1 master at 4096×4096—16,777,216 pixels, which is exactly the area cap for the 4K tier. Reference image pixel dimensions and the output canvas are set separately, so whether your actual photo is 3000 px or 2048 px, it doesn’t affect the 4096 square output. When you explicitly pass size in the APIYI compatibility layer, both width and height must be between 256 and 8192, and their product must not exceed 16,777,216. If it does, you’ll get a 400 invalid_size error.
| Output size | Pixel area | Within the 4K tier? | Typical use |
|---|---|---|---|
4096x4096 |
16,777,216 | Yes (upper limit) | 1:1 main image master |
3200x4000 |
12,800,000 | Yes | 4:5 portrait main image |
3840x2160 |
8,294,400 | Yes | 16:9 landscape banner |
| Omit size | Default square | Yes | -4k model default output |
1.2 Draw the Safe Area on the Master First
If the square image also needs to work as a 4:5, you can crop a centered 3200×4000 area: 448 px off each side and 48 px off the top and bottom. Keep the subject, label, and any necessary shadow inside this area. Suppose the bottle height is about three-quarters of the canvas height—3072 px. Centered, it leaves about 512 px above and below. After the center crop, that theoretically still leaves 464 px. If the horizontal margin isn’t enough, don’t force the crop—just generate a separate image using 3200x4000 as its size.

“Three-quarters height” is just a starting point for this example’s composition, not a universal standard. Placement requirements vary by channel and product category and need to be checked separately. For acceptance, go by the actual pixel positions of the cap, base, and contact shadow—not by the prompt description.
2 Preparing “Image 1” and “Image 2” with Product Reference Images
2.1 Image 1: the sole baseline for product appearance
Use a front-facing photo of the same SKU for Image 1, or a real-world shot taken close to the final camera position. Keep the lighting neutral and the background clean; the bottle opening, base, and both sides should be fully in frame, and the pump head structure, color, logo, and capacity markings should all be clearly visible. After shooting, first correct rotation and white balance. For portrait or landscape originals, you can extend the canvas proportionally with a neutral color to make a square image, and keep an unprocessed original for acceptance comparisons.
For the same product set, try to shoot with the same camera position, distance, and lighting. For tricky areas such as translucent parts, metal reflections, and fine graduations, let the main reference image establish the overall structure first, then use detail shots to fill in the transparent edges or graduation details.
2.2 Image 2: solve only one specific detail
Image 2 is there to fill gaps—for example, a close-up of the label on the same bottle to verify the wording and layout. The camera position and bottle shape should still follow Image 1. For the first round, it’s best to use only Image 1, then add more images once you’ve identified a specific gap. Handle different variants, colors, or accessories separately; otherwise, the model may merge two products into one. If other products appear in a background reference image, crop out a clean background area before using it.
2.3 Input specs
| Item | Requirement |
|---|---|
| Format | PNG, JPEG, WebP |
| Per-image limit | 20 MB; the documentation notes a maximum of 20 images under the vendor’s constraints |
| Recommended size | Longest side no more than 2048 pixels; about 6 MB combined across multiple images |
| Online images | Public URLs that the server can access directly; links that require an authenticated session, have hotlink protection, or have expired signatures will fail to fetch |
| Local images | Convert to data:image/png;base64,... or data:image/jpeg;base64,... |
| Order | Array position corresponds to Image 1 and Image 2 in the prompt |
🎯 Technical tip: Before doing a formal batch generation, we recommend running a single-image request on APIYI apiyi.com with one front-facing real photo to confirm that image fetching, sizing, and response format all work. Then add Image 2.
3 Calling the Hy-Image 3.5 Preview 4K Reference Image API
3.1 Request Structure
Use a token from the Default group and send JSON to POST /v1/images/generations, with Authorization: Bearer <密钥> and Content-Type: application/json in the request headers. For new integrations, we recommend using the plural images array; older clients can still use the singular image, or go through the multipart POST /v1/images/edits. A synchronous request always returns exactly one image — if you need multiple candidates, submit them as separate requests and simply omit the n parameter.
3.2 Three-Part Prompt Structure
Prompts are organized into three parts: first lock down the product’s features, then spell out what can be changed (background and lighting), and finally define the delivery composition. You can copy the request body below as-is — just swap the two example URLs for your own direct image links:
{
"model": "hy-image-v3.5-preview-4k",
"size": "4096x4096",
"response_format": "url",
"images": [
"https://example.com/sku-front.png",
"https://example.com/sku-label.png"
],
"prompt": "以图1为商品唯一外观基准,图2只作原标签外观参考。保留原瓶身轮廓、墨绿瓶色、泵头结构、材质、商标位置和标签相对尺寸,维持图1正面机位。生成一张方形电商棚拍主图,单瓶居中竖立,约占画布高度的四分之三,泵头、瓶底和两侧全部入镜。使用干净的纯白背景、柔和中性光和浅接触阴影。保留商品包装原有标签,不添加商品、配件、文字、促销贴片或装饰。"
}
When you’re working with a front-facing shot only in the first round, drop the second item from the array and remove the constraints about image 2 from the prompt as well.
3.3 Minimal Python Example
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.apiyi.com/v1" # APIYI OpenAI-compatible endpoint
payload = {
"model": "hy-image-v3.5-preview-4k",
"size": "4096x4096",
"response_format": "url",
"images": ["https://example.com/sku-front.png"],
"prompt": "以图1为商品唯一外观基准……纯白背景,单瓶居中竖立……",
}
resp = requests.post(f"{BASE_URL}/images/generations",
headers={"Authorization": f"Bearer {API_KEY}"},
json=payload, timeout=240)
resp.raise_for_status()
img_url = resp.json()["data"][0]["url"]
open("sku001_v1_4096.png", "wb").write(requests.get(img_url, timeout=120).content)
View the full implementation (local image to data URI, Base64 mode, on-disk validation, and logging)
import base64, json, time, requests
from datetime import datetime
from PIL import Image
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.apiyi.com/v1" # Same APIYI endpoint as in the minimal example
def to_data_uri(path: str) -> str:
mime = "image/png" if path.lower().endswith(".png") else "image/jpeg"
with open(path, "rb") as f:
return f"data:{mime};base64,{base64.b64encode(f.read()).decode()}"
def generate(sku, version, images, prompt, size="4096x4096", use_b64=False):
payload = {
"model": "hy-image-v3.5-preview-4k",
"size": size,
"images": images,
"prompt": prompt,
}
if not use_b64:
payload["response_format"] = "url" # omit this field to default to Base64
timeout = 360 if use_b64 else 240 # give 4K plenty of time to come back
started = datetime.now().isoformat()
for attempt in range(3):
try:
r = requests.post(f"{BASE_URL}/images/generations",
headers={"Authorization": f"Bearer {API_KEY}"},
json=payload, timeout=timeout)
except requests.Timeout:
# After a timeout the platform may have already finished and billed the request: check logs and billing first, don't resend automatically
raise RuntimeError("超时,请先在控制台核对本次请求日志")
if r.status_code == 200:
break
if r.status_code in (429, 500) and attempt < 2:
time.sleep(2 ** attempt * 5) # back off only on clear transient errors
continue
# 400: fix the parameters first; 401: check the token; 503: check the model and group
raise RuntimeError(f"{r.status_code}: {r.text[:300]}")
data = r.json()["data"][0]
out = f"{sku}_{version}_{size}.png"
if use_b64:
open(out, "wb").write(base64.b64decode(data["b64_json"]))
else:
open(out, "wb").write(requests.get(data["url"], timeout=120).content)
im = Image.open(out)
record = {"sku": sku, "version": version, "size": size, "file_size": im.size,
"format": im.format, "prompt": prompt, "started": started,
"request_id": r.headers.get("x-request-id")}
with open("render_log.jsonl", "a", encoding="utf-8") as f:
f.write(json.dumps(record, ensure_ascii=False) + "\n")
return out
generate("SKU001", "v1",
[to_data_uri("sku-front.jpg")],
"以图1为商品唯一外观基准……纯白背景、柔和中性光和浅接触阴影……")
🚀 Quick start: APIYI (apiyi.com) provides an OpenAI-compatible interface — a single API key is all you need to call Hunyuan image generation and other mainstream models. New users get free trial credits, so you can run one SKU through the whole flow first.
4 Retrieving and Validating 4K Main Images from Hy-Image 3.5 Preview
4.1 Get the File First
In URL mode, download the original file from data[0].url. In the default Base64 mode, pull the raw Base64 from data[0].b64_json and decode it into a PNG. Once the file is written to disk, read its dimensions, format, and file size, confirm it’s 4096×4096, and only then move on to content review. Every time you generate an image, log the SKU, reference-image version, model, dimensions, prompt, start time, and request ID so rework and reconciliation are easier later.
4.2 Then Check the Content
Place the finished image next to the actual product photo. Start with the thumbnail and check the silhouette and placement. Then, at native pixel scale, inspect color, bottle-shoulder seams, label text, accessory count, edge aliasing, reflections, and shadows item by item. For a white-background main image, also check the four corners and the area around the subject for light-gray borders, dust spots, and color banding introduced by compression. Details like capacity and accessory count need to be verified against the original product data, one by one.
4.3 Uploaded Files Need a Separate Acceptance Check
Take Google Merchant Center’s image_link as an example: a single file must stay under 16 MB, the main image has to show the exact product, promotional text isn’t allowed, and generative AI images need to retain the appropriate metadata. APIYI’s public 4K reference-image sample PNG is around 18–19 MB, which is already over that limit. So keep the PNG master, export a separate JPEG that meets the channel’s requirements, and double-check sharpness and IPTC source tags. Save the master, the published file, and the original reference image separately under the SKU plus a version number.
5 Hy-Image 3.5 Preview: Main Image Retouching and Photo Compositing
5.1 Single-variable retouching
Change only one factor per retouch. The APIYI compatibility layer submits each request one at a time, so every round has to re-pass the original real photo as image 1. If you need to carry over the previous version’s layout, you can pass the previous version as an extra reference image and note in the prompt that it’s only for composition.
- Not enough edge whitespace: “Shrink the bottle, keep the camera angle and label position.”
- Background cleanup only: “Keep the product, camera angle, and framing from image 1; just make the background uniformly white and soften the shadow at the bottom.”
- Bottle cap or label distortion: use the real photo to emphasize that detail again.
- Dark bottle body merging into the shadow: ask for soft light coming from the side-front toward the base of the bottle, and lighten the shadow.
5.2 Generate the background, composite the real subject
For anything that must match character for character — labels, barcodes, specifications — the safest route is to keep the real subject and let the model generate only the white background and lighting. A background prompt might look like this: “Keep a large blank area in the center of the frame, generate a pure white seamless studio paper backdrop, with only a soft, light shadow on the floor slightly right of center; no products, display stands, or text in the background.” When compositing, paint in a contact shadow at the subject’s actual landing point, and check the semi-transparent edges and the original label. Pull marketing slogans, volume, and campaign details from the product materials and lay them out separately according to each channel’s rules — don’t hand that to the model.
6 Hy-Image 3.5 Preview 4K Budget, Timeout, and Retries

Estimate cost based on the number of successfully generated images. The Default list price is $0.030 per 4K image; the number of reference images, the size, and the return format don’t affect the tier price. Candidates that return successfully but show distorted product appearance are billed too; the usage field in the response is just a compatibility placeholder, and actual billing is determined by the console.
| Plan | Calculation | API fee |
|---|---|---|
| 3 4K candidates, pick 1 | 3×0.030 | $0.090 |
| 2 2K draft compositions + 1 4K | 2×0.022+0.030 | $0.074 |
Note that after you nail a satisfactory composition at 2K, 4K regenerates the image, and final acceptance is still based on the newly generated 4K output.
| Case | Handling |
|---|---|
| 400 size-related errors | Fix size first; don’t retry as-is |
| 401 | Check the token |
| 503 no available channels | Check the model name and group |
| Explicit temporary rate limiting or service errors | Limited backoff retries |
| Moderation block | Adjust the prompt or the reference image content |
| Client disconnect or timeout | Check this request’s logs and billing first; the platform may have already completed generation and billed you |
| Got a URL but download failed | Re-check the same link, or switch to server-side download and storage |
The explicit failures listed in the FAQ, such as 400, 401, 500, and 503, aren’t billed. We recommend a client timeout of 240 seconds, or 360 seconds in Base64 mode; if you’re going through a proxy or Serverless, the response body limit should be at least 30 MB.
💰 Cost optimization: We recommend settling the composition at the 2K tier first, then producing the 4K master. In the APIYI apiyi.com console you can verify billing per request, which makes it easy to record each SKU’s image generation cost in your ledger.
7 Tencent Hunyuan Hy-Image 3.5 Preview: Side-by-Side with the Vendor’s Own Specs (Consult As Needed)
The APIYI compatibility layer supports a custom size. If you see an index summary claiming a “fixed 4096×4096”, go by the field documentation for the current endpoint. The compatibility layer submits one reference image task at a time; the dedicated fields for session history and watermarks belong only to Tencent’s native Chat/Messages API.
| Item | APIYI compatibility layer | Tencent Cloud TokenHub (China site) |
|---|---|---|
| Endpoint | /v1/images/generations |
/v1/wand/hunyuan-image/v35-generation |
| Model | hy-image-v3.5-preview-4k |
hy-image-v3.5-preview |
| Reference image | images array |
image_url entries inside messages |
| Exact 4K | size: "4096x4096" |
Top-level size: "4096x4096"; generate_max_pixels caps at 2K |
| Input area | Long edge ≤2048 recommended | resize_max_pixels defaults to 1,048,576 |
| Image retrieval | data[0].url / b64_json |
choices[0].delta.image.url, signed URL valid for 12 hours by default |
| Continuous editing | Submit one at a time, re-uploading image 1 | Concatenate the previous round’s messages with assembled_history |
| Available platforms | APIYI apiyi.com | Tencent Cloud TokenHub |
When you’re using the vendor’s native API, put {"type":"text","text":"提示词"} first in the content array of the last role: "user" message, then add one image_url object per image, in order. The “4K” here refers to the output file specs defined in the documentation.
Pre-Delivery Checks
A main image is ready for delivery only when it passes all three checks:
- The file is 4096×4096, and the subject stays within the 3200×4000 safe zone.
- When compared side by side with an actual product photo, there are no deviations in bottle shape, color, label, or accessories.
- The exported file meets the target channel’s requirements for file size and metadata.
If any check fails, use Section 5 to choose the rework or compositing route.
📚 References
- APIYI Hunyuan reference image API: request fields, input specifications, and size tiers
- Link:
docs.apiyi.com/api-capabilities/hunyuan-image/image-edit
- Link:
- APIYI Hunyuan FAQ: error codes, billing, and timeout recommendations
- Link:
docs.apiyi.com/api-capabilities/hunyuan-image/faq
- Link:
- Tencent Cloud TokenHub invocation guide: native Messages API and parameters
- Link:
cloud.tencent.com/document/product/1823/135745
- Link:
- Google Merchant Center main image rules: upload file size and AI image metadata
- Link:
support.google.com/merchants/answer/6324350
- Link:
Author: APIYI Technical Team
Technical support: Feel free to contact us through the APIYI homepage. For more API documentation, visit the docs.apiyi.com documentation center.
