Skip to main content

SMG Logo

Shepherd Model Gateway

Release Docker PyPI License Docs Discord Slack Ask DeepWiki PyTorch Blog

Engine-agnostic, high-performance model-routing gateway for large-scale LLM deployments. SMG centralizes worker lifecycle management, balances traffic across self-hosted engines and cloud providers, and gives you enterprise-grade control over multi-tenancy, chat-history storage, MCP tooling, and observability — behind one unified endpoint.

SMG architecture: clients flow through the gateway layer and router layer to gRPC workers, HTTP workers, and external APIs

Why SMG?

🚀 Maximize GPU Utilization Cache-aware routing tracks each worker's KV-cache state in radix trees to reuse prefixes across SGLang, vLLM, TensorRT-LLM, TokenSpeed, and MLX — with load modeling that accounts for queued token work and KV pressure.
🔌 One API, Any Backend Route to self-hosted engines over HTTP or gRPC, or to OpenAI, Anthropic, Gemini, and xAI — plus any OpenAI-compatible endpoint — through a single unified gateway.
⚡ Built for Speed Native Rust with streaming gRPC pipelines, cached tokenization with zero-copy cache hits, prefill/decode disaggregation (including a separate encode stage for vision), and DP-aware routing for data-parallel engines.
🔒 Enterprise Control Priority admission scheduling with preemption and per-tenant controls, API-key auth with OIDC on the control plane, WebAssembly plugins for custom logic, and chat history that never leaves your infrastructure.
📊 Full Observability 90+ Prometheus metrics, OpenTelemetry tracing with W3C trace context propagated into the engines over both HTTP and gRPC, and structured JSON logs with request correlation.

API Coverage: OpenAI Chat Completions, Completions, Embeddings, Rerank, and Classify; Responses and Conversations APIs for agents; Anthropic Messages; Gemini Interactions; Realtime over WebSocket and WebRTC; audio transcription; tokenize/detokenize; and MCP tool execution with approval policies in the Responses and Messages APIs.

Quick Start

Install — pick your preferred method:

# Docker
docker pull lightseekorg/smg:latest

# Kubernetes (Helm)
helm install smg oci://ghcr.io/smg-project/charts/smg

# Python
pip install smg

# Rust (needs protoc)
cargo install smg

Run — point SMG at your inference workers:

# Single worker
smg launch --worker-urls http://localhost:8000

# Multiple workers with cache-aware routing
smg launch --worker-urls http://gpu1:8000 http://gpu2:8000 --policy cache_aware

# With high availability mesh
smg launch --worker-urls http://gpu1:8000 --enable-mesh \
  --mesh-advertise-host 10.0.0.1 --mesh-peer-urls 10.0.0.2:39527

Use — send requests to the gateway:

curl http://localhost:30000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "llama3", "messages": [{"role": "user", "content": "Hello!"}]}'

That's it. SMG is now load-balancing requests across your workers.

Supported Backends

Self-Hosted Engines vLLM · SGLang · TokenSpeed · TensorRT-LLM · MLX (Apple Silicon) · any OpenAI-compatible server (e.g. Ollama)
Cloud Providers OpenAI · Anthropic · Google Gemini · xAI · OCI Generative AI · AWS Bedrock · Azure OpenAI · any OpenAI-compatible provider (Groq, Together, …)

Features

Feature Description
10 Routing Policies cache_aware, least_load, power_of_two, consistent_hashing, prefix_hash, bucket, round_robin, random, manual, passthrough
gRPC Pipeline Native streaming gRPC to the engines with prefill/decode and encode disaggregation and DP-aware routing
Kubernetes Discovery Native pod watchers with label selectors, per-role prefill/decode/encode selectors, and router peer discovery
Model Parsers 21 tool-call parsers and 16 reasoning parsers with automatic model detection — DeepSeek, Qwen, Kimi, GLM, Llama, Mistral, Command, Nemotron, and more
MCP Integration Tool discovery and execution over stdio, SSE, and streamable HTTP, with approval policies and audit logging
High Availability Mesh networking with SWIM gossip and CRDT-replicated state for multi-node deployments
Chat History Pluggable storage with schema migrations: PostgreSQL, Oracle, Redis, or in-memory
WASM Plugins Extend request and response handling with custom WebAssembly middleware
Resilience Circuit breakers, retries with backoff and jitter, rate limiting, and priority admission scheduling

Documentation

Full documentation lives at lightseek.org/smg.

Getting Started Installation and first steps
Architecture How SMG works
Configuration CLI reference and options
API Reference OpenAI-compatible endpoints
Kubernetes Setup In-cluster discovery and production setup

Contributing

We welcome contributions! See the Contributing Guide for details.

Release files for tokenspeed-smg 1.9.0.post20260802

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

Source distribution (sdist)

Source distribution for tokenspeed-smg 1.9.0.post20260802
File Size Uploaded
tokenspeed_smg-1.9.0.post20260802.tar.gz 3.2 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for tokenspeed-smg 1.9.0.post20260802
File Interpreter ABI Platform
tokenspeed_smg-1.9.0.post20260802-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
tokenspeed_smg-1.9.0.post20260802-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details

Total release size: 66.2 MB

Release files / tokenspeed_smg-1.9.0.post20260802.tar.gz

Download URL tokenspeed_smg-1.9.0.post20260802.tar.gz
Size 3.2 MB
Tags Source
SHA-256 checksum
How to use checksums
dee1d5c645602d697dca00551460dfeaead86564c11cd258878c3cd3a4a6b89a
BLAKE2b-256 checksum
How to use checksums
50b2005327310bdd66da576653af7f12f67ef0217928dd93271d2072d97bd947
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / tokenspeed_smg-1.9.0.post20260802-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL tokenspeed_smg-1.9.0.post20260802-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 30.7 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
0f1215f85a29707574d82d15bf0070c3c2d67e7306f28de0a8568ef899460576
BLAKE2b-256 checksum
How to use checksums
f170fb56f8611d9dd25945759ffefbfcfee58fb7a5e0a1ee2b82d345f6108385
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / tokenspeed_smg-1.9.0.post20260802-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL tokenspeed_smg-1.9.0.post20260802-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 32.3 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
95145b0f29b8e5baf4753d86c03a81fea8a00e80879e6a567522b515e9395fea
BLAKE2b-256 checksum
How to use checksums
eebc4606f10ff43a584d42c96deabfc6deed1dea0dcfbd7d55ace05928c5bc90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.9.0.post20260802 This release

3 release files

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