Models

Atlas with GLM-5.2: A 1M Token Open-Weights Model at $1.40 per Mtok (2026)

Updated 6 min read

GLM-5.2 is Z.ai's June 2026 flagship and the first GLM to reach a 1M tokens context, priced at $1.40 / $4.40 per Mtok (input / output). Inside Atlas, GLM-5.2 is the model to pick when you want a million-token window without frontier pricing: $1.40 per Mtok input compares to $5 for GPT-5.6 at a comparable window. GLM is the open-weights line that consistently punches above its price on agentic coding, and its open-weights lineage means GLM-5.2 also runs through Ollama Cloud and self-hosted setups, not just Z.ai's API.

Why is GLM-5.2's 1M token context significant?

GLM-5.2 is the first GLM to reach a 1M tokens context, and Z.ai prices that window at $1.40 per Mtok input, versus $5 for GPT-5.6 at a comparable window. Inside Atlas, a 1,000,000 token context means large codebase-index result sets fit in one turn.

Context window and price usually move together, and GLM-5.2 is where that stopped being true in 2026. Atlas searches code with hybrid semantic and keyword retrieval fused by reciprocal rank fusion, which returns a lot of material, and Atlas indexes code by AST declarations using tree-sitter, not blind line windows, so what fills the window is real declarations. Pouring that into a 1M token GLM-5.2 turn at $1.40 per Mtok input costs roughly a quarter of what GPT-5.6 charges at $5 for a comparable window. For repository-wide questions, GLM-5.2 is the cheapest way Atlas can ask them.

What does GLM-5.2's open-weights lineage give you?

GLM-5.2's open-weights lineage means it also runs through Ollama Cloud and self-hosted setups, not just Z.ai's API. That portability is the structural difference between GLM-5.2 and a closed 1M context model, and it holds at the same $1.40 / $4.40 per Mtok pricing.

GLM is the open-weights line that consistently punches above its price on agentic coding, and GLM-5.2 inherits that. Because the weights are open, GLM-5.2 is not locked to Z.ai's endpoint: Ollama Cloud and self-hosted deployments run it too. Atlas fits that model of the world well, since Atlas can build its code index with local Ollama embeddings, keeping code off third-party servers, so both halves of the pipeline, indexing and inference, can be moved off a vendor's servers if a policy requires it. Atlas lets you switch the active model and provider on the fly, so testing a self-hosted GLM-5.2 against the hosted one is straightforward.

How do you route GLM-5.2 through a US host?

GLM-5.2's first-party hosting is in China, so route through Fireworks if that is a constraint. Set `FIREWORKS_API_KEY` and pick accounts/fireworks/models/glm-5p2 instead of the Z.ai endpoint, and GLM-5.2 stays the same model at the same 1M tokens context window.

Hosting jurisdiction is separable from the model when the weights are open, and GLM-5.2 demonstrates that. The default Atlas path is `ZHIPU_API_KEY` against api.z.ai via `@ai-sdk/openai-compatible`, confirmed with `atlas models zai`. For US-hosted inference, set `FIREWORKS_API_KEY` and pick accounts/fireworks/models/glm-5p2 instead. Fireworks also offers a fast router variant, glm-5p2-fast, when latency matters more than price. Every Atlas tool call is permission-gated against allow, ask, and deny rules before it runs, so whichever host serves GLM-5.2, the blast radius of a bad tool call stays under your control.

Where is GLM-5.2 more expensive than its open-weights peers?

GLM-5.2's $4.40 per Mtok output is above DeepSeek V4 Pro's $0.87 for broadly similar open-weights positioning. That output rate, not the $1.40 input rate, is the number to watch when running GLM-5.2 as an Atlas build agent on refactor-heavy work.

GLM-5.2 is cheap on input and mid-priced on output, and the honest comparison inside the open-weights tier makes that clear: $4.40 per Mtok output against DeepSeek V4 Pro's $0.87. In an Atlas session dominated by reading, where the 1M context is doing the work, GLM-5.2's economics are excellent. In a session dominated by writing, where Atlas computes a unified diff for every file edit and that diff is the model's output, the $4.40 rate adds up faster than a cheaper open-weights alternative would. Match GLM-5.2 to read-heavy work and the pricing lands in your favor.

When should you pick a different model than GLM-5.2?

Pick a different model than GLM-5.2 when output volume dominates your Atlas sessions, since GLM-5.2's $4.40 per Mtok output is above DeepSeek V4 Pro's $0.87 at broadly similar open-weights positioning. Also switch away if China-hosted inference is prohibited and Fireworks routing is not an option.

