feat(anthropic): enable 1M context window for Claude models#1134
Open
kilo-code-bot[bot] wants to merge 1 commit intomainfrom
Open
feat(anthropic): enable 1M context window for Claude models#1134kilo-code-bot[bot] wants to merge 1 commit intomainfrom
kilo-code-bot[bot] wants to merge 1 commit intomainfrom
Conversation
Add the context-1m-2025-08-07 beta header to the standard OpenRouter proxy path and override context_length from 200K to 1M for non-Haiku Anthropic models in the enhanced model list.
| extraHeaders: Record<string, string> | ||
| ) { | ||
| appendAnthropicBetaHeader(extraHeaders, 'fine-grained-tool-streaming-2025-05-14'); | ||
| appendAnthropicBetaHeader(extraHeaders, 'context-1m-2025-08-07'); |
Contributor
Author
There was a problem hiding this comment.
WARNING: Gate the 1M beta header to non-Haiku models
applyAnthropicModelSettings() runs for every anthropic/* request, so this now adds context-1m-2025-08-07 to Haiku too. The model-list change in this PR explicitly excludes Haiku, which suggests the beta is not meant to apply there; if Anthropic validates beta flags per model, Haiku requests will start failing even though the UI still advertises the smaller context window.
Contributor
Author
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)CRITICAL
WARNING
SUGGESTION
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments: N/A Files Reviewed (4 files)
Reviewed by gpt-5.4-20260305 · 530,299 tokens |
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.
Summary
context-1m-2025-08-07Anthropic beta header to the standard OpenRouter proxy path (applyAnthropicModelSettings), matching what was already done in the custom LLM pathway. Previously, only the custom LLM path incustomLlmRequest.tssent this header — the main proxy route did not, leaving Claude models limited to 200K context.context_lengthfrom 200K to 1M for non-Haiku Anthropic models in the enhanced model list returned byGET /api/openrouter/models. OpenRouter reports 200K, but with the beta header enabled, Claude Sonnet/Opus models actually support 1M tokens.ANTHROPIC_1M_CONTEXT_LENGTHconstant from the anthropic provider module for shared use.Verification
pnpm typecheck— passed (all 30 workspace projects)pnpm format:check— passed (all matched files use Prettier code style)pnpm lint— passed (all workspace projects, no errors)Visual Changes
N/A
Reviewer Notes
context-1m-2025-08-07beta header is appended alongside the existingfine-grained-tool-streaming-2025-05-14header using the sameappendAnthropicBetaHeaderhelper, which correctly comma-joins multiple beta flags.kilo-auto/frontiermodel already advertised 1M context (kilo-auto-model.ts:31), but the underlying Claude models it routes to were still listed at 200K — this change makes the direct Claude model entries consistent.