fix: query account balance on Linux/macOS (use curl, not only curl.exe) - #7
Open
RaBBBBBBBIT wants to merge 1 commit into
Open
fix: query account balance on Linux/macOS (use curl, not only curl.exe)#7RaBBBBBBBIT wants to merge 1 commit into
RaBBBBBBBIT wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The balance query (
/api/usage-stats/balance) only attempts Windows executables —curl.exeandpowershell.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
curlattempt before the Windows ones. On Windows,curlstill resolves tocurl.exevia 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.exewere attempted, sosubprocess.spawnalways failed on non-Windows hosts).