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.9.0.tar.gz (3.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.9.0-cp38-abi3-win_amd64.whl (27.6 MB view details)

Uploaded CPython 3.8+Windows x86-64

smg-1.9.0-cp38-abi3-musllinux_1_1_x86_64.whl (30.8 MB view details)

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

smg-1.9.0-cp38-abi3-musllinux_1_1_aarch64.whl (32.4 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.1+ ARM64

smg-1.9.0-cp38-abi3-manylinux_2_28_aarch64.whl (32.3 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ ARM64

smg-1.9.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (30.7 MB view details)

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

smg-1.9.0-cp38-abi3-macosx_11_0_arm64.whl (29.6 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

smg-1.9.0-cp38-abi3-macosx_10_12_x86_64.whl (28.7 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for smg-1.9.0.tar.gz
Algorithm Hash digest
SHA256 a075234d6d21a2aea0494ad599bfce2a81d11e8a1a1d9bb4e4f0f12f5a2031b6
MD5 19d1c625fd97f0a12ec82fd9bf7ffa0e
BLAKE2b-256 13c87707780338e7bd79769ba521a86f73c8272468c58006685ab9b2feacf221

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for smg-1.9.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e3e5396f32041b73eda166476d18b2978288d8a88f6ff3d03d07236cdc2c8beb
MD5 f8088a4534c7b6e13ba5631a6dcb68a7
BLAKE2b-256 cc7173c455cfc449f7c6227382487de3937f55576b27d1d7d433b3e0b52ec3f9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for smg-1.9.0-cp38-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 11c2bea9079a15681c5d2c23ca4fdac47d4781a80d85317d1e7f479ab059a9dd
MD5 9dd42e524a82d677ba40787723ddc24c
BLAKE2b-256 5c59b8d1e3abdfd9e4f901bf2e444d69bf4e914261518090d64f199c3d3e347f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for smg-1.9.0-cp38-abi3-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 3cce9c414271dea3aff43503251176d46d1ca793dcad0eed40aa65e1c7d759f9
MD5 d30f0a5ee4b84baf026c3f4b72e684bc
BLAKE2b-256 9da52ca1b5bbc9bf8ebbbd23eb77cf7dba30214715693e80c7839502271544ba

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for smg-1.9.0-cp38-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cb0462657ecfb8179f3781023d61a5ca92ff26f48557b196e5e4f74e5cbad25d
MD5 d93b1a893aed6d9e460a5d53dc88ba79
BLAKE2b-256 e2ae9eb904c003c6d45d34f75d97ccd1a3fcb5520c09ee83718e83c013858afe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for smg-1.9.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 38261c1de77f10f8b16fffe20d19235f6c888d2e257029f6c0e66071e62d1446
MD5 0c1c19590c07ff58292c2f7a7175db04
BLAKE2b-256 3c2d1648875495491340ae4353c3c05c04b07b514636bb0d7b408b6120756d32

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for smg-1.9.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 434aafd441371d77c24a9394ee28e1c7d2639ecdc20c16706c1250eb869edb64
MD5 71f7db830c50a4f937ef803b3fb93c2b
BLAKE2b-256 3c3f665815ad5bb50cbe70886251ff99f8186247902314d075585f8a8747a41e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for smg-1.9.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5fbd15207618b28f7bd3f55555e7c8f318724b585015ff373e5d134a8333cc9e
MD5 fcaa9a2b922a79bd586f81509e193872
BLAKE2b-256 c78b7b174d90aa4686d9d12b7ee22e3863ea1431435c49b5f6f3e28f7263ff19

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