← Back to Leaderboard
Ssmg-project

smg-project/smg

Rust LLM gateway for cache-aware routing across local engines and cloud APIs

Engineering Health (Methodology)
A+ · 95/100
Maintenance Activity
● Updated today
Latest Release
v1.15.0
Commercial License Check
Apache-2.0 · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption20/25
Release Cadence20/20
License Clarity20/20
DockerSelf-HostedAPICLIGPU
Total Stars
★ 764
24h Growth
+2
7d Growth
+14
Forks
237

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

smg-project/smg Star History (2026-01-02 - 2026-12-04) ALL-TIME STAR HISTORY (2026-01 – 2026-12) +763 in 336d · avg +2/day 807 404 0 2026-01-02: ★ 12026-01-24: ★ 82026-02-14: ★ 222026-03-07: ★ 762026-03-28: ★ 1292026-04-18: ★ 1692026-05-09: ★ 2322026-05-30: ★ 2932026-06-20: ★ 3382026-07-11: ★ 3782026-08-01: ★ 4272026-08-22: ★ 4672026-09-12: ★ 5162026-10-03: ★ 5512026-10-24: ★ 6722026-11-14: ★ 7222026-12-04: ★ 764 ★ 764 2026-01 2026-06 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

Shepherd Model Gateway (SMG) is a Rust serving gateway, not a model runtime. A client sends requests to a unified endpoint; SMG chooses an upstream and routes to self-hosted workers over HTTP or streaming gRPC, or to a cloud API. On supported gRPC paths, the gateway can route around data-parallel replicas and coordinate separate prefill and decode roles, with an additional encode stage for vision workloads.

The Cargo workspace separates model_gateway from crates such as crates/protocols, crates/service_discovery, crates/grpc_client, crates/engine_servicer, crates/kv_index, and crates/tokenizer. Tokenization caching supports zero-copy hits. WASM plugins extend request and response handling; MCP integration handles tool discovery and execution over stdio, SSE, or streamable HTTP, with approvals and audit logging.

Key Capabilities & Differentiators

SMG routes to vLLM, SGLang, TokenSpeed, TensorRT-LLM, MLX on Apple Silicon, and OpenAI-compatible servers, as well as providers including OpenAI, Anthropic, Gemini, xAI, AWS Bedrock, and Azure OpenAI. Its client-facing surface includes Chat Completions, Embeddings, Responses and Conversations, Anthropic Messages, Gemini Interactions, and Realtime over WebSocket or WebRTC. Validate the specific endpoint, model, and upstream combination before migrating clients; gateway API coverage does not guarantee identical behavior across providers.

The ten routing policies include cache_aware, least_load, prefix_hash, and round_robin. Cache-aware routing tracks worker KV prefixes in radix trees, while load modeling accounts for queued token work and KV pressure. The parser catalog covers 21 tool-call and 16 reasoning parsers, with automatic model detection for families including DeepSeek, Qwen, and Kimi. Per-tenant admission controls and 90+ Prometheus metrics give operators tools to manage and observe a shared serving fleet.

Trade-offs & Limitations

Compared with calling vLLM directly, SMG adds a hop and a service to operate. That cost is easier to justify when shared traffic rules, tenant admission, or KV-prefix reuse can improve fleet-wide operation. Benchmark cache-aware routing against a simpler policy with your own prompt mix and concurrency: prefix reuse depends on the workload, and gRPC load reporting and disaggregated serving should not be assumed available on every upstream path.

Compared with calling the OpenAI API directly, SMG gives operators control over routing and storage and lets clients reach both local and cloud backends through one gateway. It does not eliminate provider charges or differences in streaming, tool calls, or error behavior. Multi-node deployments add peer discovery and SWIM/CRDT state replication; persistent chat history adds a storage service and schema migrations. Apache-2.0 covers the gateway, not model weights or provider terms.

Hardware & Deployment Guide

