Frontier

Cost per token

The course capstone: one workload priced three ways — a managed per-token endpoint, a rented data-center GPU, and owned Apple hardware — with the break-even reasoning and the assumptions that will invalidate each answer.

Updated

01 · Concept

Concept

You have a product. It sends Qwen3.8-27B about 200 million input tokens and receives about 40 million output tokens per month — a support assistant with real usage, five parts prompt and context to one part answer. Someone has to decide how it is served, and every argument in that meeting will be a proxy for a number nobody has computed. This lesson computes it three ways, and the discipline it teaches matters more than the winner: state every assumption inline, so that when a price or a throughput figure changes, the reader can redo the whole calculation without you.

Option one, the managed per-token endpoint. Cloudflare Workers AI lists the model as a first-party offering, and as of August 2026 its published prices are USD 0.45 per million input tokens and USD 3.20 per million output tokens.

200×0.45=90.00,40×3.20=128.00,total=218.00 USD per month.200 \times 0.45 = 90.00, \qquad 40 \times 3.20 = 128.00, \qquad \text{total} = 218.00\ \text{USD per month}.

Note the shape as much as the size: the bill is proportional to traffic, so a quiet month costs nearly nothing and a viral week costs proportionally more. There is no capacity to plan, no upgrade path to negotiate, and no operational surface at all — which is the argument of lesson 8.12 restated as an invoice.

Option two, a rented data-center GPU running vLLM. Two assumptions, both stated rather than quoted: an 80 GB-class instance at USD 2.50 per hour, and a sustained aggregate output rate of 800 tokens per second under continuous batching. Neither is a vendor quote; substitute your own from a real provider page and a real benchmark.

2.50×730 hours=1,825.00 USD per month, independent of traffic.2.50 \times 730\ \text{hours} = 1{,}825.00\ \text{USD per month, independent of traffic}. 800×3600×730=2,102 million output tokens of monthly capacity.800 \times 3600 \times 730 = 2{,}102\ \text{million output tokens of monthly capacity}.

Here is the classic wrong turn, and it is the reason this lesson exists. The engineer divides rental by capacity, gets

182521020.87 USD per million output tokens,\frac{1825}{2102} \approx 0.87\ \text{USD per million output tokens},

compares it against USD 3.20, announces a 3.7-fold saving, and proposes owning the serving stack. The arithmetic is correct and the conclusion is wrong, because you do not rent tokens, you rent seconds. The workload needs 40 million output tokens, so the instance runs at

4021021.9% utilization,18254045.63 USD per million output tokens,\frac{40}{2102} \approx 1.9\%\ \text{utilization}, \qquad \frac{1825}{40} \approx 45.63\ \text{USD per million output tokens},

roughly fourteen times the endpoint price. The saving was real but it belonged to a workload eight times larger than this one. Find the crossover explicitly: one workload unit of 5 million input plus 1 million output costs the endpoint

5×0.45+3.20=5.45 USD,18255.45335 units,5 \times 0.45 + 3.20 = 5.45\ \text{USD}, \qquad \frac{1825}{5.45} \approx 335\ \text{units},

so the rented GPU wins above roughly 1.7 billion input and 335 million output tokens per month — which, reassuringly, is only about 16 percent of the assumed capacity, so the configuration is feasible rather than self-contradictory. Lesson 9.3’s memory budget is what makes that capacity claim checkable at all: 54 GB of weights against an 80 GB card leaves room for a bounded number of concurrent sequences at 64 KiB per cached token, and concurrency is precisely what turns a memory budget into the throughput number in the denominator.

Option three, owned Apple hardware. Assume a large unified-memory Mac at USD 6,000, amortized straight-line over 36 months, drawing 150 watts on average across the powered-on month, at USD 0.25 per kilowatt-hour.

600036=166.67,150 W×730 h=109.5 kWh×0.25=27.38,\frac{6000}{36} = 166.67, \qquad 150\ \text{W} \times 730\ \text{h} = 109.5\ \text{kWh} \times 0.25 = 27.38, total194 USD per month.\text{total} \approx 194\ \text{USD per month}.

Lesson 9.6 gives only an artifact-size heuristic near 47 tokens per second, which cannot establish capacity. For this scenario assume a measured sustained 25 output tokens per second: about 65.7 million output tokens per month, making the 40-million-token workload feasible at roughly 61 percent duty, provided requests do not arrive in bursts that a single-stream machine cannot absorb.

Line the three up and the result is genuinely instructive: USD 218 gross managed before the daily allowance, USD 1,825 rented, USD 194 owned. The managed endpoint and the owned Mac are within twelve percent of each other, a rounding error against the difference in everything else, while the rented GPU loses by an order of magnitude purely on utilization.

