LangChain

Use Chutes from LangChain with the OpenAI chat client.

LangChain can call Chutes through ChatOpenAI by changing base_url, api_key, and model selection to the live catalog.
OpenAI-compatible guideConnect draftEndpoint guide
Status
OpenAI-compatible client
Base URL
https://llm.chutes.ai/v1
Live model example
Qwen/Qwen3-32B-TEE
Catalog checked
Jun 25, 2026; context 40K

Full setup walkthrough

Everything you need is on this page — no need to leave for the toolkit. Each step is copy-paste runnable and uses a live model id from the catalog.

  1. 01

    Install the OpenAI integration

    bash
    pip install langchain-openai openai
  2. 02

    Point ChatOpenAI at Chutes

    ChatOpenAI
    python
    import os
    from langchain_openai import ChatOpenAI
    
    llm = ChatOpenAI(
        model="Qwen/Qwen3-32B-TEE",
        base_url="https://llm.chutes.ai/v1",
        api_key=os.environ["CHUTES_API_KEY"],
    )
  3. 03

    Provide the API key

    Store your cpk_ key as CHUTES_API_KEY in the environment or a secret store. Send it as Authorization: Bearer — never X-API-Key, which inference ignores.
    bash
    export CHUTES_API_KEY=cpk_...
  4. 04

    Invoke and verify

    Call llm.invoke("Say hello"). Tool calling, JSON mode, and vision depend on the model's supported_features — check /v1/models first.

The framework contract

Set
base_url / baseURL / api_base
Value
https://llm.chutes.ai/v1
Set
model
Value
Qwen/Qwen3-32B-TEE from the live catalog

Troubleshooting

Symptom
The model ID fails
Likely cause
The catalog changed or the client cached model metadata.
Fix
Refresh /v1/models and update the config.
Symptom
Auth falls into anonymous limits
Likely cause
The key is missing or not sent as Bearer auth.
Fix
Export CHUTES_API_KEY=cpk_... and send Authorization: Bearer.
Symptom
Routing aliases fail
Likely cause
Saved default aliases need a dashboard Model Routing pool.
Fix
Use a concrete model ID or an inline comma-separated pool first.