Skip to content

Claude Agent: 5-hour plan limit drains ~1.8x faster because the SDK labels requests sdk-ts #61072

Open

Description

@Salloxy

Description

With the Claude Agent provider, opencode uses the 5-hour Claude plan limit about 1.8x faster than the same work in Claude Code's own TUI.

opencode starts claude through the Agent SDK, and the SDK sets CLAUDE_CODE_ENTRYPOINT=sdk-ts when it isn't already set. Requests labeled sdk-ts/sdk-cli use more of the 5-hour window for the same tokens. Weekly limits don't seem to be affected. This is tracked upstream in anthropics/claude-code#97074 (still open, with a controlled A/B test showing ~1.8x). T3 Code users measured the same thing with a custom label: 14-15 calls per 1% with sdk-ts vs 25-27 with any non-sdk-* name (pingdotgg/t3code#24649, pingdotgg/t3code#25597).

Users can't fix it from Claude Code's side either: opencode loads no ~/.claude settings (settingSources: []), so the common "env": { "CLAUDE_CODE_ENTRYPOINT": ... } workaround in settings.json has no effect. Only exporting it in the shell before starting opencode works today.

Suggested fix: set CLAUDE_CODE_ENTRYPOINT=opencode next to the other variables in ISOLATION_ENV. The SDK keeps a value that is already set, and Claude Code keeps custom labels (it only rewrites cli to sdk-cli in -p mode).

Written by Claude Opus 5.5 on behalf of @Salloxy.

Plugins

none

OpenCode version

2.2.5 / dev at c8a473b, Claude Code 2.1.316, Agent SDK 0.3.301

Steps to reproduce

  1. Connect the Claude Agent provider with a Pro/Max subscription.
  2. Run a session and look at any Claude transcript it writes under ~/.claude/projects/...: every entry has "entrypoint":"sdk-ts".
  3. Compare the 5-hour usage per token with the same work in the claude TUI ("entrypoint":"cli"), or with opencode started with CLAUDE_CODE_ENTRYPOINT=opencode exported.

Operating System

Windows 11

Terminal

Windows Terminal

Activity

  1. opencodejr commented on Nov 1, 2026

    @opencodejr

    Thanks for the detailed write-up and for linking the upstream measurements.

    To restate the request: the Claude Agent provider should set CLAUDE_CODE_ENTRYPOINT itself (for example to opencode) instead of leaving the Agent SDK's default sdk-ts, so that Pro/Max users don't use up the 5-hour plan window faster than they would in the claude TUI.

    I've labelled this a feature request rather than a bug. OpenCode does reach Claude Code through the Agent SDK, so sdk-ts is an accurate label, and the faster drain comes from how Anthropic counts usage per entrypoint on its side (anthropics/claude-code#97074). Whether OpenCode should send a different label is a decision for the maintainers, and they'll consider it. I can't promise anything about whether or when it changes.

    In the meantime, the workaround you found still works: the provider passes your shell environment through to claude, so exporting CLAUDE_CODE_ENTRYPOINT before you start opencode applies to its sessions. Setting it in ~/.claude/settings.json has no effect, because the provider doesn't load those settings.

    Related:

  2. Salloxy commented on Nov 1, 2026

    @Salloxy
    Author

    This is a bug not a feature request. The bug being usage drained significantly faster than it should.

  3. Tarquinen commented on Nov 1, 2026

    @Tarquinen
    Member

    This isn't up to us to fix. It's not documented by anthropic and usage limits likely change frequently with many factors so it's hard to say how reliable the reproductions are.

  4. JtMotoX commented on Nov 2, 2026

    @JtMotoX

    @Tarquinen adding a controlled measurement, since reliability was the concern.

    Setup: opencode 2.2.5, Claude Code 2.1.316, Agent SDK 0.3.301, Linux (WSL2), Pro plan, Sonnet.

    Test: same claude -p binary and flags, no tools, 14 jobs per run of a ~5k-token writing prompt. Only CLAUDE_CODE_ENTRYPOINT changed. I read five_hour.utilization before and after each run, waited for it to settle, and divided the change by total_cost_usd.

    Entrypoint Output tokens API-equivalent cost 5h meter % per $
    sdk-ts 76,983 $0.81 +8 9.9
    opencode 74,470 $0.79 +4 5.0

    That's about 2×. The meter only shows whole percents, so the true ratio could be anywhere from about 1.4× to 3×, and the sdk-ts run went first.

    Workaround I'm using: set CLAUDE_CODE_ENTRYPOINT=opencode in the environment of the process that starts the opencode server. The spawned claude processes inherit it (checked in /proc).

    On approval: T3 Code merged the same change (pingdotgg/t3code#28410, label t3-code) after informal approval from Anthropic: https://youtube.com/watch?v=y5TEATUDDfc&t=877. Might be worth asking Anthropic for the same.

  5. Salloxy commented on Nov 3, 2026

    @Salloxy
    Author

    @JtMotoX Just saw the video from Theo and came here to leave the same comment!

    @Tarquinen please check if there is any way to get approval from Anthropic. Doubt they would give explicit approval to t3 code but not opencode

  6. Tarquinen commented on Nov 3, 2026

    @Tarquinen
    Member

    Reopening this, I think there's enough evidence that this is a real degradation of the SDK vs normal claude code use. I'll work on getting official support, for now you can do something like CLAUDE_CODE_ENTRYPOINT=opencode opencode, thats the same fix.

  7. Salloxy commented on Nov 3, 2026

    @Salloxy
    Author

    Possible to have a look at #61073 as that PR uses this fix? Thanks 🙏

  8. Tarquinen commented on Nov 3, 2026

    @Tarquinen
    Member

    yea we'll use that

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