Skip to content

feat: add Hunyuan Image Generation 3.0 (混元生图) via TokenHub API - #458

Open
clarkhjc wants to merge 1 commit into
calesthio:mainfrom
clarkhjc:feat/hunyuan_cloud_image
Open

feat: add Hunyuan Image Generation 3.0 (混元生图) via TokenHub API#458
clarkhjc wants to merge 1 commit into
calesthio:mainfrom
clarkhjc:feat/hunyuan_cloud_image

Conversation

@clarkhjc

Copy link
Copy Markdown

Summary

Add Hunyuan Image Generation 3.0 (混元生图) tool via Tencent TokenHub API, matching the code style of hunyuan_cloud_video tool. Uses the same TENCENT_TOKENHUB_API_KEY credential and Bearer-token auth — no additional setup required for existing Hunyuan users.

Changes

  • tools/graphics/hunyuan_image.py: new tool using async submit-poll-download flow via hy-image-v3.0 model. Parameters mirror the upstream SubmitTextToImageJob API: prompt, resolution, seed, revise, logo_add, logo_param, and reference images via Images.N. Built from hunyuan_cloud_video.py as a base, sharing the same _auth_headers(), _json_or_raise(), _check_response(), and _safe_error() helpers.
  • tests/tools/test_hunyuan_image.py: 32 unit tests covering registry discovery, payload building, image resolution, API error handling, and a mocked e2e submit→poll→download flow with a sentinel to catch leaked real API calls.

Testing

make test  # 32 new tests pass, no regressions

Manually verified end-to-end with TENCENT_TOKENHUB_API_KEY — image generation, polling, and file download all work correctly. Also verified the selector test (test_image_selector_no_provider) no longer leaks image files to CWD.

Checklist

  • The change is focused on a single logical concern.
  • I ran the relevant tests locally (make test) where applicable.
  • I updated docs/README if behavior or usage changed.
  • No unrelated files (build artifacts, local config) are included in the diff.

Async text-to-image tool using Tencent TokenHub (hy-image-v3.0).
Parameters mirror upstream SubmitTextToImageJob API: prompt, resolution,
seed, revise, logo_add, logo_param, and reference images via Images.N.

- tools/graphics/hunyuan_image.py: submit → poll → download flow,
  matching hunyuan_cloud_video.py code style
- tests/tools/test_hunyuan_image.py: 32 unit tests covering payload
  building, image resolution, API error handling, and mocked e2e flow
@clarkhjc
clarkhjc requested a review from calesthio as a code owner July 30, 2026 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant