Billing API reports a healthy account while every request 400s with insufficient credits
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 42/100
Rechercherichtung
Start by reading the /alpha/billing/credits handler and the request path that returns the insufficient credits error; the payload names no source files or tests. Compare how each path derives credit availability, then check the usage limits documentation and related issue #904. Done when the billing response gives clients a reliable signal that matches whether requests can be served, with the documented behavior aligned.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
/alpha/billing/credits reports a healthy account (belowThreshold=false, both rolling windows at 0% used) while every completion request is rejected with insufficient credits. A client that automates fallback across providers therefore has no way to tell "this account can't serve requests" — it has to send a real request to find out.
Expected Behavior
If requests are refused, one of the documented fields should reflect it:
credits.belowThreshold = true, or- a new explicit flag (
canRequest/insufficientCredits), or windowLimits.exceeded/fiveHour.exceededset.
Also, https://commandcode.ai/docs/resources/usage-limits ("What happens when I run out of credits?") says requests stop once your included credits reach zero, which suggests monthlyCredits would be 0 at that point. Here they stop at 0.084.
Actual Behavior
GET https://api.commandcode.ai/alpha/billing/credits → 200:
{
"credits": { "belowThreshold": false, "creditThreshold": 0,
"monthlyCredits": 0.0840296077, "purchasedCredits": 0, "freeCredits": 0 },
"windowLimits": { "limited": true, "exceeded": null,
"fiveHour": { "used": 0, "cap": 14, "exceeded": false, "resetAt": 0 },
"weekly": { "used": 0, "cap": 35, "exceeded": false, "resetAt": 0 } }
}
GET https://api.commandcode.ai/alpha/billing/subscriptions → 200: status: "active", planId: "individual-goat", currentPeriodEnd: "2026-11-04T14:00:31.000Z".
Any request fails, including a one-token one:
POST /provider/v1/chat/completions
{"model":"deepseek/deepseek-v4.1-flash","messages":[{"role":"user","content":"hi"}],"max_tokens":1}
HTTP 400
{"message":"You have insufficient credits to make this request. Please purchase more credits to continue using the service.",
"type":"invalid_request_error","code":"BAD_REQUEST"}
x-trace-id: ab67b7089a5a839861c5a497f5d9fe96
So belowThreshold is unusable as a signal: with creditThreshold = 0 it can only trip exactly at zero. windowLimits.limited = true is not a signal either — it is true with both windows at 0% used, and windowLimits.exceeded is null, not false.
Steps to reproduce the issue
- Use an account whose included monthly credits are almost gone (
0.084here) with no purchased credits. curl -s -H "Authorization: Bearer $KEY" https://api.commandcode.ai/alpha/billing/credits→belowThreshold: false,monthlyCredits: 0.084, windows0/14and0/35.curl -s -X POST https://api.commandcode.ai/provider/v1/chat/completions -H "Authorization: Bearer $KEY" -H "content-type: application/json" -d '{"model":"deepseek/deepseek-v4.1-flash","messages":[{"role":"user","content":"hi"}],"max_tokens":1}'→ 400insufficient credits.
Command Code Version
1.88.1 (provider-API behaviour; reproduced with plain curl, no CLI involved)
Operating System
Windows
Suggested fixes
- Add an explicit
canRequest/insufficientCreditsboolean to/alpha/billing/credits, or makebelowThresholdhonour a real minimum balance instead ofcreditThreshold = 0. - Return the required amount / remaining balance in the 400 body, and a documented error code distinct from
BAD_REQUEST. - Document
windowLimits.limitedandwindowLimits.exceeded(nullvsfalse) — clients can only guess today. - Align the "requests stop once your included credits reach zero" FAQ sentence with actual behaviour.
Related: #904 (non-interactive quota readout) is also helped by making these fields trustworthy.
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 4.2k
- Forks
- 377
- Ø Merge
- 1 T. 3 Std.
- Gemergte PRs (30 T.)
- 6
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus CommandCodeAI/command-code
-
Provider /v1/messages rejects role:"system" inside messages[] — Claude Code ≥ 2.1.154 incompatibleOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
CommandCodeAI/command-code#1085 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Feature request: auto-reconnect remote control (/rc) after restartEvtl. vergeben @aliarain hat das vor 20 Tagen übernommen. Offenp2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
CommandCodeAI/command-code#992 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
CommandCodeAI/command-code#933 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
CommandCodeAI/command-code#855 ·
Maintainer antworten meist innerhalb von 1 Tag
-
grep tool passes empty file type to ripgrepEvtl. vergeben @ahmadbilaldev hat das vor 19 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
CommandCodeAI/command-code#655 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in CommandCodeAI/command-code
Ähnliche Issues
-
feature javascript
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 61/100
mattgodbolt/jsbeeb#1833 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
DiamondLightSource/eiger-correction#2 · 1 Kommentar ·
-
module: backend type: bug/reported
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
OpenXiangShan/XiangShan#6938 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
PriorityNotificationQueue::wakeUpAll() loses the wake-up for a thread that is not waiting yetEvtl. vergeben @matejk hat das heute übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
pocoproject/poco#5674 ·
Maintainer antworten meist innerhalb von 2 Tagen