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
pip install -U langchain-openai
export CHAINLESS_API_KEY="cl-..."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_apidefaults toNone, which lets the library switch to the Responses API based on the model name or on parameters such asreasoning=,include=or built-in tools.Falseforces Chat Completions.- Environment variables also work:
OPENAI_API_BASE(read by LangChain) orOPENAI_BASE_URL(read by the openai SDK), plusOPENAI_API_KEY. Explicit arguments are clearer when you also use OpenAI itself. ChatOpenAIdoes not surface thereasoningtext that Chainless models stream; you get the final answer incontent.
JavaScript / TypeScript
npm install @langchain/openaiimport { 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.
- pypi.org/project/langchain-openai/
- github.com/langchain-ai/langchain/blob/master/libs/partners/openai/langchain_openai/chat_models/base.py
- www.npmjs.com/package/@langchain/openai