AI API 网关服务,提供 OpenAI 兼容的 API 接口。
docker compose up --build -d创建 .env 文件配置服务:
# 登录服务地址
LOGIN_SERVICE_URL=http://localhost:5557
# 或使用远程服务器
# LOGIN_SERVICE_URL=https://aiapi-tool.example.com# 终端 1 - 启动 aiapi-tool
cd ../aiapi_tool
docker compose up -d
# 终端 2 - 启动 aiapi
cd ../aiapi
export LOGIN_SERVICE_URL=http://localhost:5557
docker compose up -d服务器 A (aiapi-tool):
cd aiapi_tool
docker compose up -d
# 服务运行在 http://server-a:5557服务器 B (aiapi):
cd aiapi
export LOGIN_SERVICE_URL=http://server-a:5557
docker compose up -d
# 服务运行在 http://server-b:5555export LOGIN_SERVICE_URL=https://login.example.com
docker compose up -dGET /chaynsapi/v1/models- 获取可用模型列表POST /chaynsapi/v1/chat/completions- 聊天补全POST /aichat/account/add- 添加账户GET curl http://localhost:5555/ /aichat/account/info- 查询账户信息GET /metrics- Prometheus 指标
# 测试模型列表
curl http://localhost:5555/chaynsapi/v1/models
# 测试聊天
curl -X POST http://localhost:5555/chaynsapi/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "GPT-4o",
"messages": [{"role": "user", "content": "Hello"}]
}'- aiapi-tool: 账户登录验证服务(独立部署)
- PostgreSQL/MySQL: 数据库(配置在 config.json)