AI API 代理
跑在 EdgeOne 边缘函数上的反向代理,路径第一段决定上游,方法 / 请求头 / 请求体 / 响应原样透传(含 SSE 流式)。
路径映射
| 请求路径 | 转发目标 |
|---|---|
/cmdc/* | https://api.commandcode.ai/* |
/cline/* | https://api.cline.bot/* |
/cmdc/v1/messages?beta=true → https://api.commandcode.ai/v1/messages?beta=true
使用方式
把客户端里的 Base URL 换成代理域名加前缀即可:
https://api.commandcode.ai → https://<你的域名>/cmdc
https://api.cline.bot → https://<你的域名>/cline
curl https://<你的域名>/cline/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"your-model","messages":[{"role":"user","content":"你好"}],"stream":true}'
const client = new OpenAI({ baseURL: "https://<你的域名>/cline/v1", apiKey: API_KEY });
限制
- 最大连接时间 300s,超时会被中断。
- 单次请求体上限 1 MB。
- 鉴权头原样透传,代理不持有任何密钥。
- 未知前缀返回
404并列出可用前缀。