Overview
argrouter is a cost-aware routing layer for large language model (LLM) requests. It selects both the model and the reasoning effort for each query by maximizing the probability of a correct answer minus a cost penalty, where cost is based on what a model actually bills on similar requests, including hidden reasoning tokens. The project states: "argrouter routes each request to the model and reasoning effort that maximise P(correct) − λ · expected cost , where the cost is what that model actually bills on similar requests (hidden reasoning tokens included), not its list price." It is available as an alpha Python package installable via pip, with one runtime dependency (httpx).
The package includes a standalone cost engine that can be used independently. According to the documentation, "The cost engine underneath is usable on its own" and supports offline, SHA-pinned price snapshots. The cost engine computes expected costs from input tokens, expected output tokens, and cached input tokens, returning a total in USD and a component breakdown. The project emphasizes that output tokens typically dominate LLM bills and that common cost estimation failures include adding input and output rates, using a constant expected output token count, and treating unpriced models as free.
argrouter treats prompt caching as a first-class cost term. It prices cache state at decision time, honors minimum-cacheable thresholds, and uses session affinity to keep a conversation on its model unless the measured saving exceeds the measured cache loss. The project also provides a /v1/decision sidecar and plugins for existing gateways rather than reimplementing the OpenAI wire format. It is licensed under Apache-2.0 and commits to supply-chain practices such as PyPI Trusted Publishing with PEP 740 attestations and no install-time code execution.
Pricing
Free
Detailed plans have not been confirmed in our catalog. Check the official website for current limits and billing terms.
Visit WebsitePrices and limits may change. Confirm the currency, billing period, seat minimum and usage caps on the official website.
Use Cases
- Teams use argrouter to route each LLM request to the model and reasoning effort that maximize correctness minus expected cost.
- Developers use the standalone cost engine to compute expected costs for LLM calls with input, output, and cached token forecasts.
- Teams use argrouter to account for prompt caching costs and avoid forfeiting cache discounts when switching models.
- Organizations use argrouter as a decision layer alongside existing gateways via a /v1/decision sidecar and plugins.
- Teams use argrouter to select among multiple providers for the same model based on mix-aware ranking and quality floors.
Features
LLM request cost routing
Per-request cost calculation
Output length forecasting
Cache-aware pricing calculations
Tiered pricing support
Cost per quality ranking
Reviews
No reviews yet. Be the first to share your experience!