GeezerVison is showing github.com — [FEATURE]: Persist the Go allowance a session used (assistant message + session_v2) so clients can show a per-session figure · Issue #59653 · anomalyco/opencode
[FEATURE]: Persist the Go allowance a session used (assistant message + session_v2) so clients can show a per-session figure #59653DescriptionFeature 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
What
In 2.2.0 a session on OpenCode Go persists cost: 0 for every request (provider-reported cost, #58562 / #59627), and allowance — the USD a request counted against the plan's monthly limit — is not persisted either: #58562 added SessionMessage.Assistant.allowance and session_v2.allowance, and #58765 removed both the same day, before any release shipped them.
Result: no client can show what a Go session consumed from the plan. cost is 0 by design and allowance no longer exists, so the only per-session numbers left are tokens, which say nothing about the limit.
Ask
Keep usage.opencode.allowance on the assistant message and aggregate it into the session row, so clients can render a per-session figure (as /usage does account-wide today).
Evidence
dev carries both migrations (20261024002554_session_allowance, 20261024175301_drop_session_allowance); the net effect is no column, and ReportedBilling is { cost } only.
- On a local install running 2.2.0,
session_message.data has no $.allowance path on any Go row and session_v2 has no such column, while cost is stored as 0 on requests that do carry token counts.
Activityopencode-agent commented on Oct 27, 2026 Thanks for the detailed write-up! You're asking for the Go allowance each request used to be stored on the assistant message and added up per session, so clients can show how much of the plan a single session used, not just the account-wide figure in /usage.
Some background: this was left out on purpose. #58765 removed the field that #58562 had added because allowance is measured in the Go meters' own units rather than dollars, and keeping it next to cost made cost confusing to use. Subscription usage was moved to the usage limits API (#58694) instead, which is what drives /usage and the desktop Usage dialog. A per-session view would need a different design from the original field, and maintainers will consider it.
Related:
aberigle commented on Oct 28, 2026 From the client side, though, cost is still the only per-session progression we can compute, even when nothing is charged. The sidebar plugin I maintain (https://github.com/aberigle/opencode-go-usage) reads $.cost from session_message, buckets it per model and shows it across the rolling / weekly / monthly windows. On 2.2.0 those rows come back as 0 for Go sessions, so the block is empty for cost and only token counts survive. The fallback is the account-wide percent from /zen/go/v1/usage: it tells you how much of the plan is gone, but not what a session or a model consumed.
A per-session figure doesn't have to reuse the old field — either would work:
- persist the Go meter value under its own name (so it can't be read as dollars), or
- persist the list-price value per request, which is still USD and is roughly what 2.1.4 showed.
Happy to adapt the plugin to whatever ends up on the message. Reacted by Alastair Lundy aberigle commented on Nov 3, 2026 Just checking in on this. Has there been any movement? I'm still on 2.1.4 mainly because of it, and I'd be glad to test a build if something lands.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|