Reproduction steps
Creating a new issue following up on #44632.
Token size limits are often misreported in GitHub Copilot models. The marked up screenshot should be enough context to understand the issue.
Screenshot
Are here is where it finally errors. The error log is included below.
Screenshot
In this case, using Claude Open 4.5 via GitHub Copilot, the tokens go way over the stated limit.
It's my believe that there are actually two issues here:
- The token counter doesn't match what copilot / models use.
- Zed is not looking up what GitHub reports the context size to be.
In the case of the screenshots above with Opus 4.5, given that the error says the context size is 128k, I suspect the error is related to incorrect token counting.
I have also seen either ChatGPT 5 or Sonnet 4.5 go well above 200k tokens to around 265k tokens used reported in the Zed agent panel before erroring. In that case, I believe it is the second issue. The agent panel always shows a 128k token limit for GitHub Copilot models.
Luckily, continuing to use the model beyond the Zed reported token limit does work, so this is not as severe of an issue.
Unfortunately, it doesn't look like GitHub Copilot publishes any up-to-date information on it's context size limits.
Current vs. Expected behavior
I expect the token counter in the agent panel to report accurate values.
Zed version and system specs
Zed: v0.216.1+stable.95.81870d5cf77d61d40ec526a37141ebe3a74318ca (Zed)
OS: macOS 15.6
Memory: 64 GiB
Architecture: aarch64
Attach Zed log file
Zed.log
2025-12-15T14:34:02-05:00 ERROR [agent] Error in model response stream: Failed to connect to API: 400 Bad Request {"error":{"message":"prompt token count of 131835 exceeds the limit of 128000","code":"model_max_prompt_tokens_exceeded"}}
Relevant Zed settings
settings.json
Relevant Keymap
keymap.json
(for AI issues) Model provider details
Claude Opus 4.5 via GitHub Copilot
The scope of issue may exist on all models served via GitHub Copilot
If you are using WSL on Windows, what flavor of Linux are you using?
None
Reproduction steps
Creating a new issue following up on #44632.
Token size limits are often misreported in GitHub Copilot models. The marked up screenshot should be enough context to understand the issue.
Screenshot
Are here is where it finally errors. The error log is included below.
Screenshot
In this case, using Claude Open 4.5 via GitHub Copilot, the tokens go way over the stated limit.
It's my believe that there are actually two issues here:
In the case of the screenshots above with Opus 4.5, given that the error says the context size is 128k, I suspect the error is related to incorrect token counting.
I have also seen either ChatGPT 5 or Sonnet 4.5 go well above 200k tokens to around 265k tokens used reported in the Zed agent panel before erroring. In that case, I believe it is the second issue. The agent panel always shows a 128k token limit for GitHub Copilot models.
Luckily, continuing to use the model beyond the Zed reported token limit does work, so this is not as severe of an issue.
Unfortunately, it doesn't look like GitHub Copilot publishes any up-to-date information on it's context size limits.
Current vs. Expected behavior
I expect the token counter in the agent panel to report accurate values.
Zed version and system specs
Zed: v0.216.1+stable.95.81870d5cf77d61d40ec526a37141ebe3a74318ca (Zed)
OS: macOS 15.6
Memory: 64 GiB
Architecture: aarch64
Attach Zed log file
Zed.log
Relevant Zed settings
settings.json
Relevant Keymap
keymap.json
(for AI issues) Model provider details
Claude Opus 4.5 via GitHub Copilot
The scope of issue may exist on all models served via GitHub Copilot
If you are using WSL on Windows, what flavor of Linux are you using?
None