[PR #4471] fix: gpt-5* and gpt-5.1* models context overflow #10984

Closed
opened 2026-02-16 18:15:45 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4471

State: closed
Merged: No


gpt-5 and gpt-5.1 models are said to have context window of 400k with max output 128k. But there is a max input limit of 272k ( 400k - 128k)

https://models.dev/?search=gpt-5

Current implementation expects available space of 368k ( 400k - 32k ) tokens which leads to context overflow.

Ref: https://openai.com/index/introducing-gpt-5-for-developers/

In the API, all GPT‑5 models can accept a maximum of 272,000 input tokens and emit a maximum of 128,000 reasoning & output tokens, for a total context length of 400,000 tokens.

https://learn.microsoft.com/en-us/azure/ai-foundry/foundry-models/concepts/models-sold-directly-by-azure?pivots=azure-openai&view=foundry-classic&tabs=global-standard-aoai%2Cstandard-chat-completions%2Cglobal-standard#region-availability

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4471 **State:** closed **Merged:** No --- gpt-5 and gpt-5.1 models are said to have context window of 400k with max output 128k. But there is a max input limit of 272k ( 400k - 128k) https://models.dev/?search=gpt-5 Current implementation expects available space of 368k ( 400k - 32k ) tokens which leads to context overflow. Ref: https://openai.com/index/introducing-gpt-5-for-developers/ `In the API, all GPT‑5 models can accept a maximum of 272,000 input tokens and emit a maximum of 128,000 reasoning & output tokens, for a total context length of 400,000 tokens.` https://learn.microsoft.com/en-us/azure/ai-foundry/foundry-models/concepts/models-sold-directly-by-azure?pivots=azure-openai&view=foundry-classic&tabs=global-standard-aoai%2Cstandard-chat-completions%2Cglobal-standard#region-availability
yindo added the pull-request label 2026-02-16 18:15:45 -05:00
yindo closed this issue 2026-02-16 18:15:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10984