From bad5471409a53bbc0d764176b62b7acf321c43ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BC=BA?= Date: Sat, 18 Apr 2026 08:09:41 +0800 Subject: [PATCH] fix(kimi-coding): add KIMI_CODING_API_KEY fallback + api_mode detection for /coding endpoint --- hermes_cli/auth.py | 2 +- hermes_cli/runtime_provider.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hermes_cli/auth.py b/hermes_cli/auth.py index c82bad3f0..21fd0ef47 100644 --- a/hermes_cli/auth.py +++ b/hermes_cli/auth.py @@ -169,7 +169,7 @@ PROVIDER_REGISTRY: Dict[str, ProviderConfig] = { name="Kimi / Moonshot", auth_type="api_key", inference_base_url="https://api.moonshot.ai/v1", - api_key_env_vars=("KIMI_API_KEY",), + api_key_env_vars=("KIMI_API_KEY", "KIMI_CODING_API_KEY"), base_url_env_var="KIMI_BASE_URL", ), "kimi-coding-cn": ProviderConfig( diff --git a/hermes_cli/runtime_provider.py b/hermes_cli/runtime_provider.py index 4b2b9d33f..922946e2a 100644 --- a/hermes_cli/runtime_provider.py +++ b/hermes_cli/runtime_provider.py @@ -210,7 +210,8 @@ def _resolve_runtime_from_pool_entry( api_mode = opencode_model_api_mode(provider, model_cfg.get("default", "")) else: # Auto-detect Anthropic-compatible endpoints (/anthropic suffix, - # api.openai.com → codex_responses, api.x.ai → codex_responses). + # Kimi /coding, api.openai.com → codex_responses, api.x.ai → + # codex_responses). detected = _detect_api_mode_for_url(base_url) if detected: api_mode = detected