Skip to content

fix: query account balance on Linux/macOS (use curl, not only curl.exe) - #7

Open
RaBBBBBBBIT wants to merge 1 commit into
Make0209:mainfrom
RaBBBBBBBIT:fix/linux-balance-query
Open

fix: query account balance on Linux/macOS (use curl, not only curl.exe)#7
RaBBBBBBBIT wants to merge 1 commit into
Make0209:mainfrom
RaBBBBBBBIT:fix/linux-balance-query

Conversation

@RaBBBBBBBIT

@RaBBBBBBBIT RaBBBBBBBIT commented Aug 19, 2026

Copy link
Copy Markdown

Problem

The balance query (/api/usage-stats/balance) only attempts Windows executables — curl.exe and powershell.exe (…lib/index.js). On Linux/macOS both spawns fail, so the endpoint always returns:

{"status":"error","message":"余额查询失败","detail":"无法启动查询进程"}

("cannot start query process") even though the API key is configured correctly.

Fix

Add a plain curl attempt before the Windows ones. On Windows, curl still resolves to curl.exe via PATHEXT, so behavior there is unchanged; on Linux/macOS the query now actually runs.

Verification

On Linux, with a valid DEEPSEEK_API_KEY, the endpoint now returns:

{"status":"ok","currencies":[{"currency":"CNY","total":12.9,"granted":7.89,"toppedUp":5.01}]}

Related

Fixes #3 — the same root cause reported for macOS/Linux (only curl.exe/powershell.exe were attempted, so subprocess.spawn always failed on non-Windows hosts).

The balance fetch only tried Windows binaries (curl.exe, powershell.exe),
so on Linux/macOS every spawn failed and the endpoint returned
'无法启动查询进程'. Add a plain 'curl' attempt first; the Windows
fallbacks are kept unchanged.

Verified against https://api.deepseek.com/user/balance with a real key:
is_available=true, balance returned correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

余额查询在 macOS/Linux 上必定失败(无法启动查询进程):仅尝试了 Windows 二进制 curl.exe / powershell.exe

1 participant