Run the EveryAPI gateway inside LangGraph
LangGraph orchestrates stateful application flows and can call a ChatOpenAI instance configured for an OpenAI-compatible endpoint. Point that client at EveryAPI; graph state and persistence remain application concerns, while model-dependent capabilities must be tested separately.
One base URL line points LangGraph at EveryAPI
Default global Base URL / China-first Base URL: https://api.everyapi.ai/v1 / https://api-cn.everyapi.ai/v1
from langchain_openai import ChatOpenAIfrom langgraph.graph import StateGraph, START, ENDfrom typing import TypedDict llm = ChatOpenAI( base_url="https://api.everyapi.ai/v1", api_key="sk-everyapi-...", model="claude-sonnet-5",) class State(TypedDict): messages: list def think(state: State): resp = llm.invoke(state["messages"]) return {"messages": state["messages"] + [resp]} graph = StateGraph(State)graph.add_node("think", think)graph.add_edge(START, "think")graph.add_edge("think", END)app = graph.compile() result = app.invoke({"messages": [{"role": "user", "content": "Explain RAG"}]})From zero to your first call
- Install LangGraph
Install LangGraph and langchain-openai versions compatible with your application, then consult their matching API references.
- Point ChatOpenAI at EveryAPI
ChatOpenAI(base_url="https://api.everyapi.ai/v1", api_key="sk-everyapi-...", model="...") — same as on the LangChain integration page.
- Build the graph
Build graph state, nodes, edges, and checkpoints according to the current LangGraph documentation. Test any tool-calling or structured-output path with the selected model instead of assuming provider parity.
LangGraph × EveryAPI
Do LangGraph checkpoints / persistence go through EveryAPI?
No. LangGraph state checkpoints use its own PostgreSQL / SQLite / in-memory backend, independent of the LLM gateway. EveryAPI only proxies the ChatOpenAI calls.
