Models

Atlas with DeepInfra: The Cheapest Open-Weights Host for an Agent Loop in 2026

Updated 6 min read

DeepInfra runs open weights at the lowest per-token prices in the whole models.dev registry, which is the registry Atlas reads. GPT OSS 120B is $0.037/$0.17 per Mtok, DeepSeek V4 Flash is $0.09/$0.18 at a 1,048,576 token window, and Nemotron 3 Nano 30B A3B is $0.05/$0.20. DeepInfra is also one of the few gateways with a first-class Vercel AI SDK package, so Atlas loads it through @ai-sdk/deepinfra rather than falling back to @ai-sdk/openai-compatible. If you are cost-optimizing an Atlas agent loop, DeepInfra is usually the floor. The limits are open weights only and a hard output clip on most models.

Is DeepInfra the cheapest provider for an AI coding agent?

DeepInfra runs open weights at the lowest per-token prices in the whole models.dev registry. GPT OSS 120B at $0.037 input per Mtok is roughly 4x cheaper than the same weights on Groq ($0.15) and about 9x cheaper than Cerebras ($0.35). For identical weights, that spread is the entire decision.

Agent loops are token-hungry in a way chat is not. Atlas re-prompts on every turn with retrieved code chunks, the unified diff it computes for each file edit, and tool results, so input tokens accumulate fast even on modest tasks. That makes the input price the number that decides your bill, and DeepInfra's is the lowest listed. GPT OSS 120B at $0.037/$0.17 per Mtok is the headline, and the comparison is apples to apples because these are the same open weights other hosts serve. Nemotron 3 Nano 30B A3B at $0.05/$0.20 is the other cheap workhorse. Pin the cheap slot in atlas.json with "small_model": "deepinfra/openai/gpt-oss-120b" for titles, summaries, and subagents.

Can DeepInfra serve a 1M token context window affordably?

DeepInfra serves DeepSeek V4 Flash at the full 1,048,576 token window for $0.09 input per Mtok, which makes whole-repo context economically viable. Up to 1,048,576 tokens is available on DeepSeek V4 Flash, DeepSeek V4 Pro, MiMo-V2.5-Pro, and GLM-5.2.

A million-token window is only useful if you can afford to fill it, and that is precisely where DeepInfra changes the calculation. At $0.09 input per Mtok on DeepSeek V4 Flash, a prompt carrying a very large slice of a repository costs cents rather than dollars, so the strategy of giving Atlas broad context rather than narrow context stops being a luxury. Atlas still earns its keep on retrieval quality, because Atlas searches code with hybrid semantic and keyword retrieval fused by reciprocal rank fusion and indexes code by AST declarations using tree-sitter, not blind line windows. A cheap million-token window plus good retrieval beats an expensive one filled with noise.

What are the limits of DeepInfra for Atlas?

DeepInfra clips max output hard on most models: 16,384 tokens on GLM-5.1, GLM-5, Kimi K2.6, and DeepSeek V4 Pro. Very long single-shot file rewrites can truncate. DeepInfra is also open weights only, with no Claude, GPT-5, or Gemini available.

The output clip is the tradeoff that surprises people. Input is cheap and the window is huge, but the model cannot write an unbounded response, so a request to rewrite a 2,000-line file in one shot can hit the 16,384 token ceiling and truncate. The practical answer inside Atlas is to work in diffs rather than whole-file rewrites, which is how Atlas operates anyway: Atlas computes a unified diff for every file edit and surfaces it for approval before writing. The second limit is catalog scope. DeepInfra is open weights only, so a frontier fallback needs a second provider block in atlas.json, and Atlas lets you switch the active model and provider on the fly with favorites and recents.

Why does a dedicated AI SDK package matter for a DeepInfra setup?

DeepInfra loads through @ai-sdk/deepinfra, a dedicated AI SDK provider package, so Atlas does not have to fall back to @ai-sdk/openai-compatible. In 2026 DeepInfra is one of the few gateways in the models.dev registry with a first-class Vercel AI SDK package rather than a generic shim.

A generic OpenAI-compatible shim works until it does not. Provider-specific behavior around tool calls, streaming, and error shapes is where the abstraction leaks, and in an agent loop those leaks show up as malformed tool calls and turns that die halfway through. A dedicated package like @ai-sdk/deepinfra encodes the provider's real behavior instead of approximating it, which matters because every Atlas tool call is permission-gated against allow, ask, and deny rules before it runs, and a tool call that never parses cleanly never reaches that gate. Run atlas models deepinfra to confirm the registry resolved the catalog before you rely on it.

When should you pick a different provider than DeepInfra?

Pick a different provider than DeepInfra when you need frontier closed weights. DeepInfra is open weights only, so there is no Claude, GPT-5, or Gemini here, and a frontier fallback needs a second provider block in atlas.json alongside your DeepInfra configuration.

