feat(gitlab): send context-1m-2025-08-07 beta header to enable 1M context window#16153
feat(gitlab): send context-1m-2025-08-07 beta header to enable 1M context window#16153Krule wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, here are potential related PRs: Potentially Related PRs
These PRs address similar functionality (1M context support for Anthropic/Claude models) but on different providers/platforms. The current PR (#16153) is specifically for GitLab AI Gateway, so these are likely complementary rather than duplicates. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
d38f331 to
ca0a3d1
Compare
Issue for this PR
Related to #12338
Type of change
What does this PR do?
Adds
anthropic-beta: context-1m-2025-08-07to theaiGatewayHeaderssent with every GitLab Duo request. This unlocks the 1M token context window for Claude Sonnet 4.6 and Claude Opus 4.6 via the GitLab Duo provider.The GitLab AI Gateway already supports this: it lists
duo-chat-opus-4-6withmax_context_tokens: 1_000_000in its model config, andanthropic-betais explicitly in its_ALLOWED_HEADERS_TO_DOWNSTREAMlist, meaning it forwards the header to Anthropic.A companion PR to update the context limit in
models.devis at anomalyco/models.dev#1089.How did you verify your code works?
Tested locally by building from source and running a session with
gitlab/duo-chat-opus-4-6that exceeded 200k tokens. Without this change the gateway returns a 400 context overflow error. With this change the session continues past 200k.Also verified by reading the GitLab AI Gateway source:
models.yml—max_context_tokens: 1_000_000forclaude_opus_4_6_20260205anthropic.py—anthropic-betais in_ALLOWED_HEADERS_TO_DOWNSTREAMScreenshots / recordings
N/A — not a UI change.
Checklist