Skip to main content

langchain-aistupidlevel

A LangChain chat model for the AI Stupid Level Smart Router.

Instead of a fixed model you pick a routing mode, such as auto-coding, auto-reasoning, auto-tooling, auto-best or auto-value. Each request goes to the model that scores best for that mode on AI Stupid Level's benchmarks, among the providers you connected (OpenAI, Anthropic, Google, DeepSeek, Kimi, GLM). The router calls that model with your own provider keys and adds nothing to token prices.

Install

pip install -U langchain-aistupidlevel
export ASL_ROUTER_KEY="aism_..."   # https://aistupidlevel.info/router/keys

Use

from langchain_aistupidlevel import ChatAISL

llm = ChatAISL(model="auto-coding")
msg = llm.invoke("Write a Python function that reverses a string.")

print(msg.content)
print(msg.response_metadata["routed_model"])     # the model that answered, e.g. claude-opus-5-5
print(msg.response_metadata["routed_provider"])  # e.g. anthropic
print(msg.response_metadata["routing_reason"])   # why the router chose it

ChatAISL is built on ChatOpenAI, so tool calling (bind_tools), structured output (with_structured_output), streaming and async work the same way. A model id such as claude-opus-5-5 instead of a routing mode pins that model.

What it adds over ChatOpenAI with a base URL: the router reports which model answered and why in response headers, which ChatOpenAI drops. ChatAISL copies them into response_metadata as routed_model, routed_provider, routing_reason, routing_latency_ms and routing_request_id.

Sandbox

llm = ChatAISL(model="auto-tooling", sandbox=True)

The routing is real and the answer is a mock: nothing is sent to a model or counted. It is useful for building and testing before you add provider keys.

Configuration

Parameter Environment variable Default
api_key ASL_ROUTER_KEY none
base_url ASL_BASE_URL https://aistupidlevel.info/v1
model auto-best
sandbox False

The routing modes are described at https://aistupidlevel.info/router/docs#strategies. The router routes text and tool calls; image input is not supported.

Development

pip install -e ".[test]"
pytest tests/unit_tests
ASL_ROUTER_KEY=aism_... pytest tests/integration_tests            # sandbox: nothing spent
ASL_ROUTER_KEY=aism_... ASL_LIVE=1 pytest tests/integration_tests # real models, with provider keys

MIT licence.

Metadata

Release files for langchain-aistupidlevel 0.1.0

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

Source distribution (sdist)

Source distribution for langchain-aistupidlevel 0.1.0
File Size Uploaded Provenance Actions
langchain_aistupidlevel-0.1.0.tar.gz 6.0 kB Without provenance Details for langchain_aistupidlevel-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-aistupidlevel 0.1.0
File Interpreter ABI Platform Actions
langchain_aistupidlevel-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_aistupidlevel-0.1.0-py3-none-any.whl

Total release size: 11.8 kB

Release files / langchain_aistupidlevel-0.1.0.tar.gz

Download URL langchain_aistupidlevel-0.1.0.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ed223608235c7c9c0f4d0ee6f670927c2048a9e0c8f214a9d1ef51110cdccdb1
BLAKE2b-256 checksum
How to use checksums
05b6e5cf2af684c86f902ff1e6142c9761ec93d3d2d1f48de9d31954f431e89d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / langchain_aistupidlevel-0.1.0-py3-none-any.whl

Download URL langchain_aistupidlevel-0.1.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4346574c132c5e74834d85609bd8a60576fc3c58f82f61c53614f31c7e861ada
BLAKE2b-256 checksum
How to use checksums
a0f897c6e78553d9a1f906b97fc2c0d7a06478a8496f0181da8ed9319427d0d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for langchain-aistupidlevel 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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