Repository navigation
Pricing: rule for models a router runs itself (local / self-hosted) - #266
Merged
Merged
Conversation
A profile marks a local (on-device or self-hosted) model with
local: {base: <profile>, bits: N} when its weights are a listed model's,
or local: {active_params_b: N, bits: N} otherwise. scripts/pricing/
local_price.py prices it by model_cost/local_pricing.yaml: the listed
model's price, or the size curve's price for its active parameters, times
a quantization factor. --write updates the profiles and model_cost.json;
--check (a pre-commit hook) fails when a local price is out of date, e.g.
after a sync moves its base model's price.
The rule's numbers come from 103 open-weight models on OpenRouter at
standard prices (standard tier, promotions undone, median over 8-bit+
hosts): price ~ active_params^0.32 (input 0.0669 x B^0.325, output
0.2153 x B^0.316), and same-model hosts charge 1.00x at 8 vs 16 bits and
about 0.8x at 4 bits. Factors: 1.0 at 8 bits or more, 0.8 below.
scripts/pricing/fit_local_rule.py refits them from live data.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 10, 2026
bellman-sionic
pushed a commit
to sionic-ai/RouterArena
that referenced
this pull request
Nov 11, 2026
…ssifier, OpenRouter sync - DeepSeek sells its models directly but not on OpenRouter, so its own published prices are set by hand (sync: false): V4 Pro 1.32/3.96 and V4.1 Flash 0.30/1.20 (standard, peak-hour rates); V3.2 keeps 0.28/0.42, its last DeepSeek price, since DeepSeek no longer sells it. - f-router's routing classifier (Qwen3-4B-Instruct-2507, 4-bit, run locally) is priced by the local-model rule (RouteWorks#266): not listed on OpenRouter, so the size curve at 4B x0.8 = 0.084/0.267. - scripts/pricing/sync_openrouter.py with OpenRouter's data of 2026-11-10: 5 small changes (gemma-4-31b-it, qwen3-235b-a22b-2507 output, gpt-oss-120b, deepseek-v4-flash-0731, llama-3.3-70b); snapshot written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 16, 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.
For review; not merged. The quantization factors are a policy choice; the data behind them is below.
A rule for pricing models that a router runs itself, on-device or self-hosted (#193, #198). It follows the working policy in #193: price the model, not the submitter's bill.
The rule
A profile in
model_profiles.yamlmarks a local model:Price:
Either way, it's multiplied by a quantization factor for the served weights: ×1.0 at 8 bits or more, ×0.8 below.
The data (
model_cost/local_pricing.yaml)The data is 103 open-weight models on OpenRouter with a known parameter count, at standard prices: standard tier, promotions undone, median over hosts at 8 bits or more.
Size curve:
Quantization, comparing hosts of the same model:
There's no market data below 4 bits, so 2- and 3-bit weights get the 4-bit factor. This is smaller than the ×0.75 (8-bit) and ×0.5 (4-bit) I had proposed earlier, because the market doesn't discount quantized hosting that much.
What it gives the pending local submission (#198, Lemonade)
lemonade/deepseek-v4-flash(2-bit)lemonade/Qwen3.8-27B-GGUF-UD-Q4_K_XLlemonade/LFM2.5-Embedding-350MTools
python scripts/pricing/local_price.py --active-params-b 27 --bits 4(or--base <id> --bits N) prints a price and how it was derived.--writeupdates every local profile andmodel_cost.json.--checkruns as a pre-commit hook and fails when a local price is out of date, e.g. after a sync moves its base model's price.scripts/pricing/fit_local_rule.pyrefits the curve and the quantization ratios from live OpenRouter and Hugging Face data. It reproduces the numbers above.Testing
tests/test_local_price.pycovers the factors, base vs size curve, rejected specs, and--check/--writeend to end. All 48 pricing tests pass.🤖 Generated with Claude Code