anomalyco / anomalyco/opencode
[FEATURE]: Expose OpenCode Go usage history through the API key
@fwang is already working on this.
Since Aug 21, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
It would be great if we could expose our OpenCode Go usage history through an API-key-authenticated endpoint.
OpenCode Go and Zen can be used with the same API key. The existing Go usage endpoint exposes the current rolling 5-hour, weekly, and monthly limits, but there is no supported way to retrieve historical Go usage using that key.
The local OpenCode database is not a reliable replacement because it is client-local and does not represent server-side accounting, usage from other machines, or the server-side records and counters used to calculate Go limits. The Console already records individual usage entries and displays usage history in the web interface.
A new endpoint such as:
GET /zen/go/v1/usage/history?page=1
Authorization: Bearer <existing-api-key>
could return paginated Go usage records containing the timestamp, model, provider, token breakdown, documented server-calculated usage/cost fields, and session ID. It should return only the authenticated user's Go usage and should not expose prompts, API keys, or data belonging to other users.
This would allow status bars, CLI tools, dashboards, and monitoring integrations to show separate Go usage history and aggregate it by day or model. It would also allow users to track usage across multiple machines and better understand how usage relates to the rolling, weekly, and monthly limits.
This is distinct from #16017 (and it's duplicate, #31084), which covered the current rolling/weekly/monthly Go usage summary and are now closed. This request is specifically for historical usage records.
I'm happy to have a go at an implementation if this is deemed an acceptable feature.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.