[LIVE] [kiwik4954-glitch/bandready-openai-bridge] 1 endpoint(s)
ChatGPT
API Proxy/ChatGPT
2,132 characters
Status: [LIVE]
Endpoints found:
https://openrouter.ai/api/v1
Source: https://github.com/kiwik4954-glitch/bandready-openai-bridge
# BandReady × 任意 OpenAI 兼容网关(无本地模型桥接)
> 给 [BandReady / IELTS Prep](https://github.com/Luxshan2000/ielts-prep) 0.1.0 加一个本地反向代理,让它能直接用**任何需要 API Key 的 OpenAI 兼容网关**,而不是只能选 Ollama 或 OpenRouter。
>
> 不加载本地模型,不占显存,不转风扇。
## 问题
BandReady 0.1.0 的 `Settings → Providers` 只有两种选择:
- **Ollama**:`http://127.0.0.1:11434/v1`,Base URL **可以改**,但这个预设**没有 API Key 输入框**(它假定本地模型不需要鉴权);
- **OpenRouter**:Base URL 被**锁死**在 `https://openrouter.ai/api/v1`。
所以,如果你有一个自己的 OpenAI 兼容网关(需要 `Authorization: Bearer <key>`),直接填进去会被网关 401 拒绝。
## 思路
在 BandReady 和网关之间加一层**几 MB 的本地反向代理**:
```
BandReady ──(以为在跟 Ollama 说话)──▶ 127.0.0.1:11435 ──(自动注入 Bearer Key)──▶ 你的网关
```
BandReady 的 Ollama 预设本来就接受任意 Base URL,于是把它指向本地代理;代理在转发时补上 `Authorization` 头。
- 用 [Caddy](https://github.com/caddyserver/caddy)(60k+ stars,单文件、无运行时依赖、原生支持 SSE 流式);
- 代理只监听 `127.0.0.1`,不暴露到局域网;
- 不需要 Python / Node / Docker。
## 快速开始(Windows)
### 1. 安装 Caddy
```powershell
winget install --id CaddyServer.Caddy -e
```
### 2. 写配置
新建 `Caddyfile`(把网关地址和 Key 换成你自己的):
```caddyfile
http://127.0.0.1:11435 {
bind 127.0.0.1
reverse_proxy 127.0.0.1:8326 {
header_up Authorization "Bearer sk-your-gateway-key"
flush_interval -1
}
}
```
- `http://` 前缀是必须的,否则 Caddy 会把这个地址当成 HTTPS 站点;
- `bind 127.0.0.1` 保证只有本机能访问;
- `flush_interval -1` 关掉缓冲,流式输出才能逐字到达。