Skip to content

GH Copilot Context Size update #1136

Closed
Closed

Description

@slhad

GH Copilot has recently updated the context size of all or almost of the models.

After seeing PR #1104 being closed then found out PR #810 , It seems they may have finally sorted out the official context size (no output/input column).

I don't know how/where @rekram1-node is working on it (or anybody else), I just hope that the current limit setup is indicative and don't force compaction when there is a context size window a lot larger available

Here is my contribution from my Business account if it can help :

Image

Activity

  1. d4rky-pl commented on Mar 11, 2026

    @d4rky-pl

    I can confirm that at least for Opus 4.6 the new context sizes are not limited to just vsc / copilot cli but also work fine in opencode (I tweaked opencode.json to increase them and been running since yesterday with no issues)

  2. slhad commented on Mar 11, 2026

    @slhad
    Author

    so we do need to tweak them manually for now ? I did not find anything in https://opencode.ai/docs/models/ for that, how did you do it @d4rky-pl ?

    Other issues like anomalyco/opencode#16308 seem to indicate there are bugs preventing us to do that

  3. d4rky-pl commented on Mar 11, 2026

    @d4rky-pl

    @slhad the documentation for opencode.json is unfortunately very poorly maintained. The entire schema for the file is available under https://opencode.ai/config.json and includes all the undocumented features as long as you either are OK with analyzing the file yourself or you ask AI to do it for you. Or, in this case, you can try using the config I shared in opencode issue. It works for me but I don't "vibe code" and have auto-compaction enabled disabled (edit: typo, long day) so YMMV.

    Please be aware that I give zero guarantees, I do not provide support, I will not keep this trick up to date if anything changes and I'm not a maintainer of this project.

    The issue you linked seems to have nothing to do with Copilot (which never provided 1M context window) but it's hard to say because the reporter seems to be very confused about things.

  4. rekram1-node commented on Mar 11, 2026

    @rekram1-node
    Collaborator

    I think for some of this opencode just needs to sync models based on ur account/org froom the github models endpoint.

    I'm looking at the model limits from the api and I don't see these values.

  5. rekram1-node commented on Mar 11, 2026

    @rekram1-node
    Collaborator

    This is the script I use to sync:

    #!/usr/bin/env bun
    import fs from "fs/promises";
    import { homedir } from "os";
    import path from "path";
    import { randomUUID } from "node:crypto";
    
    const authPath = path.join(homedir(), ".local/share/opencode/auth.json");
    const authData = JSON.parse(await fs.readFile(authPath, "utf-8"));
    const token = authData["github-copilot"].access;
    
    // assuming individual account type otherwise use https://api.${accountType}.githubcopilot.com
    const url = "https://api.githubcopilot.com";
    
    const COPILOT_VERSION = "0.32.4";
    const EDITOR_PLUGIN_VERSION = `copilot-chat/${COPILOT_VERSION}`;
    
    const headers: Record<string, string> = {
      Authorization: `Bearer ${token}`,
      "content-type": "application/json",
      "copilot-integration-id": "vscode-chat",
      "editor-version": `vscode/1.105.s`,
      "editor-plugin-version": EDITOR_PLUGIN_VERSION,
      "user-agent": `GitHubCopilotChat/${COPILOT_VERSION}`,
      "openai-intent": "conversation-panel",
      "x-github-api-version": "2025-04-01",
      "x-request-id": randomUUID(),
      "x-vscode-user-agent-library-version": "electron-fetch",
    };
    
    const response = await fetch(`${url}/models`, {
      headers,
    });
    
    if (!response.ok) {
      throw new Error(
        `Failed to fetch models: ${response.status} ${response.statusText}`,
      );
    }
    
    export interface ModelsResponse {
      data: Array<Model>;
      object: string;
    }
    
    interface ModelLimits {
      max_context_window_tokens?: number;
      max_output_tokens?: number;
      max_prompt_tokens?: number;
      max_inputs?: number;
    }
    
    interface ModelSupports {
      tool_calls?: boolean;
      parallel_tool_calls?: boolean;
      dimensions?: boolean;
    }
    
    interface ModelCapabilities {
      family: string;
      limits: ModelLimits;
      object: string;
      supports: ModelSupports;
      tokenizer: string;
      type: string;
    }
    
    interface Model {
      capabilities: ModelCapabilities;
      id: string;
      model_picker_enabled: boolean;
      name: string;
      object: string;
      preview: boolean;
      vendor: string;
      version: string;
      policy?: {
        state: string;
        terms: string;
      };
    }
    
    const data = (await response.json()) as ModelsResponse;
    
    const pretty = JSON.stringify(data, null, 2);
    
    await Bun.write("models.local.json", pretty);
    
    console.log(pretty);
    
  6. self-assigned this
    on Mar 11, 2026
  7. d4rky-pl commented on Mar 11, 2026

    @d4rky-pl

    @rekram1-node I think it may be an issue with your script, I see the same results:

          "capabilities": {
            "family": "claude-opus-4.6",
            "limits": {
              "max_context_window_tokens": 144000,
              "max_non_streaming_output_tokens": 16000,
              "max_output_tokens": 64000,
              "max_prompt_tokens": 128000,
              "vision": {
                "max_prompt_image_size": 3145728,
                "max_prompt_images": 1,
                "supported_media_types": [
                  "image/jpeg",
                  "image/png",
                  "image/webp"
                ]
              }
            },
    

    but at the same time I already confirmed multiple times that I can comfortably hit at least 180K context (as measured by opencode so I may be misunderstanding something). The script you shared makes you pretend to be vscode, maybe the issue is with the version it presents itself as? 🤔

    I'll also try to poke at this a bit more

  8. d4rky-pl commented on Mar 11, 2026

    @d4rky-pl

    @rekram1-node I only now realized that VSC changed the way it's displaying the context size between versions which may be why it's so confusing.

    edit: and after re-reading the issue I see it was mentioned at the very top 🤦

    VSC version 1.109.5

    Image

    VSC 1.110

    Image

    They seem to be displaying the "Context Size" as Input + Output now.

    At the same time with the override in opencode.json I comfortably hit this (with compaction disabled):

    Image

    ...but I admit I may just as well be misunderstanding what I'm seeing here. With auto-compaction enabled it usually hit the threshold at around 90-100K before but it could be due to other bugs.

    For comparison, Copilot CLI:

    Image

    If I can help in any way let me know, otherwise I'll stop making extra noise

  9. slhad commented on Mar 11, 2026

    @slhad
    Author

    Indeed adding "prompt_tokens" and "output_tokens" seems to be the context value displayed (if we ignore Grok and Gemeni models which seems to have a 19K tokens deducted for what ever reason)

    Easier to see with that addition

    console.log(JSON.stringify(data.data.map((model) => ({
      id: model.id,
      name: model.name,
      prompt_tokens: model?.capabilities?.limits?.max_prompt_tokens,
      output_tokens: model?.capabilities?.limits?.max_output_tokens,
      max_context_window_tokens: model?.capabilities?.limits?.max_context_window_tokens,
      sum_prompt_and_output: (model?.capabilities?.limits?.max_prompt_tokens ?? 0) + (model?.capabilities?.limits?.max_output_tokens ?? 0),
    })), null, 2));
  10. rekram1-node commented on Mar 12, 2026

    @rekram1-node
    Collaborator

    The script isn't wrong it's pulling directly from their api, but yeah I see what u mean. Ill play w/ their limit see what happens

  11. hugefiver commented on Mar 12, 2026

    @hugefiver

    @rekram1-node

    I am the author of #1104. Here is my command for fetching the model list from the Copilot API, and the file changes were made by LLM.

    $T = curl -s https://api.github.com/copilot_internal/v2/token -H "Authorization: Bearer $COPILOT_TOKEN" -H 'User-Agent: GitHubCopilotChat/0.39.0' -H 'Editor-Version: vscode/1.111.0' -H 'Editor-Plugin-Version: copilot-chat/0.39.0' -H 'Copilot-Integration-Id: vscode-chat' -H 'X-GitHub-Api-Version: 2025-05-01'; curl -s "$($T|jq -r '.endpoints.api')/models" -H "Authorization: Bearer $($T|jq -r .token)" -H 'User-Agent: GitHubCopilotChat/0.39.0' -H 'Editor-Version: vscode/1.111.0' -H 'Editor-Plugin-Version: copilot-chat/0.39.0' | jq '[.data[] | select(.model_picker_enabled == true) | select(.id | test("claude|gpt|gemini"))]' | clip

    And I guess the context shown in VSCode's "chat: Manage LMs" maybe the lower on of max_context_window_tokens and max_prompt_tokens + max_output_tokens.

  12. tlerbao commented on Mar 16, 2026

    @tlerbao

    I didn't quite understand the content of your discussion; my English is poor.

    Does it mean that Copilot still has a 128K context, but the display method has changed, showing the input and output limits together?

    @d4rky-pl @slhad @hugefiver @rekram1-node @crankycoder

  13. slhad commented on Mar 16, 2026

    @slhad
    Author

    From what I see within VS Code with Opus 4.6, context window is the one advertised

    Right now after quite some subagents and sumarizations, Opus 4.6 stopped at

    Image

    And they changed again the context size displayed (I did not recheck API data directly), probably with 1.111.0

    Image
  14. tlerbao commented on Mar 16, 2026

    @tlerbao

    @slhad Seems like good news, but Claude's official version already supports 1M context, so GitHub still has some catching up to do.

  15. paolomainardi commented on Mar 17, 2026

    @paolomainardi

    opencode.json

    How did you configure the input and output tokens? willing to share the config ?

    Anyway, I confirm I can see the same context window on my business account too:

    Image
  16. paolomainardi commented on Mar 17, 2026

    @paolomainardi

    This is the script I use to sync:

    #!/usr/bin/env bun
    import fs from "fs/promises";
    import { homedir } from "os";
    import path from "path";
    import { randomUUID } from "node:crypto";
    
    const authPath = path.join(homedir(), ".local/share/opencode/auth.json");
    const authData = JSON.parse(await fs.readFile(authPath, "utf-8"));
    const token = authData["github-copilot"].access;
    
    // assuming individual account type otherwise use https://api.${accountType}.githubcopilot.com
    const url = "https://api.githubcopilot.com";
    
    const COPILOT_VERSION = "0.32.4";
    const EDITOR_PLUGIN_VERSION = `copilot-chat/${COPILOT_VERSION}`;
    
    const headers: Record<string, string> = {
      Authorization: `Bearer ${token}`,
      "content-type": "application/json",
      "copilot-integration-id": "vscode-chat",
      "editor-version": `vscode/1.105.s`,
      "editor-plugin-version": EDITOR_PLUGIN_VERSION,
      "user-agent": `GitHubCopilotChat/${COPILOT_VERSION}`,
      "openai-intent": "conversation-panel",
      "x-github-api-version": "2025-04-01",
      "x-request-id": randomUUID(),
      "x-vscode-user-agent-library-version": "electron-fetch",
    };
    
    const response = await fetch(`${url}/models`, {
      headers,
    });
    
    if (!response.ok) {
      throw new Error(
        `Failed to fetch models: ${response.status} ${response.statusText}`,
      );
    }
    
    export interface ModelsResponse {
      data: Array<Model>;
      object: string;
    }
    
    interface ModelLimits {
      max_context_window_tokens?: number;
      max_output_tokens?: number;
      max_prompt_tokens?: number;
      max_inputs?: number;
    }
    
    interface ModelSupports {
      tool_calls?: boolean;
      parallel_tool_calls?: boolean;
      dimensions?: boolean;
    }
    
    interface ModelCapabilities {
      family: string;
      limits: ModelLimits;
      object: string;
      supports: ModelSupports;
      tokenizer: string;
      type: string;
    }
    
    interface Model {
      capabilities: ModelCapabilities;
      id: string;
      model_picker_enabled: boolean;
      name: string;
      object: string;
      preview: boolean;
      vendor: string;
      version: string;
      policy?: {
        state: string;
        terms: string;
      };
    }
    
    const data = (await response.json()) as ModelsResponse;
    
    const pretty = JSON.stringify(data, null, 2);
    
    await Bun.write("models.local.json", pretty);
    
    console.log(pretty);
    

    I see this running the script on the business account:

    ┌─────────┬──────────────────────────┬───────────┬───────────┬───────────┬───────────────┬──────────────────┐
    │ (index) │ id                       │ prompt    │ output    │ window    │ prompt+output │ inferred context │
    ├─────────┼──────────────────────────┼───────────┼───────────┼───────────┼───────────────┼──────────────────┤
    │ 0       │ 'claude-haiku-4.5'       │ '136,000' │ '64,000'  │ '200,000' │ '200,000'     │ '200,000'        │
    │ 1       │ 'claude-opus-4.5'        │ '168,000' │ '32,000'  │ '200,000' │ '200,000'     │ '200,000'        │
    │ 2       │ 'claude-opus-4.6'        │ '168,000' │ '32,000'  │ '200,000' │ '200,000'     │ '200,000'        │
    │ 3       │ 'claude-sonnet-4'        │ '128,000' │ '16,000'  │ '216,000' │ '144,000'     │ '144,000'        │
    │ 4       │ 'claude-sonnet-4.5'      │ '168,000' │ '32,000'  │ '200,000' │ '200,000'     │ '200,000'        │
    │ 5       │ 'claude-sonnet-4.6'      │ '168,000' │ '32,000'  │ '200,000' │ '200,000'     │ '200,000'        │
    │ 6       │ 'gemini-2.5-pro'         │ '128,000' │ '64,000'  │ '128,000' │ '192,000'     │ '128,000'        │
    │ 7       │ 'gemini-3-flash-preview' │ '128,000' │ '64,000'  │ '128,000' │ '192,000'     │ '128,000'        │
    │ 8       │ 'gemini-3-pro-preview'   │ '136,000' │ '64,000'  │ '200,000' │ '200,000'     │ '200,000'        │
    │ 9       │ 'gemini-3.1-pro-preview' │ '136,000' │ '64,000'  │ '200,000' │ '200,000'     │ '200,000'        │
    │ 10      │ 'gpt-4.1'                │ '64,000'  │ '16,384'  │ '128,000' │ '80,384'      │ '80,384'         │
    │ 11      │ 'gpt-41-copilot'         │ '-'       │ '-'       │ '-'       │ '-'           │ '-'              │
    │ 12      │ 'gpt-4o'                 │ '64,000'  │ '4,096'   │ '128,000' │ '68,096'      │ '68,096'         │
    │ 13      │ 'gpt-5-mini'             │ '128,000' │ '64,000'  │ '264,000' │ '192,000'     │ '192,000'        │
    │ 14      │ 'gpt-5.1'                │ '128,000' │ '64,000'  │ '264,000' │ '192,000'     │ '192,000'        │
    │ 15      │ 'gpt-5.1-codex'          │ '128,000' │ '128,000' │ '400,000' │ '256,000'     │ '256,000'        │
    │ 16      │ 'gpt-5.1-codex-max'      │ '128,000' │ '128,000' │ '400,000' │ '256,000'     │ '256,000'        │
    │ 17      │ 'gpt-5.1-codex-mini'     │ '128,000' │ '128,000' │ '400,000' │ '256,000'     │ '256,000'        │
    │ 18      │ 'gpt-5.2'                │ '272,000' │ '128,000' │ '400,000' │ '400,000'     │ '400,000'        │
    │ 19      │ 'gpt-5.2-codex'          │ '272,000' │ '128,000' │ '400,000' │ '400,000'     │ '400,000'        │
    │ 20      │ 'gpt-5.3-codex'          │ '272,000' │ '128,000' │ '400,000' │ '400,000'     │ '400,000'        │
    │ 21      │ 'gpt-5.4'                │ '272,000' │ '128,000' │ '400,000' │ '400,000'     │ '400,000'        │
    │ 22      │ 'grok-code-fast-1'       │ '128,000' │ '64,000'  │ '128,000' │ '192,000'     │ '128,000'        │
    └─────────┴──────────────────────────┴───────────┴───────────┴───────────┴───────────────┴──────────────────┘
  17. tlerbao commented on Mar 17, 2026

    @tlerbao

    @paolomainardi Interestingly, the data I obtained using this script shows that opus4.6 is 144,000 and sonnet4.6 is 200,000.,wtf

    Image Image
  18. slhad commented on Mar 18, 2026

    @slhad
    Author

    With VS Code 1.112.0 / Github Copilot Chat 0.40.1 , I have "The reserved for response" part now, seems a lot like 64K tokens for GPT-5-mini (192K tokens) and 128K for GPT-5.4 (400K) corresponding to the max_output_tokens

    It's still the same context size as last screenshot of @paolomainardi Language Models

    Image Image
  19. rekram1-node commented on Mar 20, 2026

    @rekram1-node
    Collaborator

    This is complete sync from their api:
    #1235

  20. rekram1-node commented on Mar 20, 2026

    @rekram1-node
    Collaborator

    Okay based on some preliminary testing, this pr seems correct^^ if ur hitting issues with it lmk. I am gonna merge it, if u are using opencode (once this pr deploys) you can immediately refresh ur model list by running

    opencode models --refresh

  21. tlerbao commented on Mar 21, 2026

    @tlerbao

    @rekram1-node Does that mean I don't need to set parameters like limit.context/.output/.input for each model with the provider github-copilot in the configuration file?

  22. rekram1-node commented on Mar 24, 2026

    @rekram1-node
    Collaborator

    you never should have needed to

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