What this is #
The case for running AI on hardware you own is usually argued from sovereignty - your data stays home, no vendor can cut you off, the off-switch is yours. This guide makes the quieter, harder-to-hand-wave argument: open-weights models are dramatically cheaper per token, and the gap is structural. The numbers below are from Artificial Analysis’s independent pricing index, snapshot July 2026 - a third party’s measurement, not Tokenstead’s. They show the models you can download and self-host clustering at the bottom of the per-token cost chart, with the closed frontier roughly an order of magnitude above them.
The headline up front: the five cheapest models on the index are all open-weights. The five most expensive are all closed. Gemma 4 31B is listed at $0/M because there is no paid hosted endpoint tracked for it - the only way to use it is to run it yourself. That is the self-host thesis in one number.
The price ladder (blended $/M tokens) #
Artificial Analysis’s “blended” price weights a realistic agentic workload - roughly 70% cached input, 20% fresh input, 10% output - so it reflects what an agent actually spends, not a headline input price. Sorted cheapest first. Open-weights models (the ones you can self-host) are tagged:
Gemma 4 31B - $0.00/M (open weights). No paid hosted endpoint tracked on the index; you run it on hardware you own. SeeGemma 4 31B. DeepSeek V4 Flash - $0.058/M (open weights).****gpt-oss-20b - $0.065/M (open weights).****DeepSeek V4 Pro - $0.177/M (open weights).****gpt-oss-120B - $0.195/M (open weights).****MiniMax-M3 - $0.222/M (closed).****Nemotron 3 Ultra 550B A55B - $0.578/M (open weights).****Grok 4.3 - $0.64/M (closed).****GPT-5.4 mini - $0.653/M (closed).- Kimi K2.6 - $0.702/M(licensing varies by region). Claude 4.5 Haiku - $0.77/M (closed).- GLM-5.2 - $0.902/M (open weights). SeeGLM-5.2. **Qwen3.5 397B A17B - $0.90/M (open weights).****Mistral Medium 3.5 - $1.155/M (closed).****Gemini 3.5 Flash - $1.305/M (closed).****Qwen3.7 Max - $1.425/M (closed).****Gemini 3.1 Pro - $1.74/M (closed).****Claude Sonnet 5 - $2.31/M (closed).****Claude Opus 4.8 - $3.85/M (closed).****GPT-5.5 - $4.35/M (closed).**Claude Fable 5 - $7.70/M (closed).
The pattern: the bottom of the chart is open-weights, the top is closed. The cheapest open-weights model with a paid endpoint (gpt-oss-20b at $0.065/M) is about a third the price of the cheapest closed model on the index (MiniMax-M3 at $0.222/M), and about a twentieth the price of a closed frontier model like Gemini 3.5 Flash ($1.305/M) - or over a hundred times cheaper than Claude Fable 5 ($7.70/M). And once you own the hardware, the open-weights models drop to the cost of electricity: the per-token price goes to zero, below even gpt-oss-20b’s API floor.
Why open-weights sit at the bottom #
Two reasons, one obvious and one structural.
The obvious one: Gemma 4 31B has no paid hosted endpoint on the index. Google released the weights, but there is no Gemma-4-31B-reasoning per-token API tracked here. The only way to use it is to run it on hardware you control - so its blended price reads as $0, and the line sits at the floor. The model is free at the margin once you own the box. (Google serves other Gemma-family models through Vertex; the 31B reasoning variant specifically is not priced on this index as a hosted endpoint.)
The structural one: open-weights models are a commodity on the API side, so providers compete the margin away. Because anyone can host gpt-oss-120B, dozens of providers do - Databricks, Novita, DeepInfra, Fireworks, Groq, Together, Cerebras, SambaNova, Cloudflare, CoreWeave, Azure, Vertex - and they undercut each other down to roughly the cost of GPU time. A closed model has one price set by one vendor; an open model has a market. See the gpt-oss-120B provider spread below for what that competition looks like in practice.
The coding-agent index: capability at the cheap end #
Cheap means nothing if the model cannot do the work. Artificial Analysis’s coding-agent index (composite pass@1 across DeepSWE, Terminal-Bench v2, and SWE-Atlas-QnA, snapshot July 2026) measures agentic coding on the API - and the open-weights families Tokenstead covers show up in the field:
Claude Code on GLM-5.2 (Novita) - 57.7% pass, $6.47/task, 25.2min. A frontier-competitive coding agent on an open-weights model. This independently corroborates what theGLM-5.2 local guideshows from the self-host side - GLM-5.2 is genuinely capable, not just cheap. Claude Code on GLM-5.1 (FriendliAI) - 52.3% pass, $4.33/task.****Claude Code on Qwen3.7 Plus, thinking - 51.9% pass, $6.23/task.- Claude Code on DeepSeek V4 Pro - 47.0% pass, $0.27/task. The standout value line: credible agentic coding at twenty-seven cents a task. -
**Claude Code on Kimi K2.6 - 46.9% pass, $1.18/task**(but 41.2min wall-clock - slow).
For context, the top of the coding-agent index is Claude Code on Fable 5 at 77.2% pass and $11.75/task, and Codex on GPT-5.5 at 76.4% and $5.07/task. The open-weights models do not win the index - but they sit in the lower-middle of the field at a fraction of the per-task cost, and the ones you can run locally (GLM-5.2, DeepSeek V4, Kimi K2.6) cost only electricity once the hardware is paid for. The gap to the frontier is cost, not capability - and self-hosting closes the cost side entirely.
## The provider spread for gpt-oss-120B
Because gpt-oss-120B is open weights, anyone can host it, and the per-provider price spread shows what commodity pricing looks like (Artificial Analysis, July 2026, input and output price per million tokens):
Databricks - $0.039/M in, $0.19/M out. The cheapest hosted endpoint on the index for this model. Nebius Base - $0.05/M in, $0.25/M out.****Fireworks - $0.09/M in, $0.36/M out.- Novita - $0.10/M in, $0.75/M out(cache hit $0.055/M). Microsoft Azure - $0.10/M in, $0.50/M out.- DeepInfra, Groq, Cloudflare, CoreWeave, Scaleway, Makora - $0.15/M in, $0.60/M out. The modal price - the market’s gravitational center. - Google Vertex - $0.15/M in, $0.60/M out(cache hit $0.075/M). **SambaNova - $0.17/M in, $0.70/M out.****Parasail - $0.22/M in, $0.59/M out.**Baseten, Cerebras - $0.35/M in, $0.75/M out.
The spread is roughly 9x on input ($0.039 to $0.35) for the same model. That is what an open market does: the model is identical, the price is whatever the provider’s GPU economics justify. A closed model has one price, set by one vendor. This is the structural reason open-weights models cluster at the bottom of the chart - not a loss leader, not a promotion, just competition.
How to use this #
You want the cheapest credible coding model and do not want to run hardware- DeepSeek V4 Pro on the API at $0.177/M blended, or about $0.27/task on the coding-agent index. - You want zero per-token cost and own a box that fits the model- self-host Gemma 4 31B ($0/M, because there is no paid endpoint) or gpt-oss-20b ($0.065/M if you must use an API, free if you run it yourself). See therig finderfor what your hardware can actually run. - You want frontier-tier coding quality- the closed models (Fable 5, GPT-5.5, Opus 4.8) still top the coding-agent index, and you pay for it. The open-weights gap is cost, not capability - GLM-5.2 at 57.7% is not far behind Opus 4.8 at 72.5% on the coding-agent index, at a fraction of the per-task price, and free if self-hosted. - You want to amortize across a team- one self-hosted node breaks even with API spend at a predictable workload threshold; see thelocal-vs-cloud budget toolfor the math on your usage.
Every price on this page is a snapshot from Artificial Analysis’s July 2026 index. Provider prices move constantly - Databricks could drop, Cerebras could undercut, new providers enter - so verify live on Artificial Analysis before optimizing around a specific figure. For the hardware side of the self-host decision - which box holds which model, the bandwidth ceiling, NVFP4 setup - see self-host your AI: DGX Spark, RTX builds, and Mac. For independent DGX Spark model benchmarks, see DGX Spark benchmarks: which local model wins in 2026. To browse every model with memory and quant fits, see the model catalog.