Repository navigation
v0.20.0
0.20.0 moves model prices out of code and into a data file. A price change no longer needs a new yoagent release. Full details, with migration notes, are in CHANGELOG.md.
Breaking (behaviour)
- Generic first-party constructors now return a price when the model is listed. This covers
anthropic,openai,openai_responses,google,xai,groq,deepseek,mistral,zai,minimax,qwenandmeta. For example,ModelConfig::anthropic("claude-opus-5-5", …)now returnsSome(cost)instead ofNone. Gateways and custom endpoints (custom,openai_compat,local,ollama, OpenCode) remain unpriced. meta(id, name)is priced per id. Ids that aren't listed now returnNoneinstead of a single fixed price.
Added
src/provider/prices.jsonholds every built-in price, with its source URL and the date it was checked.PriceTableloads and validates it. Each preset's price is bit-for-bit the same as in 0.19.0.- Runtime overrides. Set
YOAGENT_PRICES=/path/prices.json, or callprices::global::install_override(table). The override returns a report of what changed, what reverted and which entries can never apply.env_override_status()andload_env_override()let an app fail fast on a bad file. - Live price sources, only when you call them.
PriceSource::YoagentMainfetches this repo's checkedprices.jsonfrommain, so a merged price fix reaches you without a release.PriceSource::ModelsDevand your ownUrlare also supported.PriceTable::fetch_cached(source, path, CacheOptions)keeps a disk cache and tells you where the prices came from, how old they are, and any error.- Fetched prices replace the built-in ones by default.
InstallPolicy::AddOnlyonly fills in models that aren't listed.
- Precedence, highest first: your override, then fetched prices, then the built-in file. A
config.costyou set yourself wins over all three;reprice()andwith_prices()replace it. - Re-pricing existing configs.
ModelConfig::reprice(),Agent::reprice()andSubAgentTool::reprice()re-price configs built before you installed prices. - Stricter hand-written files. Hand-written price files reject unknown fields, which catches typos like
cache_reed. Fetched and cached files ignore unknown fields and tell you which ones they ignored.
Note: this release was verified with unit tests, local mock-server tests and the models.dev price audit. It has not been run against a live provider API.