Repository navigation
Replies: 14 comments
What is SGLang?SGLang (Structured Generation Language) began as a research project at LMSYS and has become one of the most widely deployed open-source inference engines. It sits between the model weights and your application: load a Hugging Face model, and SGLang exposes an HTTP server that speaks the OpenAI Chat Completions API, so existing clients (OpenAI SDK, Cursor, Claude Code, your own app) can point at it without code changes. It is designed around agentic and large-scale serving rather than single-shot demos: multi-turn conversations with long shared prefixes, tool calling, constrained/structured output, high-concurrency batching, and reinforcement-learning rollout generation are all first-class paths. |
Core Architecture
|
Key Capabilities
|
Supported Models
|
Supported Hardware
Integrations in progress: AWS Trainium, Alibaba T-Head PPU, Cambricon MLU, Qualcomm QAIC, MetaX, Hygon and others. |
Typical Use Cases
|
Quick StartDocker (Linux + NVIDIA GPU with a CUDA 13-compatible driver): docker pull lmsysorg/sglang:latest
docker run --rm --gpus all --ipc=host \
-p 30000:30000 \
lmsysorg/sglang:latest \
sglang serve MODEL_PATH --host 0.0.0.0 --port 30000Or with uv: uv venv --python 3.12
source .venv/bin/activate
uv pip install --prerelease=allow sglang
sglang serve MODEL_PATH --host 0.0.0.0 --port 30000Replace curl http://localhost:30000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"MODEL_PATH","messages":[{"role":"user","content":"What is the capital of France?"}]}'See the Quickstart and Cookbook for model-specific flags, streaming and tool calls. |
OpenAI-Compatible APIBecause the server speaks the OpenAI Chat Completions protocol, drop-in clients work: from openai import OpenAI
client = OpenAI(base_url="http://localhost:30000/v1", api_key="EMPTY")
resp = client.chat.completions.create(
model="MODEL_PATH",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)Supported surfaces include streaming, tool/function calling, JSON-schema structured output, and batch requests. A hosted option exists too — SGLang is available through NVIDIA NIM and cloud providers. |
SGLang Diffusion (Image / Video / Audio)SGLang Diffusion is built into the same repository and |
The SGL Ecosystem
|
Performance & Production
|
License & PricingSGLang is Apache-2.0 and free to self-host. There is no license fee or hosted-token charge from the project itself — costs are your own GPU/hardware and electricity. Enterprise deployment support, consulting and sponsorship are offered through LMSYS ( |
FAQ
|
Links & Resources
tag: LLM Inference / Serving / Open Source / LMSYS |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
SGLang: Detailed Introduction
SGLang is an open-source, high-performance serving framework for large language models and multimodal models, hosted by the non-profit LMSYS organization (the team behind Chatbot Arena). It is built for production inference — low latency, high throughput, from a single GPU to large distributed clusters — with first-class support for agentic workloads, large-scale serving, and RL rollouts.
What it is. An inference engine, not a chatbot or a model: you bring your own open-weight model (Llama, Qwen, DeepSeek, etc.) and SGLang runs it as an OpenAI-compatible API service.
Signature capability. RadixAttention with automatic prefix caching — reused KV cache across multi-turn conversations and shared prefixes, cutting time-to-first-token on agent and chat workloads.
Scale / adoption. Powers 400,000+ GPUs and trillions of tokens per day in production; used by AI labs, cloud platforms, enterprises and universities.
Hardware. NVIDIA, AMD, Google TPU, Intel GPU/CPU, Apple Silicon, Huawei Ascend, Moore Threads — one engine across most accelerators.
License / price. Apache-2.0, free and self-hosted; you pay only for your own hardware.
Repo. ~39k stars, 10.9k forks, Apache-2.0, with active releases and near-daily commits.
Unique Advantages (vs Competitors)
sglangpackage.Table of Contents
Product intro
Getting started
Ecosystem & resources
Click a TOC item to jump to the floor; if it does not respond in-page, open the link in a new tab.
All reactions