Skip to content

Fix curated Anthropic OpenRouter slugs and hide batch endpoints from tenants - #122

Merged
jmlago merged 1 commit into
mainfrom
fix/openrouter-anthropic-slugs
Sep 23, 2026
Merged

jmlago merged 1 commit into
mainfrom
fix/openrouter-anthropic-slugs

Conversation

@jmlago

@jmlago jmlago commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #121, found by checking the live OpenRouter listing against the catalog a production tenant now sees.

Fixes

  • Curated Anthropic slugs: six curated families were served through OpenRouter with ids that OpenRouter does not list (anthropic/claude-opus-4-7; OpenRouter serves anthropic/claude-opus-4.7). Affected: Opus 4.8, 4.7, 4.6, Sonnet 4.6, 4.5, Haiku 4.5. They had no live price, and calls through OpenRouter would target a non-existent model. The other 18 curated OpenRouter ids match the live listing. New test asserts dotted Anthropic versions.
  • No :batch endpoints for tenants: OpenRouter lists batch-processing variants (…:batch, 71 today) at a discount. They are not for interactive calls, yet cost-led policies would always pick them. Excluded from the BYO tenant catalog only (operator path unchanged).
  • Rounded prices: $ / Mtok values derived from per-token strings carried float noise (0.19999999999999998); finite() rounds to 6 decimals for every catalog/preview row.

Verified live from the DEV router: OpenRouter lists 457 models, including Claude Opus 5.5 / Opus 5 / Sonnet 5 / Fable 5.1 and GPT‑6 Luna / Sol / Astra (+Pro); these already reach PRD tenants via #121.

Tests

78 passed across the new/related suites (test_openrouter_curated_slugs, test_saas_openrouter_discovery incl. a batch/rounding case, test_saas_byo, test_saas_routes, test_policy_templates, test_live_wiring).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Corrected OpenRouter model identifiers for supported Claude models, improving compatibility when selecting these models.
    • Excluded batch-processing endpoints from interactive model choices while keeping their standard model versions available.
    • Improved displayed model pricing by rounding values to avoid floating-point artifacts.

…tenants

- Six curated Anthropic families used ids OpenRouter does not serve
  (claude-opus-4-7 instead of claude-opus-4.7): no live price and calls to
  a non-existent model. Use the dotted ids; test guards the format.
- BYO tenant catalog excludes OpenRouter :batch endpoints, which are for
  batch processing but would win every cost-led policy.
- Round catalog/preview prices to 6 decimals (float noise).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 8c3bf4b5-792a-4595-a2d8-9f94c32babd3

📥 Commits

Reviewing files that changed from the base of the PR and between a07c873 and 50125aa.

📒 Files selected for processing (5)
  • config.live.lua
  • saas_routes.py
  • tenant_providers.py
  • tests/test_openrouter_curated_slugs.py
  • tests/test_saas_openrouter_discovery.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The changes update curated Anthropic OpenRouter model IDs to dotted version numbers, exclude :batch offers from the OpenRouter catalog, and round finite numeric prices to six decimal places.

Changes

OpenRouter catalog

Layer / File(s) Summary
Curated Anthropic model slugs
config.live.lua, tests/test_openrouter_curated_slugs.py
Six Anthropic OpenRouter provider model IDs now use dotted version numbers. A test checks that curated slugs do not use dashed version numbers.
Catalog filtering and price rounding
saas_routes.py, tenant_providers.py, tests/test_saas_openrouter_discovery.py
The catalog excludes offers with :batch suffixes. Finite numeric prices are rounded to six decimal places. The test checks that the batch offer is absent and verifies the non-batch model's prices.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 50125

The catalog changes are ready to merge after normal checks; no outstanding behavior change requiring a fix was identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the two primary changes: correcting curated Anthropic OpenRouter slugs and hiding batch endpoints from tenants. It is concise and directly related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jmlago
jmlago merged commit 574cd76 into main Sep 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant