Problem
Free OpenRouter models are rate-limited and users get no feedback on how
much context they're consuming. ChatOpenAI streams carry usage metadata,
but GCode drops it.
Proposed approach
- Capture
usage/rate-limit info from stream chunks (response_metadata,
OpenRouter X-RateLimit-* headers).
- Print a compact footer after each turn: tokens in/out, approximate cost
(OpenRouter publishes per-token pricing), and remaining rate limit.
- Add a
/usage command or fold it into /history.
Where to look
gcode/agent.py:59-79 (_stream), :101-137 (run_turn)
gcode/ui.py for footer rendering hooks.
Acceptance criteria
- A turn prints usage when the provider supplies it; silently omits otherwise.
- Rate-limit warnings appear before a 429 aborts the request.
Difficulty
Medium.
Problem
Free OpenRouter models are rate-limited and users get no feedback on how
much context they're consuming.
ChatOpenAIstreams carry usage metadata,but GCode drops it.
Proposed approach
usage/rate-limit info from stream chunks (response_metadata,OpenRouter
X-RateLimit-*headers).(OpenRouter publishes per-token pricing), and remaining rate limit.
/usagecommand or fold it into/history.Where to look
gcode/agent.py:59-79(_stream),:101-137(run_turn)gcode/ui.pyfor footer rendering hooks.Acceptance criteria
Difficulty
Medium.