routewise (Python SDK)
Thin client for the routewise cost-aware LLM router. No routing logic lives here -- it's a convenience wrapper around HTTP calls to the real API.
Install
pip install routewise
Quick start
from routewise import RouteWiseClient
client = RouteWiseClient(api_key="rw_your_key_here")
result = client.ask("What is the capital of France?")
print(result["response"])
print(result["routed_to"], result["cost_usd"])
Bring your own model
Override any tier with your own provider and model. Unset tiers fall back to defaults automatically.
# set custom models for any combination of tiers
client.configure(
cheap={"provider": "groq", "model_id": "llama-3.1-8b-instant", "api_key": "your-groq-key"},
frontier={"provider": "openai", "model_id": "gpt-4o", "api_key": "your-openai-key"},
# mid not set -- uses default
)
# config is stored in memory and sent with every ask() as a per-request
# BYOM override -- your API keys never touch the router's database.
result = client.ask("Design a distributed rate limiter")
print(result["response"])
configure() applies the config client-side on every request (works with a plain rw_ API key — no sign-in needed). reset() clears it.
All methods
# routing
client.ask("query") # auto-route by difficulty
client.ask("query", override_tier="frontier") # force a specific tier
client.ask("query", user_api_keys={"frontier": "sk-..."}) # per-request key override
# byom config
client.configure(cheap={...}, mid={...}, frontier={...}) # set custom models
client.get_config() # see currently active config (no keys returned)
client.get_providers() # list all supported providers + models
client.reset() # revert all tiers to defaults, clears in-memory keys
# stats
client.stats() # total requests, cost saved, tier distribution, etc.
Supported providers
providers = client.get_providers()
# returns: groq, openai, anthropic, gemini, deepseek, perplexity, mistral, xai, ollama
# each with a list of known models + "custom" option
Errors
| Exception | When |
|---|---|
RouteWiseError |
Base class for all errors |
ValidationError |
Bad input — empty query, unsupported provider, invalid model (400) |
AuthError |
Invalid/missing API key or rate limit hit (401/429) |
AllTiersFailedError |
Every provider tier failed, no response returned (503) |
from routewise import RouteWiseClient, ValidationError, AuthError, AllTiersFailedError
try:
result = client.ask("hello")
except AllTiersFailedError:
print("all providers down")
except AuthError:
print("check your api key")
except ValidationError as e:
print(f"bad request: {e}")
Metadata
Release files for routewise 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| routewise-0.4.1.tar.gz | 5.7 kB | Without provenance | Details for routewise-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| routewise-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for routewise-0.4.1-py3-none-any.whl |
Total release size: 11.6 kB
Release files / routewise-0.4.1.tar.gz
| Download URL | routewise-0.4.1.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b00c92e6c900142ff307f9e18e3bd00d1db93afa3d68666d234b4f781b5732aa
|
|
BLAKE2b-256 checksum How to use checksums |
c5232f0a40f53fbe33b772787bf4e5da8b6d1d68f01efb702821d3f5d1345e4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.2
|
Release files / routewise-0.4.1-py3-none-any.whl
| Download URL | routewise-0.4.1-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7afd9ae424bc55f2f41f9177ea05817eb6c4e15a23bae3b05cf8d8a2f39e235
|
|
BLAKE2b-256 checksum How to use checksums |
ba1712862eef3ebe3d3da410591004ff68446716c7d074b853d200cd93d3533a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.2
|
Security for routewise 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.