
GLM 5.2 API: Pricing, Access, and How to Use It
- anthropicNEWAnthropic: Claude Opus 52026-07-2461Intelligence78Coding
- googleNEWGoogle: Gemini 3.6 Flash2026-07-2150Intelligence69Coding
- googleNEWGoogle: Gemini 3.5 Flash-Lite2026-07-2137Intelligence49Coding
- metaNEWMeta: Muse Spark 1.12026-07-1651Intelligence71Coding
- kimiNEWMoonshotAI: Kimi K32026-07-1557Intelligence76Coding
- openaiOpenAI: GPT-5.6 Luna2026-07-0951Intelligence71Coding
- openaiOpenAI: GPT-5.6 Terra2026-07-0955Intelligence77Coding
- openaiOpenAI: GPT-5.6 Sol2026-07-0959Intelligence77Coding
- grokxAI: Grok 4.52026-07-0854Intelligence72Coding
- tencentTencent: Hy32026-07-0641Intelligence59Coding
- obsidianQwen3.6 35B A3B Uncensored (Aggressive)2026-07-0232Intelligence42Coding
- obsidianGemma4 26B A4B Uncensored (Balanced)2026-07-0226Intelligence39Coding
- anthropicAnthropic: Claude Sonnet 52026-06-3053Intelligence72Coding
- klingKling: Kling 3.0 Turbo2026-06-1757Intelligence52Coding57Math
- z-aiZ.ai: GLM 5.22026-06-1651Intelligence69Coding60Math
- kimiMoonshotAI: Kimi K2.7 Code2026-06-1242Intelligence61Coding61Math
- anthropicAnthropic: Claude Fable 52026-06-0960Intelligence77Coding
- qwenQwen: Qwen3.7 Plus2026-06-0139Intelligence56Coding59Math
- minimaxMiniMax: MiniMax M32026-05-3144Intelligence59Coding59Math
- AnthropicAnthropic: Claude Opus 4.82026-05-2856Intelligence74Coding68Math
GLM-5.2 has been generally available since June 16, 2026, and its API has quickly become one of the most searched developer topics of the summer — for a simple reason: it delivers near-frontier coding and agent performance at $1.40 per million input tokens and $4.40 per million output, with a 1M-token context window. No waitlist, no preview gate: you can get a key and ship today.
This guide covers everything the search box is really asking: what the GLM 5.2 API costs, the four ways to get access (including a free one), how thinking modes and effort levels work, how the API-versus-Coding-Plan decision shakes out, and how to run GLM-5.2 alongside your other models through a single endpoint.
Quick answers
Is the GLM 5.2 API available now? Yes — generally available since June 16, 2026, model ID `glm-5.2`.
How much does it cost? $1.40 / $4.40 per million tokens (input/output), with cached input at $0.26 and cache storage free for a limited time.
Context window? 1M tokens in, up to 128K tokens out.
Is there a free option? The weights are MIT-licensed for self-hosting, and gateway free tiers let you test without a card. Details below.
Is it multimodal? No — text in, text out. Vision lives in Z.ai's separate GLM-V line.
Why developers want this API

The short version of the benchmark story: on Z.ai's published table, GLM-5.2 is the strongest open-weight coding model available — 81.0 on Terminal-Bench 2.1 (versus 63.5 for GLM-5.1), 62.1 on SWE-bench Pro, and within a single point of Claude Opus 4.8 on the long-horizon FrontierSWE benchmark — at a fraction of frontier prices. That combination, plus a 1M context trained specifically on coding-agent workloads, is why the API is worth integrating rather than just interesting.
What you get with the GLM 5.2 API

The API surface is modern and unsurprising — in a good way. You call model `glm-5.2` and get: a 1M-token context window with up to 128K output tokens; a thinking mode you can enable or disable per request; configurable reasoning-effort levels up to `max` for the hardest problems; real-time streaming; function calling for tool use and agents; structured JSON output; and an intelligent context-caching mechanism that discounts repeated input. MCP-style tool integration is supported for agent frameworks.
One boundary to know before you architect around it: GLM-5.2 is text-only. Screenshots, PDFs-as-pixels, and chart reading belong to a multimodal model — either Z.ai's GLM-V line or another provider's model on a separate lane.
GLM 5.2 API pricing

Official first-party pricing is $1.40 per million input tokens and $4.40 per million output tokens — identical to GLM-5.1, which means the June capability jump came with no price increase. Cached input bills at $0.26 per million, and Z.ai is waiving cache-storage fees for a limited time. There is no long-context surcharge: the full 1M window bills at standard rates.
For context, that sits far below the closed models it benchmarks against — Claude Sonnet 5 lists $3 / $15 and Claude Opus 4.8 $5 / $25 — and it makes cache discipline the biggest lever on your bill: agent loops that re-read stable project context pay $0.26 instead of $1.40 on every hit. Two budgeting notes: higher effort levels spend more thinking tokens, and third-party hosts publish their own rates (some below first-party), so check current numbers where you actually deploy.
How to get a GLM 5.2 API key

