Local LLM Cost per Million Tokens Calculator

An agent reads far more than it writes, and most of what it reads is cached. Enter your monthly input and output tokens. The calculator prices them on an API (uncached input, cached input, output) and on your own box (hardware after resale, plus power for the hours the work takes), and says which is cheaper and at what volume they meet.

How it works

API bill        = input x (1 - hit share) x input price
                + input x hit share x cached input price
                + output x output price
hours of work   = input x (1 - local hit share) / prefill speed
                + output / decode speed
hardware /month = (price paid - sale price x (1 - selling fee)) / months kept
power /month    = (watts x hours of work + idle watts x idle hours) / 1000 x $/kWh
local $/M       = (hardware /month + power /month) / millions of tokens
break-even      = (hardware /month + idle power) / (API bill - power for the work)

Worked example: 500M input and 5M output tokens a month on one DGX Spark

Spark at 41 tokens per second decode and 800 prefill, 80% cache hits on both sides, kept 24 months, 45 W idle around the clock. The work takes 2.3 hours a day. The box costs $47.20 a month if it sells for what you paid and $147.28 if it sells for 40% less.

APIBill /moAPI $/M tokensSpark $/M tokensCheaper
Qwen3.6 27B (OpenRouter, cheapest host)$45.00$0.089$0.093 to $0.292API
DeepSeek V4.1 Flash (off-peak)$19.20$0.038$0.093 to $0.292API
DeepSeek V4.1 Flash (peak)$38.40$0.076$0.093 to $0.292API
DeepSeek V4 Pro (peak)$169.40$0.335$0.093 to $0.292Spark
Claude Sonnet 5.5$340.00$0.673$0.093 to $0.292Spark
Claude Opus 5.5$680.00$1.35$0.093 to $0.292Spark

Read the bottom rows with care. The Spark runs an open model. It beats the Claude rows on cost only if that open model does the work you were paying Claude for.

The three viewer objections, run through the math

Measured GB10 speeds in the list

RunDecodePrefillSource
The disputed figures: 41 decode, 800 prefill4180041 tok/s is the single stream in the CloudYeti video; 800 is a viewer's prefill figure. Claims, not measurements.
Qwen3-Coder-Next, vLLM 4-bit, 1 stream74.8not givenforums.developer.nvidia.com/t/379766 (August 10, 2026), one DGX Spark, same harness across stacks
Qwen3-Coder-Next, vLLM 4-bit, 8 streams289not givenforums.developer.nvidia.com/t/379766 (August 10, 2026): 289.0 tok/s aggregate at 8 concurrent
Qwen3-Coder-Next, Ollama Q4, 8 streams60.4not givenforums.developer.nvidia.com/t/379766: 59.2 single, 60.4 at 8 concurrent. "It does not batch."
gpt-oss 120B, vLLM, 1 stream60.7not givenforums.developer.nvidia.com/t/379766 (August 10, 2026); 116-153 tok/s aggregate at 8 concurrent
Qwen3.6 FP8 + MTP-3, vLLM, 32 streams1133.5not givenforums.developer.nvidia.com/t/367530 (April 22, 2026): 80.5 at 1 stream, 286.0 at 4, 479.5 at 8, 756.1 at 16, 1,133.5 at 32
DeepSeek V4 Flash IQ2_M, llama.cpp, 1 stream19.1459forums.developer.nvidia.com/t/379129 (August 4, 2026), one DGX Spark: tg128 19.09, pp2048 459.40

Community reports, not our benchmarks. No source we read shows 60 to 80 tokens per second for the DeepSeek V4 Flash DSpark build on one Spark: the 60 to 67 figure is from two Sparks on code (about 40 on mixed text), and a later two-Spark run measured 40.4.

Questions

How do I calculate cost per million tokens for a local LLM?

Add the month's hardware cost to the month's electricity, then divide by the millions of tokens the box processed. Hardware cost per month = (price paid - resale after fees) / months kept. Electricity = watts / 1000 x hours of work x your $/kWh. Count input tokens as well as output: an agent reads far more than it writes. At 500M input and 5M output tokens a month, a $6,950 DGX Spark comes to $0.09 to $0.29 per million tokens over 24 months.

How do I calculate the break-even token volume for a local LLM server?

Divide the fixed monthly cost of the box (hardware plus idle power) by the API's price per million tokens minus the box's power cost per million tokens. Use the API's blended price for your own mix of uncached input, cached input and output, not its output price. Then check the box can process that volume in a month: hours = uncached input / prefill speed + output / decode speed. If the answer is over 720 hours, one box never breaks even.

Do input tokens count in local vs API cost math?

Yes, and they usually decide it. A viewer's overnight code audit used 16 million input tokens and 0.12 million output tokens. On the cheapest OpenRouter host for Qwen3.6 27B that run costs $4.24 with no cache hits ($4.00 of it input) and $1.36 at an 80% cache hit rate. Break-even math built on output speed alone misses most of the bill.

Does concurrency change the cost per token on a DGX Spark?

It changes how much work one box can do, so it changes the cost per token at high volume. One community benchmark on a single DGX Spark measured Qwen3-Coder-Next at 74.8 tokens per second for one stream and 289.0 in total across 8 streams on vLLM. Ollama on the same box gave 60.4 across 8 streams, the same as one stream, because it does not batch. Higher aggregate speed only lowers your cost if you have enough work to fill the streams.

Is a local LLM cheaper than an API in 2026?

Against the same open model on a cheap host, rarely. At 500M input and 5M output tokens a month with 80% cache hits, the API bill for Qwen3.6 27B is $45.00 and a DGX Spark costs $47.20 to $147.28 a month to own. Against Claude Sonnet 5.5 the same token volume bills $340.00, but a local model that replaces Sonnet has to do the same work, and that is a quality question this calculator cannot answer.

Related