Skip to content

[FEATURE]: Expose Claude Agent plan usage (rate_limit_event) to plugins #60877

Closed

Description

@nexxeln

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

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.

Activity

  1. opencodejr commented on Oct 31, 2026

    @opencodejr

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions