Tencent Cloud AI Art TextToImage: Invoking Hunyuan Image Generation in Coding Agents

Preface

When asking an Agent to “draw an image” in an IDE, a common practice is for the model to fabricate a description or a fake link without actually calling a cloud-side image generation API. If you want the Agent to use text prompts to perform Tencent Cloud HunYuan text-to-image generation and obtain a downloadable image URL, you need to encapsulate this capability as a Skill and define conventions for API keys, asynchronous tasks, and polling methods.

Below is an introduction to TencentCloud Aiart TextToImage on SkillHub (Coordinate @tencent-adm/tencentcloud-aiart-texttoimage, Version 1.0.0). It is published by the Tencent Cloud HunYuan Image Team, sourced from enterprise, categorized under design-media, and marked with requires_api_key=true.

What is this

TencentCloud Aiart TextToImage is an Agent Skill based on the universal SKILL.md format, designed for Tencent Cloud HunYuan Text-to-Image Generation: it uses the HunYuan large model to generate AI images from natural language prompts. The skill description specifies the use of an asynchronous API—first submitting the image generation task, then polling until the resulting image URL is returned.

Compared to “verbally describing an image” in a conversation, this Skill interfaces with Tencent Cloud APIs via built-in Python scripts and requires the Agent to use the real result_image from the script output, rather than fabricating links.

Core Features

The following capabilities are derived from the SKILL.md (v1.0.0) within the skill package:

  1. Text-to-Image: Submit HunYuan image generation tasks based on text descriptions and obtain image URLs.
  2. Reference Image Guidance: Optionally accept up to 3 reference image URLs (jpg/jpeg/png/webp) to guide the visual direction.
  3. Resolution Control: Width and height are each between 512–2048 pixels, with a total area not exceeding 1024×1024; default is 1024:1024.
  4. Prompt Rewriting: Enabled by default to optimize prompts (the description notes this adds approximately 20 seconds); can be disabled with --revise 0.
  5. Reproducibility: Supports --seed to fix the random seed.
  6. Three Script Modes:
    • scripts/main.py: Submit and auto-poll (recommended default)
    • scripts/submit_job.py: Submit only, returns JobId
    • scripts/query_job.py: Query or poll by JobId

Runtime dependencies are Python 3.7+ and tencentcloud-sdk-python; the skill description states that the SDK can be auto-installed on the first run.

Installation and Activation

1. Install SkillHub CLI (if not already installed)

Check or install the CLI according to the SkillHub Installation Document:

command -v skillhub && skillhub --version

If not installed, you can execute:

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

2. Install this Skill

The installation guide provided on the SkillHub page is: read https://skillhub.cn/install/skillhub.md and install the coordinate @tencent-adm/tencentcloud-aiart-texttoimage.

In the terminal, you need to use --dir to point to the current Agent’s skills directory (otherwise, it may install to ./skills/ and not be recognized). The recommended command from the search results is:

skillhub install tencentcloud-aiart-texttoimage --namespace tencent-adm --dir <your skills directory>

Common path examples (from the SkillHub installation documentation):

  • Cursor: ~/.cursor/skills/
  • Claude Code: ~/.claude/skills/
  • Codex: ~/.codex/skills/ or .agents/skills/ under the project

After installation, restart or refresh the Agent to load the new Skill.

3. Configure Tencent Cloud Keys

The skill requires API key configuration, read via environment variables (do not write them into the code repository):

export TENCENTCLOUD_SECRET_ID="your_SecretId"
export TENCENTCLOUD_SECRET_KEY="your_SecretKey"

You need to activate the HunYuan image generation service on Tencent Cloud before use and create keys in API Key Management; the console entry point is the Intelligent Image Creation link in the skill.

Typical Usage

Replace <SKILL_DIR> with the local installation directory (e.g., ~/.cursor/skills/@tencent-adm/tencentcloud-aiart-texttoimage under Cursor). The examples below are from the official skill SKILL.md.

Basic Text-to-Image (One-stop, Recommended):

python3 <SKILL_DIR>/scripts/main.py "A cute cat playing in a garden"

With Reference Images and Landscape Resolution:

python3 <SKILL_DIR>/scripts/main.py --images "https://example.com/ref1.jpg" "https://example.com/ref2.png" --resolution 1024:768 "Reference these image styles, draw a landscape painting"

Step-by-step: Submit Task Only:

python3 <SKILL_DIR>/scripts/submit_job.py "A traditional Chinese ink painting"

Step-by-step: Query by JobId:

python3 <SKILL_DIR>/scripts/query_job.py "job-xxxxxxxxxxxx"

On success, the JSON will contain fields such as result_image; the skill description requires the Agent to return this URL to the user, and the generated image link is valid for 1 hour, so it needs to be saved promptly. Normal image generation usually takes about 10–30 seconds, and enabling Prompt rewriting will take additional time.

In conversational scenarios, the user provides a text description; the skill specification requires the Agent to execute main.py by default and not switch to the model “imagining” image addresses.

Use Cases and Notes

Who is it for

  • Users already using Agents that support Skills (like Cursor, Claude Code, Codex) and want to complete text-to-image tasks such as poster sketches, illustrations, and covers within conversations.
  • Teams already using or planning to use Tencent Cloud HunYuan image generation, willing to use SecretId/SecretKey for server-side authentication.

Usage Notes

  1. Billing and Quotas: This calls the Tencent Cloud HunYuan image generation API; you must comply with the console activation status and product billing rules.
  2. Key Security: requires_api_key=true; inject only via environment variables or controlled key management, do not commit to Git.
  3. Async and Timeouts: query_job.py defaults to a polling interval of 5 seconds and a maximum of 300 seconds; pay attention to failure messages during long tasks or network fluctuations.
  4. Agent Behavior: The skill explicitly requires reporting errors on failure and prohibits fabricating result_image; after installation, the Agent should be allowed to read the API descriptions under SKILL.md and references/.

SkillHub side statistics (at time of scraping): Rating 100000, Downloads 1763, Installs 60.

Conclusion

TencentCloud Aiart TextToImage encapsulates HunYuan text-to-image into an Agent-executable script flow: keys, submission, polling, and URL return all have fixed conventions, making it suitable for development scenarios that require “real image generation” rather than “fake descriptions.”

Official Entries:

  • Skill API Page: https://api.skillhub.cn/tencent-adm/tencentcloud-aiart-texttoimage
  • SkillHub Display Page: https://www.skillhub.cn/skills/tencent-adm/tencentcloud-aiart-texttoimage
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye