安装
本指南将帮助您安装和运行 vLLM Semantic Router。Router 完全在 CPU 上运行,推理不需要 GPU。
系统要求
注意
无需 GPU - Router 使用优化的 BERT 模型在 CPU 上高效运行。
要求:
- Python: 3.10 或更高版本
- 容器运行时: Docker 或 Podman(运行 Router 容器所需)
快速开始
1. 使用一键安装脚本(macOS/Linux)
curl -fsSL https://vllm-sr.ai/install.sh | bash
这个安装器会:
- 检测 Python 3.10 或更高版本
- 将
vllm-sr安装到~/.local/share/vllm-sr - 将 launcher 写入
~/.local/bin/vllm-sr - 默认为
vllm-sr serve准备 Docker 或 Podman,除非您显式跳过 - 默认自动执行一次
vllm-sr serve,并在可能时打开 dashboard - 如果无法自动打开浏览器,会打印 dashboard 地址和远程服务器访问提示
常用变体:
# 只安装 CLI
curl -fsSL https://vllm-sr.ai/install.sh | bash -s -- --mode cli
# 将本地 serve 固定为 Podman
curl -fsSL https://vllm-sr.ai/install.sh | bash -s -- --runtime podman
# 强制首次启动走 AMD / ROCm 路径
curl -fsSL https://vllm-sr.ai/install.sh | bash -s -- --platform amd
# 安装但不自动启动 serve + dashboard
curl -fsSL https://vllm-sr.ai/install.sh | bash -s -- --no-launch
# 跳过 runtime bootstrap,只执行用户态安装
curl -fsSL https://vllm-sr.ai/install.sh | bash -s -- --runtime skip
如果 ~/.local/bin 还不在您的 PATH 中,安装器会打印需要添加的 export 行。
Windows 用户请使用下面的手动 PyPI 安装流程。
2. 手动通过 PyPI 安装
# 创建虚拟环境(推荐)
python -m venv vsr
source vsr/bin/activate # Windows 上: vsr\Scripts\activate
# 从 PyPI 安装
pip install vllm-sr
验证安装:
vllm-sr --version
3. 之后再次启动 vllm-sr
vllm-sr serve
如果您没有使用 --no-launch,安装器已经自动帮您跑过一次 vllm-sr serve。
如果当前目录还没有 config.yaml,vllm-sr serve 会自动 bootstrap 一个最小 setup config,并以 setup mode 启动 dashboard。
Router 将:
- 自动下载所需的 ML 模型(约 1.5GB,一次性)
- 在端口 8700 上启动 dashboard
- 激活后在端口 8888 上启动 Envoy Proxy
- 激活后启动 Semantic Router 服务
- 在端口 9190 上启用 metrics
4. 打开 Dashboard
在浏览器中打开 http://localhost:8700。
如果您是在远程服务器上运行安装器,且浏览器没有自动打开,请使用安装器打印出的 URL 和 SSH tunnel 提示访问 dashboard。
首次使用时:
- 先配置一个或多个模型。
- 选择 routing preset,或保留 single-model baseline。
- 激活生成的配置。
激活后,config.yaml 会写入当前目录,Router 会退出 setup mode。
5. 测试 Router
curl http://localhost:8888/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "MoM",
"messages": [{"role": "user", "content": "Hello!"}]
}'