Cloudflare Workers AI
Configure Cloudflare Workers AI as a custom endpoint in LibreChat.
Cloudflare Workers AI runs open models on Cloudflare's network, and its AI Gateway exposes an OpenAI-compatible endpoint scoped to your account and gateway.
Get an API key
Create an AI Gateway by following the AI Gateway setup guide, then add your credentials to your .env file:
CF_API_TOKEN=your-api-key
CF_ACCOUNT_ID=your-account-id
CF_GATEWAY_ID=your-gateway-idConfiguration
Add the endpoint under endpoints.custom in your librechat.yaml. The baseURL embeds your account ID and gateway 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"Notes
- This uses the OpenAI-compatible endpoint of Workers AI. Browse available models in the Workers AI model catalog.
@cf/openai/gpt-oss-*models may not work due to spec incompatibility.- The
CF_API_TOKEN,CF_ACCOUNT_ID, andCF_GATEWAY_IDvariable names can be renamed as long as they match between your.envandlibrechat.yaml.
How is this guide?