Route 1 — the Z.ai platform. Create an account on Z.ai's developer platform, generate a key, and call `glm-5.2` pay-per-token at the official rates above. This is the direct, first-party route.
Route 2 — the GLM Coding Plan. A subscription that plugs GLM-5.2 into coding tools (GLM-5.2 appeared there before the public API launch). If your usage is one developer hammering an IDE assistant all day, a flat plan can beat per-token billing; check current tier pricing on Z.ai.
Route 3 — an AI gateway. Call GLM-5.2 through a multi-model gateway like OrcaRouter: one OpenAI-compatible endpoint, model ID `z-ai/glm-5.2`, at the same $1.40 / $4.40 with zero token markup — alongside Claude, GPT, Gemini, DeepSeek, and 200+ other models. One key, no per-provider account juggling, and failover included.
Route 4 — self-host. The weights are on Hugging Face under an MIT license with no regional limits. Budget honestly: this is a roughly 750B-parameter MoE, so plan for cluster-scale GPU memory — a route for platform teams, not laptops.
Calling the API: what to set and why
Integration is deliberately boring — OpenAI-style chat completions with a model string of `glm-5.2` (or `z-ai/glm-5.2` via OrcaRouter, which also exposes a `/v1/responses` endpoint). The parameters that actually change outcomes:
Thinking on or off. Leave thinking enabled for coding, agents, and analysis; disable it for fast, cheap paths like classification and short chat turns.
Effort level. The dial between quality, latency, and spend. Reserve the top settings (`max`) for genuinely hard problems; public gateway stats put median time-to-first-token in the several-second range when the model thinks, so latency-sensitive UX wants lower effort.
Cache-friendly prompt structure. Put stable content (system prompt, project context, few-shot examples) first and identical across calls, so the $0.26 cached rate does the heavy lifting.
Function calling + structured output. Both are first-class; agents built on OpenAI-style tool schemas port over with minimal changes.
API or Coding Plan?
A decision that confuses many teams, so here's the clean split. The API is metered infrastructure: right for products, pipelines, and anything programmatic, where cost scales with usage and caching rewards good engineering. The Coding Plan is a flat-rate seat for humans: right for individual developers living in AI coding tools, where a heavy month would cost multiples in tokens. Many teams sensibly run both — plans for the humans, the API for the product.
Is there a free way to use GLM 5.2?
Three honest answers. Self-hosting is license-free (MIT) but hardware-expensive — free as in speech, not as in lunch. Gateway free tiers: OrcaRouter's free Hacker plan lets you call models — including GLM-5.2 — without a credit card, which is the fastest zero-cost way to evaluate it against real prompts. Trial credits on Z.ai's own platform vary by time and region, so check the current signup offer rather than trusting month-old blog posts.
Using the GLM 5.2 API through OrcaRouter
If GLM-5.2 will share production with other models — and given its text-only boundary and thinking-latency profile, it usually should — a routing layer saves you the multi-provider plumbing. OrcaRouter already serves GLM-5.2 at first-party rates with zero markup, behind the same OpenAI-compatible endpoint as 200+ other models: route high-volume coding and agent traffic to GLM-5.2, send vision tasks to a multimodal model, escalate the hardest reasoning to a frontier flagship, and let automatic failover cover provider hiccups. Per-model observability shows what each lane costs per completed task — which is how "cheap per token" gets verified as "cheap per outcome."


The bottom line
The GLM 5.2 API is the rare launch where the hype survives contact with the pricing page: near-frontier coding at $1.40 / $4.40, a real 1M context, and four access routes including a genuinely free one. Get a key, structure your prompts for the cache, and let a router decide when GLM-5.2 is the right lane.
Ready to call GLM 5.2 in minutes? Create a free OrcaRouter account, grab one API key, and reach GLM-5.2 at zero markup — alongside Claude, GPT, Gemini, and 200+ other models — through one OpenAI-compatible endpoint.
FAQ
Does the GLM 5.2 API work with Claude Code and existing coding tools?
Remarkably well — Z.ai's own benchmark table reports GLM-5.2's best Terminal-Bench score (82.7) using Claude Code as the harness, and the GLM Coding Plan is positioned as a drop-in for Claude Code-style workflows. Most OpenAI-compatible agent frameworks connect with a base-URL and model-name change.
Where does my data go if I use the GLM 5.2 API?
The first-party API is operated by Z.ai; teams with strict data-residency or compliance requirements should review its terms, pick a third-party host in their preferred region, or use the MIT-licensed weights to run GLM-5.2 entirely inside their own infrastructure — an option closed models can't offer.
Can the GLM 5.2 API process images or files?
No — it's text-in, text-out. Z.ai ships separate vision models (the GLM-V line) for image understanding, so multimodal products typically route image requests to a vision model and keep GLM-5.2 on the text lane.
What's the difference between glm-5.2 and z-ai/glm-5.2?
Same model, different doors: `glm-5.2` is the model ID on Z.ai's first-party API, while `z-ai/glm-5.2` is the namespaced ID used by gateways like OrcaRouter. Pricing is the same $1.40 / $4.40 either way on OrcaRouter, which charges no token markup.
