mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2970] [Engine] expose configured pricing in model listings #4370
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4370
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2970
Author: @lindestad
Created: 10/17/2026
Status: 🔄 Open
Base:
main← Head:model-listing-pricing📝 Commits (1)
d0ca672serve: expose configured pricing in model listings📊 Changes
3 files changed (+183 additions, -0 deletions)
View changed files
📝
docs/DETAILS.md(+26 -0)📝
serve/server.py(+29 -0)➕
serve/test_model_pricing.py(+128 -0)📄 Description
Problem and result
I want to compare Hermes and OpenCode usage using the same simulated external API rates. Hermes can discover rates from an endpoint's model listing, but Strata 0.2.0-beta still omits them.
This adds an optional top-level
pricingobject to the run config and reports it in/v1/modelsand/models, including aliases. Existing configs need no edits: missing,nulland empty pricing blocks leave the listing unchanged.Related discussion
Closes #2969. This updates the existing PR after the tracker reset.
Approach
Validate known rates before loading the engine, then publish the supplied values unchanged. Rates accept finite, nonnegative numbers or decimal strings, including zero. Token rates are USD per token;
requestis USD per API request. The documented example uses OpenRouter'sinput_cache_readandinput_cache_write; Hermes-stylecache_readandcache_writealso work. Unknown fields are preserved for extensions.Rebased onto main
e88ee39d, keeping the new config parsing and API-key preflight. The diff remains limited to the Python server, pricing tests and configuration documentation.Validation
Tested revision
901c7be0on 0.2.0-beta, based one88ee39d. CachyOS Linux x86_64, Python 3.12.14, 91 GiB RAM; RTX 5080 (16 GB VRAM, driver 615.78.08), unused by these mock-engine tests.Passed:
25 tests passed, including config startup, both endpoints, aliases, free rates and exact response bytes without pricing.
368 tests passed in 110.086 seconds.
git diff e88ee39d...901c7be0 --checkalso passed.Direct comparison with unmodified main reproduced missing pricing there and confirmed that the patch publishes the configured rates. Both endpoints stayed byte-identical to main for no config file, an empty config, a model config and aliases without pricing. The reproduction command and output are below.
Baseline comparison command and output
Run from the PR checkout:
Failed: None observed.
Not run: GPU inference, a new live Hermes/OpenCode session, or backend builds. This change touches no engine or backend code; the HTTP checks use the mock engine.
Limits
These are operator-defined accounting rates. Clients calculate estimates from their own usage; Strata adds no billing or usage storage. This does not establish that OpenCode discovers rates through
/v1/models.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.