Is there a way to increase Context limit for Github Copilot Provider? #3764

Open
opened 2026-02-16 17:41:24 -05:00 by yindo · 4 comments
Owner

Originally created by @Steinvorth on GitHub (Dec 22, 2025).

Originally assigned to: @rekram1-node on GitHub.

Question

I had commented a while ago on this issue, and it got solved by the answer found here: https://github.com/sst/opencode/issues/2317?utm_source=chatgpt.com

i will elaborate a little more since maybe it could be more helpful to understand why im asking.

My business only allows us to use GitHub Copilot as the model provider, so we can’t switch to a provider with larger context limits via API keys. When I use OpenCode with the GitHub Copilot provider, the conversation context seems capped at 128 K tokens, even if a model like chatgpt codex allows ~256k tokens.

I want to use OpenCode instead of vscode's chat window, but such a small context window makes it very hard to work on the implementations i use for my coding workflow.

Is there any way to increase the context limit in OpenCode when using the GitHub Copilot provider? For example:

  • Does the CLI solution GitHub released handle context differently in a way that OpenCode could use?
  • Is there any configuration or workaround that lets me expand the effective context beyond 128 K tokens within OpenCode?
Image

thanks for any help and information in advance

Originally created by @Steinvorth on GitHub (Dec 22, 2025). Originally assigned to: @rekram1-node on GitHub. ### Question I had commented a while ago on this issue, and it got solved by the answer found here: https://github.com/sst/opencode/issues/2317?utm_source=chatgpt.com i will elaborate a little more since maybe it could be more helpful to understand why im asking. My business only allows us to use GitHub Copilot as the model provider, so we can’t switch to a provider with larger context limits via API keys. When I use OpenCode with the GitHub Copilot provider, the conversation context seems capped at 128 K tokens, even if a model like chatgpt codex allows ~256k tokens. I want to use OpenCode instead of vscode's chat window, but such a small context window makes it very hard to work on the implementations i use for my coding workflow. Is there any way to increase the context limit in OpenCode when using the GitHub Copilot provider? For example: - Does the CLI solution GitHub released handle context differently in a way that OpenCode could use? - Is there any configuration or workaround that lets me expand the effective context beyond 128 K tokens within OpenCode? <img width="1016" height="320" alt="Image" src="https://github.com/user-attachments/assets/83a1dd0e-18c1-4ce1-a1e9-b5efc6dc2926" /> thanks for any help and information in advance
Author
Owner

@github-actions[bot] commented on GitHub (Dec 22, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2317: Discussed solution for GitHub Copilot context limitations (referenced in your issue)
  • #2464: Similar issue about prompt token limits (128000 tokens cap)
  • #3314: GitHub Copilot specific context counting issue with 128k limit
  • #4845: Unrecoverable error when prompt exceeds token limit
  • #4659: Feature request for sliding window context management for long-running sessions
  • #4096: Feature request for context control options for subagents
  • #5970: Subagent exceeding context window

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Dec 22, 2025): This issue might be a duplicate of existing issues. Please check: - #2317: Discussed solution for GitHub Copilot context limitations (referenced in your issue) - #2464: Similar issue about prompt token limits (128000 tokens cap) - #3314: GitHub Copilot specific context counting issue with 128k limit - #4845: Unrecoverable error when prompt exceeds token limit - #4659: Feature request for sliding window context management for long-running sessions - #4096: Feature request for context control options for subagents - #5970: Subagent exceeding context window Feel free to ignore if none of these address your specific case.
Author
Owner

@connorads commented on GitHub (Jan 21, 2026):

Doesn't look like it https://github.com/microsoft/vscode/issues/264153
Also maybe now that they have auto-compaction maybe they see less of a need
Hopefully they change their mind 🤷
Although I'm wonder if going over 128k is venturing into the dumb zone anyway, maybe I should give it another go.

👈 Research

I looked at a range of sources – GitHub issues and release notes, the official changelog, and independent articles – to see if there has been any move to raise the 128k token window for Copilot Chat and associated agents.