Distribution options include lightseekorg/smg:latest, the Helm chart at oci://ghcr.io/smg-project/charts/smg, pip install smg, and cargo install smg, which requires protoc. Start with smg launch --worker-urls http://localhost:8000; the example client endpoint is http://localhost:30000/v1/chat/completions. Kubernetes can discover workers by pod label, including separate selectors for prefill, decode, and encode. Chat history can use PostgreSQL, Oracle, Redis, or in-memory storage; an external database is not required just to route requests.

Size the gateway and model workers separately: profile gateway CPU and memory under realistic streaming concurrency, and size worker VRAM for the chosen models, context lengths, concurrent sequences, and KV-cache demand. An on-premises-only inference path requires local backends and review of any enabled external integrations. v1.14.0 made Symphony the default parser and added a direct ZMQ path for TokenSpeed. v1.15.0 made the Rust engine servicer the default for vLLM, TokenSpeed, and SGLang, added streaming worker-load updates for gRPC, and made cache-aware routing track hybrid-model KV-cache groups.

Routing: Ten policies, including radix-tree KV-prefix routing and load modeling based on queued token work and KV pressure.
Engine transport: Streaming gRPC with data-parallel-aware routing; supports separate prefill, decode, and vision encode stages.
Kubernetes and HA: Pod discovery with per-role selectors; gateway peers replicate state using SWIM gossip and CRDTs.
Admission and identity: Priority scheduling with preemption, per-tenant controls, API keys, and control-plane OIDC.
Extensibility and storage: WASM request/response middleware, MCP tool approvals and audit logging, and PostgreSQL, Oracle, Redis, or in-memory chat history.
Observability: 90+ Prometheus metrics, correlated JSON logs, and W3C trace-context propagation over HTTP and gRPC.
Best For

Platform teams unifying several GPU workers or cloud providers behind one endpoint, with shared routing, tenant admission controls, and observability.

Skip If

You need a runtime that loads model weights, or you have one stable upstream and no operational reason to add a gateway.

Reviewed on 2026-12-03 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

DockerSelf-HostedAPICLI
# 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

Comparison vs. Top LLMs & Inference Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
smg ★764+14RustApache-2.0Rust LLM gateway for cache-aware routing across local engines and cloud APIs
OmniRoute92.1k+1.5kTypeScriptMITSelf-hosted OpenAI-compatible gateway for multi-provider routing and fallback
gpt-load7.2k+6GoMITSelf-hosted Go gateway for routing LLM traffic across providers and credentials
freellmapi62k+2.6kTypeScriptMITSelf-hosted LLM gateway for routing across free tiers and custom endpoints

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/smg-project/smg.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

smg-project/smg Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about smg

How do I put SMG in front of an existing inference worker?

Start an inference worker separately, then point SMG at it with smg launch --worker-urls http://localhost:8000. Send a request to the gateway at /v1/chat/completions on port 30000. To add another worker, extend the URL list. Use --policy cache_aware only after confirming that the chosen engine and transport expose the cache information the policy needs.

Does the gateway need a GPU, and how should I size the fleet?

SMG routes requests; the backend engines load the models and determine GPU and VRAM requirements. Size worker VRAM for weights, context lengths, concurrent sequences, and KV-cache demand. Size the gateway separately by measuring CPU and memory under representative tokenization, streaming, plugin, and routing loads. There is no single hardware footprint for all deployments.

Can we use it commercially and keep inference data on premises?

Apache-2.0 permits commercial use and self-hosting subject to its terms, including applicable notice obligations when redistributing the software. Review model licenses, provider terms, and your own data-handling requirements separately. Self-hosting the gateway does not keep prompts on premises if they are routed to a cloud provider.

When is SMG worth adding instead of calling vLLM or OpenAI directly?

Call the backend directly if you have one stable destination, already have the controls you need, and want fewer components to run. Add SMG when several services need one endpoint for multiple engines or providers, or when shared routing, tenant admission controls, or observability justify a separate gateway. SMG neither replaces the local runtime nor removes provider charges.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining smg-project/smg? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature smg-project/smg on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare