Repository navigation
feat(costs): use bundled model prices by default - #1049
Merged
Merged
Conversation
Contributor
Base automatically changed from
emehtabuddin/desktop-installer-platforms
to
main
October 21, 2026 03:11
elyasmnvidian
force-pushed
the
emehtabuddin/desktop-prices-file
branch
from
October 21, 2026 07:14
ed9cb2d to
a5efe3f
Compare
|
elyasmnvidian
force-pushed
the
emehtabuddin/desktop-prices-file
branch
from
October 21, 2026 16:31
a5efe3f to
e75c39d
Compare
elyasmnvidian
force-pushed
the
emehtabuddin/desktop-prices-file
branch
from
October 21, 2026 16:53
e75c39d to
01f2715
Compare
Signed-off-by: Elyas Mehtabuddin <emehtabuddin@nvidia.com>
elyasmnvidian
force-pushed
the
emehtabuddin/desktop-prices-file
branch
from
October 21, 2026 17:29
01f2715 to
a0531fb
Compare
ayushag-nv
reviewed
Oct 21, 2026
ayushag-nv
left a comment
Contributor
There was a problem hiding this comment.
Should we pull in cost from OpenRouter on the go instead of hardcoding ? It will be difficult to maintain
bhuvan002
self-requested a review
October 21, 2026 18:44
bhuvan002
approved these changes
Oct 21, 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.
Before this PR, when a provider omitted a dollar charge and no price file was set, the server recorded the cost as unknown. Now the server and desktop app estimate costs from a price table bundled in the
switchyard-costscrate. For example, calls toclaude-opus-5-5now get estimated costs and desktop baselines without a custom price file.The table lists 35 exact model IDs: 15 direct OpenAI IDs, eight prefixed OpenAI IDs,
codex-auto-review, seven direct Claude IDs, three OpenRouter Claude IDs, andazure/anthropic/claude-haiku-4-5. The bundled rates match OpenAI's prices, Anthropic's prices, and OpenRouter's model list as of October 21, 2026.codex-auto-reviewuses thegpt-6-solrates. IDs with a provider prefix use list rates, so billed charges may differ. IDs must match exactly; unlisted IDs stay unknown.For GPT-5.6 and newer, cache writes cost 1.25 times the input rate (OpenAI's 30-minute rate). Older OpenAI models charge the input rate for separately counted writes. Claude rates separate 5-minute and 1-hour writes. The table leaves out long-context and service-tier pricing, OpenAI's 12-hour cache writes, tool fees, and cache storage. Bundled rates change only with a release. ChatGPT subscription comparisons are estimates.
To use your own rates, pass
--pricing-file PATHto the server or setpricing_filein desktop settings. The TOML or JSON file replaces the whole table. A missing, unreadable, or invalid configured file is an error. Provider-reported charges, including zero, take precedence over estimates. Missing usage or rates leave the estimate unknown, and changing rates does not reprice saved calls. The server loads rates at startup, and the desktop app loads them when it refreshes settings or usage; neither fetches prices over the network. Install creates no price file, and uninstall keeps custom price files. Users must convert or remove older inline[prices]settings by hand.Testing
A local HTTP stub returned 10 uncached input tokens and 2 output tokens for
azure/anthropic/claude-haiku-4-5. With routing logging on and no price file, the server recorded{"usd":0.00002,"source":"estimated"}. TOML and JSON price files that set input to $9 and output to $0 per million tokens both produced$0.00009. The stub checks Switchyard's cost math only; it does not check a provider's bill.TOML price file used