Skip to content

fix(opencode): correct GitHub Copilot Claude context limits and thinking variants#20318

Closed
MoonFuji wants to merge 1 commit intoanomalyco:devfrom
MoonFuji:fix/github-copilot-claude-limits-and-variants
Closed

fix(opencode): correct GitHub Copilot Claude context limits and thinking variants#20318
MoonFuji wants to merge 1 commit intoanomalyco:devfrom
MoonFuji:fix/github-copilot-claude-limits-and-variants

Conversation

@MoonFuji
Copy link
Copy Markdown

Issue for this PR

Closes #20317

Type of change

  • Bug fix

What does this PR do?

Two bugs affect Claude models when used via the GitHub Copilot provider:

1. Wrong context/output limitsmodels.dev has incorrect values for GitHub Copilot Claude models (e.g. claude-opus-4.6 is listed as 144k context/64k output, correct is 1M/128k). Fixed in provider.ts inside fromModelsDevModel() with a lookup table that overrides the wrong values for Copilot+Claude combos, using the values from Anthropic's official model documentation.

2. Missing adaptive thinking variantstransform.ts had a @ai-sdk/github-copilot branch that returned only a single hardcoded thinking entry for any Claude model. The isAnthropicAdaptive variable (already computed at the top of variants()) was unused in this branch. Fixed to return low/medium/high/max for adaptive models (opus-4.6, sonnet-4.6) and high/max for other Claude models, matching the Anthropic direct-provider behavior.

How did you verify your code works?

  • Read the live models.dev API and confirmed the wrong values are present
  • Read the variants() function and confirmed isAnthropicAdaptive was already correctly detecting the model IDs but was never used in the @ai-sdk/github-copilot branch
  • Inspected both edited files to confirm the patches are syntactically correct TypeScript

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…ing variants

- provider.ts: override models.dev incorrect context/output limits for
  GitHub Copilot Claude models in fromModelsDevModel(). models.dev reports
  wrong values (e.g. claude-opus-4.6 as 144k context) vs Anthropic docs.

- transform.ts: fix @ai-sdk/github-copilot claude branch in variants() to
  return adaptive effort levels (low/medium/high/max for opus-4.6 and
  sonnet-4.6; high/max for other claude models) instead of a single
  hardcoded 'thinking' variant.

Fixes anomalyco#20317
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.

fix: GitHub Copilot Claude models have wrong context limits and missing thinking variants

2 participants