#17645 · @mollux · opened Mar 15, 2026 at 7:27 PM UTC · last updated Mar 21, 2026 at 4:51 PM UTC
fix(provider): apply config model cost overrides at runtime
Score breakdown
Impact
Clarity
Urgency
Ease Of Review
Guidelines
Readiness
Size
Trust
Traction
Summary
This PR fixes a bug where custom provider model cost overrides from the config were not applied at runtime, leading to incorrect cost tracking. The change ensures cost values are consistently used for usage calculations.
Description
Issue for this PR
Closes #17223
Type of change
- [x] Bug fix
- [ ] New feature
- [ ] Refactor / code improvement
- [ ] Documentation
What does this PR do?
This fixes a runtime gap where model prices from config could be present in resolved config but not applied on the final model object used for usage/cost calculations. The change applies config model cost overrides during provider model finalization so cost values are consistently present before runtime usage math runs.
How did you verify your code works?
- Added/updated provider test coverage for model cost override behavior via config content.
- Ran focused tests locally:
bun test test/provider/provider.test.ts -t "OPENCODE_CONFIG_CONTENT overrides cost for configured model|model cost overrides existing cost values"
Screenshots / recordings
N/A (non-UI change)
Checklist
- [x] I have tested my changes locally
- [x] I have not included unrelated changes in this PR
Linked Issues
#17223 Cost tracking ($ Spent) does not work for custom provider models
View issueComments
No comments.
Changed Files
packages/opencode/src/provider/provider.ts
+25−1packages/opencode/test/provider/provider.test.ts
+59−0