sglang-router
High-performance Rust-based load balancer for SGLang with multiple routing algorithms and prefill-decode disaggregation support
What it is and what it does
sglang-router is a Rust-based gateway that orchestrates distributed inference workloads across fleets of SGLang model workers. It sits between clients and worker nodes, routing requests using pluggable strategies (random, round_robin, cache_aware, power_of_two, bucket), managing prefill-decode disaggregation for efficient batching, and exposing OpenAI-compatible REST endpoints. The gateway handles reliability concerns—retries with backoff, circuit breakers, token-bucket rate limiting, and request queuing—while maintaining observability through Prometheus metrics and OpenTelemetry tracing.
The package is designed for large-scale LLM deployments where traffic needs to be balanced across heterogeneous worker pools, models need to be served concurrently, and inference stages (prefill and decode) can be separated for independent scaling. It integrates with SGLang's serving runtime deeply, including native Rust tokenization, reasoning parsing, and tool-call execution, while also supporting external OpenAI-compatible backends. Runtime dependencies (fastapi, uvicorn, aiohttp, orjson, setproctitle) enable the Python launcher and async HTTP handling.
Use it for:
- Route inference requests across multiple SGLang workers with cache-aware load balancing to minimize redundant computation.
- Separate prefill and decode stages across dedicated worker pools to optimize throughput and latency independently.
- Proxy OpenAI API requests to multiple remote vendors while maintaining streaming semantics and conversation state.
- Monitor and control multi-model inference deployments with per-model policies, circuit breakers, and dynamic worker discovery.
- Serve reasoning-capable models with native tokenization and tool-call parsing via gRPC.
- Centralize conversation history and state management across model fleets with pluggable storage backends.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A high-performance Rust-based load balancer and gateway for routing requests across distributed SGLang model workers, supporting multiple load-balancing strategies, prefill-decode disaggregation, and OpenAI-compatible APIs.
Yes, if you are deploying distributed SGLang inference at scale and need sophisticated load balancing, prefill-decode disaggregation, or multi-model orchestration. The package is in the top 15000 on PyPI, has no known vulnerabilities, and offers production-grade observability and reliability features. The aging maintenance status (211 days since last release) is a minor concern for a specialized infrastructure tool but warrants monitoring for security updates. Not recommended for simple single-worker or non-SGLang deployments.
Install
sglang-router on PyPI
pip
pip install sglang-routeruv
uv add sglang-routerpoetry
poetry add sglang-routerInstalling sglang-router
Before you install
Medium install friction due to Rust compilation requirements and system dependencies (libssl-dev or openssl-devel). The package provides pre-built wheels for Python 3.8+ across major platforms (x86_64, ARM64, macOS, Linux, Windows), reducing friction for standard environments. Maintenance status is aging—last release was 211 days ago—so expect slower updates.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial use, modification, and redistribution with minimal restrictions. No notable licensing constraints for most use cases.
Quickstart
pip install sglang-router
python3 -m sglang_router.launch_router \
--worker-urls http://worker1:8000 http://worker2:8000 \
--policy cache_aware
Requires Rust toolchain (rustc, cargo) if building from source; system OpenSSL development headers (libssl-dev or openssl-devel) for development builds. Pre-built wheels bypass Rust compilation for standard platforms.
Verify before relying
- Performance benchmarks comparing different load-balancing strategies under realistic LLM workloads.
- Kubernetes integration maturity and production deployment patterns.
- Compatibility with non-SGLang model serving backends beyond OpenAI-compatible proxying.
- Scaling limits and performance characteristics at very large worker fleet sizes.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 5 — setproctitle, aiohttp, orjson, uvicorn, fastapi |
| Maintenance | aging — 211 days since the last release |
| First released | |
| Downloads | 680,213/month — #5,366 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sglang_router-0.3.2-cp38-abi3-macosx_10_12_x86_64.whl; sglang_router-0.3.2-cp38-abi3-macosx_11_0_arm64.whl; sglang_router-0.3.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; sglang_router-0.3.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; sglang_router-0.3.2-cp38-abi3-musllinux_1_1_aarch64.whl; sglang_router-0.3.2-cp38-abi3-musllinux_1_1_x86_64.whl; sglang_router-0.3.2-cp38-abi3-win_amd64.whl
Tags
More Distributed Computing packages
gRPC Python is an HTTP/2-based RPC framework…
permissive · top 100 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
cloudpickleCloudpickle extends Python's standard pickle…
permissive · top 1,000 on PyPI
smart-openProvides a unified, open()-compatible Python…
permissive · top 1,000 on PyPI
portalockerPortalocker provides cross-platform file…
permissive · top 1,000 on PyPI
rayRay is a distributed computing framework that…
permissive · top 1,000 on PyPI
vllm-routerRoutes and load-balances requests across vLLM…
permissive · top 15,000 on PyPI
sanic-routingSanic-routing is a low-level AST-style router…
permissive · top 5,000 on PyPI
sglangSGLang is a serving framework that runs large…
permissive · top 1,000 on PyPI
vllmvLLM is a high-throughput inference and serving…
permissive · top 5,000 on PyPI
vllm-srRoutes LLM requests to appropriate models in a…
permissive · top 15,000 on PyPI
mooncake-transfer-engineMooncake Transfer Engine provides…
permissive · top 15,000 on PyPI
vllm-tpuvllm-tpu is a high-throughput LLM inference and…
permissive · top 15,000 on PyPI
smg-grpc-servicerProvides gRPC servicer implementations that…
permissive · top 5,000 on PyPI
semantic-routerSemantic Router routes LLM requests to…
permissive · top 15,000 on PyPI
pybgpkit-parserParses BGP (Border Gateway Protocol) update and…
permissive · top 15,000 on PyPI