Skip to main content

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

Use uv for project dependency management:

uv add langgraph-openai-serve

The equivalent pip command is:

pip install langgraph-openai-serve

For deployments that use PostgreSQL for LangGraph checkpoints, Store data, or cross-worker interrupt coordination, install the optional integration:

uv add "langgraph-openai-serve[postgres]"

For built-in Langfuse tracing, install the tracing integration:

uv add "langgraph-openai-serve[tracing]"

Set LGOS_ENABLE_LANGFUSE=true together with LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY. LGOS creates the callback lazily on the first graph run; importing the package never initializes Langfuse.

The package contains the OpenAI-compatible server integration, not a built-in LLM graph. Applications register their own graphs. The demo/ checkout keeps each deployable application in an independent uv project with its own lockfile. Its lgos-rag example indexes a small corpus packaged with the demo API, so the entire directory can be copied and run without files from this repository.

Quick Demo

From this repository, prepare the demo environment and PostgreSQL:

cd demo
cp .env.example .env
make run-postgres
make run-api-local

Then call the demo with the OpenAI Python client:

from openai import OpenAI

client = OpenAI(base_url="http://localhost:3004/v1", api_key="DUMMY")

response = client.responses.create(
    model="custom-input-output-context",
    input="Show me custom schemas.",
    store=False,
    user="demo-user",
)

print(response.output_text)

Existing Chat Completions clients can call the same simple graph through the same base URL:

completion = client.chat.completions.create(
    model="custom-input-output-context",
    messages=[{"role": "user", "content": "Show me custom schemas."}],
    user="demo-user",
)

print(completion.choices[0].message.content)

Use Responses for new clients and advanced workflow features. The Chat example is the compatibility path for existing Chat-only clients.

Use curl http://localhost:3004/v1/models only as a diagnostic to inspect the registered demo graph names.

make run-api-local overlays this checkout without changing the self-contained demo project or its lockfile. The demo publishes independent API and Chainlit images and uses official images for third-party services such as Open WebUI. See the demo Docker Compose guide.

The complete Compose demo lets one OPENAI_GATEWAY_TYPE=litellm|bifrost setting place either gateway in front of both maintained UI clients. Chainlit and Open WebUI use normal managed/native Responses and Files routes, plus a catalog-detail pass-through for rich model metadata, so neither UI connects directly to an LGOS service. The PostgreSQL-persistent Chainlit client uses a shared mock login by default, with PocketID OAuth available as an opt-in mode. See the Chainlit demo.

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,
            description="Answer questions with my LangGraph workflow.",
            streamable_node_names=["generate"],
        )
    }
)

LanggraphOpenaiServe(app=app, graphs=graphs).bind_openai_api()

The default base URL is {host}/v1. Registered graph names become OpenAI model values.

LGOS accepts native Responses input_file parts with opaque file_id values, but does not own file upload or storage. Deploy one Files API for the graph services that share a file namespace, or use a gateway-native Files provider. The standalone S3-backed demo Files API is a small reference deployment. Chat Completions remains available for direct compatibility clients; the maintained demo UIs use Responses exclusively. See Choose Responses or Chat Completions for a feature-by-feature comparison.

Docs

Release files for langgraph_openai_serve 0.17.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langgraph_openai_serve 0.17.0
File Size Uploaded
langgraph_openai_serve-0.17.0.tar.gz 47.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langgraph_openai_serve 0.17.0
File Interpreter ABI Platform
langgraph_openai_serve-0.17.0-py3-none-any.whl Python 3 none any Details

Total release size: 117.2 kB

Release files / langgraph_openai_serve-0.17.0.tar.gz

Download URL langgraph_openai_serve-0.17.0.tar.gz
Size 47.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d0ead0eb4e8f8af9e95c088d085a4829692ea172e68a0cb9a7691ef3a4a5f85c
BLAKE2b-256 checksum
How to use checksums
b2fe62266ad84c008e811bfbce58e3f184f9e20e0dc8b08279dc5d317630fb51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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}

Release files / langgraph_openai_serve-0.17.0-py3-none-any.whl

Download URL langgraph_openai_serve-0.17.0-py3-none-any.whl
Size 69.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6d8bea7092e12ef9aba41ecc697f57c0e41697f8070d4e78bdc96560b196392
BLAKE2b-256 checksum
How to use checksums
4e4e2c3768060f27460d9921de54026876f3a85f4e73552d164bf424a6543571
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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}

Release history Release notifications | RSS feed

0.25.0

2 release files

0.24.0

2 release files

0.23.0

2 release files

0.22.0

2 release files

0.21.0

2 release files

0.20.1

2 release files

0.20.0

2 release files

0.19.0

2 release files

This release

0.17.0 This release

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.2

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.2

1 release file

0.9.1

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page