--- title: Freebuff OpenAI Proxy emoji: 🚀 colorFrom: indigo colorTo: blue sdk: docker app_port: 7860 pinned: false --- # Freebuff OpenAI Proxy for Hugging Face Spaces 这是一个适配 **Hugging Face Docker Space** 的版本,保留了原项目的核心能力: - `/v1/chat/completions` - `/v1/responses` - `/v1/models` - `/v1/reset-run` - `/health` - 多账号轮询 - Agent Run 缓存 - 登录后自动追加到账号池 ## 部署方式 1. 新建一个 **Docker Space**。 2. 把本目录内的文件上传到 Space 根目录。 3. 推荐在 Space Settings -> Secrets 中配置: - `API_KEY`: 你的代理访问密钥(保护 `/v1/*`) - `ADMIN_PASSWORD`: 管理页密码(保护网页登录与账号管理) - `ACCOUNTS_JSON`: 可选,启动时预加载账号池 4. 打开 Space 首页,使用网页管理页完成登录或检查状态。 ## 可选的 ACCOUNTS_JSON 格式 ```json [ { "name": "account-1", "email": "a@example.com", "authToken": "xxx" }, { "name": "account-2", "email": "b@example.com", "authToken": "yyy" } ] ``` 也兼容原始的 `credentials.json` 结构: ```json { "default": { "name": "default", "email": "a@example.com", "authToken": "xxx" }, "accounts": [ { "name": "default", "email": "a@example.com", "authToken": "xxx" } ] } ``` ## 持久化存储 如果你的 Space 开启了持久化存储,程序会优先把凭据写入 `/data/manicode/credentials.json`。 未开启时会写到容器内普通目录,Space 重启后会丢失。 ## 接口示例 ```bash curl https://.hf.space/v1/chat/completions \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "model": "minimax/minimax-m2.7", "messages": [{"role": "user", "content": "你好"}], "stream": false }' ```