EasyAI 是一个可本地运行、免费自部署的统一 LLM 接入层:一份 YAML 配置,屏蔽不同厂商的协议差异。
前置依赖:Docker + Docker Compose(可选 Python 3.11 + PyYAML,仅本地校验配置时需要)。
- OneAPI Gateway(统一
/v1/*入口、鉴权、限流、Batch API、首页导航;不含模型接入逻辑) - LiteLLM Proxy(官方镜像,模型接入面:provider 适配、别名、重试/故障转移、缓存、护栏、密钥/预算/用量控制台)
- Batch Worker(异步批处理消费)
- 控制台:LiteLLM Admin UI(支持中文)
- 可选聊天界面:Open WebUI(
--profile chat) - 镜像默认
ghcr.io/berriai/litellm:main-latest;可用LITELLM_IMAGE环境变量固定版本
docker compose up -d --build
docker compose exec -T ollama ollama pull qwen2.5:0.5b
curl -sS http://localhost:3004/healthz可选:中文聊天界面(Open WebUI)
docker compose --profile chat up -d打开:http://localhost:3004/(首页)· http://localhost:3005/ui(控制台)· http://localhost:3006(聊天,可选)。
发起一次请求(默认开发 key: dev-key):
curl -sS http://localhost:3004/v1/chat/completions \
-H "Authorization: Bearer dev-key" \
-H "Content-Type: application/json" \
-d '{"model":"chat","messages":[{"role":"user","content":"hello"}],"temperature":0}'cp config/easyai.production.example.yaml config/easyai.production.local.yaml
# 编辑并替换所有 REPLACE_WITH_*
python3 scripts/render-local-compose.py config/easyai.production.local.yaml > docker-compose.local.yml
docker compose -f docker-compose.yml -f docker-compose.local.yml up -d --build
docker compose -f docker-compose.yml -f docker-compose.local.yml exec -T ollama ollama pull qwen2.5:0.5b生产环境对外服务验收(smoke):
BASE_URL=http://localhost:3003 CONFIG_FILE=config/easyai.production.local.yaml ./scripts/smoke-compose.sh- 开发网关:
http://localhost:3004 - 生产网关(override):
http://localhost:3003 - 首页:
/ - API 文档:
/docs - OpenAPI JSON:
/openapi.json - 控制台(LiteLLM Admin UI,右上角可切换中文):
http://localhost:3005/ui,用户名admin,密码为secrets.master_key - 聊天:
/chat→ Open WebUI(可选组件) /dashboard会 302 到控制台
LITELLM_IMAGE=ghcr.io/berriai/litellm@sha256:<digest> docker compose up -d litellm
./scripts/smoke-compose.sh