Current official limits

  • GitHub’s December 2024 changelog announced that Copilot Chat running GPT‑4o has a 64k token window for standard users, and that Visual Studio Code (VS Code) Insiders builds can access a 128k window – described at the time as “the maximum supported by GPT‑4o”. Independent guides written in 2026 confirm the same: the standard Copilot Chat window is only a few thousand tokens, the Pro+/VS Code Insiders combination gives 128k tokens, and the ordinary VS Code stable build gives 64k. There is no official mention of a larger context window on the Copilot website or documentation.
  • GitHub engineers have repeatedly explained that the 128k limit is a deliberate trade‑off. In a September 2025 issue, a Copilot engineer wrote that the limit balances server capacity, latency, cost and answer quality; most chats use less than 128k tokens, so raising the cap isn’t a priority. They suggested that anyone needing more context should bring their own API key and call the model directly. The issue was closed as “not planned”, indicating no roadmap to raise the limit.
  • A separate feature request in August 2025 asked to make context length configurable when using the “bring your own key” (BYOK) feature. A Microsoft engineer replied that higher context should already be available through BYOK and asked whether the reporter was seeing it. This issue was closed as completed. This implies that if you supply your own model (e.g. Gemini or Claude) via BYOK, you can use that model’s full context window, but Copilot itself still caps context at 128k.
  • Other issues and community posts ask for more transparency about context sizes, noting that some models (e.g. Claude Sonnet 4) have up to 200k tokens and may be further rate‑limited inside Copilot. A GitHub representative replied that Sonnet 4 typically has a 128k window in VS Code but preview models can be limited to 80k tokens due to resource constraints. Again, there was no suggestion of a future 200k or 400k cap.

Work under way

  • Recent Copilot CLI releases introduce “infinite sessions” with auto‑compaction. The CLI now automatically compresses chat history when it reaches about 95 % of the token limit and offers commands to compact or visualise context. These features help manage conversations within the 128k limit rather than expanding it.
  • GitHub blog posts and changelogs from January 2026 mention improvements such as new models and better context management tools but do not change the maximum token window.

Third‑party commentary

  • Some Reddit threads and blog posts speculate about 200k or 400k context windows and report occasional A/B tests, but these are not official announcements. For example, a DevClarity guide notes that alternative tools such as Cursor or Gemini Pro offer 200k–1 M token windows, whereas GitHub Copilot remains at 64k/128k depending on the plan. Users on Reddit therefore sometimes recommend switching to other coding assistants if very long context is needed.

Summary

As of 21 January 2026, GitHub has not announced any plan to raise the Copilot Chat context window beyond 128k tokens. Official statements emphasise that the 128k limit balances cost and performance. Developers who need larger contexts are advised to use the BYOK feature with a model that supports more tokens or choose another tool. The recent enhancements around “infinite sessions” and auto‑compaction are aimed at better managing existing limits rather than increasing them.

