fix(ai): preserve verified context windows across providers - #999
Merged
Merged
Conversation
DeepSeek's /models reports no context windows, and only `deepseek-flash` was known to have 1M. `deepseek-v4-flash` (a legacy name DeepSeek still accepts for the same Flash model) fell back to 32,768, and with the byte-level prompt bound a normal synthesis request was refused as a context overflow before it was sent. The documented windows now live in one table covering every accepted name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…an 200K
The Anthropic model list was read without its context size, so a research
request to Claude Opus fell back to the 32K default and was refused before
sending ('The model does not have enough context'). Use the list's
max_input_tokens when present, with the documented 200K floor for Claude models.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deep Research rejected prompts against models whose real context windows were missing from
/models, or disappeared from the budget cache after five minutes. Preserve the last successful catalogue for the session and replace its snapshot on refresh, including smaller limits, removals and missing metadata. Isolate custom endpoints, including a configuration change while a catalogue request is pending. If custom discovery fails, retain its known windows while still offering manually entered model IDs.Extend the original DeepSeek/Claude fix to Gemini (
inputTokenLimit), Copilot (SDK catalogue refreshes), Cerebras (optional public metadata for authenticated models only), OpenAI, Xiaomi MiMo and OpenCode Go. Documented fallbacks match exact provider/model IDs; Go uses its own gateway limits, including smaller input ceilings. Unknown Claude IDs and Codex subscription models retain the conservative unknown-model cap. Local runtime allocations and advertised route limits take precedence. The Server catalogue uses the same generated shared contracts.Validation: