Skip to content

kew pricing

Model pricing utilities: sync the committed OpenRouter pricing snapshot, or check it for drift against the live API.

OpenRouter pricing is consumption-based and varies per provider endpoint, so kew never hand-maintains those rates. The sync records, per model, the max price across provider endpoints — a conservative preflight bound. Dispatch reads only the committed snapshot (no network in the governed path); actual per-run spend is runner-reported.

Usage: kew pricing sync [OPTIONS] [SOURCE]

Arguments:
  SOURCE                Pricing source to sync (only: openrouter)  [default: openrouter]

Options:
  -m, --model TEXT      Extra openrouter/… model to include (repeatable)
  --check               Report drift against the API; write nothing
  --tolerance-pct FLOAT Drift tolerance for --check  [default: 10.0]

Synced models are the union of: entries already in the snapshot, every openrouter/… model referenced by kew.toml (agent, routing, review), and any --model arguments. Exit codes: 0 fresh/synced, 1 fetch failure, 3 drift found (--check).

Snapshot staleness is governed by [pricing] in kew.toml (warn_age_days, default 7; max_age_days, default 30). Past the hard ceiling the snapshot is ignored and governed dispatch of its models fails closed — rerun the sync and commit the refresh.

Example:

# Refresh prices for every OpenRouter model the config references
kew pricing sync openrouter
git add pricing.openrouter.toml && git commit -m "chore: refresh openrouter pricing snapshot"

# Add a model ahead of routing to it
kew pricing sync openrouter -m openrouter/qwen/qwen3-coder

# CI freshness check (used by the pricing-freshness workflow)
kew pricing sync openrouter --check