Skip to main content

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": "openrouter", "model_id": "deepseek/deepseek-v4-flash", "api_key": "sk-or-v1-..."},
    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.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for routewise 0.4.2
File Size Uploaded Provenance Actions
routewise-0.4.2.tar.gz 5.8 kB Without provenance Details for routewise-0.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for routewise 0.4.2
File Interpreter ABI Platform Actions
routewise-0.4.2-py3-none-any.whl Python 3 none any Details for routewise-0.4.2-py3-none-any.whl

Total release size: 11.6 kB

Release files / routewise-0.4.2.tar.gz

Download URL routewise-0.4.2.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2173da0e20f63874de1f7cedde962a21d70ebe7b7a03b457c805dac54e4779f0
BLAKE2b-256 checksum
How to use checksums
62df8815b1a100b740dadbaf3808bc5437f9f08af4c581fc7ba27d7ee31620b1
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.2-py3-none-any.whl

Download URL routewise-0.4.2-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e7a95e09358a6e2cbc62c82012c387580cf7e23ec03895150e8bd4c8cb00f8e
BLAKE2b-256 checksum
How to use checksums
ad3c71d0a98855e0b22bd4f57380ac992edc0c7b568b4f8a0710753233750efd
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.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page