Cloudflare Workers AI is free inference on edge infrastructure: 10,000 “neurons” a day, 46+ models on the free tier, a global network with low latency. The currency is unusual — “neurons” instead of tokens — but it converts simply. Here is the budget, the models, and working code.
The neuron budget
10,000 neurons a day is a shared wallet for all models, reset at midnight UTC. Overage is not billed — the request simply fails. A spending guidepost: a response from a mid-range model costs a few hundred neurons; so the daily budget is on the order of dozens to hundreds of short responses or a couple of dozen long ones. Embeddings (bge-m3) are cheaper than text responses — vectorizing large volumes of documents is especially advantageous here.
An important nuance: 7 models are excluded from free billing and require a paid plan or a prepaid AI Gateway: kimi-k2.6, kimi-k2.7-code, glm-5.2, glm-5.3, glm-5.3-flash, deepseek-v4-flash-0731, deepseek-v4-pro-0813. When choosing a model, check the list — fresh flagships often land in the exclusions.
The key and the first request
The path: the Cloudflare dashboard → Workers AI → creating an API token (or a key via wrangler). The request goes through REST with an account token:
curl "https://api.cloudflare.com/client/v4/accounts/ACCOUNT_ID/ai/run/@cf/meta/llama-3.3-70b-instruct-fp8-fast" \
-H "Authorization: Bearer CF_TOKEN" \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "Answer in one word: does it work?"}]}'There is also an OpenAI-compatible path: /client/v4/accounts/ACCOUNT_ID/ai/v1 — the same template as every provider of the catalog. Model names carry the @cf prefix: llama-3.3-70b-instruct-fp8-fast, llama-4-scout, gpt-oss-120b, gemma-4-26b-a4b, mistral-small-3.1, bge-m3 (embeddings).
Models: what to choose
| Model | Strength | Role |
|---|---|---|
| llama-3.3-70b-fp8-fast | A classic, and fast | Routine text |
| gpt-oss-120b | Quality on open weights | Analytics |
| llama-4-scout | Multimodality | Images in the pipeline |
| gemma-4-26b-a4b | A compact generalist | Chats |
| bge-m3 | Embeddings | Vectorization, search |
Cloudflare’s niche in the pipeline
Two roles. The first is embeddings: bge-m3 on neurons is cheap document vectorization for search and RAG; the daily budget covers noticeable volumes. The second is edge routine: latency is low thanks to nearby data centers, and Worker scripts can call models right in the handler — a bot or a webhook lives in the same place as the inference. Its place in the overall scheme is covered in the article about the limit pie.
Limitations
- Contexts are humbler than those of the market leaders: 24–131K for most text models — giant documents are out.
- A shared neuron budget, not per model: heavy models eat the wallet faster.
- Fresh flagships are often in the paid exclusions — the free lineup changes.
- Logs and privacy — as with any cloud; secrets stay away.
Case study: document search on bge-m3
A typical task where Workers AI unfolds most strongly: local search over an internal base of documents — policies, instructions, the product knowledge base. When the documents number in the hundreds rather than millions, a separate vector database is unnecessary: vectors are computed once and stored next to the texts in an ordinary JSON file or table. That scale is exactly the territory of daily neurons, not paid services.
Step one — slice the documents into fragments of 500–1000 characters with a small overlap, so that meaning does not break at the boundaries. Step two — get the vector of every fragment via bge-m3; a single request carries a whole list of strings at once, and in neurons it costs an order of magnitude less than text generation:
curl "https://api.cloudflare.com/client/v4/accounts/ACCOUNT_ID/ai/run/@cf/baai/bge-m3" \
-H "Authorization: Bearer CF_TOKEN" \
-H "Content-Type: application/json" \
-d '{"text": ["Document fragment number one", "Document fragment number two"]}'The response returns an array of vectors in the data field — one per input string; the dimensionality of bge-m3 is 1024, and the usage in the response shows the neurons spent. Indexing a couple hundred fragments in an evening passes inside the daily budget without strain, and re-running the changed documents costs pennies.
Step three — the search itself. The vector of the user’s question is computed with the same request, then cosine similarity between it and all stored vectors: on hundreds of fragments the comparison runs instantly even in pure JavaScript without libraries. The top 5 matches are glued into a context and sent to llama-3.3-70b-instruct-fp8-fast or gpt-oss-120b for an answer with references to the sources. The result: a working RAG scheme on two endpoints of one provider — no card, no installing vector stores, and with a supply of neurons for daily reindexing of the updated files.
The boundaries of the scheme are honest: the contexts of text models are capped by the same 24–131K, so only the found fragments go into the answering context, not the whole document; search quality comes down to slicing — fragments that are too large blur relevance, fragments that are too small lose meaning. Both problems are treated by experimenting with the chunk size on your own documents, and when the base is updated only the changed fragments are recomputed — unchanged vectors stay as they were.
Common questions
What is a “neuron”? The unit of compute of Workers AI; conversion into tokens depends on the model — a guidepost: a short response ≈ hundreds of neurons.
Is a Workers script needed? No: the REST endpoint works from any client. Workers are an option for edge applications.
What happens when the neurons run out? The request fails until the reset at midnight UTC. Discipline: log the spending and keep a backup route.
Are embeddings free? Within the neuron budget — yes; bge-m3 is cheap — vectorization here is more advantageous than text generation.
How does the REST endpoint differ from the OpenAI-compatible one? The result is the same, the request template differs: the /ai/v1 path lets you reuse libraries written for OpenAI by simply swapping the base_url. For curl scripts there is no difference at all.
Which models are not in the free tier? Seven flagships — kimi-k2.6, kimi-k2.7-code, glm-5.2, glm-5.3, glm-5.3-flash, deepseek-v4-flash-0731, deepseek-v4-pro-0813 — require a paid plan or a prepaid AI Gateway. The composition of exclusions changes, so before choosing a model the list is worth re-checking.
Does a call from a Worker script spend the same neurons? Yes: the budget is one per account regardless of the way of calling — REST, SDK, or a Worker handler. The only difference is latency: from a Worker the request goes to the neighboring data center and returns faster.
How do you stretch 10,000 neurons across a day? Give the routine to compact models like gemma-4-26b-a4b, long analytics to gpt-oss-120b as needed, and do not keep heavy models in loops. The spending is visible in the usage of every response — so it is immediately clear which model is eating the wallet.
Workers AI is a niche yet mandatory layer: embeddings, edge routine, a backup route. Daily neurons convert into real work with a sensible profile. Figures as of fall 2026.
