fix(kimi-coding): add KIMI_CODING_API_KEY fallback + api_mode detection for /coding endpoint

This commit is contained in:
王强 2026-04-18 08:09:41 +08:00 committed by Teknium
parent fd403854b9
commit bad5471409
2 changed files with 3 additions and 2 deletions

View file

@ -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(

View file

@ -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