Skip to content

fix: correct github-copilot model limits to match Copilot API#1246

Open
Nepomuceno wants to merge 1 commit intoanomalyco:devfrom
Nepomuceno:fix/github-copilot-model-limits
Open

fix: correct github-copilot model limits to match Copilot API#1246
Nepomuceno wants to merge 1 commit intoanomalyco:devfrom
Nepomuceno:fix/github-copilot-model-limits

Conversation

@Nepomuceno
Copy link

Summary

Corrects token limits for 6 models in the github-copilot provider to match the authoritative values from the Copilot API (GET https://api.githubcopilot.com/models).

This PR only fixes limits — no models are added or removed.

Changes

Model Field Before After (Copilot API) Delta
claude-haiku-4.5 context 144,000 200,000 +56,000
input 128,000 136,000 +8,000
output 32,000 64,000 +32,000
claude-opus-4.5 context 160,000 200,000 +40,000
input 128,000 168,000 +40,000
claude-opus-4.6 context 144,000 200,000 +56,000
input 128,000 168,000 +40,000
output 64,000 32,000 -32,000
claude-sonnet-4.5 context 144,000 200,000 +56,000
input 128,000 168,000 +40,000
claude-sonnet-4.6 input 128,000 168,000 +40,000
gpt-5.2 context 264,000 400,000 +136,000
input 128,000 272,000 +144,000
output 64,000 128,000 +64,000

How the correct values were verified

curl -s "https://api.githubcopilot.com/models" \
  -H "Authorization: Bearer $(gh auth token)" \
  -H "Copilot-Integration-Id: vscode-chat"

Each model in the response includes:

"limits": {
    "max_context_window_tokens": ...,   // → limit.context
    "max_prompt_tokens": ...,           // → limit.input
    "max_output_tokens": ...            // → limit.output
}

Impact

The under-reported limits cause tools like OpenCode to trigger context compaction 40K–136K tokens earlier than necessary, significantly degrading the user experience especially for Claude and GPT-5.2 models.

Fixes #858

Update token limits for 6 models in the github-copilot provider to
match the authoritative values from the Copilot API endpoint
(GET https://api.githubcopilot.com/models).

Models fixed:
- claude-haiku-4.5: ctx 144K→200K, input 128K→136K, output 32K→64K
- claude-opus-4.5: ctx 160K→200K, input 128K→168K
- claude-opus-4.6: ctx 144K→200K, input 128K→168K, output 64K→32K
- claude-sonnet-4.5: ctx 144K→200K, input 128K→168K
- claude-sonnet-4.6: input 128K→168K
- gpt-5.2: ctx 264K→400K, input 128K→272K, output 64K→128K

The under-reported limits cause tools like OpenCode to trigger context
compaction 40K-136K tokens earlier than necessary.

Fixes anomalyco#858
@rekram1-node
Copy link
Contributor

@Nepomuceno Where are u getting these? What kind of subscription do u have?

I'm testing and this doesnt seem accurate??

    "family": "claude-haiku-4.5",
    "limits": {
      "max_context_window_tokens": 144000,
      "max_non_streaming_output_tokens": 16000,
      "max_output_tokens": 32000,
      "max_prompt_tokens": 128000,
      "vision": {

@Nepomuceno
Copy link
Author

Interesting I do have an enterprise subscription with very relaxed limits. Interesting problem on how do we do with that.

@Nepomuceno
Copy link
Author

Happy to chat on alternatives on how this can be made more dynamic because those limits do change all the time and based on your subscription

@zakriabilal
Copy link

That is very odd, I've just done this on my end and can see the 200K limits. I’m not on the enterprise plan, but we do have the Business Copilot subscriptions with models enabled.

Could it be that the functionality is geo-restricted, or perhaps it is being rolled out gradually?

image

@rekram1-node
Copy link
Contributor

I think the ideal solution is just having opencode plugin sync from github models list and that way itll use the specifics for ur account

@tobwen
Copy link
Contributor

tobwen commented Mar 24, 2026

That would also solve this issue: #1193

@tobwen
Copy link
Contributor

tobwen commented Mar 24, 2026

Is anyone working on it already?

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.

GitHub Copilot Claude model limits are inaccurate — missing max_prompt_tokens and wrong context values

4 participants