The general form is worth memorizing because it survives every price change: per-token cost is system cost per unit time divided by tokens produced per unit time, and every lesson in this track fed one of those two terms. Bandwidth and the roofline set the achievable rate; the KV-cache budget sets concurrency, which sets aggregate rate; quantization moves both; the interconnect decides whether extra chips actually add throughput; and utilization — the term nobody puts on a slide — decides whether fixed costs are a bargain or a liability.

That is the end of the course. You began with a function from context to a distribution over 248,320 tokens and you can now trace that function end to end: how text becomes vectors, how attention and Gated DeltaNet mix them, why 16 of 64 layers cache 64 KiB per token while the other 48 hold a flat 144 MiB in the reference float32 path, how the weights were trained and aligned, how a serving stack schedules them, which silicon reads them fastest, and what a month of that costs. More usefully, you can now size a deployment you have never seen — read a config file, derive its memory and bandwidth demands, choose a stack, pick hardware, and defend the choice with arithmetic instead of vendor slides. That skill outlives this model, and the next one will be waiting for it.

02 · Analogy

Analogy

Three ways to move goods across a city. A courier charges per parcel and you pay nothing on a quiet day. A rented van costs the same whether it runs full or sits in the yard, so it wins only once you have enough parcels to fill it most days. Buying a van adds a purchase you must spread over years plus fuel, and it also makes you the mechanic. Nobody argues about which is cheapest in the abstract; they measure how many parcels they actually send, and the answer flips at a volume you can calculate before signing anything.

03 · Lab

Lab

Managed endpointUSD 218
Rented GPUUSD 1,825
GPUs required1
Fleet utilisation1.9%

The managed endpoint is cheaper at this volume.

Default token prices: Workers AI, as of Aug 2026; managed cost shown is gross before the daily free-neuron allocation. A rented GPU bills for wall-clock hours, not tokens, which is why utilisation is the deciding variable. Rental and power vary by region and contract; substitute your own numbers.

04 · Teach it back

Teach it back

Price a workload of 200 million input and 40 million output tokens per month on a managed per-token endpoint, on a rented GPU running vLLM, and on owned Apple hardware — stating every assumption — and then find the volume at which the rented GPU becomes cheaper than the endpoint.

Minimum: 80 characters and 15 words. Your writing stays only in this browser.

Waiting for your explanation.

Compare with a model answer

On Workers AI, at USD 0.45 per million input and USD 3.20 per million output as of August 2026, the bill is 200 times 0.45 equals USD 90.00 plus 40 times 3.20 equals USD 128.00, or USD 218.00 gross before the daily free allocation, and it falls to zero in a month with no traffic. On a rented 80 GB-class GPU, assume USD 2.50 per hour and a continuously running instance: 2.50 times 730 hours is USD 1,825.00 per month regardless of traffic. Assume further a sustained 800 output tokens per second aggregate under continuous batching, which gives a monthly capacity of about 2,102 million output tokens; the workload uses 40 million of them, a utilization of 1.9 percent, so the effective price is 1825 divided by 40, about USD 45.63 per million output tokens — roughly fourteen times the endpoint. Owned hardware: assume a large unified-memory Mac at USD 6,000 amortized over 36 months, USD 166.67 per month, plus 150 watts average draw for 730 hours at USD 0.25 per kilowatt-hour, about USD 27.38, totalling roughly USD 194 per month, with an explicitly assumed measured sustained rate of 25 output tokens per second, giving 65.7 million output tokens of monthly capacity; lesson 9.6 only supplies an artifact-size heuristic, not measured capacity. Break-even for the rented GPU comes from the fixed rental divided by the endpoint price of one workload unit: five million input plus one million output costs 5 times 0.45 plus 3.20, or USD 5.45, and 1825 divided by 5.45 is about 335 units, so roughly 1.7 billion input and 335 million output tokens per month — about eight times the assumed workload.

05 · Check your understanding

Check your understanding

01Applying lesson 9.3's budget arithmetic, why does a rented GPU's advertised throughput not translate directly into a low cost per token?
Answer and explanation

You rent seconds, not tokens, so the effective price is the fixed rental divided by the tokens you actually generate — utilization decides — Capacity sets the denominator's maximum; realized volume sets its actual value, and at low utilization the same instance can be an order of magnitude more expensive per token than a managed endpoint.

02Lesson 9.3 sized an 80 GB accelerator as 54 GB of weights plus 64 KiB per cached token. Why does that arithmetic belong in a cost model at all?
Answer and explanation

Because it caps concurrent sequences, which caps achievable throughput, which is the denominator of cost per token — Concurrency is what turns a memory budget into a throughput number; a machine that fits fewer simultaneous sequences generates fewer tokens per rented second and therefore prices each one higher.

Complete the teach-back and answer the quiz correctly to finish this lesson.

◎ · Evidence marker

Sources

  1. Cloudflare, Inc. (2026). Cloudflare Workers AI.
  2. vLLM Project (2026). vLLM Documentation.
  3. Qwen Team (2026). Qwen3.8-27B Model Card.