Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

feat(pricing): add an offline list-price catalog and cost estimator

Claude7fe99cf0e851
diff --git a/CLAUDE.md b/CLAUDE.md
index 20cbcfeb..16f754ee 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -539,7 +539,8 @@ unpacked through Chrome's developer mode.
- Reading a runtime's own on-disk session store is a `poll` collection path, not a new method: it is a pull that sees committed records after the fact, which is what `poll` means. fx is the case that exercises it (`cli/beacon/internal/fxsession`); a future runtime with the same shape uses `poll` too rather than adding a fifth value to a release-contract field.
- Set the provenance markers on every new collection path. `harness.collection_method` (`hook`, `otlp`, `plugin`, `poll`) records the mechanism; `event.fidelity` (`observed`, `inferred`) records whether the source named the action or Beacon derived it. Both are defined in `pkg/asymptoteobserve/provenance.go` and are the only sanctioned way to express that difference — do not add per-runtime confidence fields, and do not leave a derived action unmarked. A new plugin-shaped runtime must be added to `CollectionMethodForPlatform`, whose default is `hook`. An action synthesized from an adjacent observation, such as an approval built from a pre-tool notification on a runtime with no approval hook, is `inferred`.
- Keep event identity derivable rather than asserted. `gen_ai.tool.call.id` carries the runtime's own name for one tool invocation, promoted on every capture path from the shared alias list in `pkg/asymptoteobserve.ToolCallIDKeys`; a new runtime adds its spelling there rather than in a mapper. `event.id` is a deterministic UUID derived by `EventIDForLine` from the event about to be written, so both capture paths name one action the same way. Its namespace constant and derivation are a contract: changing either renames every event ID Beacon has written, and a test pins the value.
-- Keep `gen_ai.usage` as the single canonical token-usage representation: normalize all runtime token telemetry (span attributes, metric datapoints, legacy `llm.usage.*` aliases) into it, mirror OTel GenAI semconv JSON names exactly, and never add parallel or per-harness token fields. `gen_ai.usage.cost_usd` carries runtime-reported cost only; do not derive cost from local pricing tables.
+- Keep `gen_ai.usage` as the single canonical token-usage representation: normalize all runtime token telemetry (span attributes, metric datapoints, legacy `llm.usage.*` aliases) into it, mirror OTel GenAI semconv JSON names exactly, and never add parallel or per-harness token fields. `gen_ai.usage.cost_usd` carries runtime-reported cost only and is never written from a price list; list-price estimates are computed only at report time from the embedded catalog (`cli/beacon/internal/pricing`), are always labeled as estimates, and are never stored in events.
+- `cli/beacon/internal/pricing` estimates list-price cost for reports: integer-microdollar math over the gen_ai.usage counts (disjoint input/output/cache read/cache write, a one-hour write subset, reasoning inside output), long-context bands only for a single request, and a strict model-name ladder (exact, canonical via `NormalizeModelName`, dotted version, Bedrock route prefix, then stripping a `[1m]` marker, snapshot date or effort suffix) that leaves a model unpriced rather than guess, including when two entries tie with different prices. Its `catalog.json` is embedded, offline and report-time only (hooks never import it); it is generated from LiteLLM's MIT-licensed `model_prices_and_context_window.json` and records the upstream URL, commit and fetch/generation dates. Regenerate with `cd cli/beacon && go run ./internal/pricing/internal/gen` (resolves LiteLLM's main with `git ls-remote` and fetches that commit; `-src`/`-commit` for a local copy) and review the one-model-per-line diff; the generator never runs in builds or tests.
- When adding a new signal, include stable identifiers/counts/hashes alongside any retained raw content, and route raw fields through redaction, sanitization, truncation, and event-size controls.
- Keep the dashboard read-only. It should inspect local status and JSONL events but must not mutate endpoint configuration or telemetry.
- The local trace history (`~/.beacon/endpoint/history.db`, `cli/beacon/internal/endpoint/dashboard/history_*.go`) is opt-in: only `beacon endpoint traces reindex`, a yes to the first-run prompt, or (later) `beacon mcp setup` creates it, and nothing non-interactive is ever prompted. Once it exists, `list`, `search` and `show` must return exactly what the JSONL scan returns for the same log (`TestHistoryAnswersExactlyLikeTheJSONLScan`), so it stores every event and projects it with the same code. A change to the trace projection bumps `historyDerivationVersion`, which rebuilds derived data from the stored lines. The stored lines keep only the raw keys in `historyRawKeys`, and a test fails if the dashboard reads one that is missing. The line dictionary (`historyLineDictionary`) must never change without a new codec.
diff --git a/cli/beacon/internal/pricing/LICENSE.litellm b/cli/beacon/internal/pricing/LICENSE.litellm
new file mode 100644
index 00000000..dd11dc52
--- /dev/null
+++ b/cli/beacon/internal/pricing/LICENSE.litellm
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023 Berri AI
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/cli/beacon/internal/pricing/catalog.go b/cli/beacon/internal/pricing/catalog.go
new file mode 100644
index 00000000..10a479f0
--- /dev/null
+++ b/cli/beacon/internal/pricing/catalog.go
@@ -0,0 +1,153 @@
+package pricing
+
+import (
+ _ "embed"
+ "encoding/json"
+ "fmt"
+ "sort"
+ "sync"
+)
+
+//go:embed catalog.json
+var embeddedCatalog []byte
+
+// SchemaVersion is the catalog.json layout this package reads. A layout change bumps it, and a
+// catalog with any other version is refused rather than half-read.
+const SchemaVersion = 1
+
+// RateUnit names the unit every rate in the catalog is quoted in.
+const RateUnit = "microdollars per million tokens"
+
+// SourceInfo is the provenance of a catalog: whose list it is and how old it is.
+type SourceInfo struct {
+ // Name and License describe the upstream list.
+ Name string `json:"name"`
+ License string `json:"license"`
+ // URL is the list's canonical location; Commit is the upstream commit the catalog was
+ // generated from ("" when generated from a local copy of unknown origin).
+ URL string `json:"url"`
+ Commit string `json:"commit,omitempty"`
+ // FetchedAt is the date (YYYY-MM-DD, UTC) the list was read.
+ FetchedAt string `json:"fetched_at"`
+}
+
+// CatalogFile is the catalog.json layout. The generator writes it; LoadCatalog reads it.
+type CatalogFile struct {
+ SchemaVersion int `json:"schema_version"`
+ Source SourceInfo `json:"source"`
+ // GeneratedAt is the date (YYYY-MM-DD, UTC) the catalog was generated.
+ GeneratedAt string `json:"generated_at"`
+ Unit string `json:"unit"`
+ Models map[string]Rates `json:"models"`
+}
+
+// Catalog is a loaded, validated price list with its lookup indexes.
+type Catalog struct {
+ file CatalogFile
+ keys []string
+ // index[r] maps a key spelled at rung r to every catalog key with that spelling.
+ index [numRungs]map[string][]string
+}
+
+var (
+ defaultOnce sync.Once
+ defaultCatalog *Catalog
+)
+
+// Default returns the catalog embedded in the binary. It panics if that catalog does not load,
+// which TestEmbeddedCatalogLoads makes a build-time failure rather than a runtime one.
+func Default() *Catalog {
+ defaultOnce.Do(func() {
+ c, err := LoadCatalog(embeddedCatalog)
+ if err != nil {
+ panic("pricing: embedded catalog.json is invalid: " + err.Error())
+ }
+ defaultCatalog = c
+ })
+ return defaultCatalog
+}
+
+// Lookup resolves model against the embedded catalog. See Catalog.Lookup.
+func Lookup(model string) (Resolution, bool) {
+ return Default().Lookup(model)
+}
+
+// LoadCatalog parses and validates a catalog.json document.
+func LoadCatalog(data []byte) (*Catalog, error) {
+ var file CatalogFile
+ if err := json.Unmarshal(data, &file); err != nil {
+ return nil, fmt.Errorf("parse catalog: %w", err)
+ }
+ if file.SchemaVersion != SchemaVersion {
+ return nil, fmt.Errorf("catalog schema_version %d, want %d", file.SchemaVersion, SchemaVersion)
+ }
+ if file.Unit != RateUnit {
+ return nil, fmt.Errorf("catalog unit %q, want %q", file.Unit, RateUnit)
+ }
+ if len(file.Models) == 0 {
+ return nil, fmt.Errorf("catalog has no models")
+ }
+ c := &Catalog{file: file}
+ for key, rates := range file.Models {
+ if err := validateRates(rates); err != nil {
+ return nil, fmt.Errorf("model %q: %w", key, err)
+ }
+ c.keys = append(c.keys, key)
+ }
+ sort.Strings(c.keys)
+ for r := range c.index {
+ c.index[r] = make(map[string][]string, len(c.keys))
+ }
+ for _, key := range c.keys {
+ for r := rung(0); r < numRungs; r++ {
+ spelled := spell(r, key)
+ if spelled == "" {
+ continue
+ }
+ c.index[r][spelled] = append(c.index[r][spelled], key)
+ }
+ }
+ return c, nil
+}
+
+func validateRates(r Rates) error {
+ if err := validateSet(r.RateSet); err != nil {
+ return err
+ }
+ var prev int64
+ for i, b := range r.Bands {
+ if b.AboveTokens <= prev {
+ return fmt.Errorf("band %d threshold %d is not above %d", i, b.AboveTokens, prev)
+ }
+ prev = b.AboveTokens
+ if err := validateSet(b.RateSet); err != nil {
+ return fmt.Errorf("band above %d: %w", b.AboveTokens, err)
+ }
+ }
+ return nil
+}
+
+func validateSet(s RateSet) error {
+ if s.Input <= 0 || s.Output <= 0 {
+ return fmt.Errorf("input and output rates must be positive (input %d, output %d)", s.Input, s.Output)
+ }
+ if s.CacheRead < 0 || s.CacheWrite < 0 || s.CacheWrite1h < 0 {
+ return fmt.Errorf("negative cache rate")
+ }
+ return nil
+}
+
+// Source returns the catalog's provenance.
+func (c *Catalog) Source() SourceInfo { return c.file.Source }
+
+// GeneratedAt returns the date the catalog was generated.
+func (c *Catalog) GeneratedAt() string { return c.file.GeneratedAt }
+
+// Keys returns every priced model key, sorted.
+func (c *Catalog) Keys() []string { return append([]string(nil), c.keys...) }
+
+// Rates returns the entry for an exact catalog key.
+func (c *Catalog) Rates(key string) (Rates, bool) {
+ r, ok := c.file.Models[key]
+ return r, ok
+}
diff --git a/cli/beacon/internal/pricing/catalog.json b/cli/beacon/internal/pricing/catalog.json
new file mode 100644
index 00000000..dec89bc8
--- /dev/null
+++ b/cli/beacon/internal/pricing/catalog.json
@@ -0,0 +1,600 @@
+{
+ "schema_version": 1,
+ "source": {"name":"LiteLLM model_prices_and_context_window.json","license":"MIT","url":"https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json","commit":"1238cfe90f1029bf33e31ab40a805e7ecabfa1ff","fetched_at":"2026-10-05"},
+ "generated_at": "2026-10-05",
+ "unit": "microdollars per million tokens",
+ "models": {
+ "anthropic.claude-3-5-haiku-20241022-v1:0": {"provider":"bedrock","input":800000,"output":4000000,"cache_read":80000,"cache_write":1000000},
+ "anthropic.claude-3-5-sonnet-20240620-v1:0": {"provider":"bedrock","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"bands":[{"above_tokens":200000,"input":6000000,"output":30000000,"cache_read":600000,"cache_write":7500000}]},
+ "anthropic.claude-3-5-sonnet-20241022-v2:0": {"provider":"bedrock","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"bands":[{"above_tokens":200000,"input":6000000,"output":30000000,"cache_read":600000,"cache_write":7500000}]},
+ "anthropic.claude-3-7-sonnet-20240620-v1:0": {"provider":"bedrock","input":3600000,"output":18000000,"cache_read":360000,"cache_write":4500000},
+ "anthropic.claude-3-7-sonnet-20250219-v1:0": {"provider":"bedrock_converse","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000},
+ "anthropic.claude-3-opus-20240229-v1:0": {"provider":"bedrock","input":15000000,"output":75000000,"cache_read":1500000,"cache_write":18750000},
+ "anthropic.claude-fable-5": {"provider":"bedrock_converse","input":10000000,"output":50000000,"cache_read":1000000,"cache_write":12500000,"cache_write_1h":20000000},
+ "anthropic.claude-fable-5-1": {"provider":"bedrock_converse","input":10000000,"output":50000000,"cache_read":250000,"cache_write":12500000,"cache_write_1h":20000000},
+ "anthropic.claude-haiku-4-5-20251001-v1:0": {"provider":"bedrock_converse","input":1000000,"output":5000000,"cache_read":100000,"cache_write":1250000,"cache_write_1h":2000000},
+ "anthropic.claude-haiku-4-5@20251001": {"provider":"bedrock_converse","input":1000000,"output":5000000,"cache_read":100000,"cache_write":1250000,"cache_write_1h":2000000},
+ "anthropic.claude-instant-v1": {"provider":"bedrock","input":800000,"output":2400000},
+ "anthropic.claude-mythos-5-1": {"provider":"bedrock_converse","input":10000000,"output":50000000,"cache_read":250000,"cache_write":12500000,"cache_write_1h":20000000},
+ "anthropic.claude-mythos-preview": {"provider":"bedrock","input":27500000,"output":137500000,"cache_read":2750000,"cache_write":34375000,"cache_write_1h":55000000},
+ "anthropic.claude-opus-4-1-20250805-v1:0": {"provider":"bedrock_converse","input":15000000,"output":75000000,"cache_read":1500000,"cache_write":18750000},
+ "anthropic.claude-opus-4-20250514-v1:0": {"provider":"bedrock_converse","input":15000000,"output":75000000,"cache_read":1500000,"cache_write":18750000},
+ "anthropic.claude-opus-4-5-20251101-v1:0": {"provider":"bedrock_converse","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "anthropic.claude-opus-4-6-v1": {"provider":"bedrock_converse","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "anthropic.claude-opus-4-7": {"provider":"bedrock_converse","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "anthropic.claude-opus-4-8": {"provider":"bedrock_converse","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "anthropic.claude-opus-5": {"provider":"bedrock_converse","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "anthropic.claude-opus-5-5": {"provider":"bedrock_converse","input":4000000,"output":20000000,"cache_read":200000,"cache_write":5000000,"cache_write_1h":8000000},
+ "anthropic.claude-sonnet-4-20250514-v1:0": {"provider":"bedrock_converse","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000}]},
+ "anthropic.claude-sonnet-4-5-20250929-v1:0": {"provider":"bedrock_converse","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000,"cache_write_1h":12000000}]},
+ "anthropic.claude-sonnet-4-6": {"provider":"bedrock_converse","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000},
+ "anthropic.claude-sonnet-5": {"provider":"bedrock_converse","input":2000000,"output":10000000,"cache_read":200000,"cache_write":2500000,"cache_write_1h":4000000},
+ "anthropic.claude-sonnet-5-5": {"provider":"bedrock_converse","input":2000000,"output":10000000,"cache_read":200000,"cache_write":2500000,"cache_write_1h":4000000},
+ "anthropic.claude-v1": {"provider":"bedrock","input":8000000,"output":24000000},
+ "anthropic.claude-v2:1": {"provider":"bedrock","input":8000000,"output":24000000},
+ "apac.anthropic.claude-fable-5": {"provider":"bedrock_converse","input":11000000,"output":55000000,"cache_read":1100000,"cache_write":13750000,"cache_write_1h":22000000},
+ "apac.anthropic.claude-haiku-4-5-20251001-v1:0": {"provider":"bedrock_converse","input":1100000,"output":5500000,"cache_read":110000,"cache_write":1375000},
+ "apac.anthropic.claude-mythos-preview": {"provider":"bedrock_converse","input":27500000,"output":137500000,"cache_read":2750000,"cache_write":34375000,"cache_write_1h":55000000},
+ "apac.anthropic.claude-opus-4-7": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "apac.anthropic.claude-opus-4-8": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "apac.anthropic.claude-opus-5": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "apac.anthropic.claude-opus-5-5": {"provider":"bedrock_converse","input":4400000,"output":22000000,"cache_read":220000,"cache_write":5500000,"cache_write_1h":8800000},
+ "apac.anthropic.claude-sonnet-4-20250514-v1:0": {"provider":"bedrock_converse","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000}]},
+ "apac.anthropic.claude-sonnet-4-6": {"provider":"bedrock_converse","input":3300000,"output":16500000,"cache_read":330000,"cache_write":4125000,"cache_write_1h":6600000},
+ "apac.anthropic.claude-sonnet-5": {"provider":"bedrock_converse","input":2200000,"output":11000000,"cache_read":220000,"cache_write":2750000,"cache_write_1h":4400000},
+ "apac.anthropic.claude-sonnet-5-5": {"provider":"bedrock_converse","input":2200000,"output":11000000,"cache_read":220000,"cache_write":2750000,"cache_write_1h":4400000},
+ "au.anthropic.claude-fable-5": {"provider":"bedrock_converse","input":11000000,"output":55000000,"cache_read":1100000,"cache_write":13750000,"cache_write_1h":22000000},
+ "au.anthropic.claude-haiku-4-5-20251001-v1:0": {"provider":"bedrock_converse","input":1100000,"output":5500000,"cache_read":110000,"cache_write":1375000,"cache_write_1h":2200000},
+ "au.anthropic.claude-mythos-preview": {"provider":"bedrock_converse","input":27500000,"output":137500000,"cache_read":2750000,"cache_write":34375000,"cache_write_1h":55000000},
+ "au.anthropic.claude-opus-4-6-v1": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "au.anthropic.claude-opus-4-7": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "au.anthropic.claude-opus-4-8": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "au.anthropic.claude-opus-5": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "au.anthropic.claude-opus-5-5": {"provider":"bedrock_converse","input":4400000,"output":22000000,"cache_read":220000,"cache_write":5500000,"cache_write_1h":8800000},
+ "au.anthropic.claude-sonnet-4-5-20250929-v1:0": {"provider":"bedrock_converse","input":3300000,"output":16500000,"cache_read":330000,"cache_write":4125000,"cache_write_1h":6600000,"bands":[{"above_tokens":200000,"input":6600000,"output":24750000,"cache_read":660000,"cache_write":8250000,"cache_write_1h":13200000}]},
+ "au.anthropic.claude-sonnet-4-6": {"provider":"bedrock_converse","input":3300000,"output":16500000,"cache_read":330000,"cache_write":4125000,"cache_write_1h":6600000},
+ "au.anthropic.claude-sonnet-5": {"provider":"bedrock_converse","input":2200000,"output":11000000,"cache_read":220000,"cache_write":2750000,"cache_write_1h":4400000},
+ "au.anthropic.claude-sonnet-5-5": {"provider":"bedrock_converse","input":2200000,"output":11000000,"cache_read":220000,"cache_write":2750000,"cache_write_1h":4400000},
+ "chat-latest": {"provider":"openai","input":5000000,"output":30000000,"cache_read":500000},
+ "claude-fable-5": {"provider":"anthropic","input":10000000,"output":50000000,"cache_read":1000000,"cache_write":12500000,"cache_write_1h":20000000},
+ "claude-fable-5-1": {"provider":"anthropic","input":10000000,"output":50000000,"cache_read":250000,"cache_write":12500000,"cache_write_1h":20000000},
+ "claude-haiku-4-5": {"provider":"anthropic","input":1000000,"output":5000000,"cache_read":100000,"cache_write":1250000,"cache_write_1h":2000000},
+ "claude-haiku-4-5-20251001": {"provider":"anthropic","input":1000000,"output":5000000,"cache_read":100000,"cache_write":1250000,"cache_write_1h":2000000},
+ "claude-mythos-5": {"provider":"anthropic","input":10000000,"output":50000000,"cache_read":1000000,"cache_write":12500000,"cache_write_1h":20000000},
+ "claude-mythos-5-1": {"provider":"anthropic","input":10000000,"output":50000000,"cache_read":250000,"cache_write":12500000,"cache_write_1h":20000000},
+ "claude-mythos-preview": {"provider":"anthropic","input":10000000,"output":50000000,"cache_read":1000000,"cache_write":12500000,"cache_write_1h":20000000},
+ "claude-opus-4-5": {"provider":"anthropic","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "claude-opus-4-5-20251101": {"provider":"anthropic","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "claude-opus-4-6": {"provider":"anthropic","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "claude-opus-4-6-20260205": {"provider":"anthropic","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "claude-opus-4-7": {"provider":"anthropic","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "claude-opus-4-7-20260416": {"provider":"anthropic","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "claude-opus-4-8": {"provider":"anthropic","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "claude-opus-5": {"provider":"anthropic","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "claude-opus-5-5": {"provider":"anthropic","input":4000000,"output":20000000,"cache_read":200000,"cache_write":5000000,"cache_write_1h":8000000},
+ "claude-sonnet-4-5": {"provider":"anthropic","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000,"cache_write_1h":12000000}]},
+ "claude-sonnet-4-5-20250929": {"provider":"anthropic","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000,"cache_write_1h":12000000}]},
+ "claude-sonnet-4-6": {"provider":"anthropic","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000},
+ "claude-sonnet-5": {"provider":"anthropic","input":2000000,"output":10000000,"cache_read":200000,"cache_write":2500000,"cache_write_1h":4000000},
+ "claude-sonnet-5-5": {"provider":"anthropic","input":2000000,"output":10000000,"cache_read":200000,"cache_write":2500000,"cache_write_1h":4000000},
+ "dashscope/deepseek-v4-flash": {"provider":"dashscope","input":200000,"output":400000,"cache_read":40000},
+ "dashscope/deepseek-v4-flash-0731": {"provider":"dashscope","input":200000,"output":400000,"cache_read":40000},
+ "dashscope/deepseek-v4-pro": {"provider":"dashscope","input":2400000,"output":4800000,"cache_read":200000},
+ "dashscope/glm-5.1": {"provider":"dashscope","input":1400000,"output":4400000,"cache_read":260000},
+ "dashscope/glm-5.2": {"provider":"dashscope","input":1400000,"output":4400000,"cache_read":280000},
+ "dashscope/kimi-k2.7-code": {"provider":"dashscope","input":950000,"output":4000000,"cache_read":190000},
+ "dashscope/qwen-coder": {"provider":"dashscope","input":300000,"output":1500000},
+ "dashscope/qwen-max": {"provider":"dashscope","input":1600000,"output":6400000},
+ "dashscope/qwen-plus": {"provider":"dashscope","input":400000,"output":1200000},
+ "dashscope/qwen-plus-2025-01-25": {"provider":"dashscope","input":400000,"output":1200000},
+ "dashscope/qwen-plus-2025-04-28": {"provider":"dashscope","input":400000,"output":1200000},
+ "dashscope/qwen-plus-2025-07-14": {"provider":"dashscope","input":400000,"output":1200000},
+ "dashscope/qwen-turbo": {"provider":"dashscope","input":50000,"output":200000},
+ "dashscope/qwen-turbo-2024-11-01": {"provider":"dashscope","input":50000,"output":200000},
+ "dashscope/qwen-turbo-2025-04-28": {"provider":"dashscope","input":50000,"output":200000},
+ "dashscope/qwen-turbo-latest": {"provider":"dashscope","input":50000,"output":200000},
+ "dashscope/qwen3-next-80b-a3b-instruct": {"provider":"dashscope","input":150000,"output":1200000},
+ "dashscope/qwen3-next-80b-a3b-thinking": {"provider":"dashscope","input":150000,"output":1200000},
+ "dashscope/qwen3-vl-235b-a22b-instruct": {"provider":"dashscope","input":400000,"output":1600000},
+ "dashscope/qwen3-vl-235b-a22b-thinking": {"provider":"dashscope","input":400000,"output":4000000},
+ "dashscope/qwen3-vl-32b-instruct": {"provider":"dashscope","input":160000,"output":640000},
+ "dashscope/qwen3-vl-32b-thinking": {"provider":"dashscope","input":160000,"output":2870000},
+ "dashscope/qwen3.7-max": {"provider":"dashscope","input":2500000,"output":7500000,"cache_read":500000},
+ "dashscope/qwen3.8-flash": {"provider":"dashscope","input":150000,"output":470000,"cache_read":16000,"cache_write":200000},
+ "dashscope/qwen3.8-max": {"provider":"dashscope","input":2000000,"output":6000000,"cache_read":250000},
+ "dashscope/qwen3.8-omni-flash": {"provider":"dashscope","input":150000,"output":470000,"cache_read":16000},
+ "dashscope/qwq-plus": {"provider":"dashscope","input":800000,"output":2400000},
+ "daybreak-blue-latest": {"provider":"openai","input":4000000,"output":20000000,"cache_read":400000,"cache_write":5000000,"bands":[{"above_tokens":272000,"input":8000000,"output":30000000,"cache_read":800000,"cache_write":10000000}]},
+ "daybreak-red-latest": {"provider":"openai","input":12500000,"output":75000000,"cache_read":1250000,"cache_write":15625000,"bands":[{"above_tokens":272000,"input":25000000,"output":112500000,"cache_read":2500000,"cache_write":31250000}]},
+ "deepseek-chat": {"provider":"deepseek","input":280000,"output":420000,"cache_read":28000},
+ "deepseek-flash": {"provider":"deepseek","input":300000,"output":1200000,"cache_read":6000},
+ "deepseek-reasoner": {"provider":"deepseek","input":280000,"output":420000,"cache_read":28000},
+ "deepseek-v4-flash": {"provider":"deepseek","input":300000,"output":1200000,"cache_read":6000},
+ "deepseek-v4-flash-vision-exp": {"provider":"deepseek","input":300000,"output":1200000,"cache_read":6000},
+ "deepseek-v4-pro": {"provider":"deepseek","input":1320000,"output":3960000,"cache_read":44000},
+ "deepseek/deepseek-chat": {"provider":"deepseek","input":280000,"output":420000,"cache_read":28000},
+ "deepseek/deepseek-coder": {"provider":"deepseek","input":140000,"output":280000,"cache_read":14000},
+ "deepseek/deepseek-flash": {"provider":"deepseek","input":300000,"output":1200000,"cache_read":6000},
+ "deepseek/deepseek-r1": {"provider":"deepseek","input":550000,"output":2190000,"cache_read":140000},
+ "deepseek/deepseek-reasoner": {"provider":"deepseek","input":280000,"output":420000,"cache_read":28000},
+ "deepseek/deepseek-v3": {"provider":"deepseek","input":270000,"output":1100000,"cache_read":70000},
+ "deepseek/deepseek-v3.2": {"provider":"deepseek","input":280000,"output":400000,"cache_read":28000},
+ "deepseek/deepseek-v4-flash": {"provider":"deepseek","input":300000,"output":1200000,"cache_read":6000},
+ "deepseek/deepseek-v4-flash-vision-exp": {"provider":"deepseek","input":300000,"output":1200000,"cache_read":6000},
+ "deepseek/deepseek-v4-pro": {"provider":"deepseek","input":1320000,"output":3960000,"cache_read":44000},
+ "eu.anthropic.claude-3-5-haiku-20241022-v1:0": {"provider":"bedrock","input":800000,"output":4000000,"cache_read":80000,"cache_write":1000000},
+ "eu.anthropic.claude-3-5-sonnet-20240620-v1:0": {"provider":"bedrock","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000},
+ "eu.anthropic.claude-3-5-sonnet-20241022-v2:0": {"provider":"bedrock","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000},
+ "eu.anthropic.claude-3-7-sonnet-20250219-v1:0": {"provider":"bedrock","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000},
+ "eu.anthropic.claude-3-opus-20240229-v1:0": {"provider":"bedrock","input":15000000,"output":75000000,"cache_read":1500000,"cache_write":18750000},
+ "eu.anthropic.claude-fable-5": {"provider":"bedrock_converse","input":11000000,"output":55000000,"cache_read":1100000,"cache_write":13750000,"cache_write_1h":22000000},
+ "eu.anthropic.claude-fable-5-1": {"provider":"bedrock_converse","input":11000000,"output":55000000,"cache_read":275000,"cache_write":13750000,"cache_write_1h":22000000},
+ "eu.anthropic.claude-haiku-4-5-20251001-v1:0": {"provider":"bedrock_converse","input":1100000,"output":5500000,"cache_read":110000,"cache_write":1375000,"cache_write_1h":2200000},
+ "eu.anthropic.claude-opus-4-1-20250805-v1:0": {"provider":"bedrock_converse","input":15000000,"output":75000000,"cache_read":1500000,"cache_write":18750000},
+ "eu.anthropic.claude-opus-4-20250514-v1:0": {"provider":"bedrock_converse","input":15000000,"output":75000000,"cache_read":1500000,"cache_write":18750000},
+ "eu.anthropic.claude-opus-4-5-20251101-v1:0": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "eu.anthropic.claude-opus-4-6-v1": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "eu.anthropic.claude-opus-4-7": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "eu.anthropic.claude-opus-4-8": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "eu.anthropic.claude-opus-5": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "eu.anthropic.claude-opus-5-5": {"provider":"bedrock_converse","input":4400000,"output":22000000,"cache_read":220000,"cache_write":5500000,"cache_write_1h":8800000},
+ "eu.anthropic.claude-sonnet-4-20250514-v1:0": {"provider":"bedrock_converse","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000}]},
+ "eu.anthropic.claude-sonnet-4-5-20250929-v1:0": {"provider":"bedrock_converse","input":3300000,"output":16500000,"cache_read":330000,"cache_write":4125000,"cache_write_1h":6600000,"bands":[{"above_tokens":200000,"input":6600000,"output":24750000,"cache_read":660000,"cache_write":8250000,"cache_write_1h":13200000}]},
+ "eu.anthropic.claude-sonnet-4-6": {"provider":"bedrock_converse","input":3300000,"output":16500000,"cache_read":330000,"cache_write":4125000,"cache_write_1h":6600000},
+ "eu.anthropic.claude-sonnet-5": {"provider":"bedrock_converse","input":2200000,"output":11000000,"cache_read":220000,"cache_write":2750000,"cache_write_1h":4400000},
+ "eu.anthropic.claude-sonnet-5-5": {"provider":"bedrock_converse","input":2200000,"output":11000000,"cache_read":220000,"cache_write":2750000,"cache_write_1h":4400000},
+ "gemini-2.5-flash": {"provider":"vertex_ai-language-models","input":300000,"output":2500000,"cache_read":30000},
+ "gemini-2.5-flash-lite": {"provider":"vertex_ai-language-models","input":100000,"output":400000,"cache_read":10000},
+ "gemini-2.5-flash-lite-preview-09-2025": {"provider":"vertex_ai-language-models","input":100000,"output":400000,"cache_read":10000},
+ "gemini-2.5-flash-preview-09-2025": {"provider":"vertex_ai-language-models","input":300000,"output":2500000,"cache_read":30000},
+ "gemini-2.5-pro": {"provider":"vertex_ai-language-models","input":1250000,"output":10000000,"cache_read":125000,"bands":[{"above_tokens":200000,"input":2500000,"output":15000000,"cache_read":250000,"cache_write":250000}]},
+ "gemini-3-flash-preview": {"provider":"vertex_ai-language-models","input":500000,"output":3000000,"cache_read":50000},
+ "gemini-3.1-flash-lite": {"provider":"vertex_ai-language-models","input":250000,"output":1500000,"cache_read":25000},
+ "gemini-3.1-flash-lite-preview": {"provider":"vertex_ai-language-models","input":250000,"output":1500000,"cache_read":25000},
+ "gemini-3.1-pro-preview": {"provider":"vertex_ai-language-models","input":2000000,"output":12000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":4000000,"output":18000000,"cache_read":400000,"cache_write":250000}]},
+ "gemini-3.1-pro-preview-customtools": {"provider":"vertex_ai-language-models","input":2000000,"output":12000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":4000000,"output":18000000,"cache_read":400000,"cache_write":250000}]},
+ "gemini-3.5-flash": {"provider":"vertex_ai-language-models","input":1500000,"output":9000000,"cache_read":150000},
+ "gemini-3.5-flash-lite": {"provider":"vertex_ai-language-models","input":300000,"output":2500000,"cache_read":30000},
+ "gemini-3.6-flash": {"provider":"vertex_ai-language-models","input":750000,"output":3750000,"cache_read":75000},
+ "gemini-3.7-flash": {"provider":"vertex_ai-language-models","input":750000,"output":3750000,"cache_read":75000},
+ "gemini-3.8-flash": {"provider":"vertex_ai-language-models","input":750000,"output":3750000,"cache_read":75000},
+ "gemini-3.8-flash-cyber": {"provider":"vertex_ai-language-models","input":1500000,"output":7500000,"cache_read":150000},
+ "gemini-exp-1206": {"provider":"gemini","input":300000,"output":2500000,"cache_read":30000},
+ "gemini-flash-latest": {"provider":"gemini","input":750000,"output":3750000,"cache_read":75000},
+ "gemini-flash-lite-latest": {"provider":"gemini","input":300000,"output":2500000,"cache_read":30000},
+ "gemini-omni-flash-preview": {"provider":"vertex_ai-language-models","input":1500000,"output":9000000},
+ "gemini-pro-latest": {"provider":"gemini","input":2000000,"output":12000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":4000000,"output":18000000,"cache_read":400000}]},
+ "gemini/gemini-2.5-flash": {"provider":"gemini","input":300000,"output":2500000,"cache_read":30000},
+ "gemini/gemini-2.5-flash-lite": {"provider":"gemini","input":100000,"output":400000,"cache_read":10000},
+ "gemini/gemini-2.5-pro": {"provider":"gemini","input":1250000,"output":10000000,"cache_read":125000,"bands":[{"above_tokens":200000,"input":2500000,"output":15000000,"cache_read":250000}]},
+ "gemini/gemini-3-flash-preview": {"provider":"gemini","input":500000,"output":3000000,"cache_read":50000},
+ "gemini/gemini-3.1-flash-lite": {"provider":"gemini","input":250000,"output":1500000,"cache_read":25000},
+ "gemini/gemini-3.1-flash-lite-preview": {"provider":"gemini","input":250000,"output":1500000,"cache_read":25000},
+ "gemini/gemini-3.1-pro-preview": {"provider":"gemini","input":2000000,"output":12000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":4000000,"output":18000000,"cache_read":400000}]},
+ "gemini/gemini-3.1-pro-preview-customtools": {"provider":"gemini","input":2000000,"output":12000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":4000000,"output":18000000,"cache_read":400000}]},
+ "gemini/gemini-3.5-flash": {"provider":"gemini","input":1500000,"output":9000000,"cache_read":150000},
+ "gemini/gemini-3.5-flash-lite": {"provider":"gemini","input":300000,"output":2500000,"cache_read":30000},
+ "gemini/gemini-3.6-flash": {"provider":"gemini","input":750000,"output":3750000,"cache_read":75000},
+ "gemini/gemini-3.7-flash": {"provider":"gemini","input":750000,"output":3750000,"cache_read":75000},
+ "gemini/gemini-3.8-flash": {"provider":"gemini","input":750000,"output":3750000,"cache_read":75000},
+ "gemini/gemini-flash-latest": {"provider":"gemini","input":750000,"output":3750000,"cache_read":75000},
+ "gemini/gemini-flash-lite-latest": {"provider":"gemini","input":300000,"output":2500000,"cache_read":30000},
+ "gemini/gemini-gemma-2-27b-it": {"provider":"gemini","input":350000,"output":1050000},
+ "gemini/gemini-gemma-2-9b-it": {"provider":"gemini","input":350000,"output":1050000},
+ "gemini/gemini-omni-1.1-flash": {"provider":"gemini","input":1500000,"output":9000000},
+ "gemini/gemini-omni-flash-preview": {"provider":"gemini","input":1500000,"output":9000000},
+ "gemini/gemini-pro-latest": {"provider":"gemini","input":2000000,"output":12000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":4000000,"output":18000000,"cache_read":400000}]},
+ "global.anthropic.claude-fable-5": {"provider":"bedrock_converse","input":10000000,"output":50000000,"cache_read":1000000,"cache_write":12500000,"cache_write_1h":20000000},
+ "global.anthropic.claude-fable-5-1": {"provider":"bedrock_converse","input":10000000,"output":50000000,"cache_read":250000,"cache_write":12500000,"cache_write_1h":20000000},
+ "global.anthropic.claude-haiku-4-5-20251001-v1:0": {"provider":"bedrock_converse","input":1000000,"output":5000000,"cache_read":100000,"cache_write":1250000,"cache_write_1h":2000000},
+ "global.anthropic.claude-mythos-5-1": {"provider":"bedrock_converse","input":10000000,"output":50000000,"cache_read":250000,"cache_write":12500000,"cache_write_1h":20000000},
+ "global.anthropic.claude-opus-4-5-20251101-v1:0": {"provider":"bedrock_converse","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "global.anthropic.claude-opus-4-6-v1": {"provider":"bedrock_converse","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "global.anthropic.claude-opus-4-7": {"provider":"bedrock_converse","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "global.anthropic.claude-opus-4-8": {"provider":"bedrock_converse","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "global.anthropic.claude-opus-5": {"provider":"bedrock_converse","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "global.anthropic.claude-opus-5-5": {"provider":"bedrock_converse","input":4000000,"output":20000000,"cache_read":200000,"cache_write":5000000,"cache_write_1h":8000000},
+ "global.anthropic.claude-sonnet-4-20250514-v1:0": {"provider":"bedrock_converse","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000}]},
+ "global.anthropic.claude-sonnet-4-5-20250929-v1:0": {"provider":"bedrock_converse","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000,"cache_write_1h":12000000}]},
+ "global.anthropic.claude-sonnet-4-6": {"provider":"bedrock_converse","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000},
+ "global.anthropic.claude-sonnet-5": {"provider":"bedrock_converse","input":2000000,"output":10000000,"cache_read":200000,"cache_write":2500000,"cache_write_1h":4000000},
+ "global.anthropic.claude-sonnet-5-5": {"provider":"bedrock_converse","input":2000000,"output":10000000,"cache_read":200000,"cache_write":2500000,"cache_write_1h":4000000},
+ "gpt-3.5-turbo": {"provider":"openai","input":500000,"output":1500000},
+ "gpt-3.5-turbo-0125": {"provider":"openai","input":500000,"output":1500000},
+ "gpt-3.5-turbo-1106": {"provider":"openai","input":1000000,"output":2000000},
+ "gpt-3.5-turbo-16k": {"provider":"openai","input":3000000,"output":4000000},
+ "gpt-4": {"provider":"openai","input":30000000,"output":60000000},
+ "gpt-4-0613": {"provider":"openai","input":30000000,"output":60000000},
+ "gpt-4-1106-preview": {"provider":"openai","input":10000000,"output":30000000},
+ "gpt-4-turbo": {"provider":"openai","input":10000000,"output":30000000},
+ "gpt-4-turbo-2024-04-09": {"provider":"openai","input":10000000,"output":30000000},
+ "gpt-4.1": {"provider":"openai","input":2000000,"output":8000000,"cache_read":500000},
+ "gpt-4.1-2025-04-14": {"provider":"openai","input":2000000,"output":8000000,"cache_read":500000},
+ "gpt-4.1-mini": {"provider":"openai","input":400000,"output":1600000,"cache_read":100000},
+ "gpt-4.1-mini-2025-04-14": {"provider":"openai","input":400000,"output":1600000,"cache_read":100000},
+ "gpt-4.1-nano": {"provider":"openai","input":100000,"output":400000,"cache_read":25000},
+ "gpt-4.1-nano-2025-04-14": {"provider":"openai","input":100000,"output":400000,"cache_read":25000},
+ "gpt-4o": {"provider":"openai","input":2500000,"output":10000000,"cache_read":1250000},
+ "gpt-4o-2024-05-13": {"provider":"openai","input":5000000,"output":15000000},
+ "gpt-4o-2024-08-06": {"provider":"openai","input":2500000,"output":10000000,"cache_read":1250000},
+ "gpt-4o-2024-11-20": {"provider":"openai","input":2500000,"output":10000000,"cache_read":1250000},
+ "gpt-4o-mini": {"provider":"openai","input":150000,"output":600000,"cache_read":75000},
+ "gpt-4o-mini-2024-07-18": {"provider":"openai","input":150000,"output":600000,"cache_read":75000},
+ "gpt-5": {"provider":"openai","input":1250000,"output":10000000,"cache_read":125000},
+ "gpt-5-2025-08-07": {"provider":"openai","input":1250000,"output":10000000,"cache_read":125000},
+ "gpt-5-chat": {"provider":"openai","input":1250000,"output":10000000,"cache_read":125000},
+ "gpt-5-chat-latest": {"provider":"openai","input":1250000,"output":10000000,"cache_read":125000},
+ "gpt-5-codex": {"provider":"openai","input":1250000,"output":10000000,"cache_read":125000},
+ "gpt-5-mini": {"provider":"openai","input":250000,"output":2000000,"cache_read":25000},
+ "gpt-5-mini-2025-08-07": {"provider":"openai","input":250000,"output":2000000,"cache_read":25000},
+ "gpt-5-nano": {"provider":"openai","input":50000,"output":400000,"cache_read":5000},
+ "gpt-5-nano-2025-08-07": {"provider":"openai","input":50000,"output":400000,"cache_read":5000},
+ "gpt-5-pro": {"provider":"openai","input":15000000,"output":120000000},
+ "gpt-5-pro-2025-10-06": {"provider":"openai","input":15000000,"output":120000000},
+ "gpt-5.1": {"provider":"openai","input":1250000,"output":10000000,"cache_read":125000},
+ "gpt-5.1-2025-11-13": {"provider":"openai","input":1250000,"output":10000000,"cache_read":125000},
+ "gpt-5.1-chat-latest": {"provider":"openai","input":1250000,"output":10000000,"cache_read":125000},
+ "gpt-5.1-codex": {"provider":"openai","input":1250000,"output":10000000,"cache_read":125000},
+ "gpt-5.1-codex-max": {"provider":"openai","input":1250000,"output":10000000,"cache_read":125000},
+ "gpt-5.1-codex-mini": {"provider":"openai","input":250000,"output":2000000,"cache_read":25000},
+ "gpt-5.2": {"provider":"openai","input":1750000,"output":14000000,"cache_read":175000},
+ "gpt-5.2-2025-12-11": {"provider":"openai","input":1750000,"output":14000000,"cache_read":175000},
+ "gpt-5.2-chat-latest": {"provider":"openai","input":1750000,"output":14000000,"cache_read":175000},
+ "gpt-5.2-codex": {"provider":"openai","input":1750000,"output":14000000,"cache_read":175000},
+ "gpt-5.2-pro": {"provider":"openai","input":21000000,"output":168000000},
+ "gpt-5.2-pro-2025-12-11": {"provider":"openai","input":21000000,"output":168000000},
+ "gpt-5.3-chat-latest": {"provider":"openai","input":1750000,"output":14000000,"cache_read":175000},
+ "gpt-5.3-codex": {"provider":"openai","input":1750000,"output":14000000,"cache_read":175000},
+ "gpt-5.4": {"provider":"openai","input":2500000,"output":15000000,"cache_read":250000,"bands":[{"above_tokens":272000,"input":5000000,"output":22500000,"cache_read":500000}]},
+ "gpt-5.4-2026-03-05": {"provider":"openai","input":2500000,"output":15000000,"cache_read":250000,"bands":[{"above_tokens":272000,"input":5000000,"output":22500000,"cache_read":500000}]},
+ "gpt-5.4-mini": {"provider":"openai","input":750000,"output":4500000,"cache_read":75000},
+ "gpt-5.4-mini-2026-03-17": {"provider":"openai","input":750000,"output":4500000,"cache_read":75000},
+ "gpt-5.4-nano": {"provider":"openai","input":200000,"output":1250000,"cache_read":20000},
+ "gpt-5.4-nano-2026-03-17": {"provider":"openai","input":200000,"output":1250000,"cache_read":20000},
+ "gpt-5.4-pro": {"provider":"openai","input":30000000,"output":180000000,"bands":[{"above_tokens":272000,"input":60000000,"output":270000000}]},
+ "gpt-5.4-pro-2026-03-05": {"provider":"openai","input":30000000,"output":180000000,"bands":[{"above_tokens":272000,"input":60000000,"output":270000000}]},
+ "gpt-5.5": {"provider":"openai","input":5000000,"output":30000000,"cache_read":500000,"bands":[{"above_tokens":272000,"input":10000000,"output":45000000,"cache_read":1000000}]},
+ "gpt-5.5-2026-04-23": {"provider":"openai","input":5000000,"output":30000000,"cache_read":500000,"bands":[{"above_tokens":272000,"input":10000000,"output":45000000,"cache_read":1000000}]},
+ "gpt-5.5-cyber": {"provider":"openai","input":12500000,"output":75000000,"cache_read":1250000},
+ "gpt-5.5-pro": {"provider":"openai","input":30000000,"output":180000000,"bands":[{"above_tokens":272000,"input":60000000,"output":270000000}]},
+ "gpt-5.5-pro-2026-04-23": {"provider":"openai","input":30000000,"output":180000000,"bands":[{"above_tokens":272000,"input":60000000,"output":270000000}]},
+ "gpt-5.6": {"provider":"openai","input":4000000,"output":20000000,"cache_read":400000,"cache_write":5000000,"bands":[{"above_tokens":272000,"input":8000000,"output":30000000,"cache_read":800000,"cache_write":10000000}]},
+ "gpt-5.6-cyber": {"provider":"openai","input":12500000,"output":75000000,"cache_read":1250000,"cache_write":15625000,"bands":[{"above_tokens":272000,"input":25000000,"output":112500000,"cache_read":2500000,"cache_write":31250000}]},
+ "gpt-5.6-luna": {"provider":"openai","input":200000,"output":1200000,"cache_read":20000,"cache_write":250000,"bands":[{"above_tokens":272000,"input":400000,"output":1800000,"cache_read":40000,"cache_write":500000}]},
+ "gpt-5.6-sol": {"provider":"openai","input":4000000,"output":20000000,"cache_read":400000,"cache_write":5000000,"bands":[{"above_tokens":272000,"input":8000000,"output":30000000,"cache_read":800000,"cache_write":10000000}]},
+ "gpt-5.6-terra": {"provider":"openai","input":2000000,"output":12000000,"cache_read":200000,"cache_write":2500000,"bands":[{"above_tokens":272000,"input":4000000,"output":18000000,"cache_read":400000,"cache_write":5000000}]},
+ "gpt-6-astra": {"provider":"openai","input":10000000,"output":50000000,"cache_read":1000000,"cache_write":12500000,"bands":[{"above_tokens":272000,"input":20000000,"output":75000000,"cache_read":2000000,"cache_write":25000000}]},
+ "gpt-6-luna": {"provider":"openai","input":100000,"output":500000,"cache_read":10000,"cache_write":125000,"bands":[{"above_tokens":272000,"input":200000,"output":750000,"cache_read":20000,"cache_write":250000}]},
+ "gpt-6-sol": {"provider":"openai","input":2000000,"output":10000000,"cache_read":200000,"cache_write":2500000,"bands":[{"above_tokens":272000,"input":4000000,"output":15000000,"cache_read":400000,"cache_write":5000000}]},
+ "gpt-6.1-sol": {"provider":"openai","input":2000000,"output":10000000,"cache_read":100000,"cache_write":2500000,"bands":[{"above_tokens":272000,"input":4000000,"output":15000000,"cache_read":200000,"cache_write":5000000}]},
+ "gpt-daybreak-blue-latest": {"provider":"openai","input":4000000,"output":20000000,"cache_read":400000,"cache_write":5000000,"bands":[{"above_tokens":272000,"input":8000000,"output":30000000,"cache_read":800000,"cache_write":10000000}]},
+ "gpt-daybreak-red-latest": {"provider":"openai","input":12500000,"output":75000000,"cache_read":1250000,"cache_write":15625000,"bands":[{"above_tokens":272000,"input":25000000,"output":112500000,"cache_read":2500000,"cache_write":31250000}]},
+ "jp.anthropic.claude-haiku-4-5-20251001-v1:0": {"provider":"bedrock_converse","input":1100000,"output":5500000,"cache_read":110000,"cache_write":1375000,"cache_write_1h":2200000},
+ "jp.anthropic.claude-opus-4-7": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "jp.anthropic.claude-opus-4-8": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "jp.anthropic.claude-opus-5": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "jp.anthropic.claude-opus-5-5": {"provider":"bedrock_converse","input":4400000,"output":22000000,"cache_read":220000,"cache_write":5500000,"cache_write_1h":8800000},
+ "jp.anthropic.claude-sonnet-4-5-20250929-v1:0": {"provider":"bedrock_converse","input":3300000,"output":16500000,"cache_read":330000,"cache_write":4125000,"cache_write_1h":6600000,"bands":[{"above_tokens":200000,"input":6600000,"output":24750000,"cache_read":660000,"cache_write":8250000,"cache_write_1h":13200000}]},
+ "jp.anthropic.claude-sonnet-4-6": {"provider":"bedrock_converse","input":3300000,"output":16500000,"cache_read":330000,"cache_write":4125000,"cache_write_1h":6600000},
+ "jp.anthropic.claude-sonnet-5": {"provider":"bedrock_converse","input":2200000,"output":11000000,"cache_read":220000,"cache_write":2750000,"cache_write_1h":4400000},
+ "jp.anthropic.claude-sonnet-5-5": {"provider":"bedrock_converse","input":2200000,"output":11000000,"cache_read":220000,"cache_write":2750000,"cache_write_1h":4400000},
+ "minimax/MiniMax-M2": {"provider":"minimax","input":300000,"output":1200000,"cache_read":30000,"cache_write":375000},
+ "minimax/MiniMax-M2.1": {"provider":"minimax","input":300000,"output":1200000,"cache_read":30000,"cache_write":375000},
+ "minimax/MiniMax-M2.1-lightning": {"provider":"minimax","input":300000,"output":2400000,"cache_read":30000,"cache_write":375000},
+ "minimax/MiniMax-M2.5": {"provider":"minimax","input":300000,"output":1200000,"cache_read":30000,"cache_write":375000},
+ "minimax/MiniMax-M2.5-lightning": {"provider":"minimax","input":300000,"output":2400000,"cache_read":30000,"cache_write":375000},
+ "minimax/MiniMax-M3": {"provider":"minimax","input":300000,"output":1200000,"cache_read":60000,"bands":[{"above_tokens":512000,"input":600000,"output":2400000,"cache_read":120000}]},
+ "mistral/codestral-2508": {"provider":"mistral","input":300000,"output":900000,"cache_read":30000},
+ "mistral/codestral-latest": {"provider":"mistral","input":300000,"output":900000,"cache_read":30000},
+ "mistral/codestral-mamba-latest": {"provider":"mistral","input":250000,"output":250000,"cache_read":25000},
+ "mistral/devstral-latest": {"provider":"mistral","input":400000,"output":2000000,"cache_read":40000},
+ "mistral/devstral-medium-latest": {"provider":"mistral","input":400000,"output":2000000,"cache_read":40000},
+ "mistral/devstral-small-latest": {"provider":"mistral","input":100000,"output":300000,"cache_read":10000},
+ "mistral/glm-5-2": {"provider":"mistral","input":1400000,"output":4400000,"cache_read":140000},
+ "mistral/magistral-medium-latest": {"provider":"mistral","input":1500000,"output":7500000,"cache_read":150000},
+ "mistral/magistral-small-latest": {"provider":"mistral","input":150000,"output":600000,"cache_read":15000},
+ "mistral/ministral-14b-2512": {"provider":"mistral","input":200000,"output":200000,"cache_read":20000},
+ "mistral/ministral-14b-latest": {"provider":"mistral","input":200000,"output":200000,"cache_read":20000},
+ "mistral/ministral-3-14b-2512": {"provider":"mistral","input":200000,"output":200000,"cache_read":20000},
+ "mistral/ministral-3-3b-2512": {"provider":"mistral","input":100000,"output":100000,"cache_read":10000},
+ "mistral/ministral-3-8b-2512": {"provider":"mistral","input":150000,"output":150000,"cache_read":15000},
+ "mistral/ministral-3b-2512": {"provider":"mistral","input":100000,"output":100000,"cache_read":10000},
+ "mistral/ministral-3b-latest": {"provider":"mistral","input":100000,"output":100000,"cache_read":10000},
+ "mistral/ministral-8b-2512": {"provider":"mistral","input":150000,"output":150000,"cache_read":15000},
+ "mistral/ministral-8b-latest": {"provider":"mistral","input":150000,"output":150000,"cache_read":15000},
+ "mistral/mistral-code-agent-latest": {"provider":"mistral","input":400000,"output":2000000,"cache_read":40000},
+ "mistral/mistral-code-fim-latest": {"provider":"mistral","input":300000,"output":900000,"cache_read":30000},
+ "mistral/mistral-code-latest": {"provider":"mistral","input":300000,"output":900000,"cache_read":30000},
+ "mistral/mistral-large-2512": {"provider":"mistral","input":500000,"output":1500000,"cache_read":50000},
+ "mistral/mistral-large-3": {"provider":"mistral","input":500000,"output":1500000,"cache_read":50000},
+ "mistral/mistral-large-latest": {"provider":"mistral","input":500000,"output":1500000,"cache_read":50000},
+ "mistral/mistral-medium": {"provider":"mistral","input":1500000,"output":7500000,"cache_read":150000},
+ "mistral/mistral-medium-2604": {"provider":"mistral","input":1500000,"output":7500000,"cache_read":150000},
+ "mistral/mistral-medium-3": {"provider":"mistral","input":1500000,"output":7500000,"cache_read":150000},
+ "mistral/mistral-medium-3-5": {"provider":"mistral","input":1500000,"output":7500000,"cache_read":150000},
+ "mistral/mistral-medium-3.5": {"provider":"mistral","input":1500000,"output":7500000,"cache_read":150000},
+ "mistral/mistral-medium-latest": {"provider":"mistral","input":1500000,"output":7500000,"cache_read":150000},
+ "mistral/mistral-small": {"provider":"mistral","input":100000,"output":300000,"cache_read":10000},
+ "mistral/mistral-small-2603": {"provider":"mistral","input":150000,"output":600000,"cache_read":15000},
+ "mistral/mistral-small-latest": {"provider":"mistral","input":150000,"output":600000,"cache_read":15000},
+ "mistral/mistral-tiny": {"provider":"mistral","input":250000,"output":250000,"cache_read":25000},
+ "mistral/mistral-vibe-cli-fast": {"provider":"mistral","input":150000,"output":600000,"cache_read":15000},
+ "mistral/mistral-vibe-cli-latest": {"provider":"mistral","input":1500000,"output":7500000,"cache_read":150000},
+ "mistral/mistral-vibe-cli-with-tools": {"provider":"mistral","input":1500000,"output":7500000,"cache_read":150000},
+ "mistral/open-mistral-nemo": {"provider":"mistral","input":300000,"output":300000,"cache_read":30000},
+ "mistral/pixtral-large-latest": {"provider":"mistral","input":2000000,"output":6000000,"cache_read":200000},
+ "mistral/voxtral-small-2507": {"provider":"mistral","input":100000,"output":400000,"cache_read":10000},
+ "mistral/voxtral-small-latest": {"provider":"mistral","input":100000,"output":400000,"cache_read":10000},
+ "mistral/zai-glm-5": {"provider":"mistral","input":1400000,"output":4400000,"cache_read":140000},
+ "mistral/zai-glm-5-2": {"provider":"mistral","input":1400000,"output":4400000,"cache_read":140000},
+ "mistral/zai-glm-5-3": {"provider":"mistral","input":1400000,"output":4400000,"cache_read":140000},
+ "mistral/zai-glm-latest": {"provider":"mistral","input":1400000,"output":4400000,"cache_read":140000},
+ "moonshot/kimi-k2.5": {"provider":"moonshot","input":600000,"output":3000000,"cache_read":100000},
+ "moonshot/kimi-k2.6": {"provider":"moonshot","input":950000,"output":4000000,"cache_read":160000},
+ "moonshot/kimi-k2.7-code": {"provider":"moonshot","input":950000,"output":4000000,"cache_read":190000},
+ "moonshot/kimi-k3": {"provider":"moonshot","input":3000000,"output":15000000,"cache_read":300000},
+ "moonshot/moonshot-v1-128k": {"provider":"moonshot","input":2000000,"output":5000000},
+ "moonshot/moonshot-v1-128k-vision-preview": {"provider":"moonshot","input":2000000,"output":5000000},
+ "moonshot/moonshot-v1-32k": {"provider":"moonshot","input":1000000,"output":3000000},
+ "moonshot/moonshot-v1-32k-vision-preview": {"provider":"moonshot","input":1000000,"output":3000000},
+ "moonshot/moonshot-v1-8k": {"provider":"moonshot","input":200000,"output":2000000},
+ "moonshot/moonshot-v1-8k-vision-preview": {"provider":"moonshot","input":200000,"output":2000000},
+ "moonshot/moonshot-v1-auto": {"provider":"moonshot","input":2000000,"output":5000000},
+ "o1": {"provider":"openai","input":15000000,"output":60000000,"cache_read":7500000},
+ "o1-2024-12-17": {"provider":"openai","input":15000000,"output":60000000,"cache_read":7500000},
+ "o1-pro": {"provider":"openai","input":150000000,"output":600000000},
+ "o1-pro-2025-03-19": {"provider":"openai","input":150000000,"output":600000000},
+ "o3": {"provider":"openai","input":2000000,"output":8000000,"cache_read":500000},
+ "o3-2025-04-16": {"provider":"openai","input":2000000,"output":8000000,"cache_read":500000},
+ "o3-mini": {"provider":"openai","input":1100000,"output":4400000,"cache_read":550000},
+ "o3-mini-2025-01-31": {"provider":"openai","input":1100000,"output":4400000,"cache_read":550000},
+ "o3-pro": {"provider":"openai","input":20000000,"output":80000000},
+ "o3-pro-2025-06-10": {"provider":"openai","input":20000000,"output":80000000},
+ "o4-mini": {"provider":"openai","input":1100000,"output":4400000,"cache_read":275000},
+ "o4-mini-2025-04-16": {"provider":"openai","input":1100000,"output":4400000,"cache_read":275000},
+ "openrouter/anthropic/claude-3.7-sonnet": {"provider":"openrouter","input":3000000,"output":15000000},
+ "openrouter/anthropic/claude-opus-4.1": {"provider":"openrouter","input":15000000,"output":75000000,"cache_read":1500000,"cache_write":18750000,"cache_write_1h":30000000},
+ "openrouter/anthropic/claude-sonnet-4": {"provider":"openrouter","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000,"cache_write_1h":6000000}]},
+ "openrouter/deepseek/deepseek-chat-v3-0324": {"provider":"openrouter","input":250000,"output":1000000},
+ "openrouter/deepseek/deepseek-chat-v3.1": {"provider":"openrouter","input":250000,"output":950000,"cache_read":130000},
+ "openrouter/deepseek/deepseek-r1-0528": {"provider":"openrouter","input":500000,"output":2150000,"cache_read":350000},
+ "openrouter/deepseek/deepseek-r1-distill-llama-70b": {"provider":"openrouter","input":800000,"output":800000},
+ "openrouter/deepseek/deepseek-v3.1-terminus": {"provider":"openrouter","input":270000,"output":1000000,"cache_read":135000},
+ "openrouter/deepseek/deepseek-v3.2-exp": {"provider":"openrouter","input":270000,"output":410000,"cache_read":20000},
+ "openrouter/deepseek/deepseek-v4-pro-0813": {"provider":"openrouter","input":850000,"output":5000000,"cache_read":700000},
+ "openrouter/deepseek/deepseek-v4.1-flash": {"provider":"openrouter","input":3000,"output":2400000,"cache_read":3000},
+ "openrouter/google/gemini-2.5-pro-preview": {"provider":"openrouter","input":1250000,"output":10000000,"cache_read":125000,"cache_write":375000,"bands":[{"above_tokens":200000,"input":2500000,"output":15000000,"cache_read":250000,"cache_write":375000}]},
+ "openrouter/google/gemini-2.5-pro-preview-05-06": {"provider":"openrouter","input":1250000,"output":10000000,"cache_read":125000,"cache_write":375000,"bands":[{"above_tokens":200000,"input":2500000,"output":15000000,"cache_read":250000,"cache_write":375000}]},
+ "openrouter/google/gemma-2-27b-it": {"provider":"openrouter","input":650000,"output":650000},
+ "openrouter/google/gemma-3-12b-it": {"provider":"openrouter","input":50000,"output":150000},
+ "openrouter/google/gemma-3-27b-it": {"provider":"openrouter","input":80000,"output":450000,"cache_read":40000},
+ "openrouter/google/gemma-3-4b-it": {"provider":"openrouter","input":50000,"output":100000},
+ "openrouter/google/gemma-4-26b-a4b-it": {"provider":"openrouter","input":67500,"output":225000,"cache_read":37500},
+ "openrouter/google/gemma-4-31b-it": {"provider":"openrouter","input":90000,"output":340000,"cache_read":50000},
+ "openrouter/minimax/minimax-01": {"provider":"openrouter","input":200000,"output":1100000},
+ "openrouter/minimax/minimax-m1": {"provider":"openrouter","input":550000,"output":2200000},
+ "openrouter/minimax/minimax-m2-her": {"provider":"openrouter","input":300000,"output":1200000,"cache_read":30000},
+ "openrouter/minimax/minimax-m2.7": {"provider":"openrouter","input":210000,"output":840000,"cache_read":42000},
+ "openrouter/mistralai/devstral-2512": {"provider":"openrouter","input":400000,"output":2000000,"cache_read":40000},
+ "openrouter/mistralai/mistral-7b-instruct": {"provider":"openrouter","input":130000,"output":130000},
+ "openrouter/mistralai/mistral-large": {"provider":"openrouter","input":2000000,"output":6000000,"cache_read":200000},
+ "openrouter/mistralai/mistral-large-2407": {"provider":"openrouter","input":2000000,"output":6000000,"cache_read":200000},
+ "openrouter/mistralai/mistral-medium-3.1": {"provider":"openrouter","input":400000,"output":2000000,"cache_read":40000},
+ "openrouter/mistralai/mistral-nemo": {"provider":"openrouter","input":19000,"output":30000},
+ "openrouter/mistralai/mistral-saba": {"provider":"openrouter","input":200000,"output":600000,"cache_read":20000},
+ "openrouter/mistralai/mistral-small-24b-instruct-2501": {"provider":"openrouter","input":50000,"output":80000},
+ "openrouter/mistralai/mistral-small-3.1-24b-instruct": {"provider":"openrouter","input":351000,"output":555000},
+ "openrouter/mistralai/mistral-small-3.2-24b-instruct": {"provider":"openrouter","input":93750,"output":250000},
+ "openrouter/mistralai/mixtral-8x22b-instruct": {"provider":"openrouter","input":2000000,"output":6000000,"cache_read":200000},
+ "openrouter/mistralai/voxtral-small-24b-2507": {"provider":"openrouter","input":100000,"output":300000,"cache_read":10000},
+ "openrouter/moonshotai/kimi-k2": {"provider":"openrouter","input":570000,"output":2300000},
+ "openrouter/moonshotai/kimi-k2-0905": {"provider":"openrouter","input":600000,"output":2500000},
+ "openrouter/moonshotai/kimi-k2-thinking": {"provider":"openrouter","input":600000,"output":2500000,"cache_read":150000},
+ "openrouter/openai/gpt-3.5-turbo-0613": {"provider":"openrouter","input":1000000,"output":2000000},
+ "openrouter/openai/gpt-3.5-turbo-instruct": {"provider":"openrouter","input":1500000,"output":2000000},
+ "openrouter/openai/gpt-4-turbo-preview": {"provider":"openrouter","input":10000000,"output":30000000},
+ "openrouter/openai/gpt-5.2-chat": {"provider":"openrouter","input":1750000,"output":14000000,"cache_read":175000},
+ "openrouter/openai/gpt-5.6-luna-pro": {"provider":"openrouter","input":200000,"output":1200000,"cache_read":20000,"cache_write":250000,"bands":[{"above_tokens":272000,"input":400000,"output":1800000,"cache_read":40000,"cache_write":500000}]},
+ "openrouter/openai/gpt-5.6-sol-pro": {"provider":"openrouter","input":4000000,"output":20000000,"cache_read":400000,"cache_write":5000000,"bands":[{"above_tokens":272000,"input":8000000,"output":30000000,"cache_read":800000,"cache_write":10000000}]},
+ "openrouter/openai/gpt-5.6-terra-pro": {"provider":"openrouter","input":2000000,"output":12000000,"cache_read":200000,"cache_write":2500000,"bands":[{"above_tokens":272000,"input":4000000,"output":18000000,"cache_read":400000,"cache_write":5000000}]},
+ "openrouter/openai/gpt-6-astra-pro": {"provider":"openrouter","input":10000000,"output":50000000,"cache_read":1000000,"cache_write":12500000,"bands":[{"above_tokens":272000,"input":20000000,"output":75000000,"cache_read":2000000,"cache_write":25000000}]},
+ "openrouter/openai/gpt-6-luna-pro": {"provider":"openrouter","input":100000,"output":500000,"cache_read":10000,"cache_write":125000,"bands":[{"above_tokens":272000,"input":200000,"output":750000,"cache_read":20000,"cache_write":250000}]},
+ "openrouter/openai/gpt-6-sol-pro": {"provider":"openrouter","input":2000000,"output":10000000,"cache_read":200000,"cache_write":2500000,"bands":[{"above_tokens":272000,"input":4000000,"output":15000000,"cache_read":400000,"cache_write":5000000}]},
+ "openrouter/openai/gpt-6.1-sol-pro": {"provider":"openrouter","input":2000000,"output":10000000,"cache_read":100000,"cache_write":2500000,"bands":[{"above_tokens":272000,"input":4000000,"output":15000000,"cache_read":200000,"cache_write":5000000}]},
+ "openrouter/openai/gpt-chat-latest": {"provider":"openrouter","input":5000000,"output":30000000,"cache_read":500000},
+ "openrouter/openai/gpt-oss-120b": {"provider":"openrouter","input":37000,"output":170000},
+ "openrouter/openai/gpt-oss-20b": {"provider":"openrouter","input":18000,"output":90000,"cache_read":9000},
+ "openrouter/openai/gpt-oss-safeguard-20b": {"provider":"openrouter","input":75000,"output":300000,"cache_read":37500},
+ "openrouter/qwen/qwen-2.5-72b-instruct": {"provider":"openrouter","input":360000,"output":400000},
+ "openrouter/qwen/qwen-2.5-7b-instruct": {"provider":"openrouter","input":100000,"output":200000},
+ "openrouter/qwen/qwen-2.5-coder-32b-instruct": {"provider":"openrouter","input":660000,"output":1000000},
+ "openrouter/qwen/qwen-vl-plus": {"provider":"openrouter","input":210000,"output":630000},
+ "openrouter/qwen/qwen2.5-vl-72b-instruct": {"provider":"openrouter","input":800000,"output":1000000,"cache_read":400000},
+ "openrouter/qwen/qwen3-14b": {"provider":"openrouter","input":120000,"output":240000},
+ "openrouter/qwen/qwen3-235b-a22b": {"provider":"openrouter","input":455000,"output":1820000},
+ "openrouter/qwen/qwen3-235b-a22b-2507": {"provider":"openrouter","input":87500,"output":350000,"cache_read":17500},
+ "openrouter/qwen/qwen3-235b-a22b-thinking-2507": {"provider":"openrouter","input":230000,"output":2300000},
+ "openrouter/qwen/qwen3-30b-a3b": {"provider":"openrouter","input":120000,"output":500000},
+ "openrouter/qwen/qwen3-30b-a3b-instruct-2507": {"provider":"openrouter","input":48150,"output":193050},
+ "openrouter/qwen/qwen3-30b-a3b-thinking-2507": {"provider":"openrouter","input":200000,"output":2400000},
+ "openrouter/qwen/qwen3-32b": {"provider":"openrouter","input":80000,"output":280000},
+ "openrouter/qwen/qwen3-8b": {"provider":"openrouter","input":117000,"output":455000},
+ "openrouter/qwen/qwen3-coder": {"provider":"openrouter","input":300000,"output":1000000,"cache_read":100000},
+ "openrouter/qwen/qwen3-coder-30b-a3b-instruct": {"provider":"openrouter","input":70000,"output":280000},
+ "openrouter/qwen/qwen3-coder-flash": {"provider":"openrouter","input":195000,"output":975000,"cache_read":39000,"cache_write":243750,"bands":[{"above_tokens":32000,"input":325000,"output":1625000,"cache_read":65000,"cache_write":406250},{"above_tokens":128000,"input":520000,"output":2600000,"cache_read":104000,"cache_write":650000}]},
+ "openrouter/qwen/qwen3-coder-next": {"provider":"openrouter","input":120000,"output":800000,"cache_read":70000},
+ "openrouter/qwen/qwen3-coder-plus": {"provider":"openrouter","input":650000,"output":3250000,"cache_read":130000,"cache_write":812500,"bands":[{"above_tokens":32000,"input":1170000,"output":5850000,"cache_read":234000,"cache_write":1462500},{"above_tokens":128000,"input":1950000,"output":9750000,"cache_read":390000,"cache_write":2437500}]},
+ "openrouter/qwen/qwen3-max": {"provider":"openrouter","input":780000,"output":3900000,"cache_read":156000,"cache_write":975000,"bands":[{"above_tokens":32000,"input":1560000,"output":7800000,"cache_read":312000,"cache_write":1950000},{"above_tokens":128000,"input":1950000,"output":9750000,"cache_read":390000,"cache_write":2437500}]},
+ "openrouter/qwen/qwen3-max-thinking": {"provider":"openrouter","input":780000,"output":3900000,"bands":[{"above_tokens":32000,"input":1560000,"output":7800000},{"above_tokens":128000,"input":1950000,"output":9750000}]},
+ "openrouter/qwen/qwen3-vl-30b-a3b-instruct": {"provider":"openrouter","input":150000,"output":600000},
+ "openrouter/qwen/qwen3-vl-30b-a3b-thinking": {"provider":"openrouter","input":200000,"output":2400000},
+ "openrouter/qwen/qwen3-vl-8b-instruct": {"provider":"openrouter","input":117000,"output":455000},
+ "openrouter/qwen/qwen3-vl-8b-thinking": {"provider":"openrouter","input":180000,"output":2100000},
+ "openrouter/qwen/qwen3.5-122b-a10b": {"provider":"openrouter","input":260000,"output":2080000},
+ "openrouter/qwen/qwen3.5-27b": {"provider":"openrouter","input":195000,"output":1560000},
+ "openrouter/qwen/qwen3.5-35b-a3b": {"provider":"openrouter","input":150000,"output":1000000,"cache_read":50000},
+ "openrouter/qwen/qwen3.5-397b-a17b": {"provider":"openrouter","input":550000,"output":3500000,"cache_read":225000},
+ "openrouter/qwen/qwen3.5-9b": {"provider":"openrouter","input":100000,"output":150000},
+ "openrouter/qwen/qwen3.5-flash-02-23": {"provider":"openrouter","input":65000,"output":260000},
+ "openrouter/qwen/qwen3.5-plus-02-15": {"provider":"openrouter","input":260000,"output":1560000,"bands":[{"above_tokens":256000,"input":325000,"output":1950000}]},
+ "openrouter/qwen/qwen3.5-plus-20260420": {"provider":"openrouter","input":300000,"output":1800000,"cache_write":375000,"bands":[{"above_tokens":256000,"input":375000,"output":2250000,"cache_write":468750}]},
+ "openrouter/qwen/qwen3.6-27b": {"provider":"openrouter","input":320000,"output":3200000,"cache_read":150000},
+ "openrouter/qwen/qwen3.6-35b-a3b": {"provider":"openrouter","input":150000,"output":1000000,"cache_read":50000},
+ "openrouter/qwen/qwen3.6-flash": {"provider":"openrouter","input":187500,"output":1125000,"cache_write":234375,"bands":[{"above_tokens":256000,"input":750000,"output":3000000,"cache_write":937500}]},
+ "openrouter/qwen/qwen3.6-max-preview": {"provider":"openrouter","input":1027000,"output":6162000,"cache_write":1283750,"bands":[{"above_tokens":128000,"input":1580000,"output":9480000,"cache_write":1975000}]},
+ "openrouter/qwen/qwen3.6-plus": {"provider":"openrouter","input":325000,"output":1950000,"cache_write":406250,"bands":[{"above_tokens":256000,"input":1300000,"output":3900000,"cache_write":1625000}]},
+ "openrouter/qwen/qwen3.7-flash": {"provider":"openrouter","input":30000,"output":130000,"cache_read":6000,"cache_write":38000,"bands":[{"above_tokens":32000,"input":100000,"output":400000,"cache_read":20000,"cache_write":125000},{"above_tokens":256000,"input":200000,"output":800000,"cache_read":40000,"cache_write":250000}]},
+ "openrouter/qwen/qwen3.7-plus": {"provider":"openrouter","input":320000,"output":1280000,"cache_read":64000,"cache_write":400000,"bands":[{"above_tokens":256000,"input":960000,"output":3840000,"cache_read":192000,"cache_write":1200000}]},
+ "openrouter/qwen/qwen3.8-2.4t-a95b": {"provider":"openrouter","input":2000000,"output":6000000,"cache_read":250000},
+ "openrouter/qwen/qwen3.8-27b": {"provider":"openrouter","input":425000,"output":2550000,"cache_read":85000,"cache_write":531250},
+ "openrouter/qwen/qwen3.8-max-0902": {"provider":"openrouter","input":2000000,"output":6000000,"cache_read":250000,"cache_write":2500000},
+ "openrouter/qwen/qwen3.8-max-prime": {"provider":"openrouter","input":4000000,"output":12000000,"cache_read":500000},
+ "openrouter/x-ai/grok-4": {"provider":"openrouter","input":3000000,"output":15000000},
+ "openrouter/z-ai/glm-4.6v": {"provider":"openrouter","input":300000,"output":900000,"cache_read":50000},
+ "openrouter/z-ai/glm-4.7-flash": {"provider":"openrouter","input":60500,"output":400000,"cache_read":10000},
+ "openrouter/z-ai/glm-5-turbo": {"provider":"openrouter","input":1200000,"output":4000000,"cache_read":240000},
+ "openrouter/z-ai/glm-5.3-flashx": {"provider":"openrouter","input":370000,"output":1250000,"cache_read":90000},
+ "openrouter/z-ai/glm-5.3-prime": {"provider":"openrouter","input":2800000,"output":8800000,"cache_read":560000},
+ "openrouter/z-ai/glm-5v-turbo": {"provider":"openrouter","input":1200000,"output":4000000,"cache_read":240000},
+ "us-gov.anthropic.claude-fable-5-1": {"provider":"bedrock_converse","input":12000000,"output":60000000,"cache_read":300000,"cache_write":15000000,"cache_write_1h":24000000},
+ "us-gov.anthropic.claude-opus-4-8": {"provider":"bedrock_converse","input":6000000,"output":30000000,"cache_read":600000,"cache_write":7500000,"cache_write_1h":12000000},
+ "us-gov.anthropic.claude-opus-5": {"provider":"bedrock_converse","input":6000000,"output":30000000,"cache_read":600000,"cache_write":7500000,"cache_write_1h":12000000},
+ "us-gov.anthropic.claude-opus-5-5": {"provider":"bedrock_converse","input":4800000,"output":24000000,"cache_read":240000,"cache_write":6000000,"cache_write_1h":9600000},
+ "us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0": {"provider":"bedrock_converse","input":3600000,"output":18000000,"cache_read":360000,"cache_write":4500000,"cache_write_1h":7200000,"bands":[{"above_tokens":200000,"input":7200000,"output":27000000,"cache_read":720000,"cache_write":9000000,"cache_write_1h":14400000}]},
+ "us-gov.anthropic.claude-sonnet-5": {"provider":"bedrock_converse","input":2400000,"output":12000000,"cache_read":240000,"cache_write":3000000,"cache_write_1h":4800000},
+ "us-gov.anthropic.claude-sonnet-5-5": {"provider":"bedrock_converse","input":2400000,"output":12000000,"cache_read":240000,"cache_write":3000000,"cache_write_1h":4800000},
+ "us.anthropic.claude-3-5-haiku-20241022-v1:0": {"provider":"bedrock","input":800000,"output":4000000,"cache_read":80000,"cache_write":1000000},
+ "us.anthropic.claude-3-5-sonnet-20240620-v1:0": {"provider":"bedrock","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000},
+ "us.anthropic.claude-3-5-sonnet-20241022-v2:0": {"provider":"bedrock","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000},
+ "us.anthropic.claude-3-7-sonnet-20250219-v1:0": {"provider":"bedrock_converse","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000},
+ "us.anthropic.claude-3-opus-20240229-v1:0": {"provider":"bedrock","input":15000000,"output":75000000,"cache_read":1500000,"cache_write":18750000},
+ "us.anthropic.claude-fable-5": {"provider":"bedrock_converse","input":11000000,"output":55000000,"cache_read":1100000,"cache_write":13750000,"cache_write_1h":22000000},
+ "us.anthropic.claude-fable-5-1": {"provider":"bedrock_converse","input":11000000,"output":55000000,"cache_read":275000,"cache_write":13750000,"cache_write_1h":22000000},
+ "us.anthropic.claude-haiku-4-5-20251001-v1:0": {"provider":"bedrock_converse","input":1100000,"output":5500000,"cache_read":110000,"cache_write":1375000,"cache_write_1h":2200000},
+ "us.anthropic.claude-mythos-5": {"provider":"bedrock_converse","input":11000000,"output":55000000,"cache_read":1100000,"cache_write":13750000,"cache_write_1h":22000000},
+ "us.anthropic.claude-mythos-5-1": {"provider":"bedrock_converse","input":11000000,"output":55000000,"cache_read":275000,"cache_write":13750000,"cache_write_1h":22000000},
+ "us.anthropic.claude-mythos-preview": {"provider":"bedrock_converse","input":27500000,"output":137500000,"cache_read":2750000,"cache_write":34375000,"cache_write_1h":55000000},
+ "us.anthropic.claude-opus-4-1-20250805-v1:0": {"provider":"bedrock_converse","input":15000000,"output":75000000,"cache_read":1500000,"cache_write":18750000},
+ "us.anthropic.claude-opus-4-20250514-v1:0": {"provider":"bedrock_converse","input":15000000,"output":75000000,"cache_read":1500000,"cache_write":18750000},
+ "us.anthropic.claude-opus-4-5-20251101-v1:0": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "us.anthropic.claude-opus-4-6-v1": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "us.anthropic.claude-opus-4-7": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "us.anthropic.claude-opus-4-8": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "us.anthropic.claude-opus-5": {"provider":"bedrock_converse","input":5500000,"output":27500000,"cache_read":550000,"cache_write":6875000,"cache_write_1h":11000000},
+ "us.anthropic.claude-opus-5-5": {"provider":"bedrock_converse","input":4400000,"output":22000000,"cache_read":220000,"cache_write":5500000,"cache_write_1h":8800000},
+ "us.anthropic.claude-sonnet-4-20250514-v1:0": {"provider":"bedrock_converse","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000}]},
+ "us.anthropic.claude-sonnet-4-5-20250929-v1:0": {"provider":"bedrock_converse","input":3300000,"output":16500000,"cache_read":330000,"cache_write":4125000,"cache_write_1h":6600000,"bands":[{"above_tokens":200000,"input":6600000,"output":24750000,"cache_read":660000,"cache_write":8250000,"cache_write_1h":13200000}]},
+ "us.anthropic.claude-sonnet-4-6": {"provider":"bedrock_converse","input":3300000,"output":16500000,"cache_read":330000,"cache_write":4125000,"cache_write_1h":6600000},
+ "us.anthropic.claude-sonnet-5": {"provider":"bedrock_converse","input":2200000,"output":11000000,"cache_read":220000,"cache_write":2750000,"cache_write_1h":4400000},
+ "us.anthropic.claude-sonnet-5-5": {"provider":"bedrock_converse","input":2200000,"output":11000000,"cache_read":220000,"cache_write":2750000,"cache_write_1h":4400000},
+ "vertex_ai/claude-3-5-haiku": {"provider":"vertex_ai-anthropic_models","input":1000000,"output":5000000},
+ "vertex_ai/claude-3-5-haiku@20241022": {"provider":"vertex_ai-anthropic_models","input":1000000,"output":5000000},
+ "vertex_ai/claude-3-5-sonnet": {"provider":"vertex_ai-anthropic_models","input":3000000,"output":15000000},
+ "vertex_ai/claude-3-5-sonnet@20240620": {"provider":"vertex_ai-anthropic_models","input":3000000,"output":15000000},
+ "vertex_ai/claude-3-haiku": {"provider":"vertex_ai-anthropic_models","input":250000,"output":1250000},
+ "vertex_ai/claude-3-haiku@20240307": {"provider":"vertex_ai-anthropic_models","input":250000,"output":1250000},
+ "vertex_ai/claude-3-opus": {"provider":"vertex_ai-anthropic_models","input":15000000,"output":75000000},
+ "vertex_ai/claude-3-opus@20240229": {"provider":"vertex_ai-anthropic_models","input":15000000,"output":75000000},
+ "vertex_ai/claude-3-sonnet": {"provider":"vertex_ai-anthropic_models","input":3000000,"output":15000000},
+ "vertex_ai/claude-3-sonnet@20240229": {"provider":"vertex_ai-anthropic_models","input":3000000,"output":15000000},
+ "vertex_ai/claude-fable-5": {"provider":"vertex_ai-anthropic_models","input":10000000,"output":50000000,"cache_read":1000000,"cache_write":12500000,"cache_write_1h":20000000},
+ "vertex_ai/claude-fable-5-1": {"provider":"vertex_ai-anthropic_models","input":10000000,"output":50000000,"cache_read":250000,"cache_write":12500000,"cache_write_1h":20000000},
+ "vertex_ai/claude-fable-5-1@default": {"provider":"vertex_ai-anthropic_models","input":10000000,"output":50000000,"cache_read":250000,"cache_write":12500000,"cache_write_1h":20000000},
+ "vertex_ai/claude-fable-5@default": {"provider":"vertex_ai-anthropic_models","input":10000000,"output":50000000,"cache_read":1000000,"cache_write":12500000,"cache_write_1h":20000000},
+ "vertex_ai/claude-haiku-4-5": {"provider":"vertex_ai-anthropic_models","input":1000000,"output":5000000,"cache_read":100000,"cache_write":1250000,"cache_write_1h":2000000},
+ "vertex_ai/claude-haiku-4-5@20251001": {"provider":"vertex_ai-anthropic_models","input":1000000,"output":5000000,"cache_read":100000,"cache_write":1250000,"cache_write_1h":2000000},
+ "vertex_ai/claude-opus-4-5": {"provider":"vertex_ai-anthropic_models","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "vertex_ai/claude-opus-4-5@20251101": {"provider":"vertex_ai-anthropic_models","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "vertex_ai/claude-opus-4-6": {"provider":"vertex_ai-anthropic_models","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "vertex_ai/claude-opus-4-6@default": {"provider":"vertex_ai-anthropic_models","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "vertex_ai/claude-opus-4-7": {"provider":"vertex_ai-anthropic_models","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "vertex_ai/claude-opus-4-7@default": {"provider":"vertex_ai-anthropic_models","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "vertex_ai/claude-opus-4-8": {"provider":"vertex_ai-anthropic_models","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "vertex_ai/claude-opus-4-8@default": {"provider":"vertex_ai-anthropic_models","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "vertex_ai/claude-opus-5": {"provider":"vertex_ai-anthropic_models","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "vertex_ai/claude-opus-5-5": {"provider":"vertex_ai-anthropic_models","input":4000000,"output":20000000,"cache_read":200000,"cache_write":5000000,"cache_write_1h":8000000},
+ "vertex_ai/claude-opus-5-5@default": {"provider":"vertex_ai-anthropic_models","input":4000000,"output":20000000,"cache_read":200000,"cache_write":5000000,"cache_write_1h":8000000},
+ "vertex_ai/claude-opus-5@default": {"provider":"vertex_ai-anthropic_models","input":5000000,"output":25000000,"cache_read":500000,"cache_write":6250000,"cache_write_1h":10000000},
+ "vertex_ai/claude-sonnet-4-5": {"provider":"vertex_ai-anthropic_models","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000,"cache_write_1h":12000000}]},
+ "vertex_ai/claude-sonnet-4-5@20250929": {"provider":"vertex_ai-anthropic_models","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000,"cache_write_1h":12000000}]},
+ "vertex_ai/claude-sonnet-4-6": {"provider":"vertex_ai-anthropic_models","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000},
+ "vertex_ai/claude-sonnet-4-6@default": {"provider":"vertex_ai-anthropic_models","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000},
+ "vertex_ai/claude-sonnet-5": {"provider":"vertex_ai-anthropic_models","input":2000000,"output":10000000,"cache_read":200000,"cache_write":2500000,"cache_write_1h":4000000},
+ "vertex_ai/claude-sonnet-5-5": {"provider":"vertex_ai-anthropic_models","input":2000000,"output":10000000,"cache_read":200000,"cache_write":2500000,"cache_write_1h":4000000},
+ "vertex_ai/claude-sonnet-5-5@default": {"provider":"vertex_ai-anthropic_models","input":2000000,"output":10000000,"cache_read":200000,"cache_write":2500000,"cache_write_1h":4000000},
+ "vertex_ai/claude-sonnet-5@default": {"provider":"vertex_ai-anthropic_models","input":2000000,"output":10000000,"cache_read":200000,"cache_write":2500000,"cache_write_1h":4000000},
+ "vertex_ai/gemini-2.0-flash": {"provider":"vertex_ai","input":150000,"output":600000},
+ "vertex_ai/gemini-2.0-flash-lite": {"provider":"vertex_ai","input":75000,"output":300000},
+ "vertex_ai/gemini-3-flash-preview": {"provider":"vertex_ai","input":500000,"output":3000000,"cache_read":50000},
+ "vertex_ai/gemini-3-pro-preview": {"provider":"vertex_ai","input":2000000,"output":12000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":4000000,"output":18000000,"cache_read":400000,"cache_write":250000}]},
+ "vertex_ai/gemini-3.1-flash-lite": {"provider":"vertex_ai-language-models","input":250000,"output":1500000,"cache_read":25000},
+ "vertex_ai/gemini-3.1-flash-lite-preview": {"provider":"vertex_ai-language-models","input":250000,"output":1500000,"cache_read":25000},
+ "vertex_ai/gemini-3.1-pro-preview": {"provider":"vertex_ai","input":2000000,"output":12000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":4000000,"output":18000000,"cache_read":400000,"cache_write":250000}]},
+ "vertex_ai/gemini-3.1-pro-preview-customtools": {"provider":"vertex_ai","input":2000000,"output":12000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":4000000,"output":18000000,"cache_read":400000,"cache_write":250000}]},
+ "vertex_ai/gemini-3.5-flash": {"provider":"vertex_ai","input":1500000,"output":9000000,"cache_read":150000},
+ "vertex_ai/gemini-3.5-flash-lite": {"provider":"vertex_ai-language-models","input":300000,"output":2500000,"cache_read":30000},
+ "vertex_ai/gemini-3.6-flash": {"provider":"vertex_ai","input":750000,"output":3750000,"cache_read":75000},
+ "vertex_ai/gemini-3.7-flash": {"provider":"vertex_ai","input":750000,"output":3750000,"cache_read":75000},
+ "vertex_ai/gemini-3.8-flash": {"provider":"vertex_ai","input":750000,"output":3750000,"cache_read":75000},
+ "vertex_ai/gemini-3.8-flash-cyber": {"provider":"vertex_ai","input":1500000,"output":7500000,"cache_read":150000},
+ "vertex_ai/gemini-omni-1.1-flash": {"provider":"vertex_ai","input":1500000,"output":9000000},
+ "vertex_ai/gemini-omni-1.1-flash-preview": {"provider":"vertex_ai","input":1500000,"output":9000000},
+ "xai/grok-4.20": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-0309": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-0309-non-reasoning": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-0309-reasoning": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-beta": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-beta-0309": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-beta-0309-non-reasoning": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-beta-0309-reasoning": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-beta-latest": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-beta-latest-non-reasoning": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-beta-latest-reasoning": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-beta-non-reasoning": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-beta-reasoning": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-experimental-beta-0304": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-experimental-beta-0304-non-reasoning": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-experimental-beta-0304-reasoning": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-experimental-beta-latest": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-experimental-beta-non-reasoning-latest": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-experimental-beta-reasoning-latest": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-multi-agent": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-multi-agent-0309": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-multi-agent-beta-0309": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-multi-agent-beta-latest": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-multi-agent-experimental-beta-0304": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-multi-agent-experimental-beta-latest": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-multi-agent-latest": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-non-reasoning": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-non-reasoning-gv2": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-non-reasoning-latest": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-reasoning": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-reasoning-gv2": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.20-reasoning-latest": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.3": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.3-latest": {"provider":"xai","input":1250000,"output":2500000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2500000,"output":5000000,"cache_read":400000}]},
+ "xai/grok-4.5": {"provider":"xai","input":2000000,"output":6000000,"cache_read":300000,"bands":[{"above_tokens":200000,"input":4000000,"output":12000000,"cache_read":600000}]},
+ "xai/grok-4.5-latest": {"provider":"xai","input":2000000,"output":6000000,"cache_read":300000,"bands":[{"above_tokens":200000,"input":4000000,"output":12000000,"cache_read":600000}]},
+ "xai/grok-4.6": {"provider":"xai","input":2000000,"output":6000000,"cache_read":500000,"bands":[{"above_tokens":200000,"input":4000000,"output":12000000,"cache_read":1000000}]},
+ "xai/grok-4.7": {"provider":"xai","input":2000000,"output":6000000,"cache_read":500000,"bands":[{"above_tokens":200000,"input":4000000,"output":12000000,"cache_read":1000000}]},
+ "xai/grok-build-0.1": {"provider":"xai","input":1000000,"output":2000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2000000,"output":4000000,"cache_read":400000}]},
+ "xai/grok-build-latest": {"provider":"xai","input":2000000,"output":6000000,"cache_read":300000,"bands":[{"above_tokens":200000,"input":4000000,"output":12000000,"cache_read":600000}]},
+ "xai/grok-code-fast": {"provider":"xai","input":1000000,"output":2000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2000000,"output":4000000,"cache_read":400000}]},
+ "xai/grok-code-fast-1": {"provider":"xai","input":1000000,"output":2000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2000000,"output":4000000,"cache_read":400000}]},
+ "xai/grok-code-fast-1-0825": {"provider":"xai","input":1000000,"output":2000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2000000,"output":4000000,"cache_read":400000}]},
+ "zai/glm-4-32b-0414-128k": {"provider":"zai","input":100000,"output":100000},
+ "zai/glm-4.5": {"provider":"zai","input":600000,"output":2200000},
+ "zai/glm-4.5-air": {"provider":"zai","input":200000,"output":1100000},
+ "zai/glm-4.5-airx": {"provider":"zai","input":1100000,"output":4500000},
+ "zai/glm-4.5-x": {"provider":"zai","input":2200000,"output":8900000},
+ "zai/glm-4.5v": {"provider":"zai","input":600000,"output":1800000},
+ "zai/glm-4.6": {"provider":"zai","input":600000,"output":2200000,"cache_read":110000},
+ "zai/glm-4.7": {"provider":"zai","input":600000,"output":2200000,"cache_read":110000},
+ "zai/glm-5": {"provider":"zai","input":1000000,"output":3200000,"cache_read":200000},
+ "zai/glm-5-code": {"provider":"zai","input":1200000,"output":5000000,"cache_read":300000},
+ "zai/glm-5.1": {"provider":"zai","input":1400000,"output":4400000,"cache_read":260000},
+ "zai/glm-5.2": {"provider":"zai","input":1400000,"output":4400000,"cache_read":260000},
+ "zai/glm-5.3": {"provider":"zai","input":1400000,"output":4400000,"cache_read":260000},
+ "zai/glm-5.3-flash": {"provider":"zai","input":150000,"output":500000,"cache_read":30000}
+ }
+}
diff --git a/cli/beacon/internal/pricing/catalog_test.go b/cli/beacon/internal/pricing/catalog_test.go
new file mode 100644
index 00000000..b501be62
--- /dev/null
+++ b/cli/beacon/internal/pricing/catalog_test.go
@@ -0,0 +1,96 @@
+package pricing
+
+import (
+ "regexp"
+ "strings"
+ "testing"
+)
+
+func TestEmbeddedCatalogLoads(t *testing.T) {
+ c, err := LoadCatalog(embeddedCatalog)
+ if err != nil {
+ t.Fatalf("embedded catalog.json: %v", err)
+ }
+ if Default() == nil {
+ t.Fatal("Default() is nil")
+ }
+ src := c.Source()
+ if src.License != "MIT" || !strings.Contains(src.Name, "LiteLLM") {
+ t.Errorf("source must credit LiteLLM (MIT): %+v", src)
+ }
+ if !strings.HasPrefix(src.URL, "https://raw.githubusercontent.com/BerriAI/litellm/") {
+ t.Errorf("source URL = %q", src.URL)
+ }
+ if !regexp.MustCompile(`^[0-9a-f]{40}$`).MatchString(src.Commit) {
+ t.Errorf("source commit = %q, want the full upstream commit the catalog was generated from", src.Commit)
+ }
+ date := regexp.MustCompile(`^\d{4}-\d{2}-\d{2}$`)
+ if !date.MatchString(src.FetchedAt) || !date.MatchString(c.GeneratedAt()) {
+ t.Errorf("dates fetched_at=%q generated_at=%q", src.FetchedAt, c.GeneratedAt())
+ }
+ // The catalog is embedded in the CLI; keep it small.
+ if n := len(embeddedCatalog); n > 300_000 {
+ t.Errorf("catalog.json is %d bytes; keep it well under 300KB", n)
+ }
+ if n := len(c.Keys()); n < 200 {
+ t.Errorf("catalog has only %d models", n)
+ }
+}
+
+// LoadCatalog enforces these too; the test states them independently so a loosened validator
+// cannot quietly let a bad catalog through.
+func TestEmbeddedCatalogIntegrity(t *testing.T) {
+ c := Default()
+ for _, key := range c.Keys() {
+ r, ok := c.Rates(key)
+ if !ok {
+ t.Fatalf("%s listed but has no rates", key)
+ }
+ if r.Provider == "" {
+ t.Errorf("%s: no provider", key)
+ }
+ check := func(where string, s RateSet) {
+ if s.Input <= 0 || s.Output <= 0 {
+ t.Errorf("%s %s: input %d output %d, both must be positive", key, where, s.Input, s.Output)
+ }
+ if s.CacheRead < 0 || s.CacheWrite < 0 || s.CacheWrite1h < 0 {
+ t.Errorf("%s %s: negative cache rate %+v", key, where, s)
+ }
+ }
+ check("base", r.RateSet)
+ var prev int64
+ for _, b := range r.Bands {
+ if b.AboveTokens <= prev {
+ t.Errorf("%s: band thresholds not strictly increasing (%d after %d)", key, b.AboveTokens, prev)
+ }
+ prev = b.AboveTokens
+ check("band", b.RateSet)
+ // Bands are complete tuples: a rate the base publishes is never missing above the
+ // threshold.
+ if (r.CacheRead > 0 && b.CacheRead == 0) || (r.CacheWrite > 0 && b.CacheWrite == 0) || (r.CacheWrite1h > 0 && b.CacheWrite1h == 0) {
+ t.Errorf("%s: band above %d drops a base cache rate: base %+v band %+v", key, b.AboveTokens, r.RateSet, b.RateSet)
+ }
+ }
+ }
+}
+
+func TestLoadCatalogRejectsBadInput(t *testing.T) {
+ good := `{"schema_version":1,"source":{"name":"x","license":"MIT","url":"u","fetched_at":"2026-01-01"},"generated_at":"2026-01-01","unit":"microdollars per million tokens","models":{"m":%s}}`
+ for name, entry := range map[string]string{
+ "zero input": `{"provider":"p","input":0,"output":1}`,
+ "negative cache": `{"provider":"p","input":1,"output":1,"cache_read":-1}`,
+ "unsorted bands": `{"provider":"p","input":1,"output":1,"bands":[{"above_tokens":200000,"input":2,"output":2},{"above_tokens":100000,"input":3,"output":3}]}`,
+ "duplicate band": `{"provider":"p","input":1,"output":1,"bands":[{"above_tokens":200000,"input":2,"output":2},{"above_tokens":200000,"input":3,"output":3}]}`,
+ "band without rate": `{"provider":"p","input":1,"output":1,"bands":[{"above_tokens":200000}]}`,
+ } {
+ if _, err := LoadCatalog([]byte(strings.Replace(good, "%s", entry, 1))); err == nil {
+ t.Errorf("%s: accepted", name)
+ }
+ }
+ if _, err := LoadCatalog([]byte(strings.Replace(good, "%s", `{"provider":"p","input":1,"output":1}`, 1))); err != nil {
+ t.Errorf("valid catalog rejected: %v", err)
+ }
+ if _, err := LoadCatalog([]byte(strings.Replace(strings.Replace(good, "%s", `{"provider":"p","input":1,"output":1}`, 1), `"schema_version":1`, `"schema_version":2`, 1))); err == nil {
+ t.Error("future schema_version accepted")
+ }
+}
diff --git a/cli/beacon/internal/pricing/cost.go b/cli/beacon/internal/pricing/cost.go
new file mode 100644
index 00000000..c6ce4645
--- /dev/null
+++ b/cli/beacon/internal/pricing/cost.go
@@ -0,0 +1,150 @@
+package pricing
+
+// RateSet is one set of per-token prices, in microdollars per million tokens. Zero means the
+// provider publishes no such rate (see "Missing rates" in the package docs), never "free".
+type RateSet struct {
+ Input int64 `json:"input"`
+ Output int64 `json:"output"`
+ // CacheRead is the price of a prompt-cache hit.
+ CacheRead int64 `json:"cache_read,omitempty"`
+ // CacheWrite is the price of writing the prompt cache with the default (five-minute) TTL.
+ CacheWrite int64 `json:"cache_write,omitempty"`
+ // CacheWrite1h is the price of a cache write with a one-hour TTL.
+ CacheWrite1h int64 `json:"cache_write_1h,omitempty"`
+}
+
+// Band is a long-context price tier: a request whose prompt is larger than AboveTokens is
+// billed at these rates for every token, not only for the tokens past the threshold. The
+// generator writes complete tuples, so a field the provider did not restate for the band
+// already carries the base rate.
+type Band struct {
+ AboveTokens int64 `json:"above_tokens"`
+ RateSet
+}
+
+// Rates is everything the catalog knows about one model's price.
+type Rates struct {
+ // Provider is the upstream list's provider for the entry (anthropic, openai, gemini,
+ // vertex_ai-anthropic_models, bedrock_converse, ...), kept so a report can say whose list
+ // price it used.
+ Provider string `json:"provider"`
+ RateSet
+ // Bands are sorted by strictly increasing AboveTokens.
+ Bands []Band `json:"bands,omitempty"`
+}
+
+// Tokens is one usage record in gen_ai.usage terms. See "Token semantics" in the package docs:
+// the counts are disjoint, CacheCreation1h is a subset of CacheCreation, and Reasoning is a
+// breakdown of Output.
+type Tokens struct {
+ Input int64
+ Output int64
+ CacheRead int64
+ CacheCreation int64
+ CacheCreation1h int64
+ Reasoning int64
+}
+
+// Estimate is a list-price cost and how it was reached.
+type Estimate struct {
+ Cost Microdollars
+ // BandAboveTokens is the threshold of the long-context band that priced the request, or
+ // zero when base rates applied.
+ BandAboveTokens int64
+ // The fallbacks below are set only when they priced a non-zero count.
+ //
+ // CacheReadAtInputRate: the model publishes no cache-read rate, so reads were priced as
+ // input.
+ CacheReadAtInputRate bool
+ // CacheWriteAtInputRate: the model publishes no cache-write rate, so writes were priced
+ // as input.
+ CacheWriteAtInputRate bool
+ // CacheWrite1hAtWriteRate: the model publishes no one-hour write rate, so one-hour writes
+ // were priced at the five-minute write rate.
+ CacheWrite1hAtWriteRate bool
+ // ReasoningAtOutputRate: Output was zero and Reasoning was not, so reasoning tokens were
+ // priced as the output they are.
+ ReasoningAtOutputRate bool
+ // Saturated: the true cost does not fit in an int64 of microdollars (about 9.2 trillion
+ // dollars), so Cost holds the maximum. It means the input is corrupt; do not print Cost.
+ Saturated bool
+}
+
+// Cost prices t at r.
+//
+// requestScoped says that t is exactly one API request. Only then can a long-context band
+// apply: the band is chosen by the request's prompt size, Input + CacheRead + CacheCreation,
+// and is the one with the largest AboveTokens strictly below it. Any sum of requests --
+// a turn, a session, a day -- must pass false and is priced at base rates.
+//
+// Negative counts are treated as zero, and CacheCreation1h is clamped to CacheCreation.
+func Cost(r Rates, t Tokens, requestScoped bool) Estimate {
+ t = t.clamped()
+ var est Estimate
+ set := r.RateSet
+ if requestScoped {
+ prompt := saturatingAdd(saturatingAdd(t.Input, t.CacheRead), t.CacheCreation)
+ for _, b := range r.Bands {
+ if prompt > b.AboveTokens {
+ set = b.RateSet
+ est.BandAboveTokens = b.AboveTokens
+ }
+ }
+ }
+
+ cacheRead := set.CacheRead
+ if cacheRead <= 0 {
+ cacheRead = set.Input
+ est.CacheReadAtInputRate = t.CacheRead > 0
+ }
+ cacheWrite := set.CacheWrite
+ if cacheWrite <= 0 {
+ cacheWrite = set.Input
+ est.CacheWriteAtInputRate = t.CacheCreation > 0
+ }
+ cacheWrite1h := set.CacheWrite1h
+ if cacheWrite1h <= 0 {
+ cacheWrite1h = cacheWrite
+ est.CacheWrite1hAtWriteRate = t.CacheCreation1h > 0
+ }
+ output := t.Output
+ if output == 0 && t.Reasoning > 0 {
+ output = t.Reasoning
+ est.ReasoningAtOutputRate = true
+ }
+
+ var sum lineItem
+ sum.add(t.Input, set.Input)
+ sum.add(t.CacheCreation-t.CacheCreation1h, cacheWrite)
+ sum.add(t.CacheCreation1h, cacheWrite1h)
+ sum.add(t.CacheRead, cacheRead)
+ sum.add(output, set.Output)
+ est.Cost, est.Saturated = sum.total()
+ return est
+}
+
+func (t Tokens) clamped() Tokens {
+ nonNeg := func(v int64) int64 {
+ if v < 0 {
+ return 0
+ }
+ return v
+ }
+ t.Input = nonNeg(t.Input)
+ t.Output = nonNeg(t.Output)
+ t.CacheRead = nonNeg(t.CacheRead)
+ t.CacheCreation = nonNeg(t.CacheCreation)
+ t.CacheCreation1h = nonNeg(t.CacheCreation1h)
+ t.Reasoning = nonNeg(t.Reasoning)
+ if t.CacheCreation1h > t.CacheCreation {
+ t.CacheCreation1h = t.CacheCreation
+ }
+ return t
+}
+
+func saturatingAdd(a, b int64) int64 {
+ if a > 0 && b > (1<<63-1)-a {
+ return 1<<63 - 1
+ }
+ return a + b
+}
diff --git a/cli/beacon/internal/pricing/cost_test.go b/cli/beacon/internal/pricing/cost_test.go
new file mode 100644
index 00000000..185e12a3
--- /dev/null
+++ b/cli/beacon/internal/pricing/cost_test.go
@@ -0,0 +1,214 @@
+package pricing
+
+import (
+ "math"
+ "testing"
+)
+
+// The rates below are written out rather than read from the embedded catalog, so the golden
+// figures are hand-checkable and do not move when the catalog is regenerated. They are the
+// published list prices of the named models at the time of writing.
+var (
+ // Anthropic Claude Opus 4.6: $5 in, $25 out, $0.50 cache read, $6.25 5-minute write,
+ // $10 one-hour write per MTok.
+ opusRates = Rates{Provider: "anthropic", RateSet: RateSet{
+ Input: 5_000_000, Output: 25_000_000, CacheRead: 500_000, CacheWrite: 6_250_000, CacheWrite1h: 10_000_000,
+ }}
+ // OpenAI GPT-5.4: $2.50 in, $15 out, $0.25 cached; above 272k prompt tokens $5, $22.50,
+ // $0.50. OpenAI publishes no cache-write price.
+ gpt54Rates = Rates{Provider: "openai",
+ RateSet: RateSet{Input: 2_500_000, Output: 15_000_000, CacheRead: 250_000},
+ Bands: []Band{{AboveTokens: 272_000, RateSet: RateSet{Input: 5_000_000, Output: 22_500_000, CacheRead: 500_000}}},
+ }
+ // Gemini 2.5 Pro: $1.25 in, $10 out, $0.125 cached; above 200k $2.50, $15, $0.25.
+ geminiRates = Rates{Provider: "gemini",
+ RateSet: RateSet{Input: 1_250_000, Output: 10_000_000, CacheRead: 125_000},
+ Bands: []Band{{AboveTokens: 200_000, RateSet: RateSet{Input: 2_500_000, Output: 15_000_000, CacheRead: 250_000}}},
+ }
+)
+
+func TestCostAnthropicWithOneHourWrites(t *testing.T) {
+ tokens := Tokens{Input: 1_200, Output: 3_400, CacheRead: 150_000, CacheCreation: 20_000, CacheCreation1h: 8_000}
+ // input 1,200 x $5/M = $0.006000
+ // 5m write 12,000 x $6.25/M = $0.075000
+ // 1h write 8,000 x $10/M = $0.080000
+ // read 150,000 x $0.50/M = $0.075000
+ // output 3,400 x $25/M = $0.085000
+ // $0.321000
+ got := Cost(opusRates, tokens, true)
+ if got.Cost != 321_000 {
+ t.Fatalf("cost = %d, want 321000", got.Cost)
+ }
+ if got.CacheReadAtInputRate || got.CacheWriteAtInputRate || got.CacheWrite1hAtWriteRate || got.BandAboveTokens != 0 {
+ t.Fatalf("unexpected fallback or band: %+v", got)
+ }
+ // The same tokens as five-minute writes only cost less: 20,000 x $6.25/M = $0.125.
+ five := Cost(opusRates, Tokens{Input: 1_200, Output: 3_400, CacheRead: 150_000, CacheCreation: 20_000}, true)
+ if five.Cost != 6_000+125_000+75_000+85_000 {
+ t.Fatalf("five-minute cost = %d", five.Cost)
+ }
+}
+
+func TestCostOpenAILongContextBandIsRequestScoped(t *testing.T) {
+ // Prompt = 100,000 + 180,000 = 280,000 > 272,000.
+ tokens := Tokens{Input: 100_000, CacheRead: 180_000, Output: 2_000}
+
+ // One request: every token at the band rate.
+ // 100,000 x $5/M = $0.50; 180,000 x $0.50/M = $0.09; 2,000 x $22.50/M = $0.045
+ req := Cost(gpt54Rates, tokens, true)
+ if req.Cost != 635_000 || req.BandAboveTokens != 272_000 {
+ t.Fatalf("request-scoped = %+v, want 635000 in the 272k band", req)
+ }
+
+ // An aggregate of the same size is many smaller requests: base rates.
+ // 100,000 x $2.50/M = $0.25; 180,000 x $0.25/M = $0.045; 2,000 x $15/M = $0.03
+ agg := Cost(gpt54Rates, tokens, false)
+ if agg.Cost != 325_000 || agg.BandAboveTokens != 0 {
+ t.Fatalf("aggregate = %+v, want 325000 at base rates", agg)
+ }
+
+ // "Above 272k" is strict: a prompt of exactly 272,000 is base-priced.
+ edge := Cost(gpt54Rates, Tokens{Input: 72_000, CacheRead: 200_000}, true)
+ if edge.BandAboveTokens != 0 || edge.Cost != 180_000+50_000 {
+ t.Fatalf("272,000-token prompt = %+v, want base 230000", edge)
+ }
+ over := Cost(gpt54Rates, Tokens{Input: 72_001, CacheRead: 200_000}, true)
+ if over.BandAboveTokens != 272_000 {
+ t.Fatalf("272,001-token prompt = %+v, want the band", over)
+ }
+}
+
+func TestCostOpenAICacheWriteFallsBackToInput(t *testing.T) {
+ // OpenAI bills a cache write as ordinary input; Cost does the same and says so.
+ got := Cost(gpt54Rates, Tokens{CacheCreation: 10_000}, false)
+ if got.Cost != 25_000 || !got.CacheWriteAtInputRate || got.CacheWrite1hAtWriteRate {
+ t.Fatalf("got %+v, want 25000 at the input rate", got)
+ }
+ // One-hour writes with no published one-hour or write rate fall back twice, to input.
+ got = Cost(gpt54Rates, Tokens{CacheCreation: 10_000, CacheCreation1h: 10_000}, false)
+ if got.Cost != 25_000 || !got.CacheWriteAtInputRate || !got.CacheWrite1hAtWriteRate {
+ t.Fatalf("got %+v", got)
+ }
+}
+
+func TestCostGeminiBandCountsCacheWritesInThePrompt(t *testing.T) {
+ // 210,000 uncached input tokens in one request: band. 210,000 x $2.50/M = $0.525,
+ // 1,000 x $15/M = $0.015.
+ got := Cost(geminiRates, Tokens{Input: 210_000, Output: 1_000}, true)
+ if got.Cost != 540_000 || got.BandAboveTokens != 200_000 {
+ t.Fatalf("got %+v, want 540000 in the 200k band", got)
+ }
+ // Aggregate: 210,000 x $1.25/M = $0.2625, 1,000 x $10/M = $0.01.
+ if agg := Cost(geminiRates, Tokens{Input: 210_000, Output: 1_000}, false); agg.Cost != 272_500 {
+ t.Fatalf("aggregate = %d, want 272500", agg.Cost)
+ }
+ // Cache writes are part of the prompt the threshold is measured on.
+ mixed := Cost(geminiRates, Tokens{Input: 150_000, CacheCreation: 50_001}, true)
+ if mixed.BandAboveTokens != 200_000 {
+ t.Fatalf("150,000 input + 50,001 cache write = %+v, want the band", mixed)
+ }
+}
+
+func TestCostPicksTheLargestBandBelowThePrompt(t *testing.T) {
+ rates := Rates{
+ RateSet: RateSet{Input: 1_000_000, Output: 1_000_000},
+ Bands: []Band{
+ {AboveTokens: 128_000, RateSet: RateSet{Input: 2_000_000, Output: 2_000_000}},
+ {AboveTokens: 256_000, RateSet: RateSet{Input: 3_000_000, Output: 3_000_000}},
+ },
+ }
+ for _, c := range []struct {
+ prompt, band int64
+ }{
+ {128_000, 0},
+ {128_001, 128_000},
+ {256_000, 128_000},
+ {256_001, 256_000},
+ {1_000_000, 256_000},
+ } {
+ if got := Cost(rates, Tokens{Input: c.prompt}, true); got.BandAboveTokens != c.band {
+ t.Errorf("prompt %d: band %d, want %d", c.prompt, got.BandAboveTokens, c.band)
+ }
+ }
+}
+
+func TestCostZeroTokens(t *testing.T) {
+ got := Cost(opusRates, Tokens{}, true)
+ if got != (Estimate{}) {
+ t.Fatalf("zero tokens = %+v, want the zero Estimate", got)
+ }
+ // Fallback flags are about counts that were priced, so none are set for zero counts even
+ // on a model that publishes no cache rates.
+ if got := Cost(Rates{RateSet: RateSet{Input: 1, Output: 1}}, Tokens{}, false); got != (Estimate{}) {
+ t.Fatalf("zero tokens without cache rates = %+v", got)
+ }
+}
+
+func TestCostReasoningIsInsideOutput(t *testing.T) {
+ // Reasoning alongside output is a breakdown of it: only the 500 output tokens are billed.
+ both := Cost(opusRates, Tokens{Output: 500, Reasoning: 1_000}, false)
+ if both.Cost != 12_500 || both.ReasoningAtOutputRate {
+ t.Fatalf("output+reasoning = %+v, want 12500 (500 x $25/M)", both)
+ }
+ // A record carrying reasoning and no output is billed as that output.
+ only := Cost(opusRates, Tokens{Reasoning: 1_000}, false)
+ if only.Cost != 25_000 || !only.ReasoningAtOutputRate {
+ t.Fatalf("reasoning only = %+v, want 25000 (1,000 x $25/M)", only)
+ }
+}
+
+func TestCostRoundsHalfUpOnceAtTheEnd(t *testing.T) {
+ // A rate of 1 microdollar per million tokens makes every token half a millionth of the
+ // rounding unit visible.
+ tiny := Rates{RateSet: RateSet{Input: 1, Output: 1}}
+ if got := Cost(tiny, Tokens{Input: 500_000}, false).Cost; got != 1 {
+ t.Fatalf("0.5 microdollar = %d, want 1 (half up)", got)
+ }
+ if got := Cost(tiny, Tokens{Input: 499_999}, false).Cost; got != 0 {
+ t.Fatalf("0.499999 microdollar = %d, want 0", got)
+ }
+ // Two half-microdollar terms are one microdollar. Rounding each term would make it two.
+ if got := Cost(tiny, Tokens{Input: 500_000, Output: 500_000}, false).Cost; got != 1 {
+ t.Fatalf("0.5 + 0.5 microdollar = %d, want 1 (one rounding, at the end)", got)
+ }
+ if got := Cost(tiny, Tokens{Input: 1_500_000}, false).Cost; got != 2 {
+ t.Fatalf("1.5 microdollar = %d, want 2 (half up, not half to even)", got)
+ }
+}
+
+func TestCostHugeCountsDoNotOverflow(t *testing.T) {
+ // 9e12 tokens x $5/M: the tokens x rate product (4.5e19) overflows int64 though the cost
+ // ($45,000,000) does not. The arithmetic must still be exact.
+ got := Cost(opusRates, Tokens{Input: 9_000_000_000_000}, false)
+ if got.Cost != 45_000_000_000_000 || got.Saturated {
+ t.Fatalf("9e12 input tokens = %+v, want exactly 45000000000000", got)
+ }
+ // A cost past the int64 range saturates and says so, rather than wrapping negative.
+ all := Tokens{Input: math.MaxInt64, Output: math.MaxInt64, CacheRead: math.MaxInt64, CacheCreation: math.MaxInt64, CacheCreation1h: math.MaxInt64}
+ big := Cost(opusRates, all, true)
+ if !big.Saturated || big.Cost != math.MaxInt64 {
+ t.Fatalf("max counts = %+v, want saturated", big)
+ }
+}
+
+func TestCostClampsInconsistentCounts(t *testing.T) {
+ // More one-hour writes than writes cannot happen; the excess is not billed.
+ got := Cost(opusRates, Tokens{CacheCreation: 1_000, CacheCreation1h: 5_000}, false)
+ if got.Cost != 10_000 { // 1,000 x $10/M
+ t.Fatalf("1h > total = %d, want 10000", got.Cost)
+ }
+ // Negative counts (a counter reset differenced the wrong way) are zero, not a credit.
+ neg := Cost(opusRates, Tokens{Input: -1_000_000, Output: 1_000}, false)
+ if neg.Cost != 25_000 {
+ t.Fatalf("negative input = %d, want 25000", neg.Cost)
+ }
+}
+
+func TestCostCacheReadWithoutPublishedRate(t *testing.T) {
+ // A model with no published cache-read price bills reads at its input price, and says so.
+ rates := Rates{RateSet: RateSet{Input: 570_000, Output: 2_300_000}}
+ got := Cost(rates, Tokens{CacheRead: 1_000_000}, false)
+ if got.Cost != 570_000 || !got.CacheReadAtInputRate {
+ t.Fatalf("got %+v, want 570000 at the input rate", got)
+ }
+}
diff --git a/cli/beacon/internal/pricing/doc.go b/cli/beacon/internal/pricing/doc.go
new file mode 100644
index 00000000..52540152
--- /dev/null
+++ b/cli/beacon/internal/pricing/doc.go
@@ -0,0 +1,70 @@
+// Package pricing estimates what a model call would cost at the provider's published list price.
+//
+// It exists so token reports can show a cost for every runtime, not only the ones that report
+// one. It is report-time arithmetic and nothing more: no network access, no writes, and nothing
+// it computes is ever stored in an event. `gen_ai.usage.cost_usd` stays the runtime-reported
+// cost; a figure from this package is an estimate and callers must label it as one. The hook
+// binary does not import this package.
+//
+// # The catalog
+//
+// The rates come from catalog.json, embedded in the binary. It is generated by
+// internal/gen from the price list LiteLLM publishes as model_prices_and_context_window.json
+// (https://github.com/BerriAI/litellm, MIT License, Copyright (c) 2023 Berri AI; the notice is in
+// LICENSE.litellm next to this file). The catalog records the upstream URL, the upstream commit
+// it was generated from, and the generation date, so a report can say whose prices it used and
+// how old they are. It is regenerated by hand, never during a build or a test:
+//
+// cd cli/beacon && go run ./internal/pricing/internal/gen
+//
+// Only standard-tier rates are kept: input, output, cache read, cache write (the default
+// five-minute TTL), the one-hour cache write where a provider publishes it, and long-context
+// request bands. Batch, flex, priority and regional-endpoint surcharge variants are left out,
+// because nothing in Beacon's usage record says a call used them. Rates are integer
+// microdollars per million tokens, so $3.00/MTok is 3_000_000.
+//
+// # Token semantics
+//
+// Tokens mirrors Beacon's canonical gen_ai.usage record (docs/cli/token-usage.mdx, "Counts are
+// kept disjoint"; pkg/asymptoteobserve TraceUsageV1):
+//
+// - Input is uncached input only. Cache reads and cache writes are separate counts and are
+// never also inside Input (Beacon subtracts them on the runtimes that report input
+// inclusively, Codex among them).
+// - CacheCreation is every token written to the prompt cache. CacheCreation1h is the subset
+// of those written with a one-hour TTL, so it is clamped to CacheCreation. gen_ai.usage does
+// not carry the one-hour split today, so callers working from it leave the field zero and
+// every write is priced at the five-minute rate.
+// - Reasoning is a breakdown of Output, not an addition to it. That is the gen_ai.usage
+// contract (reasoning.output_tokens is a sub-field of output, as in the OTel GenAI
+// semantic conventions), and docs/cli/token-usage.mdx says reasoning tokens "must not be
+// charged a second time because they are already included in output". It is priced at the
+// output rate only when Output is zero, which is the record of a runtime that reported
+// reasoning and nothing else.
+//
+// # Long-context bands
+//
+// Several providers charge more for every token of a request whose prompt passes a size
+// threshold (Anthropic and Gemini above 200k, OpenAI's newer models above 272k). That is a
+// property of one API request, so Cost applies a band only when the caller says the tokens are
+// one request. A sum over many requests cannot be banded -- forty 10k requests are not one 400k
+// request -- and is always priced at base rates, which can understate a session that really did
+// send long prompts.
+//
+// # Missing rates
+//
+// When a model publishes no cache-read rate, cache reads are priced at the input rate. When it
+// publishes no cache-write rate, writes are priced at the input rate too. That matches how
+// providers without a separate write price bill (OpenAI, Gemini's implicit caching, DeepSeek,
+// xAI: a write is an ordinary input token) and turns an unpublished read discount into an upper
+// bound instead of a guess. A missing one-hour write rate falls back to the five-minute rate.
+// A zero in the upstream list is treated as unpublished, never as free: a token the model
+// processed was not free, and an estimate that quietly drops it reads as a real saving. Each
+// fallback that affected a non-zero count is reported on the Estimate.
+//
+// # Model resolution
+//
+// Lookup turns what a runtime called the model into a catalog entry by a strict ladder and
+// never by substring or prefix similarity; see Lookup for the rungs. Two catalog entries that
+// match at the same rung with different rates leave the model unpriced rather than picking one.
+package pricing
diff --git a/cli/beacon/internal/pricing/internal/gen/generate.go b/cli/beacon/internal/pricing/internal/gen/generate.go
new file mode 100644
index 00000000..de23323d
--- /dev/null
+++ b/cli/beacon/internal/pricing/internal/gen/generate.go
@@ -0,0 +1,368 @@
+package main
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "io"
+ "math/big"
+ "regexp"
+ "sort"
+ "strconv"
+ "strings"
+
+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/pricing"
+ "github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve"
+)
+
+func sourceInfo(commit, fetched string) pricing.SourceInfo {
+ return pricing.SourceInfo{
+ Name: "LiteLLM " + upstreamPath,
+ License: "MIT",
+ URL: upstreamURL,
+ Commit: commit,
+ FetchedAt: fetched,
+ }
+}
+
+// firstParty are the upstream providers whose entries are kept: the model vendors themselves
+// and the clouds coding agents reach Claude and Gemini through. Resellers, inference hosts and
+// subscription products (github_copilot, chatgpt) are not list prices for the call a runtime
+// reports, and are left out.
+var firstParty = map[string]bool{
+ "anthropic": true,
+ "openai": true,
+ "gemini": true,
+ "vertex_ai": true,
+ "vertex_ai-language-models": true,
+ "vertex_ai-anthropic_models": true,
+ "bedrock": true,
+ "bedrock_converse": true,
+ "deepseek": true,
+ "xai": true,
+ "mistral": true,
+ "moonshot": true,
+ "dashscope": true,
+ "zai": true,
+ "minimax": true,
+}
+
+// openrouter entries are kept only for models no first-party entry prices -- usually ones the
+// vendor has retired from its own list but runtimes still report -- and only from the same
+// model vendors firstParty covers, so the catalog does not grow into a directory of every
+// model OpenRouter hosts.
+const openrouter = "openrouter"
+
+var openrouterVendors = map[string]bool{
+ "anthropic": true, "openai": true, "google": true, "deepseek": true, "x-ai": true,
+ "mistralai": true, "moonshotai": true, "qwen": true, "z-ai": true, "minimax": true,
+}
+
+// excludedNameParts drop entries that are chat-mode in the upstream list but are not what a
+// coding agent's token usage is billed as: audio, realtime, search, image and similar products
+// priced by other units.
+var excludedNameParts = []string{
+ "audio", "realtime", "search", "tts", "image", "transcribe", "embedding", "lyria",
+ "robotics", "computer-use", "deep-research", "container",
+}
+
+var bedrockAnthropicKey = regexp.MustCompile(`^((us-gov|global|apac|us|eu|au|jp)\.)?anthropic\.claude-`)
+
+// bandKey matches the long-context fields, e.g. input_cost_per_token_above_200k_tokens or
+// cache_creation_input_token_cost_above_1hr_above_200k_tokens. Variants with a further tier
+// suffix (_batches, _priority, _flex) do not match, by the anchor.
+var bandKey = regexp.MustCompile(`^(input_cost_per_token|output_cost_per_token|cache_read_input_token_cost|cache_creation_input_token_cost|cache_creation_input_token_cost_above_1hr)_above_(\d+)k_tokens$`)
+
+func keep(key, provider, mode string) bool {
+ if mode != "chat" && mode != "responses" {
+ return false
+ }
+ if !firstParty[provider] && provider != openrouter {
+ return false
+ }
+ lower := strings.ToLower(key)
+ if strings.HasPrefix(lower, "ft:") {
+ return false
+ }
+ for _, part := range excludedNameParts {
+ if strings.Contains(lower, part) {
+ return false
+ }
+ }
+ switch {
+ case strings.HasPrefix(provider, "bedrock"):
+ // Only Claude, and only the model ids and inference profiles a runtime reports: the
+ // bedrock/<region>/... and commitment-term paths are regional or provisioned prices.
+ return bedrockAnthropicKey.MatchString(lower)
+ case strings.HasPrefix(provider, "vertex_ai"):
+ return strings.Contains(lower, "claude") || strings.Contains(lower, "gemini")
+ case provider == openrouter:
+ // :free, :batch, :exacto and ~latest aliases are routing products, not list prices.
+ parts := strings.Split(lower, "/")
+ return len(parts) == 3 && openrouterVendors[parts[1]] && !strings.ContainsAny(lower, ":~")
+ }
+ return true
+}
+
+// Rounding records a rate that was not an exact number of microdollars per million tokens.
+type Rounding struct {
+ Key, Field, Value string
+ Rounded int64
+}
+
+type report struct {
+ Kept int
+ ByProvider map[string]int
+ Rounded []Rounding
+}
+
+func (r report) print(w io.Writer) {
+ providers := make([]string, 0, len(r.ByProvider))
+ for p := range r.ByProvider {
+ providers = append(providers, p)
+ }
+ sort.Strings(providers)
+ for _, p := range providers {
+ fmt.Fprintf(w, " %-28s %d\n", p, r.ByProvider[p])
+ }
+ if len(r.Rounded) == 0 {
+ fmt.Fprintln(w, "every kept rate converted exactly to integer microdollars per million tokens")
+ return
+ }
+ fmt.Fprintf(w, "%d rate(s) rounded to the nearest microdollar per million tokens:\n", len(r.Rounded))
+ for _, x := range r.Rounded {
+ fmt.Fprintf(w, " %s %s = %s -> %d\n", x.Key, x.Field, x.Value, x.Rounded)
+ }
+}
+
+// generate turns the upstream list into catalog.json bytes.
+func generate(raw []byte, source pricing.SourceInfo, generatedAt string) ([]byte, report, error) {
+ dec := json.NewDecoder(bytes.NewReader(raw))
+ dec.UseNumber()
+ var upstream map[string]map[string]any
+ if err := dec.Decode(&upstream); err != nil {
+ return nil, report{}, fmt.Errorf("parse upstream list: %w", err)
+ }
+ rep := report{ByProvider: map[string]int{}}
+
+ keys := make([]string, 0, len(upstream))
+ for k := range upstream {
+ keys = append(keys, k)
+ }
+ sort.Strings(keys)
+
+ models := map[string]pricing.Rates{}
+ var routed []string
+ for _, key := range keys {
+ entry := upstream[key]
+ provider, _ := entry["litellm_provider"].(string)
+ mode, _ := entry["mode"].(string)
+ if key == "sample_spec" || !keep(key, provider, mode) {
+ continue
+ }
+ rates, ok := convert(key, provider, entry, &rep)
+ if !ok {
+ continue
+ }
+ if provider == openrouter {
+ routed = append(routed, key)
+ continue
+ }
+ models[key] = rates
+ }
+
+ // An openrouter entry is added only when the first-party catalog cannot price its model
+ // under the same lookup a report will use.
+ firstPartyOnly, err := pricing.LoadCatalog(encode(source, generatedAt, models))
+ if err != nil {
+ return nil, rep, fmt.Errorf("first-party catalog: %w", err)
+ }
+ for _, key := range routed {
+ res, ok := firstPartyOnly.Lookup(asymptoteobserve.NormalizeModelName(key))
+ if ok || len(res.Candidates) > 0 {
+ continue
+ }
+ rates, _ := convert(key, openrouter, upstream[key], &report{ByProvider: map[string]int{}})
+ models[key] = rates
+ }
+
+ // Rounding is reported only for entries that made it in.
+ kept := rep.Rounded[:0]
+ for _, r := range rep.Rounded {
+ if _, ok := models[r.Key]; ok {
+ kept = append(kept, r)
+ }
+ }
+ rep.Rounded = kept
+ for _, r := range models {
+ rep.ByProvider[r.Provider]++
+ }
+ rep.Kept = len(models)
+
+ out := encode(source, generatedAt, models)
+ if _, err := pricing.LoadCatalog(out); err != nil {
+ return nil, rep, fmt.Errorf("generated catalog does not load: %w", err)
+ }
+ return out, rep, nil
+}
+
+// convert reads one upstream entry's standard-tier rates. It reports false for an entry with no
+// positive input and output price, which is not something an estimate can use.
+func convert(key, provider string, entry map[string]any, rep *report) (pricing.Rates, bool) {
+ rate := func(field string) int64 {
+ n, ok := entry[field].(json.Number)
+ if !ok {
+ return 0
+ }
+ v, rounded, exact, ok := perMillionMicrodollars(n)
+ if !ok {
+ return 0
+ }
+ if !exact {
+ rep.Rounded = append(rep.Rounded, Rounding{Key: key, Field: field, Value: n.String(), Rounded: rounded})
+ }
+ return v
+ }
+ base := pricing.RateSet{
+ Input: rate("input_cost_per_token"),
+ Output: rate("output_cost_per_token"),
+ CacheRead: rate("cache_read_input_token_cost"),
+ CacheWrite: rate("cache_creation_input_token_cost"),
+ CacheWrite1h: rate("cache_creation_input_token_cost_above_1hr"),
+ }
+ if base.CacheRead == 0 {
+ base.CacheRead = rate("input_cost_per_token_cache_hit")
+ }
+ if base.Input <= 0 || base.Output <= 0 {
+ return pricing.Rates{}, false
+ }
+
+ bands := map[int64]*pricing.RateSet{}
+ var fields []string
+ for field := range entry {
+ fields = append(fields, field)
+ }
+ sort.Strings(fields)
+ for _, field := range fields {
+ m := bandKey.FindStringSubmatch(field)
+ if m == nil {
+ continue
+ }
+ v := rate(field)
+ if v <= 0 {
+ continue
+ }
+ thousands, err := strconv.ParseInt(m[2], 10, 64)
+ if err != nil || thousands <= 0 {
+ continue
+ }
+ above := thousands * 1000
+ b := bands[above]
+ if b == nil {
+ b = &pricing.RateSet{}
+ bands[above] = b
+ }
+ switch m[1] {
+ case "input_cost_per_token":
+ b.Input = v
+ case "output_cost_per_token":
+ b.Output = v
+ case "cache_read_input_token_cost":
+ b.CacheRead = v
+ case "cache_creation_input_token_cost":
+ b.CacheWrite = v
+ case "cache_creation_input_token_cost_above_1hr":
+ b.CacheWrite1h = v
+ }
+ }
+
+ rates := pricing.Rates{Provider: provider, RateSet: base}
+ thresholds := make([]int64, 0, len(bands))
+ for above := range bands {
+ thresholds = append(thresholds, above)
+ }
+ sort.Slice(thresholds, func(i, j int) bool { return thresholds[i] < thresholds[j] })
+ for _, above := range thresholds {
+ // A field the band does not restate costs what it costs below the threshold.
+ set := *bands[above]
+ if set.Input == 0 {
+ set.Input = base.Input
+ }
+ if set.Output == 0 {
+ set.Output = base.Output
+ }
+ if set.CacheRead == 0 {
+ set.CacheRead = base.CacheRead
+ }
+ if set.CacheWrite == 0 {
+ set.CacheWrite = base.CacheWrite
+ }
+ if set.CacheWrite1h == 0 {
+ set.CacheWrite1h = base.CacheWrite1h
+ }
+ if set == base {
+ continue
+ }
+ rates.Bands = append(rates.Bands, pricing.Band{AboveTokens: above, RateSet: set})
+ }
+ return rates, true
+}
+
+var perTokenToPerMillionMicro = new(big.Rat).SetInt64(1_000_000 * 1_000_000)
+
+// perMillionMicrodollars converts a dollars-per-token decimal to integer microdollars per
+// million tokens, exactly: the decimal is read as a rational, not a float, so 3e-06 is 3_000_000
+// and not 2_999_999.9999. A value that is not an exact integer is rounded half up and reported.
+func perMillionMicrodollars(n json.Number) (value, rounded int64, exact, ok bool) {
+ r, good := new(big.Rat).SetString(n.String())
+ if !good || r.Sign() < 0 {
+ return 0, 0, false, false
+ }
+ r.Mul(r, perTokenToPerMillionMicro)
+ if r.IsInt() {
+ if !r.Num().IsInt64() {
+ return 0, 0, false, false
+ }
+ return r.Num().Int64(), 0, true, true
+ }
+ // floor((2*num + den) / (2*den)) is num/den rounded half up.
+ num := new(big.Int).Mul(r.Num(), big.NewInt(2))
+ num.Add(num, r.Denom())
+ den := new(big.Int).Mul(r.Denom(), big.NewInt(2))
+ num.Div(num, den)
+ if !num.IsInt64() {
+ return 0, 0, false, false
+ }
+ return num.Int64(), num.Int64(), false, true
+}
+
+// encode writes the catalog with a fixed field order and one model per line.
+func encode(source pricing.SourceInfo, generatedAt string, models map[string]pricing.Rates) []byte {
+ var b bytes.Buffer
+ sourceJSON, _ := json.Marshal(source)
+ fmt.Fprintf(&b, "{\n \"schema_version\": %d,\n", pricing.SchemaVersion)
+ fmt.Fprintf(&b, " \"source\": %s,\n", sourceJSON)
+ fmt.Fprintf(&b, " \"generated_at\": %s,\n", mustJSON(generatedAt))
+ fmt.Fprintf(&b, " \"unit\": %s,\n", mustJSON(pricing.RateUnit))
+ b.WriteString(" \"models\": {\n")
+ keys := make([]string, 0, len(models))
+ for k := range models {
+ keys = append(keys, k)
+ }
+ sort.Strings(keys)
+ for i, k := range keys {
+ entry, _ := json.Marshal(models[k])
+ fmt.Fprintf(&b, " %s: %s", mustJSON(k), entry)
+ if i < len(keys)-1 {
+ b.WriteByte(',')
+ }
+ b.WriteByte('\n')
+ }
+ b.WriteString(" }\n}\n")
+ return b.Bytes()
+}
+
+func mustJSON(s string) []byte {
+ out, _ := json.Marshal(s)
+ return out
+}
diff --git a/cli/beacon/internal/pricing/internal/gen/generate_test.go b/cli/beacon/internal/pricing/internal/gen/generate_test.go
new file mode 100644
index 00000000..1a043298
--- /dev/null
+++ b/cli/beacon/internal/pricing/internal/gen/generate_test.go
@@ -0,0 +1,169 @@
+package main
+
+import (
+ "bytes"
+ "encoding/json"
+ "flag"
+ "os"
+ "path/filepath"
+ "reflect"
+ "testing"
+
+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/pricing"
+)
+
+var update = flag.Bool("update", false, "rewrite testdata/catalog.golden.json")
+
+const fixtureCommit = "0123456789abcdef0123456789abcdef01234567"
+
+func generateFixture(t *testing.T) ([]byte, report) {
+ t.Helper()
+ raw, err := os.ReadFile(filepath.Join("testdata", "litellm_fixture.json"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ out, rep, err := generate(raw, sourceInfo(fixtureCommit, "2026-10-01"), "2026-10-02")
+ if err != nil {
+ t.Fatalf("generate: %v", err)
+ }
+ return out, rep
+}
+
+// The catalog is checked in and reviewed as a diff, so generating twice from the same input
+// must give the same bytes, and the bytes must be the golden layout: sorted, one model a line.
+func TestGenerateIsDeterministicAndMatchesGolden(t *testing.T) {
+ first, _ := generateFixture(t)
+ for i := 0; i < 5; i++ {
+ again, _ := generateFixture(t)
+ if !bytes.Equal(first, again) {
+ t.Fatalf("run %d produced different bytes:\n%s\n---\n%s", i, first, again)
+ }
+ }
+ golden := filepath.Join("testdata", "catalog.golden.json")
+ if *update {
+ if err := os.WriteFile(golden, first, 0o644); err != nil {
+ t.Fatal(err)
+ }
+ }
+ want, err := os.ReadFile(golden)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !bytes.Equal(first, want) {
+ t.Fatalf("generated catalog differs from %s (rerun with -update after checking):\n%s", golden, first)
+ }
+}
+
+func TestGenerateSelectionAndRates(t *testing.T) {
+ out, rep := generateFixture(t)
+ cat, err := pricing.LoadCatalog(out)
+ if err != nil {
+ t.Fatalf("generated catalog does not load: %v", err)
+ }
+ src := cat.Source()
+ if src.Commit != fixtureCommit || src.FetchedAt != "2026-10-01" || src.License != "MIT" || src.URL != upstreamURL {
+ t.Fatalf("source = %+v", src)
+ }
+ if cat.GeneratedAt() != "2026-10-02" {
+ t.Fatalf("generated_at = %q", cat.GeneratedAt())
+ }
+
+ wantKeys := []string{
+ "claude-sonnet-4-5",
+ "deepseek/deepseek-chat",
+ "gemini/gemini-2.5-pro",
+ "gpt-5-codex",
+ "gpt-5.4",
+ "mistral/devstral-medium-latest",
+ // Not priced by any first-party entry, from a vendor the catalog covers.
+ "openrouter/moonshotai/kimi-k2",
+ "us.anthropic.claude-sonnet-4-5-20250929-v1:0",
+ "xai/grok-code-fast-1",
+ "zai/glm-4.6",
+ }
+ if got := cat.Keys(); !reflect.DeepEqual(got, wantKeys) {
+ // Left out, each for its own reason: sample_spec; a fine-tune; an audio model; an
+ // embedding; a bedrock/<region>/ path; a non-Claude Bedrock model; a subscription
+ // product; a reseller; a model with no prices; an openrouter copy of a model Anthropic
+ // prices (claude-sonnet-4.5 meets claude-sonnet-4-5 at the dotted-version rung); a
+ // :free alias; an openrouter model from a vendor the catalog does not cover.
+ t.Fatalf("keys =\n%q\nwant\n%q", got, wantKeys)
+ }
+
+ sonnet, _ := cat.Rates("claude-sonnet-4-5")
+ wantSonnet := pricing.Rates{
+ Provider: "anthropic",
+ RateSet: pricing.RateSet{Input: 3_000_000, Output: 15_000_000, CacheRead: 300_000, CacheWrite: 3_750_000, CacheWrite1h: 6_000_000},
+ Bands: []pricing.Band{{AboveTokens: 200_000, RateSet: pricing.RateSet{
+ Input: 6_000_000, Output: 22_500_000, CacheRead: 600_000, CacheWrite: 7_500_000, CacheWrite1h: 12_000_000,
+ }}},
+ }
+ if !reflect.DeepEqual(sonnet, wantSonnet) {
+ t.Fatalf("claude-sonnet-4-5 = %+v\nwant %+v", sonnet, wantSonnet)
+ }
+
+ // Priority, flex and batch fields, including a priority band, are ignored.
+ gpt, _ := cat.Rates("gpt-5.4")
+ wantGPT := pricing.Rates{
+ Provider: "openai",
+ RateSet: pricing.RateSet{Input: 2_500_000, Output: 15_000_000, CacheRead: 250_000},
+ Bands: []pricing.Band{{AboveTokens: 272_000, RateSet: pricing.RateSet{Input: 5_000_000, Output: 22_500_000, CacheRead: 500_000}}},
+ }
+ if !reflect.DeepEqual(gpt, wantGPT) {
+ t.Fatalf("gpt-5.4 = %+v\nwant %+v", gpt, wantGPT)
+ }
+
+ // A band that restates only input and output inherits the base cache-read price.
+ grok, _ := cat.Rates("xai/grok-code-fast-1")
+ wantGrokBand := []pricing.Band{{AboveTokens: 200_000, RateSet: pricing.RateSet{Input: 2_000_000, Output: 4_000_000, CacheRead: 200_000}}}
+ if !reflect.DeepEqual(grok.Bands, wantGrokBand) {
+ t.Fatalf("xai/grok-code-fast-1 bands = %+v, want %+v", grok.Bands, wantGrokBand)
+ }
+
+ // DeepSeek publishes its cache price only as input_cost_per_token_cache_hit, and a zero
+ // cache-write price is recorded as unpublished rather than as free.
+ ds, _ := cat.Rates("deepseek/deepseek-chat")
+ if ds.RateSet != (pricing.RateSet{Input: 280_000, Output: 420_000, CacheRead: 28_000}) {
+ t.Fatalf("deepseek/deepseek-chat = %+v", ds.RateSet)
+ }
+ glm, _ := cat.Rates("zai/glm-4.6")
+ if glm.CacheWrite != 0 || glm.CacheRead != 110_000 {
+ t.Fatalf("zai/glm-4.6 = %+v", glm.RateSet)
+ }
+
+ // The one inexact value is rounded half up and reported, not silently changed.
+ wantRounded := []Rounding{{Key: "mistral/devstral-medium-latest", Field: "input_cost_per_token", Value: "4.0000004e-07", Rounded: 400_000}}
+ if !reflect.DeepEqual(rep.Rounded, wantRounded) {
+ t.Fatalf("rounded = %+v, want %+v", rep.Rounded, wantRounded)
+ }
+ if rep.Kept != len(wantKeys) {
+ t.Fatalf("report kept %d, want %d", rep.Kept, len(wantKeys))
+ }
+}
+
+func TestPerMillionMicrodollarsIsExact(t *testing.T) {
+ cases := []struct {
+ in string
+ want int64
+ exact bool
+ ok bool
+ comment string
+ }{
+ {"3e-06", 3_000_000, true, true, "float64 3e-06*1e12 is 2999999.9999999995"},
+ {"1.5e-05", 15_000_000, true, true, ""},
+ {"6.712e-07", 671_200, true, true, ""},
+ {"2.8e-08", 28_000, true, true, ""},
+ {"0.000003", 3_000_000, true, true, "plain decimal"},
+ {"0", 0, true, true, ""},
+ {"1.5e-12", 2, false, true, "1.5 rounds half up"},
+ {"2.5e-12", 3, false, true, "2.5 rounds half up, not to even"},
+ {"1.49e-12", 1, false, true, ""},
+ {"-1e-06", 0, false, false, "negative"},
+ }
+ for _, c := range cases {
+ v, _, exact, ok := perMillionMicrodollars(json.Number(c.in))
+ if v != c.want || exact != c.exact || ok != c.ok {
+ t.Errorf("%s: got (%d, exact=%v, ok=%v), want (%d, %v, %v) %s", c.in, v, exact, ok, c.want, c.exact, c.ok, c.comment)
+ }
+ }
+}
diff --git a/cli/beacon/internal/pricing/internal/gen/main.go b/cli/beacon/internal/pricing/internal/gen/main.go
new file mode 100644
index 00000000..5ff2d475
--- /dev/null
+++ b/cli/beacon/internal/pricing/internal/gen/main.go
@@ -0,0 +1,121 @@
+// Command gen regenerates cli/beacon/internal/pricing/catalog.json from LiteLLM's published
+// price list (https://github.com/BerriAI/litellm, MIT License).
+//
+// It is run by hand when prices need refreshing, from cli/beacon:
+//
+// go run ./internal/pricing/internal/gen
+//
+// With no -src it resolves the head of LiteLLM's main branch with `git ls-remote`, downloads
+// the list at that exact commit, and records the commit in the catalog, so the file says
+// precisely which upstream revision it reflects. -src reads a local copy instead (pass -commit
+// to record where it came from). Nothing here runs during a build or a test, and the beacon
+// binary never fetches prices: the output is embedded.
+//
+// The output is deterministic for a given input and dates: models are sorted, one per line, so
+// a regeneration diff shows exactly which prices moved.
+package main
+
+import (
+ "bytes"
+ "context"
+ "errors"
+ "flag"
+ "fmt"
+ "io"
+ "net/http"
+ "os"
+ "os/exec"
+ "strings"
+ "time"
+)
+
+const (
+ upstreamRepo = "https://github.com/BerriAI/litellm"
+ upstreamPath = "model_prices_and_context_window.json"
+ upstreamURL = "https://raw.githubusercontent.com/BerriAI/litellm/main/" + upstreamPath
+)
+
+func main() {
+ src := flag.String("src", "", "local copy of "+upstreamPath+" (default: download it at the head of LiteLLM's main branch)")
+ commit := flag.String("commit", "", "upstream commit the -src copy was taken from, recorded in the catalog")
+ out := flag.String("out", "internal/pricing/catalog.json", "catalog file to write")
+ fetched := flag.String("fetched", "", "date the list was read, YYYY-MM-DD (default: today, UTC)")
+ generated := flag.String("generated", "", "generation date, YYYY-MM-DD (default: today, UTC)")
+ strict := flag.Bool("strict", false, "fail if any rate does not convert exactly to integer microdollars per million tokens")
+ flag.Parse()
+
+ today := time.Now().UTC().Format("2006-01-02")
+ if *fetched == "" {
+ *fetched = today
+ }
+ if *generated == "" {
+ *generated = today
+ }
+
+ raw, sha, err := readUpstream(*src, *commit)
+ if err != nil {
+ fatal(err)
+ }
+ data, rep, err := generate(raw, sourceInfo(sha, *fetched), *generated)
+ if err != nil {
+ fatal(err)
+ }
+ rep.print(os.Stderr)
+ if *strict && len(rep.Rounded) > 0 {
+ fatal(fmt.Errorf("%d rate(s) were rounded; see above", len(rep.Rounded)))
+ }
+ if err := os.WriteFile(*out, data, 0o644); err != nil {
+ fatal(err)
+ }
+ fmt.Fprintf(os.Stderr, "wrote %s (%d bytes, %d models)\n", *out, len(data), rep.Kept)
+}
+
+func readUpstream(src, commit string) ([]byte, string, error) {
+ if src != "" {
+ data, err := os.ReadFile(src)
+ return data, commit, err
+ }
+ ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
+ defer cancel()
+ if commit == "" {
+ resolved, err := resolveHead(ctx)
+ if err != nil {
+ return nil, "", err
+ }
+ commit = resolved
+ }
+ url := "https://raw.githubusercontent.com/BerriAI/litellm/" + commit + "/" + upstreamPath
+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
+ if err != nil {
+ return nil, "", err
+ }
+ resp, err := http.DefaultClient.Do(req)
+ if err != nil {
+ return nil, "", err
+ }
+ defer resp.Body.Close()
+ if resp.StatusCode != http.StatusOK {
+ return nil, "", fmt.Errorf("GET %s: %s", url, resp.Status)
+ }
+ data, err := io.ReadAll(resp.Body)
+ return data, commit, err
+}
+
+// resolveHead asks git for the commit at the head of LiteLLM's main branch. git rather than the
+// GitHub API because it needs no token and is not rate limited for this.
+func resolveHead(ctx context.Context) (string, error) {
+ out, err := exec.CommandContext(ctx, "git", "ls-remote", upstreamRepo, "refs/heads/main").Output()
+ if err != nil {
+ return "", fmt.Errorf("resolve %s main: %w", upstreamRepo, err)
+ }
+ fields := strings.Fields(string(bytes.TrimSpace(out)))
+ if len(fields) == 0 || len(fields[0]) != 40 {
+ return "", errors.New("resolve LiteLLM main: unexpected git ls-remote output")
+ }
+ return fields[0], nil
+}
+
+func fatal(err error) {
+ fmt.Fprintln(os.Stderr, "gen:", err)
+ os.Exit(1)
+}
diff --git a/cli/beacon/internal/pricing/internal/gen/testdata/catalog.golden.json b/cli/beacon/internal/pricing/internal/gen/testdata/catalog.golden.json
new file mode 100644
index 00000000..feba2df5
--- /dev/null
+++ b/cli/beacon/internal/pricing/internal/gen/testdata/catalog.golden.json
@@ -0,0 +1,18 @@
+{
+ "schema_version": 1,
+ "source": {"name":"LiteLLM model_prices_and_context_window.json","license":"MIT","url":"https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json","commit":"0123456789abcdef0123456789abcdef01234567","fetched_at":"2026-10-01"},
+ "generated_at": "2026-10-02",
+ "unit": "microdollars per million tokens",
+ "models": {
+ "claude-sonnet-4-5": {"provider":"anthropic","input":3000000,"output":15000000,"cache_read":300000,"cache_write":3750000,"cache_write_1h":6000000,"bands":[{"above_tokens":200000,"input":6000000,"output":22500000,"cache_read":600000,"cache_write":7500000,"cache_write_1h":12000000}]},
+ "deepseek/deepseek-chat": {"provider":"deepseek","input":280000,"output":420000,"cache_read":28000},
+ "gemini/gemini-2.5-pro": {"provider":"gemini","input":1250000,"output":10000000,"cache_read":125000,"bands":[{"above_tokens":200000,"input":2500000,"output":15000000,"cache_read":250000}]},
+ "gpt-5-codex": {"provider":"openai","input":1250000,"output":10000000,"cache_read":125000},
+ "gpt-5.4": {"provider":"openai","input":2500000,"output":15000000,"cache_read":250000,"bands":[{"above_tokens":272000,"input":5000000,"output":22500000,"cache_read":500000}]},
+ "mistral/devstral-medium-latest": {"provider":"mistral","input":400000,"output":2000000},
+ "openrouter/moonshotai/kimi-k2": {"provider":"openrouter","input":570000,"output":2300000},
+ "us.anthropic.claude-sonnet-4-5-20250929-v1:0": {"provider":"bedrock_converse","input":3300000,"output":16500000,"cache_read":330000,"cache_write":4125000},
+ "xai/grok-code-fast-1": {"provider":"xai","input":1000000,"output":2000000,"cache_read":200000,"bands":[{"above_tokens":200000,"input":2000000,"output":4000000,"cache_read":200000}]},
+ "zai/glm-4.6": {"provider":"zai","input":600000,"output":2200000,"cache_read":110000}
+ }
+}
diff --git a/cli/beacon/internal/pricing/internal/gen/testdata/litellm_fixture.json b/cli/beacon/internal/pricing/internal/gen/testdata/litellm_fixture.json
new file mode 100644
index 00000000..15d22d66
--- /dev/null
+++ b/cli/beacon/internal/pricing/internal/gen/testdata/litellm_fixture.json
@@ -0,0 +1,174 @@
+{
+ "sample_spec": {
+ "input_cost_per_token": 0.0,
+ "litellm_provider": "one of https://docs.litellm.ai/docs/providers",
+ "mode": "one of: chat, embedding, completion, image_generation",
+ "output_cost_per_token": 0.0
+ },
+ "claude-sonnet-4-5": {
+ "cache_creation_input_token_cost": 3.75e-06,
+ "cache_creation_input_token_cost_above_1hr": 6e-06,
+ "cache_creation_input_token_cost_above_1hr_above_200k_tokens": 1.2e-05,
+ "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06,
+ "cache_creation_input_token_cost_batches": 1.875e-06,
+ "cache_read_input_token_cost": 3e-07,
+ "cache_read_input_token_cost_above_200k_tokens": 6e-07,
+ "input_cost_per_token": 3e-06,
+ "input_cost_per_token_above_200k_tokens": 6e-06,
+ "input_cost_per_token_batches": 1.5e-06,
+ "litellm_provider": "anthropic",
+ "max_input_tokens": 200000,
+ "mode": "chat",
+ "output_cost_per_token": 1.5e-05,
+ "output_cost_per_token_above_200k_tokens": 2.25e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_prompt_caching": true
+ },
+ "gpt-5.4": {
+ "cache_read_input_token_cost": 2.5e-07,
+ "cache_read_input_token_cost_above_272k_tokens": 5e-07,
+ "cache_read_input_token_cost_flex": 1.3e-07,
+ "cache_read_input_token_cost_priority": 5e-07,
+ "input_cost_per_token": 2.5e-06,
+ "input_cost_per_token_above_272k_tokens": 5e-06,
+ "input_cost_per_token_above_272k_tokens_priority": 1e-05,
+ "input_cost_per_token_batches": 1.25e-06,
+ "input_cost_per_token_flex": 1.25e-06,
+ "input_cost_per_token_priority": 5e-06,
+ "litellm_provider": "openai",
+ "mode": "chat",
+ "output_cost_per_token": 1.5e-05,
+ "output_cost_per_token_above_272k_tokens": 2.25e-05,
+ "output_cost_per_token_priority": 3e-05
+ },
+ "gpt-5-codex": {
+ "cache_read_input_token_cost": 1.25e-07,
+ "input_cost_per_token": 1.25e-06,
+ "litellm_provider": "openai",
+ "mode": "responses",
+ "output_cost_per_token": 1e-05
+ },
+ "ft:gpt-4o-2024-08-06": {
+ "input_cost_per_token": 3.75e-06,
+ "litellm_provider": "openai",
+ "mode": "chat",
+ "output_cost_per_token": 1.5e-05
+ },
+ "gpt-4o-audio-preview-2024-12-17": {
+ "input_cost_per_token": 2.5e-06,
+ "litellm_provider": "openai",
+ "mode": "chat",
+ "output_cost_per_token": 1e-05
+ },
+ "text-embedding-3-small": {
+ "input_cost_per_token": 2e-08,
+ "litellm_provider": "openai",
+ "mode": "embedding",
+ "output_cost_per_token": 0.0
+ },
+ "gemini/gemini-2.5-pro": {
+ "cache_read_input_token_cost": 1.25e-07,
+ "cache_read_input_token_cost_above_200k_tokens": 2.5e-07,
+ "input_cost_per_token": 1.25e-06,
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "litellm_provider": "gemini",
+ "mode": "chat",
+ "output_cost_per_token": 1e-05,
+ "output_cost_per_token_above_200k_tokens": 1.5e-05
+ },
+ "us.anthropic.claude-sonnet-4-5-20250929-v1:0": {
+ "cache_creation_input_token_cost": 4.125e-06,
+ "cache_read_input_token_cost": 3.3e-07,
+ "input_cost_per_token": 3.3e-06,
+ "litellm_provider": "bedrock_converse",
+ "mode": "chat",
+ "output_cost_per_token": 1.65e-05
+ },
+ "bedrock/us-east-1/anthropic.claude-v2:1": {
+ "input_cost_per_token": 8e-06,
+ "litellm_provider": "bedrock",
+ "mode": "chat",
+ "output_cost_per_token": 2.4e-05
+ },
+ "deepseek.v3.2": {
+ "input_cost_per_token": 6.2e-07,
+ "litellm_provider": "bedrock_converse",
+ "mode": "chat",
+ "output_cost_per_token": 1.85e-06
+ },
+ "github_copilot/gpt-5.1": {
+ "input_cost_per_token": 0.0,
+ "litellm_provider": "github_copilot",
+ "mode": "chat",
+ "output_cost_per_token": 0.0
+ },
+ "together_ai/zai-org/GLM-4.6": {
+ "input_cost_per_token": 6e-07,
+ "litellm_provider": "together_ai",
+ "mode": "chat",
+ "output_cost_per_token": 2.2e-06
+ },
+ "deepseek/deepseek-chat": {
+ "cache_creation_input_token_cost": 0.0,
+ "input_cost_per_token": 2.8e-07,
+ "input_cost_per_token_cache_hit": 2.8e-08,
+ "litellm_provider": "deepseek",
+ "mode": "chat",
+ "output_cost_per_token": 4.2e-07
+ },
+ "xai/grok-code-fast-1": {
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1e-06,
+ "input_cost_per_token_above_200k_tokens": 2e-06,
+ "litellm_provider": "xai",
+ "mode": "chat",
+ "output_cost_per_token": 2e-06,
+ "output_cost_per_token_above_200k_tokens": 4e-06
+ },
+ "zai/glm-4.6": {
+ "cache_creation_input_token_cost": 0,
+ "cache_read_input_token_cost": 1.1e-07,
+ "input_cost_per_token": 6e-07,
+ "litellm_provider": "zai",
+ "mode": "chat",
+ "output_cost_per_token": 2.2e-06
+ },
+ "dashscope/qwen3-coder-plus": {
+ "litellm_provider": "dashscope",
+ "mode": "chat"
+ },
+ "mistral/devstral-medium-latest": {
+ "input_cost_per_token": 4.0000004e-07,
+ "litellm_provider": "mistral",
+ "mode": "chat",
+ "output_cost_per_token": 2e-06
+ },
+ "openrouter/anthropic/claude-sonnet-4.5": {
+ "input_cost_per_token": 3e-06,
+ "litellm_provider": "openrouter",
+ "mode": "chat",
+ "output_cost_per_token": 1.5e-05
+ },
+ "openrouter/moonshotai/kimi-k2": {
+ "input_cost_per_token": 5.7e-07,
+ "litellm_provider": "openrouter",
+ "mode": "chat",
+ "output_cost_per_token": 2.3e-06
+ },
+ "openrouter/moonshotai/kimi-k2:free": {
+ "input_cost_per_token": 0.0,
+ "litellm_provider": "openrouter",
+ "mode": "chat",
+ "output_cost_per_token": 0.0
+ },
+ "openrouter/meta-llama/llama-3.3-70b-instruct": {
+ "input_cost_per_token": 1.3e-07,
+ "litellm_provider": "openrouter",
+ "mode": "chat",
+ "output_cost_per_token": 3.9e-07
+ }
+}
diff --git a/cli/beacon/internal/pricing/lookup.go b/cli/beacon/internal/pricing/lookup.go
new file mode 100644
index 00000000..884057e5
--- /dev/null
+++ b/cli/beacon/internal/pricing/lookup.go
@@ -0,0 +1,224 @@
+package pricing
+
+import (
+ "reflect"
+ "regexp"
+ "strings"
+
+ "github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve"
+)
+
+// Match names the spelling rung at which a model matched a catalog key.
+type Match string
+
+const (
+ // MatchExact: the model string, trimmed, is a catalog key.
+ MatchExact Match = "exact"
+ // MatchCanonical: equal after Beacon's own NormalizeModelName on both sides, which
+ // lowercases and drops a "/"-separated provider prefix (anthropic/, openai/, gemini/,
+ // vertex_ai/, openrouter/google/, ...).
+ MatchCanonical Match = "canonical"
+ // MatchDottedVersion: equal after also writing a dot between two digits as a dash, so
+ // Copilot's claude-sonnet-4.6 meets Anthropic's claude-sonnet-4-6.
+ MatchDottedVersion Match = "dotted_version"
+ // MatchProviderPrefix: equal after also dropping Bedrock's dotted route prefixes (a
+ // us./eu./apac./au./jp./global./us-gov. inference-profile region, then anthropic.) and
+ // the -v1:0 model-version suffix they come with.
+ MatchProviderPrefix Match = "provider_prefix"
+)
+
+// Reductions Lookup may apply to the model string, in this order, before retrying every rung.
+const (
+ // StrippedContextWindow: a trailing context-window marker such as Claude Code's [1m].
+ // The marker names the context size the client asked for; the price of a long prompt is
+ // the model's long-context band, which Cost applies from the token counts.
+ StrippedContextWindow = "context_window"
+ // StrippedDateSnapshot: a trailing snapshot date (-20250929, @20250929, -2025-08-07),
+ // priced as the undated alias.
+ StrippedDateSnapshot = "date_snapshot"
+ // StrippedEffortSuffix: a trailing reasoning-effort label (-minimal, -low, -medium,
+ // -high, -xhigh, -thinking) that some runtimes append to the model name. Effort changes
+ // how many tokens are spent, not what each costs.
+ StrippedEffortSuffix = "effort_suffix"
+)
+
+// Resolution is the outcome of Lookup.
+type Resolution struct {
+ // Model is the string that was looked up.
+ Model string
+ // Key is the catalog key that priced it, and Rates its entry. Empty when unpriced.
+ Key string
+ Rates Rates
+ // Match is the spelling rung that matched; Stripped lists the reductions that were
+ // needed first, in the order applied. Together they say how loose the match was.
+ Match Match
+ Stripped []string
+ // Candidates is set when the model was left unpriced because several catalog keys
+ // matched at the same rung with different rates.
+ Candidates []string
+}
+
+type rung int
+
+const (
+ rungExact rung = iota
+ rungCanonical
+ rungDotted
+ rungProvider
+ numRungs
+)
+
+var rungMatch = [numRungs]Match{MatchExact, MatchCanonical, MatchDottedVersion, MatchProviderPrefix}
+
+// spell writes s the way rung r compares it. Each rung includes the ones before it. Spelling
+// rungs are applied to the model and the catalog key alike: they are different ways of writing
+// one name. The reductions in Lookup are applied only to the model, because they turn a
+// specific name into a more general one and the reverse would be invention.
+func spell(r rung, s string) string {
+ s = strings.TrimSpace(s)
+ if r == rungExact {
+ return s
+ }
+ s = asymptoteobserve.NormalizeModelName(s)
+ if r >= rungProvider {
+ s = stripRoutePrefix(s)
+ }
+ if r >= rungDotted {
+ s = foldVersionDots(s)
+ }
+ return s
+}
+
+// bedrockRegions are the inference-profile prefixes Bedrock puts in front of a model id.
+var bedrockRegions = []string{"us-gov.", "global.", "apac.", "us.", "eu.", "au.", "jp."}
+
+var bedrockVersionSuffix = regexp.MustCompile(`-v\d+(:\d+)?$`)
+
+// stripRoutePrefix removes a Bedrock route from an already-canonical name:
+// us.anthropic.claude-sonnet-4-5-20250929-v1:0 becomes claude-sonnet-4-5-20250929. Only
+// Anthropic's vendor prefix is removed, because it is the only Bedrock family the catalog keeps
+// and the others (deepseek.v3.2) do not leave a model name behind.
+func stripRoutePrefix(s string) string {
+ rest := s
+ for _, region := range bedrockRegions {
+ if strings.HasPrefix(rest, region) {
+ rest = rest[len(region):]
+ break
+ }
+ }
+ if !strings.HasPrefix(rest, "anthropic.") {
+ return s
+ }
+ rest = strings.TrimPrefix(rest, "anthropic.")
+ return bedrockVersionSuffix.ReplaceAllString(rest, "")
+}
+
+// foldVersionDots rewrites a dot between two digits as a dash. Only between digits, so a
+// dotted route prefix survives for the rung that understands it.
+func foldVersionDots(s string) string {
+ if !strings.Contains(s, ".") {
+ return s
+ }
+ b := []byte(s)
+ for i := 1; i+1 < len(b); i++ {
+ if b[i] == '.' && isDigit(s[i-1]) && isDigit(s[i+1]) {
+ b[i] = '-'
+ }
+ }
+ return string(b)
+}
+
+func isDigit(c byte) bool { return c >= '0' && c <= '9' }
+
+var reductions = []struct {
+ name string
+ re *regexp.Regexp
+}{
+ {StrippedContextWindow, regexp.MustCompile(`\[\d+[km]\]$`)},
+ {StrippedDateSnapshot, regexp.MustCompile(`([-@]\d{8}|-\d{4}-\d{2}-\d{2})$`)},
+ {StrippedEffortSuffix, regexp.MustCompile(`-(minimal|low|medium|high|xhigh|thinking)$`)},
+}
+
+// Lookup resolves what a runtime called a model to one catalog entry.
+//
+// The model is tried at four spelling rungs -- exact, canonical, dotted version, provider
+// prefix (see the Match constants) -- and the first rung with any match decides. If that fails,
+// trailing decorations are stripped one at a time (context-window marker, then date snapshot,
+// then effort suffix) and all four rungs are tried again after each. There is no substring,
+// prefix or edit-distance matching: claude-4.5-sonnet is not claude-sonnet-4-5, and a guess
+// that prices the wrong model is worse than no price.
+//
+// When several catalog keys match at the deciding rung, they must agree on every rate (as
+// claude-opus-4-6 does on Anthropic and on Vertex AI); otherwise the model is left unpriced and
+// Resolution.Candidates names the disagreeing keys. Lookup does not fall through to a looser
+// rung after a tie, since a looser rung can only match more keys.
+func (c *Catalog) Lookup(model string) (Resolution, bool) {
+ res := Resolution{Model: model}
+ query := strings.TrimSpace(model)
+ if query == "" {
+ return res, false
+ }
+ if priced, decided := c.matchSpellings(query, &res); decided {
+ return res, priced
+ }
+ current := asymptoteobserve.NormalizeModelName(query)
+ for _, red := range reductions {
+ reduced := red.re.ReplaceAllString(current, "")
+ if reduced == current || reduced == "" {
+ continue
+ }
+ current = reduced
+ res.Stripped = append(res.Stripped, red.name)
+ if priced, decided := c.matchSpellings(current, &res); decided {
+ return res, priced
+ }
+ }
+ res.Stripped = nil
+ return res, false
+}
+
+// matchSpellings runs the spelling rungs for one query. decided reports that some rung
+// matched; priced reports that its candidates agreed on a price.
+func (c *Catalog) matchSpellings(query string, res *Resolution) (priced, decided bool) {
+ for r := rung(0); r < numRungs; r++ {
+ spelled := spell(r, query)
+ keys := c.index[r][spelled]
+ if len(keys) == 0 {
+ continue
+ }
+ first := c.file.Models[keys[0]]
+ for _, k := range keys[1:] {
+ if !samePrice(first, c.file.Models[k]) {
+ res.Candidates = append([]string(nil), keys...)
+ res.Match = rungMatch[r]
+ return false, true
+ }
+ }
+ res.Key = preferredKey(keys, query)
+ res.Rates = c.file.Models[res.Key]
+ res.Match = rungMatch[r]
+ return true, true
+ }
+ return false, false
+}
+
+// preferredKey picks which of several equally priced keys to report: the one spelled exactly
+// like the query if there is one, else the shortest (the bare model id over a routed copy),
+// else the first in sort order. keys is already sorted.
+func preferredKey(keys []string, query string) string {
+ canonical := asymptoteobserve.NormalizeModelName(query)
+ best := keys[0]
+ for _, k := range keys {
+ if k == query || k == canonical {
+ return k
+ }
+ if len(k) < len(best) {
+ best = k
+ }
+ }
+ return best
+}
+
+func samePrice(a, b Rates) bool {
+ return a.RateSet == b.RateSet && reflect.DeepEqual(a.Bands, b.Bands)
+}
diff --git a/cli/beacon/internal/pricing/lookup_test.go b/cli/beacon/internal/pricing/lookup_test.go
new file mode 100644
index 00000000..c23cfe30
--- /dev/null
+++ b/cli/beacon/internal/pricing/lookup_test.go
@@ -0,0 +1,241 @@
+package pricing
+
+import (
+ "encoding/json"
+ "reflect"
+ "testing"
+)
+
+// Model strings as Beacon records them, drawn from the runtimes' own fixtures across the repo
+// (Claude Code OTLP and session files, Codex, Copilot, OpenCode, Pi, DeepSeek Harness, Cursor,
+// the collector exporter) plus the spellings the runtimes are known to emit. The expected keys
+// are the embedded catalog's, so a regeneration that moves one is a reviewable test change.
+func TestLookupRealModelStrings(t *testing.T) {
+ cases := []struct {
+ model string
+ key string // "" = must stay unpriced
+ match Match
+ stripped []string
+ }{
+ // Claude Code reports Anthropic's ids, with a snapshot date or a [1m] marker.
+ {"claude-opus-4-6", "claude-opus-4-6", MatchExact, nil},
+ {"claude-opus-4-6[1m]", "claude-opus-4-6", MatchExact, []string{StrippedContextWindow}},
+ {"claude-opus-5[1m]", "claude-opus-5", MatchExact, []string{StrippedContextWindow}},
+ {"claude-sonnet-4-5", "claude-sonnet-4-5", MatchExact, nil},
+ {"claude-sonnet-4-5-20250929", "claude-sonnet-4-5-20250929", MatchExact, nil},
+ {"claude-haiku-4-5", "claude-haiku-4-5", MatchExact, nil},
+ {"claude-opus-4-7", "claude-opus-4-7", MatchExact, nil},
+ {"claude-sonnet-5-5", "claude-sonnet-5-5", MatchExact, nil},
+ {"claude-fable-5-1", "claude-fable-5-1", MatchExact, nil},
+ // A snapshot the list does not carry is priced as its undated alias.
+ {"claude-sonnet-4-6-20260101", "claude-sonnet-4-6", MatchExact, []string{StrippedDateSnapshot}},
+ // Older snapshots Anthropic's own list has retired survive as Bedrock model ids.
+ {"claude-sonnet-4-20250514", "anthropic.claude-sonnet-4-20250514-v1:0", MatchProviderPrefix, nil},
+ {"claude-opus-4-1-20250805", "anthropic.claude-opus-4-1-20250805-v1:0", MatchProviderPrefix, nil},
+ // Claude Code on Bedrock reports the inference profile, which has its own price.
+ {"us.anthropic.claude-sonnet-4-5-20250929-v1:0", "us.anthropic.claude-sonnet-4-5-20250929-v1:0", MatchExact, nil},
+ {"global.anthropic.claude-opus-4-6-v1", "global.anthropic.claude-opus-4-6-v1", MatchExact, nil},
+ // Copilot and OpenRouter-backed runtimes dot the version.
+ {"claude-sonnet-4.6", "claude-sonnet-4-6", MatchDottedVersion, nil},
+ {"claude-opus-4.6", "claude-opus-4-6", MatchDottedVersion, nil},
+ {"anthropic/claude-opus-4.6", "claude-opus-4-6", MatchDottedVersion, nil},
+ // Provider prefixes and capitalization from gateways.
+ {"Anthropic/Claude-Sonnet-4-5", "claude-sonnet-4-5", MatchCanonical, nil},
+ {"openrouter/anthropic/claude-sonnet-4-5", "claude-sonnet-4-5", MatchCanonical, nil},
+ // Codex and OpenAI-backed runtimes.
+ {"gpt-5.4", "gpt-5.4", MatchExact, nil},
+ {"gpt-5", "gpt-5", MatchExact, nil},
+ {"gpt-5-codex", "gpt-5-codex", MatchExact, nil},
+ {"gpt-5.1-codex-max", "gpt-5.1-codex-max", MatchExact, nil},
+ {"gpt-5.3-codex", "gpt-5.3-codex", MatchExact, nil},
+ {"gpt-5.5", "gpt-5.5", MatchExact, nil},
+ {"gpt-5.6-sol", "gpt-5.6-sol", MatchExact, nil},
+ {"gpt-4o", "gpt-4o", MatchExact, nil},
+ {"gpt-4o-mini", "gpt-4o-mini", MatchExact, nil},
+ {"gpt-4o-2024-08-06", "gpt-4o-2024-08-06", MatchExact, nil},
+ {"gpt-4.1", "gpt-4.1", MatchExact, nil},
+ {"o3", "o3", MatchExact, nil},
+ {"o4-mini", "o4-mini", MatchExact, nil},
+ {"openai/gpt-5", "gpt-5", MatchCanonical, nil},
+ // Effort appended to the model name (OpenCode variants, Cursor's thinking models).
+ {"gpt-5.5-medium", "gpt-5.5", MatchExact, []string{StrippedEffortSuffix}},
+ {"gpt-5.5-high", "gpt-5.5", MatchExact, []string{StrippedEffortSuffix}},
+ {"gpt-5-codex-high", "gpt-5-codex", MatchExact, []string{StrippedEffortSuffix}},
+ {"claude-sonnet-4-5-thinking", "claude-sonnet-4-5", MatchExact, []string{StrippedEffortSuffix}},
+ // Gemini CLI.
+ {"gemini-2.5-pro", "gemini-2.5-pro", MatchExact, nil},
+ {"gemini-3.1-pro-preview", "gemini-3.1-pro-preview", MatchExact, nil},
+ {"gemini-3-pro-preview", "vertex_ai/gemini-3-pro-preview", MatchCanonical, nil},
+ // The other vendors' own APIs, whose upstream keys carry a provider prefix.
+ {"deepseek-chat", "deepseek-chat", MatchExact, nil},
+ {"deepseek-reasoner", "deepseek-reasoner", MatchExact, nil},
+ {"glm-4.6", "zai/glm-4.6", MatchCanonical, nil},
+ {"grok-code-fast-1", "xai/grok-code-fast-1", MatchCanonical, nil},
+ {"kimi-k3", "moonshot/kimi-k3", MatchCanonical, nil},
+ {"moonshotai/kimi-k3", "moonshot/kimi-k3", MatchCanonical, nil},
+ {"kimi-k2.5", "moonshot/kimi-k2.5", MatchCanonical, nil},
+ {"devstral-medium-latest", "mistral/devstral-medium-latest", MatchCanonical, nil},
+ // Retired from the vendor's list, priced from OpenRouter's.
+ {"kimi-k2", "openrouter/moonshotai/kimi-k2", MatchCanonical, nil},
+ {"claude-sonnet-4", "openrouter/anthropic/claude-sonnet-4", MatchCanonical, nil},
+
+ // Unpriced: names that are not models, and names that resemble a model without
+ // being one. No substring or fuzzy match may price any of these.
+ {"<synthetic>", "", "", nil},
+ {"auto", "", "", nil},
+ {"unknown", "", "", nil},
+ {"", "", "", nil},
+ {"grok-build", "", "", nil},
+ {"muse-spark-1.3", "", "", nil},
+ {"claude-4.5-sonnet", "", "", nil},
+ {"claude-sonnet", "", "", nil},
+ {"gpt-5.5-turbo", "", "", nil},
+ {"fake/model", "", "", nil},
+ }
+ for _, c := range cases {
+ res, ok := Lookup(c.model)
+ if c.key == "" {
+ if ok {
+ t.Errorf("Lookup(%q) priced it as %q (%s); want unpriced", c.model, res.Key, res.Match)
+ }
+ continue
+ }
+ if !ok {
+ t.Errorf("Lookup(%q) unpriced (candidates %v); want %q", c.model, res.Candidates, c.key)
+ continue
+ }
+ if res.Key != c.key || res.Match != c.match || !reflect.DeepEqual(res.Stripped, c.stripped) {
+ t.Errorf("Lookup(%q) = key %q match %s stripped %v; want %q %s %v",
+ c.model, res.Key, res.Match, res.Stripped, c.key, c.match, c.stripped)
+ }
+ if res.Rates.Input <= 0 || res.Rates.Output <= 0 {
+ t.Errorf("Lookup(%q) returned rates %+v", c.model, res.Rates)
+ }
+ }
+}
+
+func testCatalog(t *testing.T, models map[string]Rates) *Catalog {
+ t.Helper()
+ data, err := json.Marshal(CatalogFile{
+ SchemaVersion: SchemaVersion,
+ Source: SourceInfo{Name: "test", License: "MIT", URL: "https://example.invalid", FetchedAt: "2026-01-01"},
+ GeneratedAt: "2026-01-01",
+ Unit: RateUnit,
+ Models: models,
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ c, err := LoadCatalog(data)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return c
+}
+
+func flat(provider string, in, out int64) Rates {
+ return Rates{Provider: provider, RateSet: RateSet{Input: in, Output: out}}
+}
+
+func TestLookupTieWithDifferentPricesIsUnpriced(t *testing.T) {
+ c := testCatalog(t, map[string]Rates{
+ "vendor-a/model-x": flat("a", 1_000_000, 2_000_000),
+ "vendor-b/model-x": flat("b", 3_000_000, 4_000_000),
+ })
+ res, ok := c.Lookup("model-x")
+ if ok {
+ t.Fatalf("priced %q despite a price disagreement", res.Key)
+ }
+ if want := []string{"vendor-a/model-x", "vendor-b/model-x"}; !reflect.DeepEqual(res.Candidates, want) || res.Match != MatchCanonical {
+ t.Fatalf("candidates %v at %s, want %v at canonical", res.Candidates, res.Match, want)
+ }
+ // A tie is final: stripping a suffix must not go looking for a looser match that
+ // happens to be unique.
+ c = testCatalog(t, map[string]Rates{
+ "vendor-a/model-x-high": flat("a", 1_000_000, 2_000_000),
+ "vendor-b/model-x-high": flat("b", 3_000_000, 4_000_000),
+ "model-x": flat("c", 5_000_000, 6_000_000),
+ })
+ if res, ok := c.Lookup("model-x-high"); ok {
+ t.Fatalf("tie fell through to %q", res.Key)
+ }
+}
+
+func TestLookupTieWithTheSamePriceIsPriced(t *testing.T) {
+ c := testCatalog(t, map[string]Rates{
+ "claude-opus-9": flat("anthropic", 5_000_000, 25_000_000),
+ "vertex_ai/claude-opus-9": flat("vertex_ai-anthropic_models", 5_000_000, 25_000_000),
+ })
+ res, ok := c.Lookup("Claude-Opus-9")
+ if !ok || res.Key != "claude-opus-9" || res.Match != MatchCanonical {
+ t.Fatalf("got %+v ok=%v, want claude-opus-9 at canonical", res, ok)
+ }
+}
+
+func TestLookupPrefersTheLeastLooseRung(t *testing.T) {
+ c := testCatalog(t, map[string]Rates{
+ "model-1.5": flat("x", 1_000_000, 1_000_000),
+ "model-1-5": flat("y", 2_000_000, 2_000_000),
+ "model-1.5-pro": flat("x", 3_000_000, 3_000_000),
+ "model-1.5-thing": flat("x", 4_000_000, 4_000_000),
+ })
+ // Exact beats the dotted-version rung that would tie the first two.
+ if res, ok := c.Lookup("model-1.5"); !ok || res.Key != "model-1.5" || res.Match != MatchExact {
+ t.Fatalf("model-1.5 = %+v ok=%v", res, ok)
+ }
+ // So does the canonical rung, which does not fold the dot.
+ if res, ok := c.Lookup("MODEL-1.5"); !ok || res.Key != "model-1.5" || res.Match != MatchCanonical {
+ t.Fatalf("MODEL-1.5 = %+v ok=%v", res, ok)
+ }
+ if res, ok := c.Lookup("model-1_5"); ok {
+ t.Fatalf("model-1_5 priced as %q; underscores are not a spelling rung", res.Key)
+ }
+ // No prefix matching: model-1.5-pro is not model-1.5, and model-1 is neither.
+ if res, ok := c.Lookup("model-1"); ok {
+ t.Fatalf("model-1 priced as %q", res.Key)
+ }
+ if res, ok := c.Lookup("model-1.5-pro-max"); ok {
+ t.Fatalf("model-1.5-pro-max priced as %q", res.Key)
+ }
+}
+
+func TestLookupBedrockRoutes(t *testing.T) {
+ c := testCatalog(t, map[string]Rates{
+ "claude-sonnet-9": flat("anthropic", 3_000_000, 15_000_000),
+ "us.anthropic.claude-sonnet-9-v1:0": flat("bedrock_converse", 3_300_000, 16_500_000),
+ "anthropic.claude-haiku-9-20990101-v1:0": flat("bedrock_converse", 1_000_000, 5_000_000),
+ })
+ cases := []struct {
+ model, key string
+ match Match
+ }{
+ // The exact inference profile: its own (regional) price.
+ {"us.anthropic.claude-sonnet-9-v1:0", "us.anthropic.claude-sonnet-9-v1:0", MatchExact},
+ {"bedrock/us.anthropic.claude-sonnet-9-v1:0", "us.anthropic.claude-sonnet-9-v1:0", MatchCanonical},
+ // A plain id reaches a Bedrock-only entry through the provider rung.
+ {"claude-haiku-9-20990101", "anthropic.claude-haiku-9-20990101-v1:0", MatchProviderPrefix},
+ // A profile the catalog lacks meets both the Anthropic price and the US profile's at
+ // the provider rung, and they disagree: unpriced rather than either guess.
+ {"eu.anthropic.claude-sonnet-9-v1:0", "", MatchProviderPrefix},
+ {"anthropic.claude-sonnet-9-v2:0", "", MatchProviderPrefix},
+ }
+ for _, tc := range cases {
+ res, ok := c.Lookup(tc.model)
+ if ok != (tc.key != "") || res.Key != tc.key || res.Match != tc.match {
+ t.Errorf("Lookup(%q) = key %q match %s ok=%v candidates %v; want %q %s",
+ tc.model, res.Key, res.Match, ok, res.Candidates, tc.key, tc.match)
+ }
+ }
+}
+
+func TestLookupDoesNotStripTheRealModelName(t *testing.T) {
+ // kimi-k2-thinking and qwen3-32b-thinking are model names that end in an effort word; an
+ // exact entry must win over the reduction.
+ c := testCatalog(t, map[string]Rates{
+ "kimi-k2": flat("x", 1_000_000, 1_000_000),
+ "kimi-k2-thinking": flat("x", 2_000_000, 2_000_000),
+ })
+ if res, ok := c.Lookup("kimi-k2-thinking"); !ok || res.Key != "kimi-k2-thinking" || len(res.Stripped) != 0 {
+ t.Fatalf("kimi-k2-thinking = %+v ok=%v", res, ok)
+ }
+}
diff --git a/cli/beacon/internal/pricing/money.go b/cli/beacon/internal/pricing/money.go
new file mode 100644
index 00000000..f4feb17e
--- /dev/null
+++ b/cli/beacon/internal/pricing/money.go
@@ -0,0 +1,110 @@
+package pricing
+
+import (
+ "math"
+ "math/big"
+ "strconv"
+)
+
+// Microdollars is an amount of US dollars in millionths. Every rate and every estimate is
+// integer microdollars so that summing thousands of per-request estimates cannot drift the way
+// float64 cents do; conversion to a float happens once, for display.
+type Microdollars int64
+
+const microdollarsPerDollar = 1_000_000
+
+// tokensPerRateUnit is the token count a rate is quoted for: rates are microdollars per
+// million tokens.
+const tokensPerRateUnit = 1_000_000
+
+// USD returns the amount in dollars, for JSON output and arithmetic that tolerates a float.
+func (m Microdollars) USD() float64 {
+ return float64(m) / microdollarsPerDollar
+}
+
+// String formats the amount with all six decimal places, without a currency sign: 1.5 dollars
+// is "1.500000". Exact, because it never goes through a float.
+func (m Microdollars) String() string {
+ return m.Format(6)
+}
+
+// Format renders the amount in dollars with the given number of decimal places (0 to 6),
+// rounding half away from zero at the last place shown: Format(2) of 12_345 is "0.01", of
+// 5_000 is "0.01", of 4_999 is "0.00". No currency sign, so a caller can say "~$" or "est."
+// as its report requires.
+func (m Microdollars) Format(places int) string {
+ if places < 0 {
+ places = 0
+ }
+ if places > 6 {
+ places = 6
+ }
+ neg := m < 0
+ // Work in uint64 so math.MinInt64 has a magnitude.
+ var mag uint64
+ if neg {
+ mag = uint64(-(m + 1)) + 1
+ } else {
+ mag = uint64(m)
+ }
+ scale := uint64(1)
+ for i := 0; i < 6-places; i++ {
+ scale *= 10
+ }
+ if scale > 1 {
+ q, r := mag/scale, mag%scale
+ if r >= scale/2 {
+ q++
+ }
+ mag = q
+ }
+ unit := uint64(1)
+ for i := 0; i < places; i++ {
+ unit *= 10
+ }
+ whole, frac := mag/unit, mag%unit
+ s := strconv.FormatUint(whole, 10)
+ if places > 0 {
+ f := strconv.FormatUint(frac, 10)
+ for len(f) < places {
+ f = "0" + f
+ }
+ s += "." + f
+ }
+ if neg && mag != 0 {
+ s = "-" + s
+ }
+ return s
+}
+
+// lineItem accumulates tokens x rate products exactly. A token count near the int64 limit times
+// a rate in the tens of millions overflows 64 bits, so the sum is a big.Int and is divided and
+// rounded once, at the end, rather than per term.
+type lineItem struct {
+ sum big.Int
+}
+
+func (l *lineItem) add(tokens, ratePerMTok int64) {
+ if tokens <= 0 || ratePerMTok <= 0 {
+ return
+ }
+ var t, r big.Int
+ t.SetInt64(tokens)
+ r.SetInt64(ratePerMTok)
+ t.Mul(&t, &r)
+ l.sum.Add(&l.sum, &t)
+}
+
+// total divides by the rate unit, rounding half up, and saturates at the int64 limit. The
+// second result reports saturation so a caller can refuse to print a number that is not real.
+func (l *lineItem) total() (Microdollars, bool) {
+ var q, r big.Int
+ q.QuoRem(&l.sum, big.NewInt(tokensPerRateUnit), &r)
+ if r.Int64()*2 >= tokensPerRateUnit {
+ q.Add(&q, big.NewInt(1))
+ }
+ if !q.IsInt64() {
+ return Microdollars(math.MaxInt64), true
+ }
+ return Microdollars(q.Int64()), false
+}
diff --git a/cli/beacon/internal/pricing/money_test.go b/cli/beacon/internal/pricing/money_test.go
new file mode 100644
index 00000000..4425fdb7
--- /dev/null
+++ b/cli/beacon/internal/pricing/money_test.go
@@ -0,0 +1,40 @@
+package pricing
+
+import (
+ "math"
+ "testing"
+)
+
+func TestMicrodollarsFormat(t *testing.T) {
+ cases := []struct {
+ m Microdollars
+ places int
+ want string
+ }{
+ {0, 2, "0.00"},
+ {321_000, 2, "0.32"},
+ {321_000, 6, "0.321000"},
+ {1_500_000, 0, "2"},
+ {12_345, 2, "0.01"},
+ {5_000, 2, "0.01"}, // half up
+ {4_999, 2, "0.00"},
+ {1_234_567_891, 4, "1234.5679"},
+ {999_995, 5, "1.00000"}, // carry into the whole part
+ {-5_000, 2, "-0.01"}, // half away from zero
+ {-4_000, 2, "0.00"}, // no negative zero
+ {7, 9, "0.000007"}, // places capped at 6
+ {math.MaxInt64, 6, "9223372036854.775807"},
+ {math.MinInt64, 6, "-9223372036854.775808"},
+ }
+ for _, c := range cases {
+ if got := c.m.Format(c.places); got != c.want {
+ t.Errorf("Microdollars(%d).Format(%d) = %q, want %q", c.m, c.places, got, c.want)
+ }
+ }
+ if got := Microdollars(1_500_000).String(); got != "1.500000" {
+ t.Errorf("String() = %q", got)
+ }
+ if got := Microdollars(321_000).USD(); got != 0.321 {
+ t.Errorf("USD() = %v", got)
+ }
+}