Alma Version: 0.0.698
OS: macOS
日期: 2026-03-16
Alma 内置的 cloudflare-ai-gateway provider 存在以下问题:
可以获取模型列表,但在测试模型连接时失败
错误: Internal Server Error
根据 Cloudflare 官方文档,使用 BYOK (Bring Your Own Keys) 时:
路径应该是 /compat/chat/completions(不是 /openai/chat/completions)
需要 header: cf-aig-authorization: Bearer {CF_TOKEN}
Model 名称需要带提供商前缀,如 openai/gpt-5(不是 gpt-5)
不需要 Authorization header(因为 key 已存在 CF)
Alma 的 cloudflare-ai-gateway provider 可能:
没有使用 /compat 端点
没有正确发送 cf-aig-authorization header
没有给 model 名称加提供商前缀
在 Cloudflare Dashboard → AI Gateway → Provider Keys 添加 OpenAI API Key
在 Alma 配置 cloudflare-ai-gateway provider,填写 CF 认证 token
点击测试 OpenAI 模型 → 失败
手动用 curl 测试可以成功:
curl -X POST https://gateway.ai.cloudflare.com/v1/{account_id}/my-gateway/compat/chat/completions \
--header "cf-aig-authorization: Bearer $CF_TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"model": "openai/gpt-5",
"messages": [{"role": "user", "content": "Hi"}]
}'
Please authenticate to join the conversation.
In Review
Bug Reports
About 3 hours ago

Coffee
Get notified by email when there are changes.
In Review
Bug Reports
About 3 hours ago

Coffee
Get notified by email when there are changes.