Repository navigation
Description
Client or integration
Claude Code
Area
Proxy and routing
Summary
When Claude Code runs through opencodex (ocx claude, ANTHROPIC_BASE_URL=http://127.0.0.1:10100) with a claude.ai subscription, the native Anthropic passthrough rebuilds the response headers and drops every anthropic-ratelimit-* header. Claude Code reads the 5-hour / 7-day subscription usage from these headers, so the statusLine JSON never gets rate_limits (five_hour / seven_day). The key is missing entirely. Without the proxy it is present.
Expected: the passthrough relays the upstream anthropic-ratelimit-* headers so Claude Code can fill rate_limits, as it does against api.anthropic.com directly.
This is the same defect as #6292, which the issue-quality bot auto-closed because it did not use a template. It is still present on dev (checked src/server/claude-messages.ts at ea7bd16).
Cause: in src/server/claude-messages.ts, anthropicNativePassthrough() returns a new Response with a fixed header set:
- SSE path: only
Content-Type,Cache-Control,Connection - non-stream path: only
Content-TypeandRetry-After
All other upstream headers, including anthropic-ratelimit-unified-*, are discarded.
Reproduction
- Configure a Claude Code statusLine command that dumps its stdin JSON to a file.
- Launch Claude Code with
ocx claudeon a Pro/Max subscription (native passthrough) and send a message. - The dumped JSON has no
rate_limitskey. Launch plainclaude(no proxy) and it is present.
I applied the change below to the installed 2.73.0 package, ran ocx restart, and the statusLine stdin started carrying live rate_limits.five_hour / seven_day values on the next responses.
+/** Relay Anthropic rate-limit headers so Claude Code can fill statusLine `rate_limits`. */
+function passthroughRateLimitHeaders(upstream: Response): Record<string, string> {
+ const out: Record<string, string> = {};
+ upstream.headers.forEach((value, name) => {
+ if (name.toLowerCase().startsWith("anthropic-ratelimit-")) out[name] = value;
+ });
+ return out;
+}
+
async function anthropicNativePassthrough(
@@
"Content-Type": contentType,
"Cache-Control": "no-cache",
"Connection": "keep-alive",
+ ...passthroughRateLimitHeaders(upstream),
},
@@
- headers: { "Content-Type": contentType, ...(retryAfter ? { "Retry-After": retryAfter } : {}) },
+ headers: {
+ "Content-Type": contentType,
+ ...(retryAfter ? { "Retry-After": retryAfter } : {}),
+ ...passthroughRateLimitHeaders(upstream),
+ },Version
2.73.0
Operating system
Ubuntu 26.04.1 LTS (WSL2)
Provider and model
anthropic-native passthrough / claude-opus-5-5 (Claude Code 2.1.285, claude.ai subscription OAuth)
Logs or error output
No error is logged. The statusLine stdin JSON simply has no `rate_limits` key while routed through the proxy.Screenshots and supporting files
No response
Redacted configuration
{
"claudeCode": {
"nativePassthrough": true,
"authMode": "subscription"
}
}Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
Ingwannu commentedon Oct 1, 2026
Confirmed against current dev 6429463: anthropicNativePassthrough reconstructs both SSE and JSON/error response headers without the upstream anthropic-ratelimit-* family. The existing native response path therefore loses the information regardless of whether the body succeeds. I am preparing a narrow header-family relay with SSE and JSON/error regressions; unrelated upstream headers will not be forwarded. No live runtime restart or account traffic is needed for this validation. I will link the PR and exact test results here; this issue remains open until the fix lands.
github-actions commentedon Oct 1, 2026
Automated translation bookkeeping — detected language: English.
Ingwannu commentedon Oct 1, 2026
Fix PR: #6356, head eaadb51 (based on dev 6429463). The three original SSE/JSON/429 regressions failed before the change; after it, the expanded focused suite and layout/structure/file-size gates pass (141 tests), and typecheck passes. count_tokens and missing/unrelated-header behavior are covered too. All local validation used disposable homes and hard CPU/RAM limits; no live account or service changes. The PR is draft pending independent review and required CI, not a released fix. Keeping this issue open until the verified dev landing.
Ingwannu commentedon Oct 1, 2026
Update: #6356 at unchanged head eaadb51 is now ready for independent review. Exact-head Cross-platform CI run 36818611817 completed successfully, including four test shards, gates, docs build, structure and packaging/smoke jobs. This does not certify unselected full Windows/macOS lanes or a live statusLine/account run. Review was requested from lidge-jun; no self-approval or merge was performed.
fix(claude): relay native Anthropic rate-limit headers (#6356)
lidge-jun commentedon Oct 1, 2026
Fixed on dev by #6356 (404ca8b). It ships in the next release.