Check Your Workers AI Usage with the GraphQL Analytics API
Estimating cost from a price table is how you end up out of quota at 11 o'clock in the morning. We did exactly that, and what saved the diagnosis was a single GraphQL query that tells you, per model and per hour, what you actually used. This guide has the query, the script we used on the result, and what it taught us.
The query
The Cloudflare GraphQL endpoint has a dataset for Workers AI called aiInferenceAdaptiveGroups. Ask it for the call count and the neurons per model for a day:
curl -s https://api.cloudflare.com/client/v4/graphql \
-H "Authorization: Bearer $CF_API_TOKEN" -H 'content-type: application/json' \
--data '{"query":"query { viewer { accounts(filter:{accountTag:\"ACCOUNT_ID\"}) { aiInferenceAdaptiveGroups(limit:20, filter:{datetime_geq:\"2026-10-02T00:00:00Z\", datetime_leq:\"2026-10-03T00:00:00Z\"}) { count sum { totalNeurons } dimensions { modelId } } } } }"}'
Replace ACCOUNT_ID with your account id. The answer is a list of groups, one per model, like this (abridged from our day; the FLUX group counts 34 calls, of which 32 produced an image and two were our own test requests that the API rejected without charging):
{ "count": 34, "dimensions": { "modelId": "@cf/black-forest-labs/flux-1-schnell" }, "sum": { "totalNeurons": 7987.2 } }
{ "count": 78, "dimensions": { "modelId": "@cf/meta/llama-3.3-70b-instruct-fp8-fast" }, "sum": { "totalNeurons": 2894.8 } }
In our case the token we use to deploy the Worker could run it. If yours cannot, give the token an analytics read permission. Remember that the day starts at 00:00 UTC, which is when the allowance resets.
Hour by hour
Add datetimeHour to dimensions and orderBy:[datetimeHour_ASC] to the arguments to see when the usage happened. A few lines of Python turn the groups into a running total:
from collections import defaultdict
by_hour = defaultdict(float)
for g in groups: # groups = the aiInferenceAdaptiveGroups list from the response
by_hour[g["dimensions"]["datetimeHour"][11:16]] += g["sum"]["totalNeurons"]
total = 0
for hour in sorted(by_hour):
total += by_hour[hour]
print(f"{hour} UTC {by_hour[hour]:8.1f} neurons running total {total:8.1f}")
What it taught us
1. The image price was three times higher than we thought. FLUX.1 schnell is listed at 4.80 neurons per 512x512 tile and 9.60 per step. We added them: 1024 by 1024 is four tiles, so 19.2 plus 6 steps of 9.60 is 76.8. The analytics said 32 successful images used 7,987.2 neurons, which is 249.6 each. The step price applies to every tile: 4 x (4.80 + 6 x 9.60) = 249.6. Our estimate for the whole daily plan had been built on the wrong number.
2. One model was free. SDXL-Lightning showed 34 calls and 0 neurons. When you are choosing how to spend a small allowance, a model that does not draw on it is worth knowing about.
3. Our own health check was a big leak. The hourly view has only one-hour resolution, so it could not show this directly, but the arithmetic was clear. Our deploy script ended with a health check that generated a test image with FLUX, about 250 neurons each time, and we ran roughly fifteen deploys that day. That is an estimated 3,700 neurons spent to check that the model was alive. The check is text-only now, which costs a fraction of a neuron.
4. Testing adds up. The day's total reached 11,067 neurons, above the 10,000 free allowance, most of it from our own experiments, forced runs and deploy checks rather than from the scheduled work. What happens at that point is in Workers AI Error 4006: What Happens at the Daily Free Limit.
Make it a habit
Put the query in a small script and run it before you plan the day's work and whenever a number surprises you. Compare the per-call result with your estimate for each model you use, because that comparison is what exposes a wrong assumption. The price table for every model, and the per-call numbers we derived from it, are in Workers AI Free Tier: What Each API Call Really Costs in Neurons.
FAQ
Where do I see how many neurons I have used today?
In the Workers AI page of the Cloudflare dashboard, and programmatically with the GraphQL Analytics API: the aiInferenceAdaptiveGroups dataset returns the call count and the sum of totalNeurons, grouped by dimensions such as modelId and datetimeHour.
Which API token can read it?
In our case the same API token we use to deploy the Worker (Workers scripts, KV, D1 and account settings permissions) could run the query. If yours cannot, add an analytics read permission to the token.
Why was my estimate from the price table wrong?
The price table lists a per-tile price and a per-step price for image models, and it is easy to add them instead of multiplying: the step price applies to every tile. For FLUX.1 schnell at 1024 by 1024 and 6 steps that is 4 x (4.80 + 6 x 9.60) = 249.6 neurons, not 76.8.
Do all models report neurons?
Not all. In our day of usage SDXL-Lightning reported 0 neurons over 34 calls, while FLUX.1 schnell and Llama 3.3 70B accounted for almost everything.
Found this useful? Tip the studio in crypto
Every EVM chain works. USDC on Base is recommended: fees are a fraction of a cent. No account needed — it goes straight to the creator's wallet.
0x13dd72Fa0E7504790585D92bD98c720f6fD2aBa6More from DevNotes

How to Add x402 Payments to a Cloudflare Worker with Hono
A tested, minimal example of charging per request in USDC on Base with x402, Hono and Cloudflare Workers…

How an AI Agent Pays an x402 API: a 20-Line Client in JS
A working x402 client in JavaScript: sign the USDC payment, read the receipt, cap what your agent can spend…

Cloudflare Cron Triggers Not Firing? Use a Durable Object Alarm
A reliable clock for Cloudflare Workers: a Durable Object alarm that re-arms itself, with a minimum gap and a…

How to List Your x402 API on 402 Index, x402scan and Bazaar
The exact steps to get a pay-per-call x402 API discovered by AI agents: OpenAPI metadata, 402 Index, x402scan…