fix(copilot): correct Claude thinking variants and context windows#20319
fix(copilot): correct Claude thinking variants and context windows#20319MoonFuji wants to merge 2 commits intoanomalyco:devfrom
Conversation
Previously, GitHub Copilot Claude models had only a single binary "thinking" variant with a fixed 4000 token budget. This adds four granular levels matching typical budget tiers used across other providers: - low: 1,000 tokens - medium: 4,000 tokens - high: 10,000 tokens - max: 16,000 tokens Uses the Copilot SDK flat snake_case format (thinking_budget: number) as confirmed in openai-compatible-chat-options.ts.
models.dev reports stale/incorrect context windows for Anthropic Claude models served via GitHub Copilot. This adds an override table based on official Anthropic documentation (https://docs.anthropic.com/en/docs/about-claude/models): claude-opus-4.6 / claude-sonnet-4.6 → 1,000,000 tokens claude-opus-4.5 / claude-sonnet-4.5 → 200,000 tokens claude-haiku-4.5 → 200,000 tokens Both dot-notation (4.6) and dash-notation (4-6) IDs are handled to cover any naming variations returned by the Copilot API.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, I found two highly related PRs that may be duplicates or overlapping with PR #20319: Related PRs:
Most critical: Check PR #20318 first - it appears to be the closest duplicate addressing the same fixes. |
|
U cant just override the context windows, these arent going to be accurate for most copilot users. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Summary
Two bugs fixed for Claude models served via GitHub Copilot:
1. Multi-level thinking budget variants (
transform.ts)Before: Only a single binary
thinkingvariant with a hardcoded 4,000-token budget.After: Four granular budget levels matching standard tiers:
thinking_budgetlowmediumhighmaxUses the Copilot SDK flat snake_case format (
thinking_budget: number) as defined inopenai-compatible-chat-options.ts— not the@ai-sdk/anthropicformat.2. Correct context windows (
provider.ts)Before: Context windows sourced from
models.devwhich contains stale/incorrect values (e.g.claude-opus-4.6shown as ~128K).After: Override table applied when
m.api.npm === "@ai-sdk/github-copilot", based on official Anthropic documentation:claude-opus-4.6,claude-sonnet-4.6claude-opus-4.5,claude-sonnet-4.5,claude-haiku-4.5Both dot-notation (
4.6) and dash-notation (4-6) IDs are handled to cover API naming variations.Files changed
packages/opencode/src/provider/transform.tspackages/opencode/src/provider/provider.ts