Cloudflare Workers AI
Cloudflare Workers AI runs inference at the edge — no cold starts, no GPU provisioning. Use it for fast, serverless inference with models hosted on Cloudflare's global network.
Setup
# 1. Get your API token from the Cloudflare dashboard
# https://dash.cloudflare.com/profile/api-tokens
# Create a token with "Workers AI" permissions
# 2. You also need your Cloudflare Account ID
# Found at https://dash.cloudflare.com/ → right sidebar
export CLOUDFLARE_API_TOKEN=...
export CLOUDFLARE_ACCOUNT_ID=...
# 3. Verify detection
arcana doctor
# 4. Run
arcana run "hello"
Available Models
| Model | Parameters | Best For |
|---|---|---|
@cf/meta/llama-3.3-70b-instruct | 70B | Best quality, complex tasks |
@cf/meta/llama-3.1-8b-instruct | 8B | Fast, general purpose |
@cf/meta/llama-3.1-8b-instruct-awq | 8B | Quantized, faster inference |
@cf/mistralai/mistral-7b-instruct-v0.2 | 7B | Instruction following |
@cf/qwen/qwen1.5-14b-chat-awq | 14B | Multilingual, coding |
@cf/deepseek-ai/deepseek-math-7b-instruct | 7B | Math reasoning |
Config File
{
"provider": "cloudflare",
"model": "@cf/meta/llama-3.3-70b-instruct"
}
Environment Variables
| Variable | Description |
|---|---|
CLOUDFLARE_API_TOKEN | Your Cloudflare API token (required) |
CLOUDFLARE_ACCOUNT_ID | Your Cloudflare Account ID (required) |
Finding Your Account ID
- Log in to the Cloudflare dashboard
- Select any domain or go to the home page
- Your Account ID is in the right sidebar under "API"
- Alternatively, run
wrangler whoamiif you have the Wrangler CLI installed
Creating an API Token
- Go to API Tokens
- Click "Create Token"
- Use the "Workers AI" template or create a custom token with:
- Permissions:
Workers AI Read - Account resources: Select your account
- Permissions:
- Copy the token and set it as an env var
Pricing Notes
Workers AI uses a neuron-based pricing model. Approximate costs per 1M neurons:
| Model | Input (per 1M neurons) | Output (per 1M neurons) |
|---|---|---|
| Llama 3.3 70B | $0.586 | $2.93 |
| Llama 3.1 8B | $0.046 | $0.23 |
| Mistral 7B | $0.028 | $0.14 |
The free tier includes 10,000 neurons/day for all Workers AI models.
Tips
- Use
wrangler models listto see all available models on your account - Workers AI models run on Cloudflare's edge — latency is consistently low globally
- The free tier is generous for development and light usage
- For production workloads, the pay-as-you-go pricing is very competitive
- Works well for rapid prototyping since there's no GPU to provision
Limitations
- Model selection is limited to Cloudflare's hosted catalog
- No custom fine-tuned models (unlike Bedrock or Together)
- Rate limits apply per-account (default: 300 requests/min)
- Max input length varies by model (typically 4K–32K tokens)