GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(provider): apply config model cost overrides at runtime by mollux · Pull Request #17645 · anomalyco/opencode

Conversation

@mollux

@mollux mollux commented Mar 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #17223

Type of change

  • 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

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

KnutZuidema, jabr, nguyendown, mattsawyer77, Micpol, wimleers, fabians-px, michimalek-besitec, Abioy, xellos866, and a-peleshok reacted with thumbs up emoji KnutZuidema and michimalek-besitec reacted with hooray emoji jabr, Micpol, bluthen, and xellos866 reacted with heart emoji
All reactions
  • 👍 11 reactions
  • 🎉 2 reactions
  • ❤️ 4 reactions
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Mar 15, 2026
@github-actions

github-actions Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mollux
mollux marked this pull request as ready for review March 21, 2026 16:51
@mollux mollux mentioned this pull request Mar 21, 2026
Cost tracking ($ Spent) does not work for custom provider models #17223
Closed
@jabr

jabr commented Mar 25, 2026

Copy link
Copy Markdown

Any chance this will be merged soon? I use API accounts directly with providers that are often missing from the standard models.dev data, and thus specify most of my model configs (and pricing info) directly in my opencode.json config. This means that OpenCode's cost estimates are wildly inaccurate for me, even though the token usage counts are correct.

In this example, it appears to be pricing the cached reads at $0 even though I have the correct config for $0.06/Mtok. The 1.5M input + 68.7K output looks to equal the $0.54 total it reports, but it's missing $0.66 of cached read cost:

┌────────────────────────────────────────────────────────┐
│                      MODEL USAGE                       │
├────────────────────────────────────────────────────────┤
│ novita-ai/novita-ai/minimax/minimax-m2.7               │
│  Messages                                          216 │
│  Input Tokens                                     1.5M │
│  Output Tokens                                   68.7K │
│  Cache Read                                      11.0M │
│  Cache Write                                         0 │
│  Cost                                          $0.5447 │
└────────────────────────────────────────────────────────┘
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mollux
mollux force-pushed the fix/runtime-model-cost-config-override branch 2 times, most recently from 1873952 to 4150f92 Compare April 14, 2026 11:19
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 2f2ed11 to 9f201d6 Compare April 16, 2026 21:55
@mollux
test(provider): cover config cost overrides
e72cdfb
@mollux
mollux force-pushed the fix/runtime-model-cost-config-override branch from 4150f92 to e72cdfb Compare June 27, 2026 20:30
@djmaze

djmaze commented Jul 1, 2026

Copy link
Copy Markdown

Somehow this PR only contains a test but not real change. @mollux Can you fix this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hyqf98

hyqf98 commented Jul 2, 2026

Copy link
Copy Markdown

This PR has been open for nearly 4 months and is critical for anyone using custom providers (LiteLLM proxies, Chinese model providers like GLM/DeepSeek/Qwen, OpenAI-compatible endpoints).

The cost config field in opencode.json model definitions has zero effect — $ Spent stays at $0.00 regardless of token usage. This affects a huge number of users outside the Anthropic/OpenAI ecosystem.

Real-world impact: Users in China using GLM-5.2, DeepSeek V4, MiMo, etc. via @ai-sdk/openai-compatible cannot see any cost tracking. Related issues: #24113, #17223.

The fix looks solid with test coverage. Could the maintainers prioritize reviewing and merging this? Many users are resorting to third-party plugins (opencode-throughput, opencode-tokenscope) as workarounds because the built-in cost tracking is completely broken for custom providers.

buildgreatthings reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hyqf98 hyqf98 mentioned this pull request Jul 2, 2026
[BUG] Cost tracking shows $0.00 for Chinese model providers (GLM, DeepSeek, Qwen, MiMo) via @ai-sdk/openai-compatible #34877
Closed
@djmaze

djmaze commented Jul 3, 2026

Copy link
Copy Markdown

Everyone in here who is not a hallucinating bot, raise your hands. ✋

a-peleshok reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@buildgreatthings

buildgreatthings commented Jul 11, 2026

Copy link
Copy Markdown

+1

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

1 similar comment
@a-peleshok

a-peleshok commented Jul 11, 2026

Copy link
Copy Markdown

+1

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@riley206-pnnl riley206-pnnl mentioned this pull request Jul 14, 2026
fix(opencode): apply config cost overrides and track usage for openai-compatible models #36903
Closed
3 of 6 tasks
@riley206-pnnl

riley206-pnnl commented Jul 15, 2026

Copy link
Copy Markdown

real fix here #36903

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Jul 17, 2026
Kimi K3 does not accurately report money spent via Moonshot AI API #37524
Closed
@rekram1-node

rekram1-node commented Jul 20, 2026

Copy link
Copy Markdown
Member

This adds nothing, closing

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node rekram1-node closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Cost tracking ($ Spent) does not work for custom provider models

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@mollux @jabr @djmaze @hyqf98 @buildgreatthings @a-peleshok @riley206-pnnl @rekram1-node
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.