anomalyco / anomalyco/opencode

[FEATURE]: report plan usage (Go limits, Zen balance) to ACP clients

Open
#49,693 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

opencode acp already sends usage_update with the context size and the session's cost. What an ACP client still can't see is the account's plan standing:

  • Go: the rolling 5-hour, weekly and monthly usage that GET /zen/go/v1/usage returns (#16017).
  • Zen: the remaining balance (#10448).

Today an ACP client (Zed, HarnessDesk, others) has to find the user's key and call those endpoints itself, which it may not be able to do.

Suggestion: have the ACP server attach these figures itself. ACP has no standard plan-usage message yet, so _meta or an extension method is the sanctioned place. Either of these would work:

  • a _meta block on usage_update:
{ "sessionUpdate": "usage_update", "used": 53000, "size": 200000,
  "_meta": { "opencode": { "go": { "rolling": { "percent": 19.5, "resetsAt": "…" }, "weekly": { … }, "monthly": { … } } } } }
  • a custom request such as _opencode/usage, returning the same object.

In the meantime, HarnessDesk reads each session's cost from opencode.db (HarnessDesk/HarnessDesk#772), but that shows spend, not the plan's limits.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the opencode acp handling for usage_update, then review the Go usage endpoint GET /zen/go/v1/usage and the Zen balance flow referenced in the issue. Compare the _meta and custom _opencode/usage options, and define completion as ACP clients receiving rolling, weekly, monthly, and balance information without querying account endpoints themselves.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.