fix: register Ollama Cloud as known provider for context length resolution#5490
Closed
LucidPaths wants to merge 1 commit into
Closed
fix: register Ollama Cloud as known provider for context length resolution#5490LucidPaths wants to merge 1 commit into
LucidPaths wants to merge 1 commit into
Conversation
…olution Ollama Cloud (ollama.com/v1) was not registered in the URL-to-provider mapping or the models.dev provider mapping. This caused all Ollama Cloud models to fall through to the 128K default context length, regardless of actual model capability (e.g. qwen3.5:397b has 256K, glm-5 has 202K). Two one-line additions: - _URL_TO_PROVIDER: map ollama.com -> ollama-cloud - PROVIDER_TO_MODELS_DEV: map ollama-cloud -> ollama-cloud This enables the existing models.dev cache lookup (step 5 in get_model_context_length) to resolve correct context lengths for all Ollama Cloud models.
Contributor
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.
What does this PR do?
Registers Ollama Cloud (
ollama.com/v1) as a recognized provider in the URL-to-provider and models.dev provider mappings. Without this, all Ollama Cloud models silently default to 128K context length instead of their actual capacity.The existing
get_model_context_length()resolution chain (step 5: provider-aware models.dev lookup) already handles this correctly for every other cloud provider — Ollama Cloud was simply missing from the two mapping dicts that feed it.Related Issue
Type of Change
Changes Made
agent/model_metadata.py: Added"ollama.com": "ollama-cloud"to_URL_TO_PROVIDERdict — enables_infer_provider_from_url()to recognize Ollama Cloud base URLs.agent/models_dev.py: Added"ollama-cloud": "ollama-cloud"toPROVIDER_TO_MODELS_DEVdict — enableslookup_models_dev_context()to resolve model context lengths from the models.dev cache.Impact
Affects all users on Ollama Cloud (Free, Pro, Max tiers) who use
https://ollama.com/v1as their base URL. Before this fix, every model on that endpoint reported 128K context regardless of actual capacity:This caused the status bar to display wrong values and — more critically — could lead to premature context compression or missed compression triggers.
How to Test
OLLAMA_API_KEYand usebase_url: https://ollama.com/v1/model qwen3.5:397b --provider custom)pytest tests/agent/test_model_metadata.py tests/agent/test_models_dev.py -vChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/A (no new config keys or user-facing API changes)cli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/A