Skip to content

About

Official Python SDK for NuRoute, a provider-agnostic LLM gateway with automatic cost-optimized routing.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NuRoute Python SDK

PyPI version License: MIT

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.

Installation

pip install nuroute

Requires Python 3.9+.

Quick start

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? AICPClient is still importable as a deprecated alias of NuRouteClient — existing code keeps working unchanged (it now raises a DeprecationWarning).

Streaming

for chunk in client.chat.stream(
    model="auto",
    messages=[{"role": "user", "content": "Tell me a story"}],
):
    print(chunk, end="", flush=True)

Async client

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!"}],
    )

Authentication

result = client.auth.login(email="[email protected]", password="...")
client.set_api_key(result["token"])

Documentation

Full SDK documentation: nuroute.ai/docs

How routing decisions are made: nuroute.ai/docs/concepts/routing-performance

Community

Questions, ideas, or show-and-tell: github.com/NuRoute-ai/.github/discussions

License

MIT

About

Official Python SDK for NuRoute, a provider-agnostic LLM gateway with automatic cost-optimized routing.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages