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.7.0.tar.gz (2.2 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.7.0-cp38-abi3-win_amd64.whl (26.4 MB view details)

Uploaded CPython 3.8+Windows x86-64

smg-1.7.0-cp38-abi3-musllinux_1_1_x86_64.whl (29.9 MB view details)

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

smg-1.7.0-cp38-abi3-musllinux_1_1_aarch64.whl (31.5 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.1+ ARM64

smg-1.7.0-cp38-abi3-manylinux_2_28_aarch64.whl (31.4 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ ARM64

smg-1.7.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (29.8 MB view details)

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

smg-1.7.0-cp38-abi3-macosx_11_0_arm64.whl (28.7 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

smg-1.7.0-cp38-abi3-macosx_10_12_x86_64.whl (27.8 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for smg-1.7.0.tar.gz
Algorithm Hash digest
SHA256 be89d1b5f15f5f5da33a67d6fa3da069b28898415fcbc3586296edd1642f0953
MD5 17398c00a04be627896ca440568efaa5
BLAKE2b-256 f533f562f91223131dfb66eb9c648312025212233ecc7c5b039f310b024e01c0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smg-1.7.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 26.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.7.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 633047765f427ca8cb5acf7e25f3e1491cab64d119911abc0437caaa880e57af
MD5 73ecf901cba585ae5251361f563831a8
BLAKE2b-256 d16382f6f511ff9f0499d65b12cdaad60f42e907dc6dad98f1860d6c14ac6ac5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smg-1.7.0-cp38-abi3-musllinux_1_1_x86_64.whl
  • Upload date:
  • Size: 29.9 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.7.0-cp38-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 eab01ad8b048c7c0a613036196ca19715628ee410300dbe3571e8fd5d3080109
MD5 f8bc7560f0f356a2c7288f5a6392c31f
BLAKE2b-256 53fe47b3f7113d0586e08b72876edc1bc2dea14a6e21109dd01048e9b0f769ff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smg-1.7.0-cp38-abi3-musllinux_1_1_aarch64.whl
  • Upload date:
  • Size: 31.5 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.7.0-cp38-abi3-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 9ddab2ed83b8db12e4fe9944d1e83539ffa9c5ab930a8ead2001b93c01048f49
MD5 0fbde5063239cc0f85d981dffc04e71d
BLAKE2b-256 851dc964f97e9d00058221182089d9a4cc99f9f43b422ea06ba07b7782484276

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smg-1.7.0-cp38-abi3-manylinux_2_28_aarch64.whl
  • Upload date:
  • Size: 31.4 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.7.0-cp38-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4569026bdcfd2efbffff861118f3affa356bd1e6e9355a65c651493828b4d061
MD5 491b1a4be56c3b204e30be276266e7d6
BLAKE2b-256 336ba7b09ed2e97f58bc63f0eb57692bf41cf47d25094fe2cfaf6f2dc2fa4cd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for smg-1.7.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa16eaa052f92fec5f20347e07f9851dfc896cea2286086cc8bb9e0e897bd203
MD5 f2e22c6a6dcf738d33d4c1d3ef354544
BLAKE2b-256 aa1b4ae699bd35596917341c7358633c4108649e35cb464b42856a6ff0228048

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smg-1.7.0-cp38-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 28.7 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.7.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 08a0f6d74cdb6a26161ad9681d642a17f5cd9b6015f5f3ffad8a6cf697015e9d
MD5 445b7af850b9f3493351a3ede103feb3
BLAKE2b-256 71b7fde6bb92738e13c5ef94621de9021d3e9465843a1ea0487ed7fc8df14bf8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smg-1.7.0-cp38-abi3-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 27.8 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.7.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 38a3f4b54a60f14548169f347a85407e923be0850bd447706408d92957b5902d
MD5 db5cb34e8bd67e86840dd42c74aeeb77
BLAKE2b-256 ef09f37e5b8340cc66a722cd8b7eb15f21bd0a71228dd420419b66e7b66e6da3

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