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
Claude Agent: 5-hour plan limit drains ~1.8x faster because the SDK labels requests sdk-ts #61072
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).
2.2.5 / dev at c8a473b, Claude Code 2.1.316, Agent SDK 0.3.301
Steps to reproduce
Connect the Claude Agent provider with a Pro/Max subscription.
Run a session and look at any Claude transcript it writes under ~/.claude/projects/...: every entry has "entrypoint":"sdk-ts".
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.
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.
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.
@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).
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.
Reacted by JtMotoX, Salloxy, Ricardo Chu, Houssam Elbadissi and Lucas Carrias
Activity
opencodejr commentedon Nov 1, 2026
Thanks for the detailed write-up and for linking the upstream measurements.
To restate the request: the Claude Agent provider should set
CLAUDE_CODE_ENTRYPOINTitself (for example toopencode) instead of leaving the Agent SDK's defaultsdk-ts, so that Pro/Max users don't use up the 5-hour plan window faster than they would in theclaudeTUI.I've labelled this a feature request rather than a bug. OpenCode does reach Claude Code through the Agent SDK, so
sdk-tsis 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 exportingCLAUDE_CODE_ENTRYPOINTbefore you startopencodeapplies to its sessions. Setting it in~/.claude/settings.jsonhas no effect, because the provider doesn't load those settings.Related:
Salloxy commentedon Nov 1, 2026
This is a bug not a feature request. The bug being usage drained significantly faster than it should.
Tarquinen commentedon Nov 1, 2026
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.
JtMotoX commentedon Nov 2, 2026
@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 -pbinary and flags, no tools, 14 jobs per run of a ~5k-token writing prompt. OnlyCLAUDE_CODE_ENTRYPOINTchanged. I readfive_hour.utilizationbefore and after each run, waited for it to settle, and divided the change bytotal_cost_usd.sdk-tsopencodeThat'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-tsrun went first.Workaround I'm using: set
CLAUDE_CODE_ENTRYPOINT=opencodein the environment of the process that starts the opencode server. The spawnedclaudeprocesses 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.Salloxy commentedon Nov 3, 2026
@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
Tarquinen commentedon Nov 3, 2026
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.Salloxy commentedon Nov 3, 2026
Possible to have a look at #61073 as that PR uses this fix? Thanks 🙏
Tarquinen commentedon Nov 3, 2026
yea we'll use that