Skip to content
MizanStack

Cloudflare Workers AI free tier: build a small free AI endpoint

Cloudflare gives every Workers AI account 10,000 Neurons a day at no charge, and on the free plan going over means errors, not a bill. That is roughly 287,000 output tokens a day on the 8B fast model. Here is what the allowance covers, how to build a tiny endpoint on it, and where the free part ends.

What Workers AI is

Cloudflare describes Workers AI as a serverless platform that runs machine learning models on GPUs in its global network. You do not manage servers or pay for idle time: you send a request, a model answers, and you are billed by usage. The catalog has more than 50 open-source models, and you can call them from a Worker, a Pages project, or any outside client through the REST API.

The catalog covers several task types: text generation, embeddings, classification, text-to-image, text-to-speech, speech recognition, image-to-text, image classification and translation. Text generation is the one most people start with.

What is free, exactly

  • Workers AI includes 10,000 Neurons per day at no charge. The allowance resets daily at 00:00 UTC.
  • A Neuron is Cloudflare's billing unit. Different models and different token counts consume different amounts of it.
  • On the Workers Free plan there is no overage billing. When the daily Neurons run out, requests fail with an error until the reset. The docs list the paid option as "Upgrade to Workers Paid".
  • On the Workers Paid plan, usage above the daily 10,000 Neurons is billed at $0.011 per 1,000 Neurons.

So the free part is a daily budget, not a trial that expires. The catch is that you cannot save it up: unused Neurons vanish at the reset.

How far do 10,000 Neurons go?

The pricing page (opens in a new tab) lists Neurons per million tokens for each model. A few text models, with their Neurons per million tokens (input and output):

  • @cf/meta/llama-3.2-1b-instruct: 2,457 input, 18,252 output.
  • @cf/meta/llama-3.1-8b-instruct-fp8-fast: 4,119 input, 34,868 output.
  • @cf/openai/gpt-oss-20b: 18,182 input, 27,273 output.
  • @cf/openai/gpt-oss-120b: 31,818 input, 68,182 output.

Rough math with the 8B fast model, counting only output tokens: 10,000 divided by 34,868 Neurons per million tokens is about 287,000 output tokens per day. That is a few hundred short answers, enough for a personal tool or a demo, not enough for a busy public app. The small 1B model stretches the same budget to roughly 548,000 output tokens, with weaker answers. Big models burn through it fast: one gpt-oss-120b million-token output would cost 68,182 Neurons, about seven days of free allowance.

One more rule from the pricing page: the DeepSeek V4 Pro model needs a paid billing method (Workers Paid or prepaid AI Gateway credits), so it is not part of the free route.

Build the endpoint in a Worker

You need a free Cloudflare account and Node.js. The steps follow Cloudflare's Workers get-started guide.

  1. Create the project (answer the prompts the tool shows) and enter the folder.

    npm create cloudflare@latest -- hello-ai
    cd hello-ai
  2. Add the AI binding to your Wrangler config. In wrangler.jsonc add this entry:

    "ai": {
      "binding": "AI"
    }
  3. If your project uses wrangler.toml instead, the equivalent is:

    [ai]
    binding = "AI"
  4. When the tool asks, choose "Hello World example", "Worker only" and JavaScript. Then replace the contents of src/index.js with this code. It reads ?q= from the URL, caps it at 500 characters so one request cannot eat your budget, calls the model and returns JSON. It uses the same 8B fast model as the cost math above, with a prompt input like the official REST example; run it once locally to confirm the response shape before you build on it.

    export default {
      async fetch(request, env) {
        const q = new URL(request.url).searchParams.get("q") ?? "Say hello in one sentence";
        const out = await env.AI.run("@cf/meta/llama-3.1-8b-instruct-fp8-fast", { prompt: q.slice(0, 500) });
        return Response.json(out);
      },
    };
  5. Log in to your Cloudflare account from the terminal.

    npx wrangler login
  6. Test it locally. Note from the docs: local development still uses your Cloudflare account, so Workers AI usage counts and is charged the same way.

    npx wrangler dev
  7. Deploy.

    npx wrangler deploy

