feat: multi-provider pricing and custom rate overrides#101
Merged
Conversation
Savings estimates were locked to Anthropic model pricing, showing wrong numbers for users on GPT-4o, Gemini, etc. Now supports 15 models across three providers with static fallbacks, and users can override rates via pricing.input/pricing.output in cce.toml for unlisted models. Dashboard savings page now shows estimated cost saved with the active pricing model and rates. Closes #99
Use TYPE_CHECKING import for Config to satisfy both F821 (undefined name) and F401 (unused import) rules.
fazleelahhee
previously approved these changes
Jun 11, 2026
This was referenced Jun 11, 2026
Member
Author
Contributor
There was a problem hiding this comment.
Pull request overview
Adds multi-provider model pricing support so savings/cost estimates work beyond Anthropic defaults, with config-driven model selection and per-rate overrides, and surfaces this information in both CLI and dashboard.
Changes:
- Introduces static pricing for multiple OpenAI/Google/Anthropic models and merges it with live-fetched Anthropic pricing (cache-backed).
- Adds
pricing.input/pricing.outputoverrides to config and uses a sharedresolve_pricing()helper in CLI/dashboard. - Extends the dashboard savings API/UI and updates tests accordingly.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_cli_smoke.py | Updates pricing fallback expectations and asserts presence of non-Anthropic models. |
| tests/dashboard/test_server.py | Extends /api/savings assertions to include pricing metadata and cost saved. |
| src/context_engine/pricing.py | Adds static multi-provider pricing, merged lookup behavior, and resolve_pricing() / list_available_models(). |
| src/context_engine/dashboard/server.py | Adds pricing/cost fields to /api/savings. |
| src/context_engine/dashboard/_page.py | Updates Savings page UI to show estimated cost saved and pricing note. |
| src/context_engine/config.py | Adds optional pricing rate override fields and config mapping/type validation. |
| src/context_engine/cli.py | Switches savings reporting to use centralized resolve_pricing(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- list_available_models() no longer triggers network fetch - resolve_pricing() strips whitespace, shows fallback label when model unknown - Config accepts None for pricing_input/pricing_output (YAML null) - Dashboard pricing note references correct config file paths - Dashboard /api/savings uses fetch_live=False to avoid request-path latency - Savings tests patched to be hermetic (no network/cache side effects)
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
pricing.inputandpricing.outputconfig overrides incce.tomlfor unlisted or custom-priced modelsExample
cce.tomlconfigs:Closes #99