Repository navigation
pricing: price an OpenRouter model variant as its model - #315
Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Conversation
`resolve_model` drops a router's provider prefix (`openai/gpt-6.1-sol` is `gpt-6.1-sol`), since the prefix names a route, not a price. OpenRouter also adds a variant after a colon: `:free`, `:nitro`, `:floor`, `:online` (its SDK documentation: "Supports variant suffixes (e.g. openai/gpt-4:free)"). The variant chooses how the request is routed or billed, not the model, but it was kept, so `openai/gpt-6.1-sol:nitro` found no price: `weights_for` raised, and the ledger priced the session on the fallback curve (0.10x cache hits and 6x output, where gpt-6.1-sol is 0.05x and 5x). Claude ids escaped only because they are matched by substring. The variant is now dropped with the provider. No price-table key holds a colon, so this changes only ids that had no price; a colon in an id no router named (`llama3:8b`) is left as it is, and an unknown model still fails loudly.
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.
resolve_modeldrops a router's provider prefix (openai/gpt-6.1-solisgpt-6.1-sol), since the prefix names a route, not a price. OpenRouter also adds a variant after a colon::free,:nitro,:floor,:online. Its SDK documentation says it "Supports variant suffixes (e.g. openai/gpt-4:free)". The variant chooses how the request is routed or billed, not the model, but it was kept. Soopenai/gpt-6.1-sol:nitrofound no price:weights_forraised, and the ledger priced the session on the fallback curve (0.10x cache hits and 6x output, where gpt-6.1-sol is 0.05x and 5x). Claude ids escaped only because they are matched by substring.Fix: the variant is dropped with the provider. No price-table key holds a colon, so this changes only ids that had no price. A colon in an id no router named (
llama3:8b) is left as it is, and an unknown model still fails loudly. The change is inresolve_model; the branch merges with the open #309, which editsweights_for.Tests, in a new
tests/test_pricing_router_variants.py::nitro,:floor,:free,:online,:thinking) resolve to their model and are priced by its table, the same as the bare model (all fail on main);The skips need Windows, a real agent CLI (Codex, Hermes, opencode) or aider, or a non-root user.
Fixes #313