Arcana ARCANA

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

ModelParametersBest For
@cf/meta/llama-3.3-70b-instruct70BBest quality, complex tasks
@cf/meta/llama-3.1-8b-instruct8BFast, general purpose
@cf/meta/llama-3.1-8b-instruct-awq8BQuantized, faster inference
@cf/mistralai/mistral-7b-instruct-v0.27BInstruction following
@cf/qwen/qwen1.5-14b-chat-awq14BMultilingual, coding
@cf/deepseek-ai/deepseek-math-7b-instruct7BMath reasoning

Config File

{
  "provider": "cloudflare",
  "model": "@cf/meta/llama-3.3-70b-instruct"
}

Environment Variables

VariableDescription
CLOUDFLARE_API_TOKENYour Cloudflare API token (required)
CLOUDFLARE_ACCOUNT_IDYour Cloudflare Account ID (required)

Finding Your Account ID

  1. Log in to the Cloudflare dashboard
  2. Select any domain or go to the home page
  3. Your Account ID is in the right sidebar under "API"
  4. Alternatively, run wrangler whoami if you have the Wrangler CLI installed

Creating an API Token

  1. Go to API Tokens
  2. Click "Create Token"
  3. Use the "Workers AI" template or create a custom token with:
    • Permissions: Workers AI Read
    • Account resources: Select your account
  4. 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:

ModelInput (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 list to 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)
Last updated: Jul 25, 2026