Skip to main content
This page provides a ready-to-use Agent Skill: drop it into your coding agent and call APIYI’s Tencent Hunyuan Hy-Image 3.5 Preview (hy-image-v3.5-preview-2k / hy-image-v3.5-preview-4k) in natural language or with explicit commands. It is just two files; copy and use.
The skill defaults to hy-image-v3.5-preview-2k (2048×2048, $0.022 per image). Top-up bonuses bring the effective price to about 83–91% of list; see Top-up Bonuses. Add -m 4k for 4096×4096. Pass local reference images with -i; the script converts them to the data URIs expected by the images array. For direct API integration, see the text-to-image API and the reference-image API.

What the Skill Does

One script that switches behavior based on whether reference images are supplied:

Text-to-Image

Prompt only → a 2048×2048 (2K) or 4096×4096 (4K) image, with strong Chinese text rendering.

Reference-Image Generation

One local image + instruction → style transfer, composition preservation, or local edits.

Multi-Image Fusion

Multiple images + one instruction → combine subjects in a single scene; refer to them as “image 1 / image 2”.

Which Agents Can Use It

A Skill is essentially a folder: a SKILL.md instruction file for the agent and a script that does the work. Any coding agent that can read local files and run shell commands can use it — Codex, Claude Code, Cursor, and others. The only requirements are Python 3 and network access to api.apiyi.com.

Three-Step Setup

① Create the folder and add the files

Create a skill folder with these two files:

② Add your key

Write your APIYI API key (created in the api.apiyi.com console) to hunyuan-image/.env:
The script reads the key from this .env automatically.
.env contains your secret key. If you share this skill in a project repository, add .env to .gitignore and never commit it.

③ Hand it to your agent

  • Agents with skill discovery (such as Claude Code): put the whole hunyuan-image/ folder in the skill directory — ~/.claude/skills/ for personal use or .claude/skills/ for project use.
  • Other agents: follow their skill/plugin convention, or simply tell the agent to read SKILL.md in the folder and follow it.
Then jump to Usage.

SKILL.md

Create hunyuan-image/SKILL.md with the following content:

scripts/hunyuan_image.py

Create hunyuan-image/scripts/hunyuan_image.py with the following content (standard library only, no pip install):
The default model is hy-image-v3.5-preview-2k. Add -m 4k for 4096×4096. Resolution cannot be changed with --size; both models have fixed output dimensions.

Usage

Natural language (implicit invocation)

Once installed, just talk to your agent:

Explicit invocation

  • Agents with slash commands (such as Claude Code):
  • Any agent / direct script call:

Where the Images Go

  • When -o is a bare filename (such as -o poster.png), images go to the hunyuan-output/ folder in the project root (created automatically).
  • “Project root” is the first directory containing .git or .claude when walking up from the script location. The images always land inside the project, never in a temporary directory.
  • The script prints the full absolute path of every image.
  • Default is one image; -n 3 generates three (max 5, automatically capped), with -1, -2, -3 suffixes.
Hunyuan Hy-Image 3.5 has content safety controls. If the script reports HTTP 400 (content_safety_violation), the prompt was blocked. Adjust the content; do not retry the same prompt.