Set up LangChain with uncensored AI models
LangChain's ChatOpenAI takes a custom base_url. One flag matters: turn the Responses API off, or LangChain may call an endpoint Wild West API does not serve.
- Base URL
- https://wildwestapi.com/v1
- API key
- Get one free, starts sk-ww-
- Example model
- outlaw-1-xploded
Python
Python
# pip install -U langchain-openai from langchain_openai import ChatOpenAI llm = ChatOpenAI( model="outlaw-1-xploded", api_key="sk-ww-...", base_url="https://wildwestapi.com/v1", use_responses_api=False, ) print(llm.invoke("Hello").content)
Keep use_responses_api False With a custom base URL LangChain can switch to the Responses API, which returns 404 on Wild West API. Set use_responses_api=False. If streaming usage misbehaves, it is off by default on a custom base URL, which is fine.
JavaScript
TypeScript
// npm install @langchain/openai @langchain/core import { ChatOpenAI } from "@langchain/openai"; const llm = new ChatOpenAI({ model: "outlaw-1-xploded", apiKey: process.env.WILDWEST_API_KEY, configuration: { baseURL: "https://wildwestapi.com/v1" }, }); console.log((await llm.invoke("Hello")).content);