Skip to content

feat(launch): add opt-in entrypoint relabeling via CPROXY_ENTRYPOINT - #33

Merged
dehydr8 merged 1 commit into
mainfrom
feat/entrypoint-relabel
Oct 28, 2026
Merged

dehydr8 merged 1 commit into
mainfrom
feat/entrypoint-relabel

Conversation

@dehydr8

@dehydr8 dehydr8 commented Oct 28, 2026

Copy link
Copy Markdown
Owner

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 requests sdk-cli/sdk-ts. A custom CLAUDE_CODE_ENTRYPOINT label 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.
  • Unset (the default), off, 0, or an unusable name (cli, which headless claude rewrites to sdk-cli, and sdk-* spellings) → CLAUDE_CODE_ENTRYPOINT is 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 inherited cli/sdk-*/custom values, flag injection and replacement, unusable and off/0 cases).
  • End-to-end through the built binary (cproxy run --isolated -- env): unset → variable absent; ambient sdk-ts/cli pass through untouched; CPROXY_ENTRYPOINT=acme-agent → acme-agent over ambient; off and cli leave ambient untouched.
  • Label wiring itself (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

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>
@dehydr8
dehydr8 merged commit de54322 into main Oct 28, 2026
2 checks passed
@dehydr8
dehydr8 deleted the feat/entrypoint-relabel branch October 28, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants