Status: [LIVE] Endpoints found: https://platform.openai.com/docs/api-reference/chat https://ark.cn-beijing.volces.com/api/v3 Source: https://github.com/cxl-nkb/ai-gateway # AI Gateway > 统一 LLM API 反向代理 —— 一个端点接入多家模型 provider。 [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org) [![FastAPI](https://img.shields.io/badge/FastAPI-0.141-009688)](https://fastapi.tiangolo.com) ## 它做什么 把客户端的 `POST /v1/chat/completions` 请求按模型名路由到对应的 provider (火山方舟、DeepSeek、minimax……),统一鉴权、限流、故障转移、日志。 客户端不用关心后端是哪个 provider、不用持有多个 API key、不用自己写重试。 ## 一图概览 ``` ┌──────────┐ POST /v1/chat/completions ┌─────────────┐ 路由+failover ┌──────────┐ │ Client │ ─────────────────────────────▶ │ AI Gateway │ ─────────────────▶ │ Provider │ │ (harness)│ Authorization: Bearer sk-xx │ (uvicorn) │ Bearer PROVIDER_KEY │ API │ └──────────┘ └─────────────┘ └──────────┘ │ ├── journald 日志(统一结构化 JSON) ├── /healthz, /v1/models └── SIGHUP 热重载 ``` ## 5 分钟快速跑起来(dev 模式) ```bash # 1. 装依赖(用 venv) python3 -m venv venv source venv/bin/activate pip install -r requirements.txt # 2. 配 provider key(火山/DeepSeek 任一即可) export VOLCENGINE_API_KEY="sk-你的火山 key" export DEEPSEEK_API_KEY="sk-你的 DeepSeek key" # 3. 改 config/config.yaml 里的 clients[*].api_key(默认是占位符) $EDITOR config/config.yaml # 4. 启æœ