GLM-5.2's case rests on the 1M tokens context at $1.40 per Mtok input, which is a genuinely strong combination Atlas can exploit through its codebase index. The case against GLM-5.2 is narrower than it first looks: the output rate is the main soft spot, and the hosting question has a documented answer in Fireworks. If your Atlas work is repository-scale analysis, architecture review, or bug hunting across a big result set, GLM-5.2 is an easy recommendation. If it is refactor-heavy diff generation, price the $4.40 per Mtok output against a cheaper open-weights option before committing.

Setup

  1. 01Export `ZHIPU_API_KEY=...` in your shell. Atlas loads Z.ai via `@ai-sdk/openai-compatible` against api.z.ai.
  2. 02Confirm with `atlas models zai` that Atlas resolved the GLM lineup.
  3. 03Select GLM-5.2 from the `/models` dialog.
  4. 04For US-hosted inference, set `FIREWORKS_API_KEY` and pick accounts/fireworks/models/glm-5p2 instead.
  5. 05If latency matters more than price, use the Fireworks fast router variant, glm-5p2-fast.

Frequently asked questions

How much does GLM-5.2 cost per million tokens?
GLM-5.2 costs $1.40 / $4.40 per Mtok (input / output). The $1.40 input rate compares to $5 for GPT-5.6 at a comparable 1M window.
Does GLM-5.2 have a 1M context window?
Yes. GLM-5.2 is Z.ai's June 2026 flagship and the first GLM to reach a 1M tokens context.
How do I set up GLM-5.2 in Atlas?
Export `ZHIPU_API_KEY=...`, since Atlas loads Z.ai via `@ai-sdk/openai-compatible` against api.z.ai, confirm with `atlas models zai`, then select GLM-5.2 from the `/models` dialog.
Can I run GLM-5.2 outside China?
Yes. First-party hosting is in China, so route through Fireworks: set `FIREWORKS_API_KEY` and pick accounts/fireworks/models/glm-5p2 instead.
Is GLM-5.2 open weights?
GLM-5.2 has open-weights lineage, which means it also runs through Ollama Cloud and self-hosted setups, not just Z.ai's API.
Is there a faster GLM-5.2 variant?
Yes. GLM-5.2 is available on Fireworks as a fast router variant, glm-5p2-fast, when latency matters more than price.
Is GLM-5.2 cheaper than DeepSeek V4 Pro?
Not on output. GLM-5.2's $4.40 per Mtok output is above DeepSeek V4 Pro's $0.87 for broadly similar open-weights positioning. GLM-5.2's advantage is its 1M context window.

Try Atlas in your terminal

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

Install Atlas

Related guides

Atlas for Spring in 2026

Atlas, the terminal native AI coding agent, empowers Spring developers in 2026 with intelligent code assistance, secure local embeddings, and transparent review processes for enhanced productivity.

Atlas for SolidJS: A Terminal-Native AI Coding Agent Built on Solid, for Solid, in 2026

Atlas is a terminal-native AI coding agent for SolidJS in 2026. It reads your createSignal and createMemo graph, fixes destructured props that break reactivity, and runs vitest.

Atlas vs Fine.dev: Terminal AI Coding Agents in 2026

Compare Atlas and Fine.dev for terminal AI coding in 2026. Atlas offers a free core TUI with permission-gated tools, while Fine.dev provides asynchronous cloud agents and prebuilt libraries.

Atlas vs Greptile: Terminal AI Coding Agents in 2026

Comparing Atlas and Greptile in 2026. Atlas offers terminal-native AI coding with permission-gated tools. Greptile reviews code with sandbox execution, catching 20% more bugs.

Atlas for Bun: Terminal-Native AI Coding in 2026

Atlas is a terminal-native AI coding agent for Bun. Swap Node compatibility shims for Bun.serve and bun:sqlite, iterate with bun test, and format with bun fmt in 2026.

Atlas for Elixir in 2026

Adopt Atlas, the terminal-native AI coding agent, for Elixir development in 2026. Enhance productivity with deep code understanding, safety features, and direct integration into mix projects and OTP applications.

Atlas vs Devin: AI Coding Agents Compared for 2026

Atlas and Devin offer distinct AI coding experiences in 2026. Atlas provides a terminal-native TUI with local control, while Devin is a cloud-managed engineer with SWE-1.7.

Atlas for Node.js in 2026

Node.js developers in 2026 can adopt Atlas, the terminal-native AI coding agent, for secure, efficient development. Leverage local embeddings, AST indexing, and robust safety features.

Browse this resource hub