Skip to content
Updates & support on Telegram

ChatOpenAI + StateGraph

Native OpenAI-compatible support

LangGraph 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

  1. 01

    Bind the model

    Create a ChatOpenAI client pointed at the gateway and bind the tools each node needs.

    python
    from 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])
  2. 02

    Compile with a checkpointer

    Checkpointing is local. The model swap does not change graph semantics, so existing threads keep working.

    checkpoint
    from langgraph.checkpoint.memory import MemorySaver
    
    graph = agent.with_config({"configurable": {"thread_id": "run-1"}})
  3. 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 tiers
    fast = 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.

More integrations

LangGraph Custom Model — Stateful Agent Setup · UncensoredAI