Add pricing entries for newly observed models#156
Conversation
Add pricing coverage and regression tests for the unknown models surfaced by cargo run, annotate each new pricing table with a source, and serialize registry-mutating tests so the models test suite remains stable under parallel execution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📝 WalkthroughWalkthroughExtends the default model registry in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/models.rs (1)
1815-1832:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winMake the registry test guard unwind-safe.
reset_global_registry()only runs on the happy path, so a panic leaves the global registry dirty for later tests.std::sync::Mutexalso poisons after a panic, which turns one failure into a cascade. Please switch this helper toparking_lot::Mutexand move the cleanup into aDropguard so the registry is restored during unwinding too. As per coding guidelines, prefer parking_lot locks over std::sync locks in Rust code.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/models.rs` around lines 1815 - 1832, Replace the std::sync::Mutex-based test guard with a parking_lot-based RAII guard so the registry is restored even during unwinding: change TEST_MUTEX to OnceLock<parking_lot::Mutex<()>>, remove or stop relying on the standalone reset_global_registry() helper, and implement a small guard type (e.g. RegistryTestGuard) returned by registry_test_guard() that acquires parking_lot::Mutex::lock() and on Drop calls get_registry_lock() and replaces the global registry with Registry::new_with_defaults(); update registry_test_guard() to return this guard (holding the parking_lot::MutexGuard) so the cleanup runs during unwinding and avoids poisoning.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/models.rs`:
- Around line 1815-1832: Replace the std::sync::Mutex-based test guard with a
parking_lot-based RAII guard so the registry is restored even during unwinding:
change TEST_MUTEX to OnceLock<parking_lot::Mutex<()>>, remove or stop relying on
the standalone reset_global_registry() helper, and implement a small guard type
(e.g. RegistryTestGuard) returned by registry_test_guard() that acquires
parking_lot::Mutex::lock() and on Drop calls get_registry_lock() and replaces
the global registry with Registry::new_with_defaults(); update
registry_test_guard() to return this guard (holding the parking_lot::MutexGuard)
so the cleanup runs during unwinding and avoids poisoning.
Summary
mimo-v2.5-pro,deepseek-v4-pro,qwen/qwen3.5-35b-a3b,meituan/longcat-flash-lite,kimi-k2.5, andautosrc/models.rswith an inline source commentmodels.rstests that mutate the global registry so the suite stays reliable under parallel executionPricing sources
deepseek-v4-pro$1.74/M, output$3.48/M, cache hit$0.0145/Mmimo-v2.5-pro$1.00/M, output$3.00/Mis_estimated = truebecause this is provider-published pricing rather than a first-party Xiaomi pricing page.qwen3.5-35b-a3b$0.1625/M, output$1.30/Mqwen3.5-35b-a3b; existing provider-prefix normalization coversqwen/qwen3.5-35b-a3b. Marked estimated.longcat-flash-lite$0.10/M, output$0.40/Mlongcat-flash-lite; existing provider-prefix normalization coversmeituan/longcat-flash-lite. Marked estimated because I could not find a first-party Meituan pricing page.kimi-k2.5$0.44/M, output$2.00/Mauto$0.00/Minput/outputautois a router label, not a billable standalone model. This placeholder is marked estimated and suppresses historical unknown-model warnings when onlyautowas logged.Validation
cargo fmt --all --quietcargo build --quietcargo test --quietcargo clippy --quiet -- -D warningscargo doc --quietcargo run --quiet(the newly added unknown-model warnings are gone)Summary by CodeRabbit
New Features
Tests