The official Python SDK for NuRoute, a provider-agnostic LLM gateway that lets you route, monitor, and control inference requests across OpenAI, Anthropic, Google, and more.
Point model="auto" at any request and NuRoute predicts the cheapest model that can still answer it well, so you stop paying frontier prices for prompts a cheaper model would handle just as well.
pip install nurouteRequires Python 3.9+.
from nuroute import NuRouteClient
client = NuRouteClient(
api_key="aicp-...",
base_url="https://your-nuroute-gateway",
)
response = client.chat.complete(
model="auto", # classifies the request and routes it — see nuroute.ai/docs for strategies
messages=[{"role": "user", "content": "Hello!"}],
)
print(response["choices"][0]["message"]["content"])Upgrading from an older version?
AICPClientis still importable as a deprecated alias ofNuRouteClient— existing code keeps working unchanged (it now raises aDeprecationWarning).
for chunk in client.chat.stream(
model="auto",
messages=[{"role": "user", "content": "Tell me a story"}],
):
print(chunk, end="", flush=True)from nuroute import AsyncNuRouteClient
async with AsyncNuRouteClient(api_key="aicp-...", base_url="https://your-nuroute-gateway") as client:
response = await client.chat.complete(
model="auto",
messages=[{"role": "user", "content": "Hello!"}],
)result = client.auth.login(email="[email protected]", password="...")
client.set_api_key(result["token"])Full SDK documentation: nuroute.ai/docs
How routing decisions are made: nuroute.ai/docs/concepts/routing-performance
Questions, ideas, or show-and-tell: github.com/NuRoute-ai/.github/discussions
MIT