sellAI
neurology

Workers AI

Call powerful AI models with a single line of code — no GPU to buy, no server to manage.

50+Ready-made models
10,000Free Neurons / day
$0.011Per 1,000 Neurons
1Line to call AI
lightbulb

What is Workers AI?

Workers AI lets you run ready-made, open-source AI models (chatbots, translation, image generation, speech-to-text and more) directly on Cloudflare's global network of GPUs, just by calling an API.

Normally, running an AI model means renting an expensive GPU server, installing complex software, and keeping it online 24/7. Workers AI removes all of that: Cloudflare owns the GPUs, you just send a request and get the answer back.

restaurant

Think of it like a restaurant

You don't build a kitchen or hire chefs to eat a great meal — you just order from the menu. Workers AI is the kitchen of GPUs; the model catalog is the menu; you simply place your order (a request) and the dish (the answer) arrives.

help

Why use it?

Workers AI removes the three biggest pains of doing AI yourself: cost, complexity, and distance from your users.

payments

No GPU to buy

GPUs cost thousands of dollars. Here you pay only for what you use, and get a free daily allowance to experiment.

bolt

Runs near users

Models run on Cloudflare's worldwide network, so answers come back fast wherever your users are.

lock_open

Open-source models

Use popular open models like Llama, Mistral and Whisper without signing separate contracts with each provider.

code

One simple API

Every model is called the same way — swap one model name for another to switch tasks.

target

When should you use it?

chat

Chatbots & assistants

Build a Q&A bot or writing helper using a large language model (LLM, 大型語言模型).

translate

Translate & summarize

Turn text into other languages or shrink long articles into short summaries.

image

Generate images

Create pictures from a text description using text-to-image models.

mic

Speech to text

Transcribe audio into text with speech models like Whisper.

scatter_plot

Embeddings for search

Turn text into embeddings (向量, number lists that capture meaning) to power semantic search and RAG.

label

Classify content

Detect sentiment, tag images, or sort messages into categories automatically.

rocket_launch

How do you start?

You'll use Wrangler, Cloudflare's command-line tool for Workers. The steps below create a Worker, connect it to AI, and deploy it.

  1. Install Wrangler & log in

    Install the CLI globally, then log in to your Cloudflare account in the browser.

    bash
    npm install -g wrangler
    wrangler login
  2. Add the AI binding

    A binding (繫結) is a setting that wires your Worker to a Cloudflare service. Add this to wrangler.jsonc so env.AI becomes available in your code.

    jsonc
    {
      "name": "my-ai-worker",
      "main": "src/index.js",
      "compatibility_date": "2025-06-01",
      "ai": {
        "binding": "AI"
      }
    }
  3. Call a model

    Use env.AI.run() with a model name and an input. Here we ask Llama 3.1 a question.

    js
    export default {
      async fetch(request, env) {
        const result = await env.AI.run(
          "@cf/meta/llama-3.1-8b-instruct",
          { prompt: "What is Cloudflare in one sentence?" }
        );
        return Response.json(result);
      }
    };
  4. Deploy

    Publish your Worker to the world with one command.

    bash
    wrangler deploy

Prefer no Worker? Use the REST API

You can also call any model straight from the command line (or any backend) with a single HTTP request and an API token.

bashCall via REST API
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/run/@cf/meta/llama-3.1-8b-instruct \
  -H "Authorization: Bearer {api_token}" \
  -d '{ "prompt": "Tell me a joke" }'
school

Key concepts

psychology

Inference 推論

Inference is the moment a trained model 'thinks' and produces an answer for your input. Each call you make is one inference.

menu_book

Model catalog

A menu of 50+ models, each with an ID like @cf/meta/llama-3.1-8b-instruct. Pick one for your task.

cable

Binding 繫結

The wiring that exposes AI inside your Worker as env.AI — no API keys to paste into your code.

bolt

Neuron 神經元

Cloudflare's unit for measuring AI usage (the GPU work a request needs). You get 10,000 free every day.

scatter_plot

Embedding 向量

A list of numbers that captures the meaning of text. Store them in Vectorize to build search and RAG.

tips_and_updates

Tips & billing

savings

Start free

You get 10,000 Neurons free every day (resets at 00:00 UTC). Beyond that, the paid plan is $0.011 per 1,000 Neurons — only pay for what you actually use.

  • Different models cost different amounts of Neurons — bigger models cost more per request.
  • Put AI Gateway in front of Workers AI to cache repeated answers and cut cost.
  • Test locally with 'wrangler dev' before deploying.
  • Browse all models and their IDs in the Cloudflare dashboard or docs.