Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

vLLM Semantic Router

Intelligent Router for Mixture-of-Models (MoM).

GitHub: https://github.com/vllm-project/semantic-router

Quick Start

Installation

# Install from PyPI
pip install vllm-sr

# Or install from source (development)
cd src/vllm-sr
pip install -e .

Usage

# Initialize vLLM Semantic Router Configuration
vllm-sr init

# Start the router (includes dashboard)
vllm-sr serve

# Open dashboard in browser
vllm-sr dashboard

# View logs
vllm-sr logs router
vllm-sr logs envoy
vllm-sr logs dashboard

# Check status
vllm-sr status

# Stop
vllm-sr stop

Features

  • Router: Intelligent request routing based on intent classification
  • Envoy Proxy: High-performance proxy with ext_proc integration
  • Dashboard: Web UI for monitoring and testing (http://localhost:8700)
  • Metrics: Prometheus metrics endpoint (http://localhost:9190/metrics)

Endpoints

After running vllm-sr serve, the following endpoints are available:

Endpoint Port Description
Dashboard 8700 Web UI for monitoring and Playground
API 8888* Chat completions API (configurable in config.yaml)
Metrics 9190 Prometheus metrics
gRPC 50051 Router gRPC (internal)

*Default port, configurable via listeners in config.yaml

Configuration

Plugin Configuration

The CLI supports configuring plugins in your routing decisions. Plugins are per-decision behaviors that customize request handling (security, caching, customization, debugging).

Supported Plugin Types:

  • semantic-cache - Cache similar requests for performance
  • jailbreak - Detect and block adversarial prompts
  • pii - Detect and enforce PII policies
  • system_prompt - Inject custom system prompts
  • header_mutation - Add/modify HTTP headers
  • hallucination - Detect hallucinations in responses
  • router_replay - Record routing decisions for debugging

Plugin Examples:

  1. semantic-cache - Cache similar requests:
plugins:
  - type: "semantic-cache"
    configuration:
      enabled: true
      similarity_threshold: 0.92  # 0.0-1.0, higher = more strict
      ttl_seconds: 3600  # Optional: cache TTL in seconds
  1. jailbreak - Block adversarial prompts:
plugins:
  - type: "jailbreak"
    configuration:
      enabled: true
      threshold: 0.8  # Optional: detection sensitivity 0.0-1.0
  1. pii - Enforce PII policies:
plugins:
  - type: "pii"
    configuration:
      enabled: true
      threshold: 0.7  # Optional: detection sensitivity 0.0-1.0
      pii_types_allowed: ["EMAIL_ADDRESS"]  # Optional: list of allowed PII types
  1. system_prompt - Inject custom instructions:
plugins:
  - type: "system_prompt"
    configuration:
      enabled: true
      system_prompt: "You are a helpful assistant."
      mode: "replace"  # "replace" (default) or "insert" (prepend)
  1. header_mutation - Modify HTTP headers:
plugins:
  - type: "header_mutation"
    configuration:
      add:
        - name: "X-Custom-Header"
          value: "custom-value"
      update:
        - name: "User-Agent"
          value: "SemanticRouter/1.0"
      delete:
        - "X-Old-Header"
  1. hallucination - Detect hallucinations:
plugins:
  - type: "hallucination"
    configuration:
      enabled: true
      use_nli: false  # Optional: use NLI for detailed analysis
      hallucination_action: "header"  # "header", "body", or "none"
  1. router_replay - Record decisions for debugging:
plugins:
  - type: "router_replay"
    configuration:
      enabled: true
      max_records: 200  # Optional: max records in memory (default: 200)
      capture_request_body: false  # Optional: capture request payloads (default: false)
      capture_response_body: false  # Optional: capture response payloads (default: false)
      max_body_bytes: 4096  # Optional: max bytes to capture (default: 4096)

Validation Rules:

  • Plugin Type: Must be one of: semantic-cache, jailbreak, pii, system_prompt, header_mutation, hallucination, router_replay
  • enabled: Must be a boolean (required for most plugins)
  • threshold/similarity_threshold: Must be a float between 0.0 and 1.0
  • max_records/max_body_bytes: Must be a positive integer
  • ttl_seconds: Must be a non-negative integer
  • pii_types_allowed: Must be a list of strings (if provided)
  • system_prompt: Must be a string (if provided)
  • mode: Must be "replace" or "insert" (if provided)

CLI Commands:

# Initialize config with plugin examples
vllm-sr init

# Validate configuration (including plugins)
vllm-sr validate config.yaml

# Generate router config with plugins
vllm-sr config router --config config.yaml

File Descriptor Limits

The CLI automatically sets file descriptor limits to 65,536 for Envoy proxy. To customize:

export VLLM_SR_NOFILE_LIMIT=100000  # Optional (min: 8192)
vllm-sr serve

License

Apache 2.0

Metadata

Release files for vllm-sr 0.1.0b2.dev20260125144457

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

Source distribution (sdist)

Source distribution for vllm-sr 0.1.0b2.dev20260125144457
File Size Uploaded Provenance Actions
vllm_sr-0.1.0b2.dev20260125144457.tar.gz 55.2 kB Without provenance Details for vllm_sr-0.1.0b2.dev20260125144457.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vllm-sr 0.1.0b2.dev20260125144457
File Interpreter ABI Platform Actions
vllm_sr-0.1.0b2.dev20260125144457-py3-none-any.whl Python 3 none any Details for vllm_sr-0.1.0b2.dev20260125144457-py3-none-any.whl

Total release size: 117.3 kB

Release files / vllm_sr-0.1.0b2.dev20260125144457.tar.gz

Download URL vllm_sr-0.1.0b2.dev20260125144457.tar.gz
Size 55.2 kB
Tags Source
SHA-256 checksum
How to use checksums
64253c9c1733de957aac2acbd33f521872996df45c47f1c9c74ba849e14f20ed
BLAKE2b-256 checksum
How to use checksums
f69da149a125fe0b717990f754b6df3398e5f640971bd8b5fef0f37b70e35cd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / vllm_sr-0.1.0b2.dev20260125144457-py3-none-any.whl

Download URL vllm_sr-0.1.0b2.dev20260125144457-py3-none-any.whl
Size 62.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93ab07180ff8323c7bdd9af97227282b0bbe753823f47661b7d21cf094b7e46d
BLAKE2b-256 checksum
How to use checksums
dc7b3661eb98c200ddfb4ecc52454155f0ea7a3f1318adad1984b551ddb44096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for vllm-sr 0.1.0b2.dev20260125144457

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

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