Repository navigation
fix(free-tier): hide client tool names from shaped requests - #161
Merged
jasonxu114514 merged 1 commit intoOct 29, 2026
Merged
Conversation
The free tier refuses a shaped body whose tool list still reads as another client's session. A Claude Code request that declares both ReportFindings and ScheduleWakeup is answered with FreeUsageLimitError — the same 429 a genuinely exhausted IP receives — and the refusal is deterministic: rename either name and the same request succeeds, and two empty placeholder tools carrying just those two names reproduce it. Schema, size and tool count do not matter. The gateway forwarded client tools as clint_<name>, so every Claude Code session behind CLIProxyAPI was refused (14 tools, both markers present) while the official CLI kept working and small requests through the gateway were fine. Client tools now get an opaque wire name: clint_ plus 12 hex characters of the name's SHA-256, collision-suffixed like before. Descriptions and schemas are untouched, so the model still knows what a tool does, and the response path still restores the names the client declared, streaming included. Verified against the captured Claude Code request (95 KB, 14 tools): 3/3 429 before the change, 3/3 200 after, and the same request replayed through CLIProxyAPI (Anthropic /v1/messages -> chat -> /inference) returns 200. Session ids are unaffected: they are normalized by CanonicalSessionID, and an implausible session timestamp is a separate 429 trigger documented there.
This was referenced Oct 29, 2026
Closed
This was referenced Oct 29, 2026
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
Shaped free-tier requests now send client tools under an opaque wire name (
clint_+ 12 hex of the SHA-256 of the client name) instead ofclint_<client name>.Why
The free tier refuses a shaped body whose tool list still reads as another client's session, and answers with
429 FreeUsageLimitError— the exact message a genuinely exhausted IP receives.A Claude Code request (
claude-cli/2.1.312→ CLIProxyAPI → gateway) declares 14 tools. Two of them,ReportFindingsandScheduleWakeup, are enough on their own:ReportFindingsScheduleWakeupSo it is the names, not the schema, the size or the tool count. Because the gateway renames client tools as
clint_<name>, every Claude Code session behind a proxy hit this, while the official CLI (which sends its own tool set) kept working and small hand-written requests through the gateway were fine.Verification
Same daemon, same config, same minute, against the captured Claude Code body (95 898 bytes, 14 tools):
429 anon:429200 anon:200,in=28254End to end through CLIProxyAPI (
/v1/messages→ chat →/inference), replaying the original captured client request:200, normal SSE stream.Response path unchanged in behaviour: a call to a renamed client tool still comes back under the client's name, streaming fragments included (
"name":"Read"observed), and non-streamingtool_callsrestore too.go build ./...,go vet ./...,go test ./...pass.Notes
CanonicalSessionIDalready re-encodes foreign sessions, and an implausible session timestamp is a separate 429 trigger documented ininternal/identity/request.go; the follow-up identity work stays in fix(identity): salt derived session ids per process so a restart re-mints them #160.internal/protocol/tools_test.gopins opacity, stability and collision suffixes;internal/gateway/toolshape_test.gopins that a shaped body never spells the client tool names while still carrying the official set.Closes #163. Related: #158 (umbrella tracking), #156 / #162 (probe and bench identity), #159 / #160 (session identity).