> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apiyi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tencent Hunyuan Hy-Image 3.5 Preview Image Generation

> Tencent Cloud official-relay Hunyuan Hy-Image-3.5-preview image models: hy-image-v3.5-preview-2k / -4k with fixed 2K/4K output, text-to-image and reference-image generation, $0.022 and $0.030 per image at official parity; top-up bonuses bring the effective price to about 83–91% of list. Flat per-image pricing, strong Chinese text rendering and multi-reference input.

## Overview

**Tencent Hunyuan Hy-Image 3.5 Preview** (official model ID `hy-image-v3.5-preview`) is a preview image-generation model released by Tencent Hunyuan on 2026-09-22 (UTC+8). The native API uses a Chat/Messages protocol and supports text-to-image, reference-image generation, multi-turn editing, chain-of-thought rewriting, and search augmentation, with output up to 4096×4096 (4K).

APIYI offers two fixed-resolution models through the Tencent Cloud official channel (official relay), both on the same OpenAI Images-compatible endpoint:

* **`hy-image-v3.5-preview-2k`**: fixed **2048×2048**, \$0.022 per image
* **`hy-image-v3.5-preview-4k`**: fixed **4096×4096**, \$0.030 per image

The official price is ¥0.15 per image for 1K/1.5K/2K and ¥0.20 for 4K. APIYI converts at a **fixed 1:7 exchange rate** and pins the output to 2K or 4K, so billing stays simple and the 2K model delivers the highest resolution in the official same-price tier.

> [!NOTE]
>
> **🎨 Highlights**: **fixed 2K/4K output** (`-2k` at 2048×2048, `-4k` at 4096×4096, regardless of `size`), **accurate Chinese text rendering** (poster titles, dates, and locations), **multi-reference generation** (the `images` array accepts URLs or data URIs), **flat per-image pricing** (reference count and response format do not add cost), and **official price parity** (fixed 1:7 conversion). Built for posters, e-commerce hero images, film assets, and social media visuals.

> [!WARNING]
>
> **📌 Four things to know before you start**
>
> 1. **Use `/v1/images/generations` (JSON) as the primary path.** The multipart `/v1/images/edits` endpoint still works, but it only outputs 1536×1536 and does not use the 2K/4K override. It is not recommended.
> 2. **Do not pass `size`.** `-2k` is fixed at 2048×2048 and `-4k` at 4096×4096. Values such as `1024x1024`, `4096x4096`, or invalid strings are all overridden by the model's fixed resolution.
> 3. **Use the `images` array for reference images.** The legacy `image` field goes through the edit path and outputs only **1536×1536** without `size`. Pass `size` explicitly for 2K/4K, but billing is still the model's flat price.
> 4. **Responses default to `b64_json`.** A 2K image is roughly 6–10 MB and a 4K image 20–26 MB after base64 encoding. Pass `response_format: "url"` to receive a CDN URL instead.

