From 2d17143d72f1c190f15c89b6ff0a5048b6eec79a Mon Sep 17 00:00:00 2001 From: JOJO <1498581755@qq.com> Date: Mon, 5 Jan 2026 14:17:43 +0800 Subject: [PATCH] fix: fallback to existing kimi/deepseek key names in balance fetch --- modules/balance_client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/balance_client.py b/modules/balance_client.py index 35c8d37..d36a9b1 100644 --- a/modules/balance_client.py +++ b/modules/balance_client.py @@ -71,9 +71,9 @@ def _http_get(url: str, headers: Dict[str, str] | None = None, timeout: int = 8) # -------- Kimi (Moonshot) -------- def fetch_kimi_balance() -> Dict[str, Any]: - api_key = _env("MOONSHOT_API_KEY") + api_key = _env("MOONSHOT_API_KEY") or _env("API_KEY_KIMI") or _env("AGENT_API_KEY") if not api_key: - return {"success": False, "error": "MOONSHOT_API_KEY 未设置"} + return {"success": False, "error": "Kimi 密钥未设置(MOONSHOT_API_KEY / API_KEY_KIMI / AGENT_API_KEY)"} url = "https://api.moonshot.ai/v1/users/me/balance" payload, err = _http_get(url, headers={"Authorization": f"Bearer {api_key}"}) @@ -101,9 +101,9 @@ def fetch_kimi_balance() -> Dict[str, Any]: # -------- DeepSeek -------- def fetch_deepseek_balance() -> Dict[str, Any]: - api_key = _env("DEEPSEEK_API_KEY") + api_key = _env("DEEPSEEK_API_KEY") or _env("API_KEY_DEEPSEEK") if not api_key: - return {"success": False, "error": "DEEPSEEK_API_KEY 未设置"} + return {"success": False, "error": "DeepSeek 密钥未设置(DEEPSEEK_API_KEY / API_KEY_DEEPSEEK)"} url = "https://api.deepseek.com/user/balance" payload, err = _http_get(url, headers={"Authorization": f"Bearer {api_key}"})