Skip to content

GLM-5.2 API

New

200K context · Released Jun 30, 2026 · By Z.ai · MIT

GLM-5.2 costs $0.82 per million input tokens and $2.55 per million output tokens, against an official rate of $1.4 and $4.4 — 42% below official pricing. It is a Z.ai model under the MIT licence, with a 200K context window, callable through an OpenAI-compatible endpoint with the model id `z-ai/glm-5.2`.

Input

$0.82/M

$1.40/M

Output

$2.55/M

$4.40/M

Savings

42%

off official

  • No markup
  • OpenAI SDK compatible
  • No minimum spend
  • MIT

The strongest all-rounder in the catalog for the money. Genuinely competitive with closed frontier models on coding and tool use, under a plain MIT license.

Copy this and go

The model id is already filled in. Nothing in this snippet needs editing except your key.

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://router.xark.io/api/v1"   # ← the only line that changes
)

response = client.chat.completions.create(
    model="z-ai/glm-5.2",
    messages=[{"role": "user", "content": "Hello"}]
)

GLM-5.2 pricing across providers

Rates as published by each provider. We update these when they change; if you spot one that's stale, tell us and we'll fix it.

ProviderInputOutput
AI Token Router$0.82/M$2.55/M
Official (Z.ai)$1.40/M$4.40/M
OpenRouter$1.36/M$4.27/M
DeepInfra$0.95/M$3.10/M
Together AI$1.30/M$4.10/M

Cached input on GLM-5.2 is billed at $0.16/M — roughly 80% below the standard input rate. For agent loops with a large fixed system prompt this is usually the number that matters most.

What it's good at

  • General-purpose production workloads
  • Structured output and function calling at scale
  • Bilingual EN/ZH applications
Full technical documentation

Related

Other text models

Start using GLM-5.2 today

$5 in free credits, no credit card required.