Skip to content

Incorrectly reported token limits in agent panel on many GitHub Copilot models #44909

Description

@mkcode

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

Image

Are here is where it finally errors. The error log is included below.

Screenshot

Image

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:

  1. The token counter doesn't match what copilot / models use.
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:aiRelated to Agent Panel, Edit Prediction, Copilot, or other AI featuresarea:ai/copilotAI feedback for GitHub Copilot via ACPreach:all usersBug that happens for everyone on every platform no matter how they use Zedseverity:S2Average run-of-the-mill bugs; a feature is broken but only partially

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions