diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.py index 65a709cb42..88887d7aaa 100644 --- a/agent/auxiliary_client.py +++ b/agent/auxiliary_client.py @@ -710,6 +710,8 @@ _PROVIDER_ALIASES = { "tokenhub": "tencent-tokenhub", "tencent-cloud": "tencent-tokenhub", "tencentmaas": "tencent-tokenhub", + "tokenplan": "tencent-tokenplan", + "tencent-lkeap": "tencent-tokenplan", } @@ -1080,7 +1082,8 @@ _API_KEY_PROVIDER_AUX_MODELS_FALLBACK: Dict[str, str] = { "opencode-go": "glm-5", "kilocode": "google/gemini-3.6-flash", "ollama-cloud": "nemotron-3-nano:30b", - "tencent-tokenhub": "hy3-preview", + "tencent-tokenhub": "hy4-preview", + "tencent-tokenplan": "hy4-preview", # NB: no "deepinfra" entry — its aux model lives on the ProviderProfile # (plugins/model-providers/deepinfra: default_aux_model), which # _get_aux_model_for_provider() reads first. Duplicating it here would be diff --git a/agent/model_metadata.py b/agent/model_metadata.py index cbcc760995..7a7bc1f183 100644 --- a/agent/model_metadata.py +++ b/agent/model_metadata.py @@ -583,6 +583,8 @@ DEFAULT_CONTEXT_LENGTHS = { "hy3-preview": 262144, # Tencent — Hy3 (GA successor to Hy3 Preview), same 256K window. "hy3": 262144, + # Tencent — Hy4 preview (Hunyuan) with 1M context window. + "hy4-preview": 1024000, # OpenCode Zen — "Ox Alpha" stealth model (x-preview-f-free). 1M context # per OpenCode's launch announcement (2026-08-20); free, ZDR. "x-preview-f": 1_048_576, @@ -765,6 +767,7 @@ _URL_TO_PROVIDER: Dict[str, str] = { "api.gmi-serving.com": "gmi", "api.novita.ai": "novita", "tokenhub.tencentmaas.com": "tencent-tokenhub", + "api.lkeap.cloud.tencent.com": "tencent-tokenplan", "ollama.com": "ollama-cloud", } diff --git a/hermes_cli/auth.py b/hermes_cli/auth.py index 8d3a3d13ae..2539dc1626 100644 --- a/hermes_cli/auth.py +++ b/hermes_cli/auth.py @@ -526,6 +526,14 @@ PROVIDER_REGISTRY: Dict[str, ProviderConfig] = { api_key_env_vars=("TOKENHUB_API_KEY",), base_url_env_var="TOKENHUB_BASE_URL", ), + "tencent-tokenplan": ProviderConfig( + id="tencent-tokenplan", + name="Tencent TokenPlan", + auth_type="api_key", + inference_base_url="https://api.lkeap.cloud.tencent.com/plan/anthropic", + api_key_env_vars=("TOKENPLAN_API_KEY",), + base_url_env_var="TOKENPLAN_BASE_URL", + ), "ollama-cloud": ProviderConfig( id="ollama-cloud", name="Ollama Cloud", @@ -2237,6 +2245,7 @@ def resolve_provider( "mimo": "xiaomi", "xiaomi-mimo": "xiaomi", "tencent": "tencent-tokenhub", "tokenhub": "tencent-tokenhub", "tencent-cloud": "tencent-tokenhub", "tencentmaas": "tencent-tokenhub", + "tokenplan": "tencent-tokenplan", "tencent-lkeap": "tencent-tokenplan", "aws": "bedrock", "aws-bedrock": "bedrock", "amazon-bedrock": "bedrock", "amazon": "bedrock", "go": "opencode-go", "opencode-go-sub": "opencode-go", "kilo": "kilocode", "kilo-code": "kilocode", "kilo-gateway": "kilocode", diff --git a/hermes_cli/doctor.py b/hermes_cli/doctor.py index dec9f8801a..717ed5830f 100644 --- a/hermes_cli/doctor.py +++ b/hermes_cli/doctor.py @@ -67,6 +67,7 @@ _PROVIDER_ENV_HINTS = ( "COMMANDCODE_API_KEY", "XIAOMI_API_KEY", "TOKENHUB_API_KEY", + "TOKENPLAN_API_KEY", ) diff --git a/hermes_cli/main.py b/hermes_cli/main.py index b25738679d..536ec2516f 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -4210,6 +4210,7 @@ def select_provider_and_model(args=None): "nvidia", "ollama-cloud", "tencent-tokenhub", + "tencent-tokenplan", "lmstudio", } or _is_profile_api_key_provider(selected_provider): _model_flow_api_key_provider(config, selected_provider, current_model) diff --git a/hermes_cli/models.py b/hermes_cli/models.py index f838df6247..a41e9153d8 100644 --- a/hermes_cli/models.py +++ b/hermes_cli/models.py @@ -478,6 +478,13 @@ _PROVIDER_MODELS: dict[str, list[str]] = { "mimo-v2-flash", ], "tencent-tokenhub": [ + "hy4-preview", + "hy3", + "hy3-preview", + ], + "tencent-tokenplan": [ + "hy4-preview", + "hy3", "hy3-preview", ], "arcee": [ @@ -1234,7 +1241,8 @@ CANONICAL_PROVIDERS: list[ProviderEntry] = [ ProviderEntry("alibaba", "Qwen Cloud", "Qwen Cloud / DashScope (Qwen + multi-provider)"), ProviderEntry("xai-oauth", "xAI Grok OAuth (SuperGrok / Premium+)", "xAI Grok OAuth (SuperGrok / Premium+ subscription)"), ProviderEntry("xiaomi", "Xiaomi MiMo", "Xiaomi MiMo (MiMo-V2.5 and V2 models: pro, omni, flash)"), - ProviderEntry("tencent-tokenhub", "Tencent TokenHub", "Tencent TokenHub (Hy3 Preview via tokenhub.tencentmaas.com)"), + ProviderEntry("tencent-tokenhub", "Tencent TokenHub", "Tencent TokenHub (Hy4 preview via tokenhub.tencentmaas.com)"), + ProviderEntry("tencent-tokenplan", "Tencent TokenPlan", "Tencent TokenPlan (Hy4 preview via api.lkeap.cloud.tencent.com, Anthropic Messages)"), ProviderEntry("nvidia", "NVIDIA NIM", "NVIDIA NIM (Nemotron models via build.nvidia.com or local NIM)"), ProviderEntry("copilot", "GitHub Copilot", "GitHub Copilot (Uses GITHUB_TOKEN or gh auth token)"), ProviderEntry("copilot-acp", "GitHub Copilot ACP", "GitHub Copilot ACP (Spawns copilot --acp --stdio)"), @@ -1317,6 +1325,7 @@ PROVIDER_GROUPS: dict[str, tuple[str, str, list[str]]] = { "qwen": ("Qwen", "Qwen Cloud / DashScope, Coding Plan & Qwen CLI OAuth", ["alibaba", "alibaba-coding-plan", "qwen-oauth"]), "opencode": ("OpenCode", "Zen pay-as-you-go, Go subscription, or free tier", ["opencode-zen", "opencode-go", "opencode-free"]), "copilot": ("GitHub Copilot", "GitHub token API or copilot --acp process", ["copilot", "copilot-acp"]), + "tencent": ("Tencent Hy", "Hy4 / Hy3 via TokenHub & TokenPlan", ["tencent-tokenhub", "tencent-tokenplan"]), } # Reverse index: member slug -> group_id. Built once at import. @@ -1464,6 +1473,8 @@ _PROVIDER_ALIASES = { "tokenhub": "tencent-tokenhub", "tencent-cloud": "tencent-tokenhub", "tencentmaas": "tencent-tokenhub", + "tokenplan": "tencent-tokenplan", + "tencent-lkeap": "tencent-tokenplan", "aws": "bedrock", "aws-bedrock": "bedrock", "amazon-bedrock": "bedrock", diff --git a/hermes_cli/providers.py b/hermes_cli/providers.py index caf6947e43..87e2136a96 100644 --- a/hermes_cli/providers.py +++ b/hermes_cli/providers.py @@ -196,6 +196,11 @@ HERMES_OVERLAYS: Dict[str, HermesOverlay] = { transport="openai_chat", base_url_env_var="TOKENHUB_BASE_URL", ), + "tencent-tokenplan": HermesOverlay( + transport="anthropic_messages", + base_url_override="https://api.lkeap.cloud.tencent.com/plan/anthropic", + base_url_env_var="TOKENPLAN_BASE_URL", + ), "arcee": HermesOverlay( transport="openai_chat", base_url_override="https://api.arcee.ai/api/v1", @@ -384,6 +389,8 @@ ALIASES: Dict[str, str] = { "tokenhub": "tencent-tokenhub", "tencent-cloud": "tencent-tokenhub", "tencentmaas": "tencent-tokenhub", + "tokenplan": "tencent-tokenplan", + "tencent-lkeap": "tencent-tokenplan", # bedrock "aws": "bedrock", @@ -445,6 +452,7 @@ _LABEL_OVERRIDES: Dict[str, str] = { "actual": "Actual Computer", "tencent-tokenhub": "Tencent TokenHub", "nebius-token-factory": "Nebius Token Factory", + "tencent-tokenplan": "Tencent TokenPlan", "lmstudio": "LM Studio", "local": "Local endpoint", "bedrock": "AWS Bedrock",