Skip to main content

High-performance Rust-based inference gateway for large-scale LLM deployments

Project description

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. Centralizes worker lifecycle management, balances traffic across HTTP/gRPC/OpenAI-compatible backends, and provides enterprise-ready control over history storage, MCP tooling, and privacy-sensitive workflows.

SMG Architecture

Why SMG?

🚀 Maximize GPU Utilization Cache-aware routing understands your inference engine's KV cache state—whether vLLM, TensorRT-LLM, TokenSpeed, or SGLang—to reuse prefixes and reduce redundant computation.
🔌 One API, Any Backend Route to self-hosted models (vLLM, TensorRT-LLM, TokenSpeed, SGLang) or cloud providers (OpenAI, Anthropic, Gemini, Bedrock, and more) through a single unified endpoint.
⚡ Built for Speed Native Rust with gRPC pipelines, sub-millisecond routing decisions, and zero-copy tokenization. Circuit breakers and automatic failover keep things running.
🔒 Enterprise Control Multi-tenant rate limiting with OIDC, WebAssembly plugins for custom logic, and a privacy boundary that keeps conversation history within your infrastructure.
📊 Full Observability 40+ Prometheus metrics, OpenTelemetry tracing, and structured JSON logs with request correlation—know exactly what's happening at every layer.

API Coverage: OpenAI Chat/Completions/Embeddings, Responses API for agents, Anthropic Messages, and MCP tool execution.

Quick Start

Install — pick your preferred method:

# Docker
docker pull lightseekorg/smg:latest

# Python
pip install smg

# Rust
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 Cloud Providers
vLLM OpenAI
TensorRT-LLM Anthropic
TokenSpeed Google Gemini
SGLang AWS Bedrock
Ollama Azure OpenAI
Any OpenAI-compatible server Any OpenAI-compatible provider

Features

Feature Description
8 Routing Policies cache_aware, round_robin, power_of_two, consistent_hashing, prefix_hash, manual, random, bucket
gRPC Pipeline Native gRPC with streaming, reasoning extraction, and tool call parsing
MCP Integration Connect external tool servers via Model Context Protocol
High Availability Mesh networking with SWIM protocol for multi-node deployments
Chat History Pluggable storage: PostgreSQL, Oracle, Redis, or in-memory
WASM Plugins Extend with custom WebAssembly logic
Resilience Circuit breakers, retries with backoff, rate limiting

Documentation

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 Contributing Guide for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smg-1.8.0.tar.gz (3.1 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

smg-1.8.0-cp38-abi3-win_amd64.whl (27.4 MB view details)

Uploaded CPython 3.8+Windows x86-64

smg-1.8.0-cp38-abi3-musllinux_1_1_x86_64.whl (30.7 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.1+ x86-64

smg-1.8.0-cp38-abi3-musllinux_1_1_aarch64.whl (32.3 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.1+ ARM64

smg-1.8.0-cp38-abi3-manylinux_2_28_aarch64.whl (32.1 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ ARM64

smg-1.8.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (30.6 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

smg-1.8.0-cp38-abi3-macosx_11_0_arm64.whl (29.4 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

smg-1.8.0-cp38-abi3-macosx_10_12_x86_64.whl (28.5 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file smg-1.8.0.tar.gz.

File metadata

  • Download URL: smg-1.8.0.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for smg-1.8.0.tar.gz
Algorithm Hash digest
SHA256 e54d459690d07d4a80ea5f46a8c70fb297ab045be9c60810f34fa8862397a730
MD5 5d3de0a2f8fc3c792008f7a4a4696ab8
BLAKE2b-256 5cd1df3c26b65be017681ee35780305a7641ad274c50b377827746743328bad1

See more details on using hashes here.

File details

Details for the file smg-1.8.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: smg-1.8.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 27.4 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for smg-1.8.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 220beecd703d3169dfc6233d3cd8351ec29cd5f0dabcd1190ad3f9605e00ba29
MD5 c55f6443f9624c02f2b394af5d9c4198
BLAKE2b-256 8d2d008ca4c0ffa6d892de3919ba3c4ab6296c942101743af216b31a8c13d19d

See more details on using hashes here.

File details

Details for the file smg-1.8.0-cp38-abi3-musllinux_1_1_x86_64.whl.

File metadata

  • Download URL: smg-1.8.0-cp38-abi3-musllinux_1_1_x86_64.whl
  • Upload date:
  • Size: 30.7 MB
  • Tags: CPython 3.8+, musllinux: musl 1.1+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for smg-1.8.0-cp38-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 938e130078299ef7445afbbc2a12ff1d3b6adc088b77830b0dc01d7d2d7cf5e0
MD5 20b2d120747987542f427e832114ef85
BLAKE2b-256 c19fe32f8076ceaf2a9518c496c9c9c900f474c6b3d796e3ce99a89992d5568c

See more details on using hashes here.

File details

Details for the file smg-1.8.0-cp38-abi3-musllinux_1_1_aarch64.whl.

File metadata

  • Download URL: smg-1.8.0-cp38-abi3-musllinux_1_1_aarch64.whl
  • Upload date:
  • Size: 32.3 MB
  • Tags: CPython 3.8+, musllinux: musl 1.1+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for smg-1.8.0-cp38-abi3-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 04d32e79989ef9deff9e5d231b47bf481a33cd95dabafbffdbc3d700aaf24224
MD5 3730ca3ab1edcbf702e0c3dcba17f924
BLAKE2b-256 8cd47b0ae89a9e42c234d14ead93b07a551e579c3850d9ac59f5ff67f3ff6023

See more details on using hashes here.

File details

Details for the file smg-1.8.0-cp38-abi3-manylinux_2_28_aarch64.whl.

File metadata

  • Download URL: smg-1.8.0-cp38-abi3-manylinux_2_28_aarch64.whl
  • Upload date:
  • Size: 32.1 MB
  • Tags: CPython 3.8+, manylinux: glibc 2.28+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for smg-1.8.0-cp38-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3eb71238a5409a84704711612bb57a2993b83cd74db3f82c4697d0bbd5a3069e
MD5 fc36432089a5dc98bb91aa5f367d0183
BLAKE2b-256 407920400899376b751f5427a0e31dfff44dd35f64adfdaa472f5164ac51f781

See more details on using hashes here.

File details

Details for the file smg-1.8.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for smg-1.8.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0677bb534f5f6ee4ebc0ee198ff7720da43e2c833610e2530a8460bb58947f86
MD5 7fe6b6968af515b867cb7abcac7b03ee
BLAKE2b-256 f6f5935d9dedbf66fb0851b567871fbfc75fa072bc6394d639363c7f456bad6b

See more details on using hashes here.

File details

Details for the file smg-1.8.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: smg-1.8.0-cp38-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 29.4 MB
  • Tags: CPython 3.8+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for smg-1.8.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 650789635dfd2ac81b493ea1e2180bb2a12ae2569a7383bc4df358fddf1217f2
MD5 6dd7bdc1396a8f951ab82a53953402ef
BLAKE2b-256 4ef4e13a0237f74258a5f05fb74a58330c9718544afc6b9b431fe8208f8668e5

See more details on using hashes here.

File details

Details for the file smg-1.8.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: smg-1.8.0-cp38-abi3-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 28.5 MB
  • Tags: CPython 3.8+, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for smg-1.8.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0fb8df8d23724e2d22a51b2b699306c1edbe123335f450195300d313976012aa
MD5 212bf0015cca91c973b108f320fa60b8
BLAKE2b-256 d1c03dbea5655365f37f8d6506fcfd31f9422846b55125d724aca505559b7170

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page