feat: log forwarded requests under --verbose#2
Merged
skishore23 merged 2 commits intoJun 11, 2026
Conversation
Extends --verbose to print a one-line summary of each forwarded request (method, path, model, stream flag, body size, and the `anthropic-beta` header) plus a per-response status line showing which account served it. The `anthropic-beta` header is the diagnostic payload: a `context-1m-*` value means the client negotiated the 1M-token context window; its absence means the client is assuming the 200K default and will auto-compact far sooner. The response line makes account flapping — which invalidates the upstream prompt cache — visible at the same time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When an account hits 429/402/529, --verbose now prints the upstream response body (truncated) and the reported 5h/7d utilization headers, not just the status. This distinguishes a real quota limit (high utilization, rate_limit_error body) from an auth/request-shape rejection that merely uses a 429 status — the two were indistinguishable from the status code alone. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Extends the existing
--verboseflag (which today only logs rotations/errors) to also print, per forwarded request:Why
Useful for proxy debugging in general, but specifically a diagnostic for a compaction issue seen when driving Claude Code through the proxy (auto-compacting on nearly every tool call). The
anthropic-betaheader is the tell:context-1m-*value, the client negotiated the 1M-token context window.ANTHROPIC_API_KEYthat puts Claude Code in API-key mode rather than subscription mode.The per-response status line surfaces account flapping at the same time, which invalidates the upstream prompt cache and compounds the cost.
Notes
--verbose; default behavior unchanged.cargo build,cargo clippy --all-targetsclean; 18 unit + 5 integration tests pass.🤖 Generated with Claude Code