Cloudflare Workers AI
在 LibreChat 中将 Cloudflare Workers AI 配置为自定义 endpoint。
Cloudflare Workers AI 在 Cloudflare 的网络上运行开源模型,其 AI Gateway 提供了一个兼容 OpenAI 的 endpoint,该 endpoint 的作用域限定在您的账户和网关内。
获取 API key
按照 AI Gateway setup guide 的说明创建一个 AI Gateway,然后将您的凭据添加到 .env 文件中:
CF_API_TOKEN=your-api-key
CF_ACCOUNT_ID=your-account-id
CF_GATEWAY_ID=your-gateway-id配置
在您的 librechat.yaml 中的 endpoints.custom 下添加该 endpoint。baseURL 中嵌入了您的账户 ID 和网关 ID:
- name: "Cloudflare Workers AI"
apiKey: "${CF_API_TOKEN}"
baseURL: "https://gateway.ai.cloudflare.com/v1/${CF_ACCOUNT_ID}/${CF_GATEWAY_ID}/workers-ai/v1"
models:
default: [
"@cf/google/gemma-3-12b-it",
"@cf/meta/llama-4-scout-17b-16e-instruct",
"@cf/qwen/qwq-32b",
"@cf/qwen/qwen2.5-coder-32b-instruct",
"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
"@cf/openai/gpt-oss-120b"
]
fetch: false
titleConvo: true
titleModel: "@cf/google/gemma-3-12b-it"
modelDisplayLabel: "Cloudflare AI"注意事项
- 这使用了 Workers AI 的 OpenAI-compatible endpoint。请在 Workers AI model catalog 中浏览可用模型。
@cf/openai/gpt-oss-*模型可能会因为规范不兼容而无法工作。CF_API_TOKEN、CF_ACCOUNT_ID和CF_GATEWAY_ID变量名可以重命名,只要它们在.env和librechat.yaml中保持一致即可。
这篇指南怎么样?