The Rust load balancer that remembers what your GPUs already know
SMG exists so you can point all your LLM traffic—self-hosted or cloud—at one Rust gateway that actually understands what your GPU workers have already computed.
What it does
SMG is a Rust-based gateway that sits between your applications and a mix of self-hosted inference engines (vLLM, SGLang, TensorRT-LLM, MLX) and cloud providers (OpenAI, Anthropic, Gemini, xAI, and others). It exposes a single OpenAI-compatible API surface while handling routing, worker lifecycle management, multi-tenant auth, chat history storage, and MCP tool execution. Essentially, it treats HTTP and gRPC backends as interchangeable plugs behind one endpoint.
The interesting bit
The standout trick is cache-aware routing: SMG tracks each worker’s KV-cache state in radix trees to reuse prefixes across compatible engines, modeling load by looking at queued token work and KV pressure rather than just request counts. It also disaggregates prefill, decode, and even vision encoding into separate pipeline stages with DP-aware routing for data-parallel setups.
Key highlights
- Speaks OpenAI Chat Completions, Embeddings, Anthropic Messages, Gemini Interactions, the Responses API, Realtime over WebSocket/WebRTC, and MCP tool execution with approval policies
- 10 routing policies including
cache_aware,least_load, andpower_of_two, plus native Kubernetes pod discovery with label selectors - Streaming gRPC pipelines to engines with prefill/decode/encode disaggregation and zero-copy tokenization caching
- Enterprise controls: per-tenant priority admission with preemption, OIDC on the control plane, WebAssembly plugins for custom middleware, and pluggable chat-history backends (PostgreSQL, Oracle, Redis, or in-memory)
- Observability stack: 90+ Prometheus metrics, OpenTelemetry tracing with W3C context propagation into engines, and structured JSON logs
Verdict
Worth evaluating if you run a heterogeneous fleet of self-hosted GPUs alongside cloud API keys and want one consistent API facade for the lot. Probably overkill if you are calling a single OpenAI endpoint from a monolith.
Frequently asked
- What is smg-project/smg?
- SMG exists so you can point all your LLM traffic—self-hosted or cloud—at one Rust gateway that actually understands what your GPU workers have already computed.
- Is smg open source?
- Yes — smg-project/smg is open source, released under the Apache-2.0 license.
- What language is smg written in?
- smg-project/smg is primarily written in Rust.
- How popular is smg?
- smg-project/smg has 517 stars on GitHub.
- Where can I find smg?
- smg-project/smg is on GitHub at https://github.com/smg-project/smg.