fix: zero out cost for local providers (ollama, local)#9222
Merged
Conversation
When the provider is a local inference engine (ollama, local), maybe_get_canonical_model now zeros out the pricing on the resolved canonical model. The model-name inference logic in map_to_canonical_model correctly resolves local models to their canonical architecture (e.g. ollama/mistral-nemo → mistralai/mistral-nemo) for context limits and capabilities, but the cloud pricing from that entry does not apply when running locally. Fixes #8192 Signed-off-by: Douwe Osinga <douwe@squareup.com>
b89609e to
ea0775f
Compare
alexhancock
approved these changes
May 14, 2026
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.
When the provider is a local inference engine (
ollama,local),maybe_get_canonical_modelnow zeros out the pricing on the resolved canonical model. The model-name inference logic correctly resolves local models to their canonical architecture (e.g.ollama/mistral-nemo→mistralai/mistral-nemo) for context limits and capabilities, but the cloud pricing from that entry does not apply when running locally.This fixes the bug where the CLI cost line showed non-zero dollar amounts for Ollama sessions.
The fix is in
maybe_get_canonical_model— the single public API that bridges requesting provider → canonical model. All consumers (CLI, server, future code) get correct zero cost without duplication.Fixes #8192