refactor: remove TENCENT_TOKENHUB_MODEL env var, relocate Hunyuan entry in .env.example

The env var added complexity without meaningful benefit — explicit model
selection via the "model" input parameter is sufficient for both image and
video TokenHub tools.

- tools/video/hunyuan_cloud_video.py: drop env var fallback from
  _resolve_model(), remove mention from install_instructions
- tests/contracts/test_hunyuan_cloud_video.py: remove
  test_resolve_model_from_env and test_resolve_model_input_overrides_env
- .env.example: move TENCENT_TOKENHUB_API_KEY to a dedicated "Tencent
  Hunyuan TokenHub API" section, drop TENCENT_TOKENHUB_MODEL comment,
  broaden description from "video generation" to generic "Tencent Hunyuan
  via TokenHub API"
This commit is contained in:
clarkh
2026-07-30 10:53:33 +08:00
parent 287c77fa64
commit 2237a9bcf9
3 changed files with 6 additions and 24 deletions

View File

@@ -44,6 +44,10 @@ DOUBAO_SPEECH_VOICE_TYPE= # Default Doubao speaker/voice type, e.g. zh_female
DASHSCOPE_API_KEY= # Qwen image gen (qwen-image-2.0-pro), TTS (qwen3-tts-flash), ASR with word timestamps (qwen3-asr-flash-filetrans)
# Get one at https://dashscope.aliyun.com/
# --- Tencent Hunyuan TokenHub API ---
TENCENT_TOKENHUB_API_KEY= # Tencent Hunyuan (腾讯混元) via TokenHub API (Bearer token)
# Get it at https://console.cloud.tencent.com/tokenhub
# --- Music ---
SUNO_API_KEY= # Suno AI music generation (full songs, instrumentals, any genre)
@@ -52,9 +56,6 @@ HEYGEN_API_KEY= # HeyGen API (VEO, Sora, Runway, Kling, Seedance vi
RUNWAY_API_KEY= # Runway Gen-4 (direct API, alternative to fal.ai routing)
VOLC_ACCESSKEY= # Volcengine Jimeng (即梦 AI) video generation via official API (HMAC-SHA256 V4 signing)
VOLC_SECRETKEY= # Secret Access Key paired with VOLC_ACCESSKEY. Get both at https://console.volcengine.com/iam/keymanage
TENCENT_TOKENHUB_API_KEY= # Tencent Hunyuan (腾讯混元) video generation via TokenHub API (Bearer token)
# Get it at https://console.cloud.tencent.com/tokenhub
# TENCENT_TOKENHUB_MODEL= # Optional: override default TokenHub model (hy-video-1.5 / yt-video-2.0)
VIDEO_GEN_LOCAL_ENABLED= # Set to "true" for local video gen (needs GPU + diffusers)
VIDEO_GEN_LOCAL_MODEL= # Local model: wan2.1-1.3b, wan2.1-14b, hunyuan-1.5, ltx2-local, cogvideo-5b
MODAL_LTX2_ENDPOINT_URL= # Modal self-hosted LTX-2 endpoint (optional)

View File

@@ -280,20 +280,6 @@ class TestToolSpecific:
})
assert model == "yt-video-2.0"
def test_resolve_model_from_env(self, monkeypatch):
monkeypatch.setenv("TENCENT_TOKENHUB_MODEL", "hy-video-1.5")
model = HunyuanCloudVideo._resolve_model({
"prompt": "test", "operation": "image_to_video",
})
assert model == "hy-video-1.5"
def test_resolve_model_input_overrides_env(self, monkeypatch):
monkeypatch.setenv("TENCENT_TOKENHUB_MODEL", "hy-video-1.5")
model = HunyuanCloudVideo._resolve_model({
"prompt": "test", "model": "yt-video-2.0",
})
assert model == "yt-video-2.0"
# -- _build_payload --
def test_build_payload_t2v_minimal(self):

View File

@@ -56,8 +56,7 @@ class HunyuanCloudVideo(BaseTool):
dependencies = []
install_instructions = (
"Set TENCENT_TOKENHUB_API_KEY to your Tencent Cloud TokenHub API key.\n"
" Get it at https://console.cloud.tencent.com/tokenhub\n"
" Optionally set TENCENT_TOKENHUB_MODEL to override the default model."
" Get it at https://console.cloud.tencent.com/tokenhub"
)
agent_skills = ["ai-video-gen"]
@@ -361,14 +360,10 @@ class HunyuanCloudVideo(BaseTool):
Order of precedence:
1. Explicit ``model`` input
2. TENCENT_TOKENHUB_MODEL env var
3. Default based on operation (hy-video-1.5 for T2V, yt-video-2.0 for I2V)
2. Default based on operation (hy-video-1.5 for T2V, yt-video-2.0 for I2V)
"""
if inputs.get("model"):
return inputs["model"]
env_model = os.environ.get("TENCENT_TOKENHUB_MODEL", "").strip()
if env_model:
return env_model
operation = inputs.get("operation", "text_to_video")
return _MODEL_I2V if operation == "image_to_video" else _MODEL_T2V