DeepInfra optimizes one axis extremely well, which is price per token on open weights, and it does not pretend to do anything else. If your work requires a closed frontier model, DeepInfra cannot serve it, full stop. If your work requires very long single-shot generations, the 16,384 token output clip on GLM-5.1, GLM-5, Kimi K2.6, and DeepSeek V4 Pro is a real constraint. Outside those two cases, the cost floor is hard to walk away from. A common Atlas configuration sets the main model to "deepinfra/moonshotai/Kimi-K2.7-Code" ($0.74/$3.50) or "deepinfra/zai-org/GLM-5.2" ($0.93/$3.00), keeps GPT OSS 120B in small_model, and registers a frontier provider for the rare turn that needs it.

Setup

  1. 01Create a DeepInfra API key and export it as DEEPINFRA_API_KEY, or run `atlas login` and pick DeepInfra to store it in the Atlas credential store
  2. 02Run `atlas models deepinfra` to confirm the registry resolved the catalog
  3. 03Pin the cheap slot in atlas.json: `"small_model": "deepinfra/openai/gpt-oss-120b"` for titles, summaries, and subagents
  4. 04Set your main model to `"deepinfra/moonshotai/Kimi-K2.7-Code"` or `"deepinfra/zai-org/GLM-5.2"`, then use `/models` in the TUI to switch between them

Frequently asked questions

what is the cheapest provider to run an AI coding agent
DeepInfra runs open weights at the lowest per-token prices in the whole models.dev registry. GPT OSS 120B is $0.037/$0.17 per Mtok and Nemotron 3 Nano 30B A3B is $0.05/$0.20.
deepinfra vs groq pricing for gpt oss 120b
GPT OSS 120B at $0.037 input per Mtok on DeepInfra is roughly 4x cheaper than the same weights on Groq ($0.15) and about 9x cheaper than Cerebras ($0.35).
how do I set the DEEPINFRA_API_KEY for atlas
Create a DeepInfra API key and export it as DEEPINFRA_API_KEY, or run `atlas login` and pick DeepInfra to store it in the Atlas credential store. Then run `atlas models deepinfra` to confirm the catalog resolved.
does deepinfra support claude or gpt-5
No. DeepInfra is open weights only. There is no Claude, GPT-5, or Gemini there, so a frontier fallback needs a second provider block in atlas.json.
what is deepinfra max output token limit
Max output is clipped hard on most DeepInfra models, at 16,384 tokens on GLM-5.1, GLM-5, Kimi K2.6, and DeepSeek V4 Pro, so very long single-shot file rewrites can truncate.
cheapest 1M context model in 2026
DeepSeek V4 Flash on DeepInfra is served at the full 1,048,576 token window for $0.09 input per Mtok, which makes whole-repo context economically viable.
what model should I use as small_model on deepinfra
Pin "small_model": "deepinfra/openai/gpt-oss-120b" in atlas.json for titles, summaries, and subagents. At $0.037/$0.17 per Mtok it is the cheapest capable option in the registry.

Try Atlas in your terminal

The terminal-native AI coding agent. Free core, single binary.

Install Atlas

Related guides

Atlas vs v0: A Developer's Guide for 2026

Comparing Atlas and v0 in 2026: Atlas offers terminal-native AI coding with explicit diffs and BYO model keys, while v0 provides a visual editor for React/Next.js apps.

Atlas for PowerShell: A Terminal-Native AI Coding Agent for Modules and Pester in 2026

Atlas is a terminal-native AI coding agent for PowerShell in 2026. It reads your .psm1 module and .psd1 manifest, adds SupportsShouldProcess, and runs Invoke-Pester behind a prompt.

Atlas for Fastify in 2026

Atlas is a terminal-native AI coding agent for Fastify in 2026. It reads plugin encapsulation and JSON schemas, then runs node --test behind a permission prompt.

Atlas for C# in 2026

Atlas is a terminal-native AI coding agent for C# and the .NET SDK in 2026. Run it in a solution with a .csproj or .sln and approve every diff before dotnet build.

Atlas vs GitHub Copilot: Terminal AI Coding Agents in 2026

Comparing Atlas, the terminal-native AI coding agent, with GitHub Copilot's editor extension and chat features for developers in 2026. Explore planning, pricing, and privacy.

Atlas vs Windsurf: Terminal AI Coding Agents in 2026

Atlas and Windsurf offer distinct AI coding experiences in 2026. Atlas provides a terminal-native TUI with permission-gated tools, while Windsurf features an in-editor live preview and a dedicated GUI.

Atlas vs Kiro in 2026: Terminal Agent Compared to AWS's Spec-Driven IDE and CLI

Atlas vs Kiro in 2026. Kiro writes EARS-notation specs before code and charges credits; Atlas is a free, open source terminal agent with diff-before-write review.

Atlas for Blazor: Terminal-Native AI Coding for .razor Components in 2026

Atlas is a terminal-native AI coding agent for Blazor developers in 2026. Work across .razor components, render modes, and the C# and JS interop boundary safely.

Browse this resource hub