Add context field to OpenRouter, MistralAI, and OpenAI models#2653
Open
costajohnt wants to merge 2 commits intoHeyPuter:mainfrom
Open
Add context field to OpenRouter, MistralAI, and OpenAI models#2653costajohnt wants to merge 2 commits intoHeyPuter:mainfrom
costajohnt wants to merge 2 commits intoHeyPuter:mainfrom
Conversation
OpenRouter's API returns context_length for each model, but it was not being mapped to the context field in the model list response. This caused the context window size to be missing for all OpenRouter models. Closes HeyPuter#2347
Collaborator
|
we should probably support this "context" field in more models too |
Addresses reviewer feedback to support the context field in more providers. All 9 providers now consistently expose context window sizes via the context field. - MistralAI: 16 models (context matches known window sizes) - OpenAI: 27 models (128k for GPT series, 200k for o-series, 1M+ for GPT-4.1 and GPT-5.4)
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.
Summary
context_lengthfrom OpenRouter's API response to thecontextfield in the model list, matching the pattern used by all other providerscontextfield to all 16 MistralAI hardcoded model definitionscontextfield to all 27 OpenAI hardcoded model definitionsAll 9 providers now consistently expose context window sizes via the
contextfield.Context values by provider family:
Closes #2347
Test plan
contextin the model list API responsecontextfieldcontextfieldcontext)