AI Agent Hub
Back to skills
Hunyuan Intelligent Image Generation icon

Hunyuan Intelligent Image Generation

Design & Media Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please install @tencent-adm/hy-image-generation according to https://skillhub.cn/install/skillhub.md.

About this skill

In automated workflows driven by Large Language Models (LLMs), transforming natural language into high-quality images is a frequent requirement. Manually coding API calls for image generation, managing asynchronous task polling, and handling parameter validation consume significant development effort. Furthermore, relying directly on an Agent's "imagination" often lacks controllability and reproducibility. The HY Image Generation skill encapsulates the image generation capabilities of Tencent's Hunyuan large model into a set of scripts, enabling Agents to reliably and autonomously complete the text-to-image pipeline.

Core Capabilities

The skill provides three dedicated Python scripts, each with a specific role:
* main.py (Recommended): This is the primary entry point for generating images. It encapsulates the complete logic of task submission and result polling. An Agent only needs to invoke this single script with the appropriate arguments and wait for the final image URL output, achieving truly "zero-intervention" automation.
* submit_job.py: Suitable for scenarios requiring decoupled submission and querying. It only submits the generation request and immediately returns a unique JobId, facilitating integration into more complex task queues.
* query_job.py: Used to track and retrieve results of submitted tasks. By passing in a JobId, one can manually check the task status, obtain the generated image, or review error information in case of failure.

Key Steps and Parameters

A typical generation process involves the following critical aspects:
1. Task Submission and Automation: By default, the Agent should call main.py. The script internally handles dependency installation, credential detection, API invocation, and result waiting, finally outputting a JSON containing the image URL. For example: python main.py --prompt "A mechanical cat in a cyberpunk city" --resolution 1024:768.
2. Image Guidance and Control:
* Image Guidance (--images): You can guide the generation's direction and style by passing up to 3 reference image URLs.
* Resolution (--resolution): Customize the output image dimensions. The width and height must be within [512, 2048] pixels, and the total pixel area (width × height) must not exceed 1024×1024. For instance, vertical posters commonly use 768:1024.
* Prompt Rewriting (--revise): Enabled by default, the Hunyuan model optimizes the user's original prompt for better results, though this adds approximately 20 seconds to the processing time.

Application Boundaries and Notes

  • Output Expiration: The generated image URL is valid for only 1 hour. The Agent must remind the Agent to save it promptly, or persist the result itself.
  • Environment Dependencies: Execution requires a valid Tencent Cloud API key (SecretId and SecretKey) on first run, and network access to Tencent Cloud APIs must be ensured.
  • Failure Handling: If the task fails (e.g., due to content safety policy violation or parameter error), the script returns a clear error code and message. The Agent should use this to provide user feedback and must never fabricate a fake image result.
  • Performance and Cost: Enabling prompt rewriting increases latency; the image generation service typically has call frequency limits and associated costs. The Agent should possess corresponding cost awareness before execution.

Use Cases

  • Generating specific visual concept art from a detailed text description (e.g., character settings, scene atmosphere) for pre-production discussions in game or film projects.
  • Quickly creating multiple illustrations of different sizes (e.g., square, vertical, banner) for a social media post or product launch to match platform requirements.
  • A designer has preliminary concept sketches or reference images and wishes to combine them with text prompts to generate more detailed, stylistically consistent visual options using AI for selection.
  • A developer needs to integrate an image generation API into an application, handling user-submitted generation requests and managing the complete asynchronous process from submission to result retrieval.

Best For

  • Indie game developers or concept artists: Need to rapidly iterate on visual prototypes of characters and scenes based on script descriptions.
  • Social media managers or content creators: Need to batch-create original images with appropriate dimensions for graphic content across different platforms (WeChat Official Accounts, Xiaohongshu, TikTok).
  • Product managers or marketing personnel: Need to quickly transform key points of product features or marketing copy into intuitive UI mockups or promotional poster concepts.
  • AI application developers: Need to integrate a stable and reliable text-to-image capability into their own applications or services without building complex API calling and task management systems from scratch.