Repository navigation
feat(launch): add opt-in entrypoint relabeling via CPROXY_ENTRYPOINT - #33
Merged
Merged
Conversation
Headless Claude Code (claude -p, the Agent SDK) labels its requests sdk-cli/sdk-ts, and Anthropic's plan meters currently charge those labels roughly 1.7x-2.9x more of the 5-hour window per token than the same tokens under any other label (anthropics/claude-code#97074, pingdotgg/t3code#24649). A custom CLAUDE_CODE_ENTRYPOINT label sidesteps the weighting - the same workaround T3 Code and Paseo ship. CPROXY_ENTRYPOINT=<name> launches claude with that label, replacing any inherited value. Unset (the default), off, 0, or an unusable name (cli, which headless claude rewrites to sdk-cli, and the sdk-* spellings) leaves CLAUDE_CODE_ENTRYPOINT exactly as the environment has it, including absent: stock claude behaviour. Amp-Thread-ID: https://ampcode.com/threads/T-01a1827b-84be-77af-be20-fc95a7f72d46 Co-authored-by: Osama Khalid <osama.khalid@spare.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Temporary workaround for pingdotgg/t3code#24649 / anthropics/claude-code#97074: Anthropic's plan meters currently charge headless Claude Code (
claude -p, Agent SDK apps) roughly 1.7×–2.9× more of the 5-hour window per token than the same tokens under any other label, because those sessions label their requestssdk-cli/sdk-ts. A customCLAUDE_CODE_ENTRYPOINTlabel skips the weighting — the same workaround T3 Code and Paseo ship.cproxy can now apply it, opt-in only:
CPROXY_ENTRYPOINT=<name>→ the launch carries that label (e.g.CPROXY_ENTRYPOINT=acme-agent), replacing any inherited value.off,0, or an unusable name (cli, which headless claude rewrites tosdk-cli, andsdk-*spellings) →CLAUDE_CODE_ENTRYPOINTis left exactly as the environment has it, including absent: stock claude behaviour. Nothing is labeled unless you ask.So when the metering is fixed upstream, there is nothing to undo — no launch is labeled by default. No Claude settings files are read; it's one env var on the proxy side.
Verification
gofmt -l .clean,go vet ./...,go test ./...,go build -trimpath ./...all pass (table-driven tests cover passthrough of inheritedcli/sdk-*/custom values, flag injection and replacement, unusable andoff/0cases).cproxy run --isolated -- env): unset → variable absent; ambientsdk-ts/clipass through untouched;CPROXY_ENTRYPOINT=acme-agent→acme-agentover ambient;offandclileave ambient untouched.cc_entrypoint=in the billing block + User-Agent(external, <label>)) was wire-verified earlier against a mock upstream.Amp thread: https://ampcode.com/threads/T-01a1827b-84be-77af-be20-fc95a7f72d46