Repository navigation
Price openrouter/ models from OpenRouter's model list - #5
Merged
Merged
Conversation
LiteLLM dropped its openrouter rows, so every openrouter/<provider>/<model> name was unresolvable. Refresh now also fetches OpenRouter's public /api/v1/models, converts each priced model to a LiteLLM-shaped row keyed openrouter/<id>, and merges it into the cached dataset. Router models (priced at -1) are skipped. Both sources go into one KV write, so a failed fetch from either keeps the previous cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README, llms.txt, the UI footer and the changelog now say that openrouter/<provider>/<model> names are priced from OpenRouter's own model list, at OpenRouter's rates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
openrouter/<provider>/<model>names stopped resolving because LiteLLM dropped all of its OpenRouter rows (BerriAI/litellm#45665, 2026-10-09). The live service returns zeroopenrouterrows, and/api/inspect-costsreturns 400 for every OpenRouter model. That leaves OpenRouter runs unpriced by the Inspect Costs Plugin.This PR makes refresh also fetch OpenRouter's public
/api/v1/modelsand convert each priced model into a LiteLLM-shaped row keyedopenrouter/<id>. Those rows are merged into the cached dataset. The Inspect resolver needs no change: it already scopesopenrouter/...lookups tolitellm_provider == "openrouter"and matches the full key.openrouter/auto-betaand its siblings are priced at-1. 451 of 458 models are kept.vision,tools,reasoning,prompt_caching) are derived from OpenRouter's fields, so the UI and APIsupportsfilters work on these rows.Verification
openrouter/...names, including dotted versions such asclaude-opus-4-1againstclaude-opus-4.1. Worker tests cover the merged refresh and the failure path (previous cache kept).openrouter/openai/gpt-oss-20b: 0.018 input / 0.09 output per 1M tokens). First-party names still resolve to LiteLLM rows. The merged value is 2.2 MB, well under KV's limit.wrangler dev --test-scheduledran the real refresh in workerd: 4,492 models cached, and/api/inspect-costsserved the OpenRouter prices.npm test(31 passed),npm run typecheck,wrangler deploy --dry-run --env production, and pre-commit all pass.Screenshots
Searching "openrouter" in the UI.
Before (production): 0 of 4041 models, and the footer credits only litellm.
After (local, refreshed): 451 OpenRouter rows with capability badges, and the footer credits both sources.
Not in scope
anthropic/claude-opus-4-1(first-party) also fails to resolve. The cause is separate: LiteLLM's first-partyanthropicrows now start at Claude 4.5, and 4.1 survives only as Bedrock and Databricks keys.openrouter/anthropic/claude-opus-4-1resolves after this PR.🤖 Generated with Claude Code