Merge pull request #485 from kunish/fix/copilot-premium-request-inflation

fix(copilot): reduce premium request inflation, enable thinking, and use dynamic API limits
This commit is contained in:
Luis Pater
2026-04-04 02:19:56 +08:00
committed by GitHub
6 changed files with 773 additions and 54 deletions

View File

@@ -848,6 +848,14 @@ func applyClaudeHeaders(r *http.Request, auth *cliproxyauth.Auth, apiKey string,
hasClaude1MHeader = true
}
}
// Also check auth attributes — GitLab Duo sets gitlab_duo_force_context_1m
// when routing through the Anthropic gateway, but the gin headers won't have
// X-CPA-CLAUDE-1M because the request is internally constructed.
if !hasClaude1MHeader && auth != nil && auth.Attributes != nil {
if auth.Attributes["gitlab_duo_force_context_1m"] == "true" {
hasClaude1MHeader = true
}
}
// Merge extra betas from request body and request flags.
if len(extraBetas) > 0 || hasClaude1MHeader {