fix: fallback to existing kimi/deepseek key names in balance fetch
This commit is contained in:
parent
e58936bf05
commit
2d17143d72
@ -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}"})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user