semantic-router
Super fast semantic router for AI decision making
Decision gist · record as of 2026-08-14
Yes, with conditions. Install if you need fast semantic intent classification in an LLM application and can manage an API key for embeddings (or use local models via optional dependencies). The low install friction, active maintenance, MIT license, and zero known vulnerabilities support adoption. The substantial dependency footprint is typical for LLM packages and not a blocker. Verify that your embedding provider and vector store choices align with your deployment model (cloud vs. local).AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires an API key for an encoder (OpenAI, Cohere, or similar); local execution available via optional dependencies.
- Low friction install with a pure-Python wheel.
- Active maintenance as of 19 days ago.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions, making it suitable for most production deployments.
last release 2026-07-26 (19 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 453,597 downloads/mo, #6,574 on PyPI
Alternatives
Verify before relying
pip install semantic-router
from semantic_router import Route
from semantic_router.routers import SemanticRouter
from semantic_router.encoders import OpenAIEncoder
routes = [Route(name="politics", utterances=["isn't politics the best thing ever"])]
encoder = OpenAIEncoder()
rl = SemanticRouter(encoder=encoder, routes=routes)
result = rl("don't you love politics?")
print(result.name)- Whether the package's performance claims (e.g., 'superfast', latency improvements over LLM-based routing) are independently validated.
- Support status and roadmap for the 13 runtime dependencies, particularly litellm and openai version compatibility.
- Whether multi-modal and hybrid routing features are production-ready or experimental.
What it is and what it does
Semantic Router is a decision-making layer for LLM applications that classifies user intents using semantic vector embeddings rather than generating LLM responses for routing. It defines a set of named routes, each associated with example utterances; incoming queries are embedded and matched against route embeddings to determine which decision path to take. If no route matches above a threshold, it returns None.
The package integrates with embedding providers (OpenAI, Cohere, Hugging Face, FastEmbed) and vector stores (Pinecone, Qdrant), and supports dynamic routes that can call functions or generate parameters. It's designed for chatbots, agents, and LLM applications where you need to branch logic based on user intent without the latency of full LLM inference for every routing decision.
Use it for
- Route chatbot conversations to different prompt templates or handlers based on detected topic (politics, chitchat, support requests).
- Classify incoming support tickets or healthcare administrative requests into workflow categories for downstream processing.
- Implement intent-based branching in LLM agents to decide which tool or API to call without waiting for LLM generation.
- Filter out-of-scope queries in production chatbots by detecting when user input doesn't match any known route.
- Optimize LLM pipeline latency by replacing slow LLM-based routing with fast semantic vector matching.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, with conditions.
Install if you need fast semantic intent classification in an LLM application and can manage an API key for embeddings (or use local models via optional dependencies). The low install friction, active maintenance, MIT license, and zero known vulnerabilities support adoption. The substantial dependency footprint is typical for LLM packages and not a blocker. Verify that your embedding provider and vector store choices align with your deployment model (cloud vs. local).
Install
semantic-router on PyPI
Before you install
Low friction install with a pure-Python wheel. Active maintenance as of 19 days ago. Requires 13 runtime dependencies including aiohttp, litellm, openai, pydantic, and numpy—a substantial dependency footprint typical of LLM-adjacent packages.
Requires an API key for an encoder (OpenAI, Cohere, or similar); local execution available via optional dependencies.
License in practice
MIT license permits commercial and private use with minimal restrictions, making it suitable for most production deployments.
Quickstart
pip install semantic-router
from semantic_router import Route
from semantic_router.routers import SemanticRouter
from semantic_router.encoders import OpenAIEncoder
routes = [Route(name="politics", utterances=["isn't politics the best thing ever"])]
encoder = OpenAIEncoder()
rl = SemanticRouter(encoder=encoder, routes=routes)
result = rl("don't you love politics?")
print(result.name)
Verify before relying
- Whether the package's performance claims (e.g., 'superfast', latency improvements over LLM-based routing) are independently validated.
- Support status and roadmap for the 13 runtime dependencies, particularly litellm and openai version compatibility.
- Whether multi-modal and hybrid routing features are production-ready or experimental.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <3.14,>=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 13 packagesaiohttpaurelio-sdkcoloramacolorloglitellmnumpyopenaipydanticpyyamlregextiktokentornadourllib3 |
| Maintenance | Actively maintained 19 days since the last release |
| First released | |
| Downloads | 453,597 / month, #6,574 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: semantic_router-0.1.16-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “semantic routing for llms”
- semantic-routerSemantic Router routes LLM requests to predefined decision paths…
- portkey-aiPortkey is a Python SDK that wraps OpenAI-compatible APIs to add…
- graphragGraphRAG extracts structured knowledge graphs from unstructured text…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also vllm-sr · sanic-routing · jupyter-ai-router · sglang-router · aiohttp-fast-url-dispatcher · llama-index-vector-stores-pinecone · vllm-router · llama-index-vector-stores-qdrant · memsearch · llama-index-vector-stores-milvus