You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Expose Claude Agent plan usage (rate_limit_event) to plugins #60877
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Expose Claude Agent plan usage to plugins.
Claude Code sends a rate_limit_event SDK message with utilization and reset times for the 5-hour and weekly windows. The Claude Agent provider only uses it to word limit errors in claude-agent-error.ts, and plugins never see it.
Today a plugin that shows Claude subscription usage has to poll api.anthropic.com/api/oauth/usage, which is rate limited, and read Claude Code's OAuth token to do it. The provider's design says OpenCode never reads those tokens. ChatGPT sign-ins don't have this problem: the backend streams a codex.rate_limits frame with each response, which plugins can read through the experimental.ws.receive hook.
Proposal: attach the latest rate_limit_info to the step's finish provider metadata, so it shows up as native.rateLimit on session.step.ended. That uses the existing event and needs no new API. I have a small PR ready.
Thanks for the detailed proposal! I checked the current dev source and it matches your description: the Claude Agent provider reads rate_limit_event only in claude-agent-error.ts, to word limit errors. It doesn't add rate_limit_info to the step's finish provider metadata, so plugins never see it on session.step.ended.
This is how the provider currently works rather than a bug, so I've handled it as a feature request. Attaching the latest rate_limit_info as native.rateLimit on the existing step event sounds like a reasonable, low-surface way to do it. A maintainer will review the proposal and your PR.
Activity
opencodejr commentedon Oct 31, 2026
Thanks for the detailed proposal! I checked the current
devsource and it matches your description: the Claude Agent provider readsrate_limit_eventonly inclaude-agent-error.ts, to word limit errors. It doesn't addrate_limit_infoto the step's finish provider metadata, so plugins never see it onsession.step.ended.This is how the provider currently works rather than a bug, so I've handled it as a feature request. Attaching the latest
rate_limit_infoasnative.rateLimiton the existing step event sounds like a reasonable, low-surface way to do it. A maintainer will review the proposal and your PR.