Important: a deployed Worker that anyone can call spends your daily budget. Before you share the URL, add a simple guard (a secret header, a login, or a rate limit), otherwise a stranger can use up your 10,000 Neurons in minutes.

Or call it from the REST API

If you are calling from a script, an app or a server outside Cloudflare, use the REST endpoint: https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/run/{model} with an Authorization: Bearer {API_TOKEN} header.

  1. In the Cloudflare dashboard open the Workers AI page and choose the REST API option.

  2. Create a Workers AI API token from the prefilled template and copy it somewhere safe. A custom token needs both Workers AI - Read and Workers AI - Edit permissions.

  3. Copy your Account ID from the same section.

  4. Send a request (this is Cloudflare's own example). Replace the two placeholders with your values.

    curl https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/run/@cf/meta/llama-3.1-8b-instruct-fp8-fast \
      -H 'Authorization: Bearer {API_TOKEN}' \
      -d '{ "prompt": "Where did the phrase Hello World come from" }'

The reply is JSON: the text is in result.response, next to success, errors and messages.

Rate limits and what happens after the free part

  • Per the limits page (opens in a new tab), text generation is limited to 300 requests per minute, unless the model requires Workers Paid. Those paid models are limited per account and per model: 20 per minute with standard billing, 50 with prepaid AI Gateway credits.
  • Other task types have their own limits, for example 3,000 per minute for text embeddings and 720 for text-to-image.
  • Local runs with Wrangler count toward these limits. Beta models may have lower limits.
  • On Workers Free, going over the daily allowance means errors, not a bill. On Workers Paid, the extra is billed at $0.011 per 1,000 Neurons.

Money example from the pricing table: one million output tokens on the 8B fast model is 34,868 Neurons, about $0.38 at the paid rate. Cheap for experiments, but it adds up with traffic.

Who should skip the Workers AI free tier

  • Public apps with real traffic: the free budget is per day and shared by every visitor.
  • Anyone who needs the strongest models: free-route models are open-source ones, not the frontier models of the big paid APIs.
  • Work that must never fail: at the daily limit, Workers Free simply returns errors.
  • Heavy testing sessions: local runs spend the same Neurons.

Alternatives, in general terms: a paid hosted API gives stronger models and predictable capacity for a price, and running an open model on your own computer costs no per-request fee but needs your own hardware and setup. Workers AI trades that for zero install and a small free daily budget, with a one-command deploy.

What Cloudflare sees, and your API token

  • Whatever you put in the prompt leaves your machine and goes to Cloudflare, so do not send customer data you are not allowed to share.
  • Cloudflare states it does not use Customer Content processed by Workers AI to train AI models, and does not retain inputs or outputs after they are no longer needed for a standard request. Storage you direct yourself (R2, KV, AI Gateway logs and so on) is yours to manage. Metadata such as model IDs, timestamps and token counts may be kept.
  • Keep the API token out of your code, out of Git and out of screenshots. Store it as a secret, and delete it from the dashboard if it ever leaks.
  • Treat model output as untrusted text: never run it as code or insert it into a page without escaping.

Workers AI: card, reset time and model choice

Do I need a credit card?

The pricing page describes the free route as the Workers Free plan with 10,000 Neurons a day and no overage billing.

When does the counter reset?

Daily at 00:00 UTC.

Which model should I start with?

A small or fast model, since you pay per token in Neurons. Browse the model catalog (opens in a new tab) and compare it with the pricing table before choosing.

Cloudflare docs pages we checked on 2026-11-06

Checked 2026-11-06 on the official Cloudflare pages below. Free allowances and prices change often, so confirm them on the pricing page before you rely on them.

Checked against the official docs in November 2026.