> [card] [Text-to-Image API](https://docs.apiyi.com/en/api-capabilities/hunyuan-image/text-to-image.md)
>
> `POST /v1/images/generations` generates 2K/4K images from a prompt, with an interactive Playground.

> [card] [Reference-Image API](https://docs.apiyi.com/en/api-capabilities/hunyuan-image/image-edit.md)
>
> Pass 1–20 reference images in the `images` array with an instruction; output stays fixed at 2K/4K.

> [card] [Agent Skill](https://docs.apiyi.com/en/api-capabilities/hunyuan-image/skills.md)
>
> Package Hunyuan image generation as a drop-in Agent Skill for Codex, Claude Code, or Cursor.

> [card] [FAQ](https://docs.apiyi.com/en/api-capabilities/hunyuan-image/faq.md)
>
> `images` vs `image`, default base64, 4K timeouts, billing, and error codes.

## Let an AI Agent Do the Integration

**Copy this prompt and paste it into Codex / Claude Code / Cursor**

It first fetches the plain-text version of this page (append `.md` to any docs URL), then writes code for your stack. It already accounts for the high-frequency traps: `size` is overridden, `images` and `image` produce different output sizes, default responses are large base64 payloads, and 4K needs a longer timeout.

\> Help me integrate / troubleshoot Tencent Hunyuan Hy-Image 3.5 Preview text-to-image and reference-image generation in this project.
\>
\> Read the docs first: fetch `https://docs.apiyi.com/en/api-capabilities/hunyuan-image/overview.md` for the plain-text version of this page. For parameter details, append `.md` to the text-to-image and image-edit pages as well.
\>
\> 1. Model IDs: `hy-image-v3.5-preview-2k` (fixed 2048×2048) or `hy-image-v3.5-preview-4k` (fixed 4096×4096). Do not pass `size`; it is overridden anyway.

10 requirements in total. Use the button below to copy the full prompt.

Help me integrate / troubleshoot Tencent Hunyuan Hy-Image 3.5 Preview text-to-image and reference-image generation in this project.

Read the docs first: fetch [https://docs.apiyi.com/en/api-capabilities/hunyuan-image/overview.md](https://docs.apiyi.com/en/api-capabilities/hunyuan-image/overview.md) for the plain-text version of this page. For parameter details, append `.md` to the text-to-image and image-edit pages as well.

Requirements:

1. Model IDs: `hy-image-v3.5-preview-2k` (fixed 2048×2048, \$0.022 per image) or `hy-image-v3.5-preview-4k` (fixed 4096×4096, \$0.030 per image). **Do not pass `size`**; it is overridden by the model. `n` is fixed at 1; send concurrent requests for multiple images.

2. Endpoint: use `POST https://api.apiyi.com/v1/images/generations` (JSON). Do not use `/v1/chat/completions` or `/v1/responses`. The multipart `/v1/images/edits` endpoint works but only outputs 1536×1536; do not use it as the primary path.

3. Reference images: use the `images` array. Items may be public URLs or `data:image/...;base64,...`. The `images` path always outputs 2K/4K. The legacy `image` field outputs **1536×1536** without `size`; pass `size` explicitly for 2K/4K, but billing remains the model's flat price. **`prompt` is required**; an image without a prompt returns 400.

4. Response handling: the default is `data[0].b64_json` (plain base64, no `data:` prefix). A 2K image is about 6–10 MB and a 4K image 20–26 MB. Pass `response_format: "url"` to receive a stable URL on `hdcdn.agisuitepro.com`. That URL works in `<img>`, but CORS preflight returns 403, so browser `fetch` / canvas access needs your own server-side proxy.

5. Timeouts: this is a synchronous API with no task ID. If the client disconnects, the result is lost but the request is usually still billed. Use a client timeout of at least 120 seconds for 2K, 240 seconds for 4K, and 360 seconds for 4K base64. Raise the limits of reverse proxies, serverless functions, and gateways as well.

6. Content moderation: blocked prompts return **HTTP 400** with `code` / `type` set to `content_safety_violation` and the message `Input Prompt violates policy`. This is deterministic; **do not retry**. Rewrite the prompt.

7. `response_format` accepts only `b64_json` or `url`. Invalid values such as `webp` silently fall back to base64; do not rely on them. `quality`, `style`, and `output_format` have no effect; remove them.

8. Billing: flat per-model pricing. `size`, `response_format`, and reference-image count do not affect the price. Failed requests are not billed. List prices match the official list; top-up bonuses bring the effective price to about 83–91% of list. See [Top-up Bonuses](https://docs.apiyi.com/en/faq/recharge-promotions.md). The `usage` object is a placeholder (`prompt_tokens` is always 1000) and cannot be used for reconciliation.

9. Read the key from the `APIYI_API_KEY` environment variable and use `https://api.apiyi.com/v1` as `base_url`. Do not hardcode or commit the key.

10. After the change, run one text-to-image request and one reference-image request, then report the outputs and the cost of both calls.

> [accordion] What this prompt saves you from
>
> | Requirement | Trap avoided |
> | - | - |
> | Do not pass `size` | Passing 1024 does not reduce cost or change output; passing 4096 still returns 2K |
> | Use `images` for references | Using `image` silently returns 1536×1536 while charging the 2K price |
> | Handle large base64 and long timeouts | 4K responses reach 20–26 MB and get truncated by clients or proxies |
> | Do not retry moderation 400s | Retrying a deterministic content block wastes time and may trigger more calls |
> | Do not use chat / responses | Chat-style clients send every model to chat endpoints and fail here |
> | Use URL mode for the web | Sending a 26 MB base64 string to the browser exhausts memory |

## Why APIYI's Hunyuan Hy-Image 3.5?

> [card] Tencent Cloud official relay
>
> The same model as `hy-image-v3.5-preview` on Tencent Cloud TokenHub, exposed through the standard `/v1/images/generations` endpoint with an OpenAI Images-compatible response shape.

> [card] Official parity at 1:7
>
> The official ¥0.15 / ¥0.20 prices convert to \$0.022 / \$0.030 at a **fixed 1:7 exchange rate** with no markup. Top-up bonuses stack on top.

> [card] Fixed 2K / 4K, simple billing
>
> Two models pin the output at 2048×2048 and 4096×4096 and charge a flat per-image price. No pixel, area, or reference-count math.

> [card] Global access, no Tencent account
>
> No Tencent Cloud account or overseas server required. Call `api.apiyi.com` from mainland China data centers, residential networks, or overseas nodes with one key.

> [card] A complete image stack
>
> Pair it with [GPT-Image-2](https://docs.apiyi.com/en/api-capabilities/gpt-image-2/overview.md), [Nano Banana 2](https://docs.apiyi.com/en/api-capabilities/nano-banana-2-image/overview.md), [Seedream](https://docs.apiyi.com/en/api-capabilities/seedream-image/overview.md), or [MAI-Image](https://docs.apiyi.com/en/api-capabilities/mai-image/overview.md).

> [card] Hands-on support
>
> The team knows Chinese visual production workflows for posters, e-commerce, and film assets, and supports everything from model selection to production rollout.

## Key Features

> [card] Fixed 2K / 4K output
>
> `-2k` always returns 2048×2048 and `-4k` always returns 4096×4096. Pick a model; no size math required.

> [card] Chinese text rendering
>
> Poster titles, dates, locations, and signage come out character-accurate, ideal for Chinese movie posters, e-commerce hero images, and campaign assets.

> [card] Reference-image generation
>
> The `images` array accepts 1–20 references as URLs or data URIs. Style transfer, composition preservation, and multi-image fusion are supported.

> [card] Multi-reference input
>
> Send several references at once and refer to them as "image 1 / image 2" in the prompt. Reference count does not change the price.

> [card] Base64 by default, URL on request
>
> Default responses are `data[0].b64_json` for server-side saving; pass `response_format: "url"` for a platform CDN URL suitable for web display.

> [card] OpenAI Images compatible
>
> Call with `model` and `prompt` from Python, Node, or cURL. No need to learn Tencent's native Chat/Messages protocol.

> [card] Synchronous responses
>
> One request returns the image directly; no task submission, polling, or callbacks. Measured 2K latency is about 18–35 seconds and 4K about 45–58 seconds.

> [card] Flat per-image pricing
>
> `size`, `response_format`, reference count, and actual output dimensions do not affect the price. Budget per image.

### Sample Outputs

**Chinese text rendering** (`hy-image-v3.5-preview-2k`, prompt asks for the title "Between Mountains and Seas" and the subtitle "November 24, 2026, Beijing Premiere"):

![Hunyuan Hy-Image 3.5 Preview Chinese movie poster sample with accurate title and date text](https://mintcdn.com/apiyillc/cLkvFpJy1Cs-mPwm/images/hunyuan-image-v35-chinese-poster.jpg?fit=max\&auto=format\&n=cLkvFpJy1Cs-mPwm\&q=85\&s=f36d52ef2c2067d71d09fd0851854413)

**Reference-image watercolor** (`hy-image-v3.5-preview-2k`, `images` receives a red circle and blue square reference, prompt asks to preserve composition):

![Hunyuan Hy-Image 3.5 Preview reference-image sample: red circle and blue square restyled as watercolor](https://mintcdn.com/apiyillc/cLkvFpJy1Cs-mPwm/images/hunyuan-image-v35-reference-edit.jpg?fit=max\&auto=format\&n=cLkvFpJy1Cs-mPwm\&q=85\&s=eeadac51306e8785ff1e21ca222585de)

## Pricing

Flat per-image pricing. **The model list price matches the official list item by item at the 1:7 fixed exchange rate; the effective price depends on top-up bonuses**:

| Model | Output | Official CNY | APIYI list price | After top-up bonus |
| - | - | - | - | - |
| **`hy-image-v3.5-preview-2k`** | 2048×2048 | ¥0.15/image (1K/1.5K/2K) | **\$0.022/image** | **\$0.018–\$0.020/image** |
| **`hy-image-v3.5-preview-4k`** | 4096×4096 | ¥0.20/image | **\$0.030/image** | **\$0.025–\$0.027/image** |

> [!NOTE]
>
> Pricing follows the official list and may change. The table is for reference only; the **Model Pricing** tab in the top navigation is authoritative: [Model Pricing](https://docs.apiyi.com/en/models/index.md).

> [!NOTE]
>
> **List price vs effective price**
>
> * **List price matches the official list**: ¥0.15 / ¥0.20 convert to \$0.022 / \$0.030 at the 1:7 fixed rate, with **no markup**.
> * **The discount lives in top-up bonuses**: current top-up bonuses bring the effective price to about **83–91% of list** (17–9% off). This is a platform top-up benefit, **not a model price cut**, and it is not reflected in the model's unit price.
> * **Live terms come from the promotion page**: see [Top-up Bonuses](https://docs.apiyi.com/en/faq/recharge-promotions.md) for current tiers, validity, and stacking rules.
> * **Flat per image, not per pixel**: `-2k` and `-4k` each have a fixed price. `size` and actual output dimensions do not change it.
> * **References are free**: 1 or 20 reference images cost the same. Multipart edits bill at the same model price.
> * **Failures are not billed**: 400 / 401 / 500 / 503 errors produce no image and no charge; `usage` is a placeholder.

## Group Setup

This series is available in the **`Default`** and **`SVIP`** groups, both at **1.0x**. A new Token can call it directly; no dedicated group is required.

> [!NOTE]
>
> **Token billing model**: both `Pay-as-you-go Priority` and `Pay-per-request` work. We recommend `Pay-as-you-go Priority` so the same Token also covers token-billed models.
>
> **Rate**: two concurrent 2K requests completed normally in testing (23–35 seconds each). For large batches, send concurrent requests and watch for 429s; contact support in advance if you need more capacity.

## Technical Specs

| Item | Value |
| - | - |
| **Model IDs** | `hy-image-v3.5-preview-2k`, `hy-image-v3.5-preview-4k` |
| **Output resolution** | `-2k`: 2048×2048; `-4k`: 4096×4096 (fixed; `size` is ignored) |
| **Output format** | PNG; `data[0].b64_json` by default, or a URL when `response_format: "url"` |
| **Images per request** | Exactly 1; `n` has no effect |
| **Reference limit** | Official docs: ≤20MB per image, ≤20 input images total; 2 references verified in testing |
| **Chinese prompts** | ✅ Supported; Chinese text rendering is accurate |
| **Reference field** | `images` recommended (fixed 2K/4K); legacy `image` defaults to 1536, explicit `size` for 2K/4K |
| **Multipart edits** | Works, but outputs only 1536×1536; not recommended |
| **`size`** | Overridden for text-to-image and `images`; only honored by the legacy `image` field |
| **Response fields** | `created`, `id`, `data[0].b64_json` or `data[0].url`, `usage` (placeholder) |
| **Measured latency** | 2K text-to-image 18–35s; 2K reference 16–54s; 4K 45–58s |
| **Recommended timeout** | 2K ≥120s; 4K ≥240s; 4K base64 360s |
| **Multi-turn editing / seed / watermark / search** | ❌ Not exposed by the OpenAI Images compatibility layer; these are native Chat/Messages features |
| **Streaming** | ❌ Not supported; responses are synchronous |

## API Endpoints

| Endpoint | Purpose | Content-Type |
| - | - | - |
| `POST /v1/images/generations` | Text-to-image + reference-image generation (recommended) | `application/json` |
| `POST /v1/images/edits` | Multipart editing (legacy; 1536 only; not recommended) | `multipart/form-data` |

> [!TIP]
>
> **Domains**: `api.apiyi.com` is the primary domain. Other platform gateways such as `b.apiyi.com` behave identically.

## Key Parameters

### Size: fixed by model, do not pass `size`

| Model | Requested `size` | Actual output |
| - | - | - |
| `hy-image-v3.5-preview-2k` | omitted | 2048×2048 |
| `hy-image-v3.5-preview-2k` | `1024x1024` | 2048×2048 |
| `hy-image-v3.5-preview-2k` | `4096x4096` | 2048×2048 |
| `hy-image-v3.5-preview-2k` | `abc` | 2048×2048 |
| `hy-image-v3.5-preview-4k` | omitted | 4096×4096 |
| `hy-image-v3.5-preview-4k` | `2048x2048` | 4096×4096 |

> [!WARNING]
>
> **`size` only works on the legacy `image` edit path.** With the recommended `images` field, an explicit `1024x1024` is overridden to 2048×2048. The same applies to text-to-image. Choose `-2k` or `-4k` instead of trying to switch resolution with `size`.

### Reference images: `images`, `image`, and multipart

| Approach | Field | Default output | Explicit `size` | Recommendation |
| - | - | - | - | - |
| JSON `images` array | `images: ["url", "data:image/png;base64,..."]` | **2048×2048 / 4096×4096** | Overridden | ✅ Recommended |
| JSON `image` | `image: ["url"]` or `image: "url"` | **1536×1536** | Honored: 2K/4K | ⚠️ Legacy, not recommended |
| Multipart `/v1/images/edits` | `-F "image=@file.png"` | **1536×1536** | Not overridden | ❌ Not recommended |

> [!WARNING]
>
> **Both reference styles bill at the model's flat price.** The legacy `image` field costs the same as `-2k` / `-4k` even when it returns only 1536×1536. Use `images` consistently.

### `response_format`

* Omitted: `data[0].b64_json` (plain base64, no `data:` prefix).
* `"url"`: `data[0].url` on `hdcdn.agisuitepro.com`. Works in `<img>`; HEAD returns 200, CORS preflight returns 403.
* Invalid values (such as `"webp"`): silently fall back to `b64_json`. Do not rely on them.

## Best Practices

**1. Pick the model by use case**

Use `hy-image-v3.5-preview-2k` for web images, social media, and general posters. Use `hy-image-v3.5-preview-4k` for print, film assets, and heavy cropping. Only the model name changes.

**2. Do not pass size or n**

`size` is overridden and `n` is fixed at 1. For multiple images, send concurrent requests. Two concurrent 2K requests completed normally in testing.

**3. Use images for references**

One reference: `images: ["https://..."]`. Multiple: `images: ["url1", "url2"]`. Convert local files to `data:image/png;base64,...`. Avoid `image`, which returns only 1536.

**4. Quote text that must appear**

Put text in quotes and state its position: main title "Between Mountains and Seas" centered, subtitle "November 24, 2026, Beijing Premiere". The model follows quoted text closely.

**5. Use URL mode for the web**

A 4K base64 response can reach 26 MB. For web display, pass `response_format: "url"` and let `<img>` load the CDN image. Use the default base64 for server-side file writes.

**6. Set timeouts by tier**

Use at least 120 seconds for 2K, 240 seconds for 4K, and 360 seconds for 4K base64. Raise reverse-proxy and serverless response-size limits to at least 30 MB.

**7. Do not retry moderation blocks**

Content moderation returns 400 `content_safety_violation`. This is deterministic; rewrite the prompt instead of retrying.

**8. Compress reference images**

Keep each reference under 20MB. Resize the long edge to 2048px and use quality 0.9 before upload to reduce transfer and processing time.

## Error Codes & Retries

| Status | Meaning | Action |
| - | - | - |
| `400` | Missing `prompt` (`invalid_image_request`), empty reference images, or content moderation (`content_safety_violation`) | Fix the parameters; do not retry moderation |
| `401` | Invalid Token | Check the Bearer Token |
| `429` | Rate limit or insufficient quota | Exponential backoff; lower concurrency |
| `500` | Server error | Retry 1–2 times |
| `503` | Wrong model name or no channel in the current group | Check for `hy-image-v3.5-preview-2k` / `-4k` |
| Timeout | Long tail or large response | Use ≥120s for 2K and ≥240s for 4K; do not disconnect early |

> [!NOTE]
>
> **Client guidance**:
>
> * Use a timeout of **≥120s for 2K and ≥240s for 4K** (360s for 4K base64).
> * Retry only 429s, network timeouts, and deterministic 5xx errors with exponential backoff. Do not retry moderation 400s.
> * Log `x-oneapi-request-id` and the response `id` for troubleshooting.
> * The API is synchronous: a client disconnect loses the result but the request is usually still billed. Set generous timeouts.

## FAQ

> [accordion] What is the difference between `hy-image-v3.5-preview-2k` and `-4k`?
>
> `-2k` always outputs 2048×2048 and `-4k` always outputs 4096×4096. The endpoint, parameters, and reference-image behavior are identical; only the model name changes. The official 1K/1.5K/2K price is the same, so `-2k` gives the best value in that tier. See the [FAQ](https://docs.apiyi.com/en/api-capabilities/hunyuan-image/faq.md).

> [accordion] Why does `size` still return 2048×2048 or 4096×4096?
>
> Both models override `size`: `-2k` is fixed at 2048×2048 and `-4k` at 4096×4096. `size` only works on the legacy `image` edit path; the recommended `images` path is also overridden.

> [accordion] Why is the default response a large base64 string? How do I get a URL?
>
> The default is `response_format: "b64_json"` and the image is in `data[0].b64_json`. Pass `response_format: "url"` to receive a stable URL on `hdcdn.agisuitepro.com`. A 4K base64 response can reach 26 MB, so use URL mode for web display.

> [accordion] What is the difference between `images` and `image`?
>
> `images` is the recommended JSON array and returns fixed 2K/4K. `image` is the legacy edit path and returns only 1536×1536 without `size`. Both bill at the model's flat price; use `images` for all new integrations.

> [accordion] How many images can I get per request? Why does `n=2` return only one?
>
> The model always returns exactly one image. `n` has no effect and you are billed once. Send concurrent requests for multiple images.

> [accordion] How long does 4K take, and how large is the response?
>
> Measured 4K text-to-image latency is 45–58 seconds. The PNG is 12.6–18.9 MB and the base64 response is 17.6–26.4 MB. Use a timeout of at least 240 seconds (360 seconds for base64) and raise response-size limits.

## Related Docs

* [Text-to-Image API & Playground](https://docs.apiyi.com/en/api-capabilities/hunyuan-image/text-to-image.md)
* [Reference-Image API & Playground](https://docs.apiyi.com/en/api-capabilities/hunyuan-image/image-edit.md)
* [Hunyuan Hy-Image 3.5 Agent Skill](https://docs.apiyi.com/en/api-capabilities/hunyuan-image/skills.md)
* [Hunyuan Hy-Image 3.5 FAQ](https://docs.apiyi.com/en/api-capabilities/hunyuan-image/faq.md)
* [Image API Best Practices](https://docs.apiyi.com/en/api-capabilities/image-api-best-practices.md)
* [Full Model Pricing](https://docs.apiyi.com/en/models/index.md)

> [!NOTE]
>
> Tencent Hunyuan Hy-Image 3.5 Preview is a preview model; Tencent may change its behavior or retire it at any time. Keep a fallback image model for production. APIYI follows the official channel, and pricing and groups are governed by the [Model Pricing](https://docs.apiyi.com/en/models/index.md) tab.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.