ChatOpenAI + StateGraph
Native OpenAI-compatible supportLangGraph with a custom OpenAI-compatible model
LangGraph is model-agnostic. Bind ChatOpenAI to the gateway and every node, checkpoint and interrupt works unchanged.
Base URL
https://uncensoredai.dev/v1
- 01
Bind the model
Create a ChatOpenAI client pointed at the gateway and bind the tools each node needs.
pythonfrom langchain_openai import ChatOpenAI from langgraph.prebuilt import create_react_agent model = ChatOpenAI( model="gpt-6-sol", base_url="https://uncensoredai.dev/v1", api_key="sk-ua-XXXX-XXXX-XXXX-XXXX", ) agent = create_react_agent(model, tools=[search, calculator]) - 02
Compile with a checkpointer
Checkpointing is local. The model swap does not change graph semantics, so existing threads keep working.
checkpointfrom langgraph.checkpoint.memory import MemorySaver graph = agent.with_config({"configurable": {"thread_id": "run-1"}}) - 03
Route cheap nodes to a fast tier
Use a second client for classification and retrieval nodes so only planning hits the reasoning tier.
two tiersfast = ChatOpenAI(model="deepseek-v4.1-flash", base_url="https://uncensoredai.dev/v1", api_key="...")
Commands and configuration below are shown exactly as the tool expects them, so they stay in English.
FAQ
Does human-in-the-loop still work?+
Yes. Interrupts are handled by LangGraph locally; only model calls leave your process.
Can different nodes use different models?+
Yes. Create one ChatOpenAI client per tier and pass the right one into each node.
