Skip to content

Prefer Grok unified credits over legacy billing - #562

Merged
SDSLeon merged 1 commit into
masterfrom
poracode/silver-meadow-26b1aac0
Aug 12, 2026
Merged

Prefer Grok unified credits over legacy billing#562
SDSLeon merged 1 commit into
masterfrom
poracode/silver-meadow-26b1aac0

Conversation

@SDSLeon

@SDSLeon SDSLeon commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Type: Bugfix

  • Prefer Grok’s unified credits response (aggregate percentage + weekly period) when collecting usage via the CLI token path
  • Avoid treating legacy /v1/billing 0/0 placeholders as real usage so credit windows stay accurate
  • Fall back to legacy billing only when the credits payload has no usable credit fields
  • Cover mapping and endpoint preference with collector unit tests

- Collect from `/v1/billing?format=credits` before plain `/v1/billing`
- Fall back to legacy used/limit fields when credits data is absent
- Map weekly credits window from creditUsagePercent and period end
- Cover parse and token-path preference in collector tests
@SDSLeon
SDSLeon merged commit 61ebb44 into master Aug 12, 2026
8 checks passed
@SDSLeon
SDSLeon deleted the poracode/silver-meadow-26b1aac0 branch August 12, 2026 16:12
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