10,000 neurons/day free; the URL contains your account ID. curl, Python and JavaScript samples, live testing.
- Type
- Provider
- Provider
- Cloudflare Workers AI
- Pricing
- Free + paid
- Keyless access
- No
- Key variable
CLOUDFLARE_API_TOKEN- Base URL (OpenAI-compatible)
https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/v1- Inputs
- Text
- Developer rating
- Not rated yet
- Documentation
- https://developers.cloudflare.com/workers-ai/platform/pricing/
- Last check
- 2026-12-04T20:20:29+00:00
Code samples
cURL
curl https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-d '{"model":"MODEL_NAME","messages":[{"role":"user","content":"Hello, introduce yourself in one sentence."}]}'Python
# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/v1", api_key=os.environ["CLOUDFLARE_API_TOKEN"])
r = client.chat.completions.create(
model="MODEL_NAME",
messages=[{"role": "user", "content": "Hello, introduce yourself in one sentence."}],
)
print(r.choices[0].message.content)JavaScript
// npm install openai
import OpenAI from 'openai'
const client = new OpenAI({ baseURL: 'https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/v1', apiKey: process.env.CLOUDFLARE_API_TOKEN })
const r = await client.chat.completions.create({
model: 'MODEL_NAME',
messages: [{ role: 'user', content: 'Hello, introduce yourself in one sentence.' }],
})
console.log(r.choices[0].message.content)
Popular searches
Frequently asked questions
Is the Cloudflare Workers AI API free?
Cloudflare Workers AI offers a limited free tier; beyond it, usage is paid.