Skip to content

fix(llm): claude code quota check header#1785

Merged
looplj merged 1 commit into
unstablefrom
dev-tmp
Jun 4, 2026
Merged

fix(llm): claude code quota check header#1785
looplj merged 1 commit into
unstablefrom
dev-tmp

Conversation

@looplj

@looplj looplj commented Jun 4, 2026

Copy link
Copy Markdown
Owner

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the anthropic-beta header sent during Claude Code quota-check requests by introducing a dedicated ClaudeCodeQuotaCheckHeader constant that omits context-1m-2025-08-07 (the 1M-token context beta), which is unnecessary for a minimal 1-token probe and was likely causing the quota check to fail.

  • constants.go: New ClaudeCodeQuotaCheckHeader constant added — same as ClaudeCodeBetaHeader minus context-1m-2025-08-07. Extra alignment whitespace added to ClaudeCodeQuotaCheckModel line.
  • claudecode_checker.go: CheckQuota now sends ClaudeCodeQuotaCheckHeader instead of ClaudeCodeBetaHeader for the anthropic-beta request header.

Confidence Score: 4/5

Safe to merge — the change is a targeted one-line swap to a narrower beta-header constant, and the new constant correctly drops the 1M-context beta flag that is irrelevant for a minimal quota-probe request.

Both changed files are small and focused. The new constant value is a strict subset of the existing ClaudeCodeBetaHeader, the omitted feature (context-1m-2025-08-07) has no bearing on a 1-token probe request, and the checker logic itself is unchanged. The only gap is a missing doc comment on the new constant.

No files require special attention; constants.go warrants a glance only for the missing comment on ClaudeCodeQuotaCheckHeader.

Important Files Changed

Filename Overview
llm/transformer/anthropic/claudecode/constants.go Adds ClaudeCodeQuotaCheckHeader constant — identical to ClaudeCodeBetaHeader but without context-1m-2025-08-07; also adds alignment whitespace to ClaudeCodeQuotaCheckModel. No doc comment on the new constant.
internal/server/biz/provider_quota/claudecode_checker.go Switches the anthropic-beta header in CheckQuota from ClaudeCodeBetaHeader to the new ClaudeCodeQuotaCheckHeader; one-line change, logically correct.

Sequence Diagram

sequenceDiagram
    participant C as ClaudeCodeQuotaChecker
    participant A as Anthropic API

    C->>A: "POST /v1/messages<br/>anthropic-beta: ClaudeCodeQuotaCheckHeader<br/>(no context-1m-2025-08-07)<br/>model: claude-haiku-4-5, max_tokens: 1"
    A-->>C: HTTP 200 + rate-limit headers
    C->>C: "parseResponse(headers)<br/>read Anthropic-Ratelimit-Unified-* headers"
    C-->>C: "return QuotaData{Status, Limits, ...}"
Loading

Reviews (1): Last reviewed commit: "fix(llm): claude code quota check header" | Re-trigger Greptile

// ClaudeCodeQuotaCheckModel is the model used for quota checking requests.
ClaudeCodeQuotaCheckModel = "claude-haiku-4-5"
ClaudeCodeQuotaCheckModel = "claude-haiku-4-5"
ClaudeCodeQuotaCheckHeader = "claude-code-20250219,interleaved-thinking-2025-05-14,redact-thinking-2026-02-12,context-management-2025-06-27,prompt-caching-scope-2026-01-05,mid-conversation-system-2026-04-07,effort-2025-11-24"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The new constant has no doc comment, unlike every other constant in this block. Future readers won't know which beta features were intentionally excluded from quota-check requests or why (here, context-1m-2025-08-07 is omitted because it's irrelevant for a 1-token quota probe).

Suggested change
ClaudeCodeQuotaCheckHeader = "claude-code-20250219,interleaved-thinking-2025-05-14,redact-thinking-2026-02-12,context-management-2025-06-27,prompt-caching-scope-2026-01-05,mid-conversation-system-2026-04-07,effort-2025-11-24"
// ClaudeCodeQuotaCheckHeader contains beta feature identifiers for quota-check requests.
// Intentionally omits context-1m-2025-08-07, which is not needed for minimal probe requests.
ClaudeCodeQuotaCheckHeader = "claude-code-20250219,interleaved-thinking-2025-05-14,redact-thinking-2026-02-12,context-management-2025-06-27,prompt-caching-scope-2026-01-05,mid-conversation-system-2026-04-07,effort-2025-11-24"

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@looplj looplj merged commit e5c2281 into unstable Jun 4, 2026
5 checks passed
junjiangao pushed a commit to junjiangao/axonhub that referenced this pull request Jun 5, 2026
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.

1 participant