Skip to content

v0.20.0

Choose a tag to compare

@yuanhao yuanhao released this 26 Sep 08:56
· 257 commits to main since this release
c3dc646

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, qwen and meta. For example, ModelConfig::anthropic("claude-opus-5-5", …) now returns Some(cost) instead of None. 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 return None instead of a single fixed price.

Added

  • src/provider/prices.json holds every built-in price, with its source URL and the date it was checked. PriceTable loads 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 call prices::global::install_override(table). The override returns a report of what changed, what reverted and which entries can never apply. env_override_status() and load_env_override() let an app fail fast on a bad file.
  • Live price sources, only when you call them. PriceSource::YoagentMain fetches this repo's checked prices.json from main, so a merged price fix reaches you without a release. PriceSource::ModelsDev and your own Url are 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::AddOnly only fills in models that aren't listed.
  • Precedence, highest first: your override, then fetched prices, then the built-in file. A config.cost you set yourself wins over all three; reprice() and with_prices() replace it.
  • Re-pricing existing configs. ModelConfig::reprice(), Agent::reprice() and SubAgentTool::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.

See docs/concepts/pricing.md.

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.