Measure the Burn Rate: A Token Meter for Quota-Limited AI Coding Servers
Description and use
A token meter gives users of free AI coding servers visibility into daily token consumption, calculates burn rate, and predicts quota exhaustion.
Problem
Users of free AI coding servers cannot see token consumption until a request fails, making it hard to manage quotas.
Outcome
The token meter provides real‑time visibility into token consumption, enabling users to predict when their free quota will run out and adjust usage accordingly.
Workflow
- 1. Create a SQLite table to store usage records.
- 2. Wrap the OpenAI client in a MeteredClient that logs prompt, completion, and total tokens per request.
- 3. Implement a burn_rate function to aggregate usage over the last N days and compute tokens per day.
- 4. Use a report function to display total tokens, requests, elapsed days, burn rate, and days left until quota exhaustion.
- 5. Integrate the MeteredClient into existing workflows (editor, scripts, CI).
Evidence
The meter has three components: a SQLite table for usage records, a wrapper around the OpenAI client, and a report function.
Without a meter, the first sign of trouble is a 429 or a quota‑exceeded error in the middle of a task.
- Record date: 2026-09-07T22:37:45.385Z