Repository navigation
Pricing: charge routers for the LLM calls they make themselves - #251
Merged
Merged
Conversation
A prediction row may now list router_usage: each LLM call the router made to decide (routing model, classifier, voters, critic, earlier cascade steps) with its model, input tokens and output tokens (reasoning included). The evaluator bills these calls at their models' prices on top of the answer, the checker validates the field and includes its models in the price check, and scripts/pricing/compute_cost.py reports a file's cost the same way, offline. Per-row cost logic moves into compute_row_cost so the evaluator and the tool share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yl231
changed the base branch from
pricing/model-profiles
to
pricing/openrouter-sync
October 31, 2026 22:08
yl231
marked this pull request as ready for review
October 31, 2026 22:16
This was referenced Oct 31, 2026
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.
Part of the pricing rework, after #218 and #250 (both merged); the re-pricing tool (#261) builds on it. It implements the plan for routers that call LLMs themselves (#198, #209), so that every such call is charged.
What it adds
router_usageon a prediction row (optional): one record per LLM call the router itself made to decide, whether a routing model, a classifier, voters, a critic, or the earlier steps of a cascade:output_tokenscounts every generated token, reasoning included.router_cost. The per-row logic moves intocompute_row_cost()inllm_evaluation/run.py, unchanged for the answer (it still prefersmodel_usedwhen priced, Leaderboard integrity: retired Grok 4.1 Fast slug silently resolved to Grok 4.3 at the old price #166).router_usage, and its models join the missing-price warning.uv run python scripts/pricing/compute_cost.py <router>prints answer, router-call and total cost per 1K queries, plus any model charged the maximum.--per-row out.csvwrites a per-row breakdown. It calls the evaluator's owncompute_row_cost(), so both agree by construction, and it grades nothing, so it runs offline in seconds. On KT-ModelRouter it gives $0.2698/1K, matching the board's $0.27.tests/test_router_usage.py; with the Model price profiles: one entry per model, exact price matching, max price for unmatched models #218 and Pricing: sync model prices with OpenRouter (manual), applied with the 2026-10-31 list #250 tests, 25 pass.Not in this PR
cascade_accounting, IQ Routing's note, dalpha's classifier) would move torouter_usagewhen they resubmit or are re-priced.🤖 Generated with Claude Code