Skip to main content

Client SDK for the routewise cost-aware LLM router

Project description

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

Locally, for development:

pip install -e ./sdk

Or directly from GitHub (once pushed):

pip install git+https://github.com/Ishan-5/llm-router.git#subdirectory=sdk

Usage

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"])

# Force a specific tier instead of letting the difficulty model decide
result = client.ask("Explain quantum computing", override_tier="frontier")

# Get aggregate usage stats
stats = client.stats()
print(stats["total_requests"], stats["cache_hit_rate"])

Errors

All non-2xx responses raise RouteWiseError with the API's error detail message, e.g. invalid key, rate limit exceeded, empty query.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

routewise-0.1.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

routewise-0.1.1-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file routewise-0.1.1.tar.gz.

File metadata

  • Download URL: routewise-0.1.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.2

File hashes

Hashes for routewise-0.1.1.tar.gz
Algorithm Hash digest
SHA256 47277e4c77be62e2ac4b270366767f32f7ac7dbdf9f7f301ea64044419ed3dbc
MD5 76ded0de527b02996b00c94b2b699bff
BLAKE2b-256 cbe58915fbae62214dd80d8b3d6ea56c4c4bde17a244b4a5144b9f3afa771008

See more details on using hashes here.

File details

Details for the file routewise-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: routewise-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.2

File hashes

Hashes for routewise-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e59783c0929625781aae5c2cb79843fd1814a085f39b0d5b2e92486147dd2815
MD5 b9f743313406d12635dc451b7438bb20
BLAKE2b-256 375a56173280b8b18cfdd4b3e97af6949bf3b08dd4f84d36f9e0d52f04e417b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page