LangGraph OpenAI Serve
Serve LangGraph graphs through an OpenAI-compatible /v1 API so existing
OpenAI SDKs, Chainlit, Open WebUI, and similar clients can call them without a
project-specific protocol.
Install
uv add langgraph-openai-serve
# or
pip install langgraph-openai-serve
The package contains the OpenAI-compatible server integration, not a built-in
LLM graph. Applications register their own graphs; repository demo graph
dependencies are kept in the demo dependency group.
Quick Demo
From this repository:
docker compose up -d postgres
make run-demo-api
Then call the demo with the OpenAI Python client:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="DUMMY")
response = client.chat.completions.create(
model="custom-input-output-context",
messages=[{"role": "user", "content": "Show me custom schemas."}],
user="demo-user",
)
print(response.choices[0].message.content)
Use curl http://localhost:8000/v1/models only as a diagnostic to inspect the
registered demo graph names.
Use In FastAPI
from fastapi import FastAPI
from langgraph_openai_serve import GraphConfig, GraphRegistry, LanggraphOpenaiServe
from your_graphs import my_graph
app = FastAPI()
graphs = GraphRegistry(
registry={
"my-graph": GraphConfig(
graph=my_graph,
streamable_node_names=["generate"],
)
}
)
LanggraphOpenaiServe(app=app, graphs=graphs).bind_openai_api()
The default base URL is {host}/v1. Register graph names become OpenAI model
values.
Docs
- Start here: docs/index.md
- Runnable demo: docs/tutorials/getting-started.md
- OpenAI clients: docs/tutorials/openai-clients.md
- Custom graphs: docs/tutorials/custom-graphs.md
- API and configuration: docs/reference.md
- Compatibility contract: docs/explanation/openai-compatibility.md
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file langgraph_openai_serve-0.4.0.tar.gz.
File metadata
- Download URL: langgraph_openai_serve-0.4.0.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49df9e88d1f1c67a480c3cbfca96c51d5fc8d4f92ab4c0c5c3092f07dc0c756d
|
|
| MD5 |
5a9c716e06d5febdff11523774df79a1
|
|
| BLAKE2b-256 |
bf1b88b5904e21d6b43503f0b437953cc757d27e449fc0281067d554fb7c4a6e
|