To use LangChain with abliteration.ai, instantiate ChatOpenAI with base_url="https://api.abliteration.ai/v1" and your ak_... key. The same class works for LangGraph.
Install
pip install langchain langchain-openai
Usage
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="abliterated-model",
base_url="https://api.abliteration.ai/v1",
api_key=os.environ["ABLIT_KEY"],
)
print(llm.invoke("Hello").content)
Streaming
for chunk in llm.stream("Write a haiku"):
print(chunk.content, end="", flush=True)
from langchain_core.tools import tool
@tool
def get_weather(city: str) -> str:
"""Get the weather for a city."""
return f"Sunny in {city}"
llm_with_tools = llm.bind_tools([get_weather])
See tool calling for the underlying API.
LangGraph
Pass the same ChatOpenAI instance into any LangGraph node. No other configuration needed. Last modified on May 3, 2026