@connorads commented on GitHub (Jan 21, 2026): Doesn't look like it https://github.com/microsoft/vscode/issues/264153 Also maybe [now that they have auto-compaction](https://github.blog/changelog/2026-01-14-github-copilot-cli-enhanced-agents-context-management-and-new-ways-to-install/#context-management) maybe they see less of a need Hopefully they change their mind 🤷 Although I'm wonder if going over 128k is venturing into the dumb zone anyway, maybe I should give it another go. <details><summary>👈 Research</summary> <p> I looked at a range of sources – GitHub issues and release notes, the official changelog, and independent articles – to see if there has been any move to raise the 128k token window for Copilot Chat and associated agents. **Current official limits** * GitHub’s December 2024 changelog announced that Copilot Chat running GPT‑4o has a 64k token window for standard users, and that Visual Studio Code (VS Code) Insiders builds can access a 128k window – described at the time as “the maximum supported by GPT‑4o”. Independent guides written in 2026 confirm the same: the standard Copilot Chat window is only a few thousand tokens, the Pro+/VS Code Insiders combination gives 128k tokens, and the ordinary VS Code stable build gives 64k. There is no official mention of a larger context window on the Copilot website or documentation. * GitHub engineers have repeatedly explained that the 128k limit is a deliberate trade‑off. In a September 2025 issue, a Copilot engineer wrote that the limit balances server capacity, latency, cost and answer quality; most chats use less than 128k tokens, so raising the cap isn’t a priority. They suggested that anyone needing more context should bring their own API key and call the model directly. The issue was closed as “not planned”, indicating no roadmap to raise the limit. * A separate feature request in August 2025 asked to make context length configurable when using the “bring your own key” (BYOK) feature. A Microsoft engineer replied that higher context should already be available through BYOK and asked whether the reporter was seeing it. This issue was closed as completed. This implies that if you supply your own model (e.g. Gemini or Claude) via BYOK, you can use that model’s full context window, but Copilot itself still caps context at 128k. * Other issues and community posts ask for more transparency about context sizes, noting that some models (e.g. Claude Sonnet 4) have up to 200k tokens and may be further rate‑limited inside Copilot. A GitHub representative replied that Sonnet 4 typically has a 128k window in VS Code but preview models can be limited to 80k tokens due to resource constraints. Again, there was no suggestion of a future 200k or 400k cap. **Work under way** * Recent Copilot CLI releases introduce “infinite sessions” with auto‑compaction. The CLI now automatically compresses chat history when it reaches about 95 % of the token limit and offers commands to compact or visualise context. These features help manage conversations within the 128k limit rather than expanding it. * GitHub blog posts and changelogs from January 2026 mention improvements such as new models and better context management tools but do not change the maximum token window. **Third‑party commentary** * Some Reddit threads and blog posts speculate about 200k or 400k context windows and report occasional A/B tests, but these are not official announcements. For example, a DevClarity guide notes that alternative tools such as Cursor or Gemini Pro offer 200k–1 M token windows, whereas GitHub Copilot remains at 64k/128k depending on the plan. Users on Reddit therefore sometimes recommend switching to other coding assistants if very long context is needed. **Summary** As of 21 January 2026, GitHub has **not announced any plan to raise** the Copilot Chat context window beyond 128k tokens. Official statements emphasise that the 128k limit balances cost and performance. Developers who need larger contexts are advised to use the BYOK feature with a model that supports more tokens or choose another tool. The recent enhancements around “infinite sessions” and auto‑compaction are aimed at better managing existing limits rather than increasing them. </p> </details>
Author
Owner

@adrians5j commented on GitHub (Feb 4, 2026):

Kinda annoying for me as well. Regularly reaching 128k. :(

@adrians5j commented on GitHub (Feb 4, 2026): Kinda annoying for me as well. Regularly reaching 128k. :(
Author
Owner

@cuipengfei commented on GitHub (Feb 4, 2026):

I've gathered data directly from GitHub Copilot's official API confirming this limitation.

Key finding: Models like gpt-5.1-codex-max report 400K context_window but only allow 128K max_prompt (64% utilization).

Model context_window max_prompt Utilization
gpt-5.2-codex 400K 272K 100% ✓
gpt-5.1-codex-max 400K 128K 64%
gpt-5 400K 128K 64%

Full analysis with reproducible curl commands: https://github.com/orgs/community/discussions/186340

@cuipengfei commented on GitHub (Feb 4, 2026): I've gathered data directly from GitHub Copilot's official API confirming this limitation. **Key finding**: Models like gpt-5.1-codex-max report 400K `context_window` but only allow 128K `max_prompt` (64% utilization). | Model | context_window | max_prompt | Utilization | |-------|----------------|------------|-------------| | gpt-5.2-codex | 400K | 272K | 100% ✓ | | gpt-5.1-codex-max | 400K | 128K | 64% | | gpt-5 | 400K | 128K | 64% | Full analysis with reproducible curl commands: https://github.com/orgs/community/discussions/186340
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3764