Repository navigation
feat: add Claude Opus 5, Opus 5.5, Fable 5.1, Mythos 5.1 to models.json - #131
Conversation
Also update stale descriptions for claude-opus-4-8, claude-fable-5 and claude-mythos-5 to point to their successors. Old entries are kept for historical cost lookups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Runtime pricing reads model_pricing_rates, not models.json, so existing databases never picked up the new entries. Add migration 092 that re-seeds rates from models.json (same approach as 071), and a test that pins the micro-USD values for the new models and their predecessors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
seed_pricing_rates clears the cache before the migration commits, so a worker lookup in between can leave a stale null entry for up to 300s. Clear again once the new rows are visible. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The test-sharding failure is unrelated to this PR: CI now installs SQLAlchemy 2.1, which defaults postgresql:// to psycopg v3 (not installed). Fixed separately in #133 . Once that merges, I'll update this branch from main to get CI green. |
|
@kush10000 Can you add a migrations script/ app startup seeding script which is going to update all the newer models & updates the pricing of existing models if we have changed them. I dont want to create a explicit migration script every time we add a new model |
|
sure @TEJASNARAYANS I will do it |
…ions On API startup, upsert model_pricing_rates rows that are missing from or differ from models.json, then invalidate the pricing cache after commit. Adding or repricing a model now only needs a models.json edit. Rows that exist only in the database are kept for usage history. Sync failures log a warning and do not block startup; USAGE_PRICING_SYNC_ON_STARTUP=false disables it. Replaces migration 092, which re-seeded rates for one batch of models. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read USAGE_PRICING_SYNC_ON_STARTUP from Settings instead of os.environ: voice_bundle.py runs load_dotenv(override=True) during app import, so a .env value could re-enable a sync the operator disabled in the process environment. Skip (and log) models that have a rate dated after the default effective_from. Runtime lookups prefer the later row, so updating only the default row reported success while usage kept the old price. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve app/config.py conflict: main converted the file from CRLF to LF (plus Call Traces settings), which conflicted as a whole-file change. Took main's version and re-applied USAGE_PRICING_SYNC_ON_STARTUP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…usage kind Skipping models with a later-dated rate left usage dated before that rate unpriced when the baseline row was missing, and matched by model name, so a later rate for one usage kind blocked syncing another. Baseline rows now always follow models.json (they only price usage before any later-dated row). Keys whose baseline is overridden by a later-dated row for the same (model, usage_kind) are reported as shadowed, with the date they take over, instead of being skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge of main left app/config/models.json as two concatenated JSON documents (invalid JSON) and dropped the startup-sync helpers that app_factory still imported, so the API could not start. main now syncs models.json into model_pricing_rates after migrations (maybe_sync_pricing_catalog_after_migrate) and falls back to models.json at runtime, so drop this PR's separate startup sync. Rebuild models.json from main and re-apply only this PR's changes: Claude Opus 5, Opus 5.5, Fable 5.1 and Mythos 5.1, plus the three predecessor description fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@greptile give a confidence score in this |
|
Confidence score: 5/5. The changes are internally consistent: the four model entries have matching pricing assertions, predecessor cache-read rates are preserved, and the migration/upgrade path is covered by the stated tests. I see no blocking correctness issues in the reviewed changes. Tip: You can customize Greptile's behavior for this repo with |
What Changed?
Added 4 missing Anthropic models to
app/config/models.json:claude-opus-5,claude-opus-5-5,claude-fable-5-1, andclaude-mythos-5-1.Also updated the descriptions of
claude-opus-4-8,claude-fable-5, andclaude-mythos-5to point to their successors. Their old "most capable" wording stopped being accurate once the newer models were added to the same file. Pricing for existing entries is unchanged.Added
test_models_json_anthropic_2026_09_rates, which pins the new rates and the predecessors' cache-read prices.No migration is needed: existing installs pick up the new rates through main's post-migrate sync (
maybe_sync_pricing_catalog_after_migrate). An earlier version of this PR shipped its own startup sync; it was removed in favour of main's to avoid two mechanisms.Operator note: usage of these models recorded before this deploy was priced at $0. Run
eai usage recompute --config config.yml --syncafter deploying to backfill it.Why?
Anthropic released Claude Opus 5.5 on Sept 22, 2026, and Fable 5.1 / Mythos 5.1 on Sept 1, 2026. None of these were in the pricing config. Fable 5.1 also cut its cache-read price from $1.00/M to $0.25/M, so cost calculations for anyone testing against the new model would have been wrong.
I kept the older
claude-fable-5/claude-mythos-5entries instead of removing them, because existingevaluator_resultsmay reference those model IDs. The file already keeps historical entries the same way (e.g.gpt-3.5-turbo, oldero1variants).How to Test?
python -m json.tool app/config/models.jsonto confirm the JSON is valid (731 → 735 entries)pytest tests/test_services/test_usage/test_pricing.py: passes, including the new rate testmodel_pricing_rates, start the app. The post-migrate sync logsSynced pricing catalog from models.json, and the 4 models resolve to their rates from DB rows (e.g. Opus 5.5 input $4/M, Fable 5.1 cache read $0.25/M)eai usage diff-rates --config config.yml:models.json priced: 735 | database rows: 735 | in_sync: TrueRelease Label
Select one semantic version bump intent for this PR:
major- breaking change, next release bumps major versionminor- backward-compatible feature, next release bumps minor versionfix- backward-compatible bug fix, next release bumps patch versionIntended release label:
minorChecklist
CONTRIBUTING.mdguide.