MASS-Base(Model-as-a-Service Base)是一个开源的模型服务(Model-as-a-Service)基础平台,用于高效管理和调度 AI 模型推理服务。它支持多种推理引擎(vLLM、SGLang、TensorRT-LLM 等),可跨多节点进行性能优化与资源编排。
MASS-Base 由以下核心组件构成:
详细架构说明请参见 架构文档。
MASS-Base 支持多种部署方式,请根据场景选择:
| 部署方式 | 适合场景 | 文档 |
|---|---|---|
| Docker 单容器 | 快速体验、演示、单节点 | 下方快速开始 |
| Docker Compose | 开发测试、小团队、含监控部署 | Docker Compose 部署指南 |
| Kubernetes (Helm) | 生产环境、大规模、多节点 | Kubernetes 部署指南 |
sudo docker run -d --name mass-base \
--restart unless-stopped \
-p 80:80 \
--volume mass-base-data:/var/lib/mass-base \
mass-base/mass-base
sudo docker run -d --name mass-base \
--restart unless-stopped \
--privileged \
--network host \
--ipc host \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/run/cdi:/var/run/cdi \
-v mass-base-data:/var/lib/mass-base \
-v /var/lib/kubelet/device-plugins:/var/lib/kubelet/device-plugins \
-e NVIDIA_VISIBLE_DEVICES=all \
-e NVIDIA_DRIVER_CAPABILITIES=compute,utility \
mass-base/mass-base
sudo docker exec mass-base cat /var/lib/mass-base/initial_admin_password
在浏览器中打开 http://<服务器IP>,使用用户名 admin 和上一步获取的密码登录。
使用 API Key 调用 OpenAI 兼容接口:
export MASS_API_KEY=your_api_key
curl http://your_mass_base_server_url/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MASS_API_KEY" \
-d '{
"model": "your-model-name",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Tell me a joke." }
],
"stream": true
}'
如需更详细的部署说明(含 Docker Compose 完整监控栈、Worker 节点独立部署、Kubernetes Helm 部署等),请参见:
安装 Python 3.10 ~ 3.12。
执行构建:
make build
构建产物位于 dist 目录。
make package
注意: 镜像构建仅支持 Linux/macOS。
# 安装开发依赖
make install
# 本地开发启动(需先运行数据库)
uv run gpustack start \
--database-url postgresql://postgres:mysecretpassword@localhost:5432/postgres \
--gateway-mode disabled \
--api-port 80
| 命令 | 说明 |
|---|---|
make install |
安装 uv、同步依赖、设置 pre-commit hooks |
make deps |
同步锁定依赖 |
make generate |
生成代码(OpenAPI Client 等) |
make lint |
运行代码检查(flake8、black 等) |
make test |
运行单元测试 |
make build |
构建 wheel 包 |
make ci |
完整 CI 流水线 |
详细开发指南请参见 Development Guide。
完整文档请访问 官方文档站点。
项目内文档:
有任何问题或建议,欢迎加入我们的 Discord 社区 获取支持。
Copyright (c) 2024-2026 The MASS-Base authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at LICENSE.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.