GET /api/usage
A JSON snapshot for the subject making the call — session cookie or API key. The same numbers the account page shows.
curl https://rewr.it/api/usage -H "Authorization: Bearer hn_..."
What comes back
Plan and period counters, plus the credit wallet:
| Field | Means |
|---|---|
plan | anonymous | free | pro |
requests | Rewrites used this period |
resetAt | When the period rolls over |
creditBalance | Credits available to spend |
reservedCredits | Held for requests currently in flight |
purchasedCredits | Bought, lifetime |
spentCredits | Spent, lifetime |
canBuyCredits | Whether this subject may buy more |
Included quota is spent first
Included allowance goes before wallet credits, always. A rewrite only touches
credits once the period's included requests or input tokens are gone. The usage
event on a rewrite stream says which one paid, via fundingSource.
API keys spend the owning user's wallet. There is no separate per-key balance.
Polling
Don't. Read the usage event on the rewrite stream — it carries the post-request
numbers and costs nothing extra. Call this endpoint when a client starts, or
after a purchase.