langchain-nuroute
A LangChain chat model for NuRoute — a provider-agnostic LLM gateway that routes, monitors, and controls inference requests across OpenAI, Anthropic, Google, and more.
This talks to the gateway through the official aicp client rather than
through ChatOpenAI's OpenAI-compatibility path, so NuRoute-specific behavior — the "auto"
routing model, provider overrides, and NuRouteError — comes through unchanged instead of
being flattened into OpenAI's response/error shapes.
Installation
pip install langchain-nuroute
Requires Python 3.9+.
Quick start
from langchain_nuroute import ChatNuRoute
from langchain_core.messages import HumanMessage
llm = ChatNuRoute(
nuroute_api_key="aicp-...",
nuroute_base_url="https://your-nuroute-gateway",
model="auto", # classifies the request and routes it — see nuroute.ai/docs for strategies
)
response = llm.invoke([HumanMessage(content="Hello!")])
print(response.content)
Streaming
for chunk in llm.stream([HumanMessage(content="Tell me a story")]):
print(chunk.content, end="", flush=True)
Forcing a provider or model
llm = ChatNuRoute(
nuroute_api_key="aicp-...",
nuroute_base_url="https://your-nuroute-gateway",
model="claude-sonnet-4-6",
provider="anthropic",
temperature=0.2,
max_tokens=1024,
)
Usage and routing metadata
ChatResult.llm_output carries the model NuRoute actually routed to and the token usage for
the call:
result = llm.generate([[HumanMessage(content="Hello!")]])
print(result.llm_output["model"], result.llm_output["usage"])
Documentation
Full SDK documentation: nuroute.ai/docs
License
MIT
Metadata
Release files for langchain-nuroute 0.1.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 | |
|---|---|---|---|
| langchain_nuroute-0.1.1.tar.gz | 148.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_nuroute-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 152.8 kB
Release files / langchain_nuroute-0.1.1.tar.gz
| Download URL | langchain_nuroute-0.1.1.tar.gz |
|---|---|
| Size | 148.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15e5d71aeceedfd7cff123e3fd33a597474a42bec3fb2685f0c09da86a29badb
|
|
BLAKE2b-256 checksum How to use checksums |
f27d4c2e4820e9c329fc3f5939f42b3d0debb2327cb4a5b9da627475a3e7e76f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / langchain_nuroute-0.1.1-py3-none-any.whl
| Download URL | langchain_nuroute-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbb909a28708b82b6cc7f99dc35b0c0c63d50ac33eb161229a1507090c9b9a0e
|
|
BLAKE2b-256 checksum How to use checksums |
0dbf0b3bc6f5368c5db76b92e9000e02a191414e4a573f6c6e24b219ffd5c991
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|