Integrations

Use uncensored models with LangChain

ChatOpenAI with a base URL, in Python or JavaScript. Pin it to Chat Completions so it never tries the Responses API.

LangChain's ChatOpenAI works with any OpenAI-compatible endpoint. Two settings matter for Chainless: the base URL and keeping the class on Chat Completions.

Python

shell
pip install -U langchain-openai
export CHAINLESS_API_KEY="cl-..."
python
import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="kimi-k3.1-pro-uncensored",
    base_url="https://chainless.one/v1",
    api_key=os.environ["CHAINLESS_API_KEY"],
    use_responses_api=False,
    stream_usage=True,
)

msg = llm.invoke("Explain what an SSRF to cloud metadata endpoint attack looks like in access logs.")
print(msg.content)
print(msg.usage_metadata)

Notes:

  • use_responses_api defaults to None, which lets the library switch to the Responses API based on the model name or on parameters such as reasoning=, include= or built-in tools. False forces Chat Completions.
  • Environment variables also work: OPENAI_API_BASE (read by LangChain) or OPENAI_BASE_URL (read by the openai SDK), plus OPENAI_API_KEY. Explicit arguments are clearer when you also use OpenAI itself.
  • ChatOpenAI does not surface the reasoning text that Chainless models stream; you get the final answer in content.

JavaScript / TypeScript

shell
npm install @langchain/openai
typescript
import { ChatOpenAI } from "@langchain/openai";

const llm = new ChatOpenAI({
  model: "kimi-k3.1-pro-uncensored",
  apiKey: process.env.CHAINLESS_API_KEY,
  configuration: { baseURL: "https://chainless.one/v1" },
  useResponsesApi: false,
});

const res = await llm.invoke("List common indicators of a web shell on an nginx server.");
console.log(res.content);

In JS useResponsesApi is already false by default, but some options (built-in tools, reasoning.summary, previous_response_id) switch it on automatically; setting it explicitly keeps requests on /chat/completions.

Tools and agents

llm.bind_tools([...]) (Python) and llm.bindTools([...]) (JS) send OpenAI-format tools that every public Chainless model supports. Use glm-5.3-fast-uncensored for high-volume chains and kimi-k3.1-pro-uncensored for the agent's planning step; ids and limits are on /models.

Sources

Checked against the official documentation on 2026-11-29. Tools change their settings often; if a field moved, the source below is the reference.

Other tools

Questions

Why set use_responses_api=False?

langchain-openai picks the Responses API automatically for some model names and parameters, independent of base_url. Chainless serves Chat Completions only, so pinning the flag avoids surprise 404s.

Streaming works but usage_metadata is empty. Why?

With a custom base_url, langchain-openai does not request usage in streams by default. Pass stream_usage=True; Chainless returns the final usage chunk when asked.

Does tool calling work with bind_tools?

Yes. All public Chainless models accept OpenAI-format tools, so bind_tools and LangGraph agents work unchanged.