Copilot Chat BYOK `vendor: openai` appears to ignore `maxInputTokens` and `maxOutputTokens`

Open
#322,216 0 comments 0 reactions 1 assignee View on GitHub

@vritant24 is already working on this.

Since Jun 22, 2026.

Assessment

This issue has not been assessed yet.

Description

bug model-byok

VS Code Version:
1.125.1

Copilot Chat Version:
0.53.1

OS:
Windows 11

Description:
When configuring an OpenAI BYOK model through chatLanguageModels.json with vendor: openai, Copilot Chat appears to ignore the configured maxInputTokens and maxOutputTokens values.

The same configuration, when changed from vendor: openai to vendor: customendpoint, appears to honour the configured token limits correctly.

The documentation appears to imply that these model-level settings are valid for providers including openai, because the model configuration reference lists vendor examples including azure, openai, and customendpoint, and then lists maxInputTokens and maxOutputTokens as model-level properties. The docs also say VS Code uses the sum of these two values as the model's total context window in the Chat view.

If these settings are not intended to be supported for vendor: openai, the documentation should say that clearly. If they are intended to be supported, this appears to be a bug.

Model configuration:
The model is configured through chatLanguageModels.json, not selected from the standard built-in Copilot model list.

The relevant OpenAI provider entry uses the Responses API:

vendor: openai
apiType: responses
model id: gpt-5.5
streaming: true
toolCalling: true
vision: true
thinking: true
zeroDataRetentionEnabled: true
reasoningEffort: medium
maxInputTokens: 272000
maxOutputTokens: 128000
url: https://api.openai.com/v1/responses

Representative redacted configuration:

[
  {
    "name": "OpenAI",
    "vendor": "openai",
    "apiKey": "${input:chat.lm.secret.REDACTED}",
    "models": [
      {
        "id": "gpt-5.5",
        "name": "GPT-5.5",
        "url": "https://api.openai.com/v1/responses",
        "apiType": "responses",
        "toolCalling": true,
        "vision": true,
        "thinking": true,
        "streaming": true,
        "maxInputTokens": 272000,
        "maxOutputTokens": 128000,
        "zeroDataRetentionEnabled": true,
        "supportsReasoningEffort": ["none", "low", "medium", "high", "xhigh"],
        "reasoningEffortFormat": "responses"
      }
    ],
    "settings": {
      "gpt-5.5": {
        "reasoningEffort": "medium"
      }
    }
  }
]

Expected:
The Context Window popover and context packing should use the configured model limits:

maxInputTokens + maxOutputTokens
272000 + 128000 = 400000 tokens

So the Chat UI should show a context window of approximately 400K tokens.

The configured maxInputTokens value should also be respected by context packing so that VS Code does not pack more input context than the configured cap.

Actual:
With vendor: openai, the Context Window popover showed a much larger context window, approximately:

18.8K / 888K tokens

This suggests VS Code is using built-in or discovered metadata for the recognised OpenAI model instead of the manually configured maxInputTokens and maxOutputTokens.

Workaround / comparison:
Changing the same endpoint and model configuration to vendor: customendpoint causes the configured values to be honoured.

For example:

[
  {
    "name": "OpenAI Custom Endpoint",
    "vendor": "customendpoint",
    "apiKey": "${input:chat.lm.secret.REDACTED}",
    "apiType": "responses",
    "models": [
      {
        "id": "gpt-5.5",
        "name": "GPT-5.5 Custom",
        "url": "https://api.openai.com/v1/responses",
        "apiType": "responses",
        "toolCalling": true,
        "vision": true,
        "thinking": true,
        "streaming": true,
        "maxInputTokens": 272000,
        "maxOutputTokens": 128000,
        "zeroDataRetentionEnabled": true,
        "supportsReasoningEffort": ["none", "low", "medium", "high", "xhigh"],
        "reasoningEffortFormat": "responses"
      }
    ],
    "settings": {
      "gpt-5.5": {
        "reasoningEffort": "medium"
      }
    }
  }
]

With vendor: customendpoint, the Context Window popover showed:

18.8K / 400K tokens

That matches the configured total:

272000 + 128000 = 400000 tokens

Impact:
This prevents users from reliably controlling context packing for BYOK OpenAI models.

In this specific case, the configured model has a pricing threshold based on input-token count. If VS Code ignores the configured maxInputTokens value and instead packs according to the model's larger maximum context window, a conversation can unexpectedly cross into the higher pricing tier.

This is especially problematic because the UI appears to advertise the larger effective context window when vendor: openai is used, suggesting that the larger value may be used by the context packer rather than only displayed incorrectly.

Suggested resolution:
If maxInputTokens and maxOutputTokens are intended to be supported with vendor: openai, ensure the OpenAI provider honours the configured model-level values and uses them for both:

  • the Chat Context Window display
  • context packing / prompt construction

If these settings are intentionally ignored or overridden for recognised OpenAI models when vendor: openai is used, please document that clearly in the BYOK / chatLanguageModels.json model configuration documentation.

Additional notes:
Other model-level settings may also be affected when using vendor: openai, but this has not been verified. The demonstrated issue is specifically with maxInputTokens and maxOutputTokens.

The current workaround is to configure the same OpenAI Responses API endpoint using vendor: customendpoint, where the configured token limits appear to be honoured.

Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.