Skip to content

feat(quota): record and chart Qoder credit usage - #40

Merged
rune-gh merged 7 commits into
mainfrom
feat/qoder-quota
Dec 3, 2026
Merged

rune-gh merged 7 commits into
mainfrom
feat/qoder-quota

Conversation

@rune-gh

@rune-gh rune-gh commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Qoder credit usage did not appear in the quota panel. The hub now reads it.

  • A qoder auth file holds a Qoder personal access token. The recorder exchanges it at api.qoder.sh/api/v1/jobToken/exchange and reads /sash/api/v2/me/usage (falling back to the quota and plan endpoints).
  • Two windows are recorded: monthly plan credits and add_on credits. Add-on credits never renew, but Qoder spends them first, so the panel charts them next to the plan credits. Before this, the panel showed only the untouched monthly window.
  • Plan weights are Pro 1, Pro+ 3 and Ultra 10. Qoder and Mistral are recorded but never routed.
  • The panel gains a Qoder tab and icon.

Depends on #38 and #39 (merged into this branch).

Testing: go test ./internal/quotahistory/ (the map-order flake is fixed) and bun run verify pass; live on the hub, which reads plan Ultra and add-on credits.

🤖 Generated with Claude Code

rune-gh and others added 6 commits December 2, 2026 16:17
A Qoder account is an auth file holding a personal access token
({"type":"qoder","personal_access_token":"..."}). The recorder exchanges
it for a session token at api.qoder.sh/api/v1/jobToken/exchange, the
exchange Qoder CLI makes for QODER_PERSONAL_ACCESS_TOKEN, and caches the
session until shortly before it expires. It then reads
/sash/api/v2/me/usage (the figures Qoder CLI's /usage shows), falling
back to /api/v2/quota/usage, and the plan tier from /api/v2/user/plan.
None of these requests spend credits, and the global endpoints answer in
plain JSON.

Plan credits become a "monthly" window that resets at the plan refresh
time; bought add-on credits become a non-renewing "add_on" window.
Qoder is not routed through the hub, so like Mistral its readings stay
out of routing. Built-in plan weights: Pro 1, Pro+ 3, Ultra 10.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Qoder joins Mistral as a provider the panel shows from the hub's
recorded history alone, with its own tab, label, type colors and the
ACP registry icon inlined as light and dark assets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reset assertion ran after ranging over a map, so it failed whenever the
case without a reset time was iterated last.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Qoder spends add-on credits, which never renew, before the plan's monthly
credits. One-off balances stay out of pools in general; Qoder's add_on window
is charted explicitly so the card does not show an untouched pool while
credits drain. The owner-pool dev fixture gains a Qoder Ultra account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rune-gh
rune-gh merged commit 79ffc17 into main Dec 3, 2026
8 checks passed
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.

1 participant