Skip to content

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

Closed

Description

@Steinvorth

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

Activity

  1. github-actions commented on Dec 22, 2025

    @github-actions
    Contributor

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

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

  2. self-assigned this
    on Dec 22, 2025
  3. connorads commented on Jan 21, 2026

    @connorads
    Contributor

    Doesn't look like it microsoft/vscode#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.

  4. adrians5j commented on Feb 4, 2026

    @adrians5j

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

  5. cuipengfei commented on Feb 4, 2026

    @cuipengfei

    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

  6. georgeharker commented on Feb 23, 2026

    @georgeharker
    Contributor

    Does that mean opencode thinks it has 400k to work in but will repeatedly hit max_prompt before that with large goal summaries?

  7. github-actions commented on Apr 25, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions