GLM 5.2 · Z.ai open-weight

GLM 5.2: the open model built for coding

Z.ai's open-weight flagship for agentic coding and long-horizon tasks, on an OpenAI- and Anthropic-compatible API. Drop it into Claude Code, Cline, Cursor, and Aider, a real Claude Code alternative, billed per token with no monthly plan.

  • Open weights · zai-org
  • OpenAI- & Anthropic-compatible
  • Agentic + long-horizon
  • Per token, no monthly plan
claude code · glm-5.2connected
$ export ANTHROPIC_BASE_URL=https://inference.openrelay.inc
$ export ANTHROPIC_MODEL=openrelay/glm-5.2
$ claude "add retry + backoff to fetchUser()"

● Read src/api/user.ts
● Edited src/api/user.ts (+21 -4)
● Ran tests: 24 passed
✓ done in 3 tool calls

Why GLM 5.2 for code

An agent-grade coding model.

Built for agentic coding

Plans, calls tools, and edits across multiple files, the way coding agents actually work rather than one-shot completion.

Long-horizon tasks

Z.ai's headline for 5.2: holds context over long, multi-step sessions so an agent can finish a whole task without losing the thread.

Open weights, no lock-in

Released open by Z.ai (zai-org). Call it on OpenRelay today, or self-host the same weights later. Switch without rewriting.

Drop-in compatible

Speaks OpenAI Chat Completions and Anthropic Messages, so it slots into the editor and agent you already use.

Use it in your coding agent

Your editor, GLM 5.2 underneath.

GLM 5.2 speaks the OpenAI and Anthropic dialects, so it works in the agents you already run. Change a base URL and a model name. Keep everything else.

Claude Code

Point it at our Anthropic-compatible endpoint.

ANTHROPIC_BASE_URL=https://inference.openrelay.inc

Cline

Add an OpenAI-Compatible provider.

Base URL https://inference.openrelay.inc/v1 · openrelay/glm-5.2

Roo Code

OpenAI-Compatible provider, set the model.

Base URL https://inference.openrelay.inc/v1 · openrelay/glm-5.2

Cursor

Override the OpenAI base URL, add the model.

https://inference.openrelay.inc/v1 · openrelay/glm-5.2

Continue

Add a model with apiBase.

apiBase: https://inference.openrelay.inc/v1

Aider

Pass the base URL and model on the CLI.

--openai-api-base .../v1 --model openrelay/glm-5.2

OpenCode

Add an OpenAI-compatible provider in opencode.json.

baseURL https://inference.openrelay.inc/v1

They all point at the same endpoint with one vl_ key. Full setup is in the API reference.

Claude Code alternative

The open coding agent stack.

Keep the agentic workflow from Claude Code (plan, edit, run, fix), but on an open-weight model you control. No monthly Coding Plan, no proprietary lock-in, and the same key reaches every other open model on OpenRelay.

Open weights, hosted or self-hosted
Per-token billing, no subscription
OpenAI + Anthropic compatible
One key across the whole catalog
Browse every model & price
point Claude Code at GLM 5.2bash
# Use GLM 5.2 as your Claude Code model
export ANTHROPIC_BASE_URL=https://inference.openrelay.inc
export ANTHROPIC_AUTH_TOKEN=vl_••••••••
export ANTHROPIC_MODEL=openrelay/glm-5.2

claude            # agentic coding, now on an open model

Quickstart

One model name away.

Already using the OpenAI SDK? Set the base URL and pass openrelay/glm-5.2. Streaming, tool calls, and JSON mode work the same as any model in the catalog.

chat.py · OpenAI SDK, OpenRelay base URLpython
from openai import OpenAI

client = OpenAI(
    base_url="https://inference.openrelay.inc/v1",
    api_key="vl_••••••••",
)

resp = client.chat.completions.create(
    model="openrelay/glm-5.2",             # open weights, zai-org
    messages=[
        {"role": "system", "content": "You are a senior engineer."},
        {"role": "user", "content": "Refactor utils.py and add unit tests."},
    ],
)
print(resp.choices[0].message.content)

How it compares

GLM 5.2 vs the coding field.

ModelOpen weightsUse in Claude Code / ClineOpenAI-compatiblePricingOn OpenRelay
GLM 5.2 (Z.ai)This pagePer token
Claude (Sonnet)NativeMessages APIPlan / per token
GPT-5 classPer token
Qwen3 CoderPer token
DeepSeekPer token

GLM 5.2 runs on OpenRelay's one API today. Qwen3 Coder and DeepSeek are shown here as open-weight coding models for comparison, not as models currently available on OpenRelay. Reflects publicly documented capabilities as of June 2026.

FAQ

GLM 5.2, answered.

What is GLM 5.2?

GLM 5.2 is an open-weight large language model from Z.ai (Zhipu AI), released under the zai-org project. It is built for agentic coding and long-horizon tasks: planning, calling tools, and editing across many files. That is why developers reach for it as a coding model rather than a plain chat model.

Is GLM 5.2 good for coding?

Coding and agentic tool use are exactly what GLM 5.2 is designed for. Z.ai positions it for long-horizon tasks, so it holds context across multi-step sessions instead of losing the thread after a few edits. It handles code generation, refactoring, multi-file changes, and test-fix loops inside agents like Claude Code and Cline.

Can I use GLM 5.2 in Claude Code, Cline, or Cursor?

Yes. On OpenRelay, GLM 5.2 is served on both an OpenAI-compatible Chat Completions endpoint and an Anthropic-compatible Messages endpoint. Point Claude Code at ANTHROPIC_BASE_URL=https://inference.openrelay.inc with model openrelay/glm-5.2; point Cline, Roo Code, Cursor, Continue, Aider, or OpenCode at https://inference.openrelay.inc/v1 as an OpenAI-compatible provider with model openrelay/glm-5.2.

Is GLM 5.2 a Claude Code alternative?

It is one of the most popular ones. You get the same agentic coding workflow (plan, edit, run, fix), but on an open-weight model billed per token instead of a proprietary model behind a monthly plan. Because GLM 5.2 is open, you are not locked in: run it on OpenRelay or self-host the same weights.

GLM Coding Plan vs the GLM 5.2 API: what's the difference?

Z.ai's GLM Coding Plan is a monthly subscription to their own hosted endpoint. OpenRelay gives you GLM 5.2 through a usage-based API: pay per token, no monthly commitment, and the same vl_ key reaches every other model in the OpenRelay catalog, so you can switch models without switching accounts.

How much does the GLM 5.2 API cost?

GLM 5.2 is billed per token on OpenRelay, typically a fraction of a proprietary coding model, with no monthly plan and no GPU rental. There is no minimum: you pay only for the tokens your agent uses. See the inference catalog for current per-token rates.

Is GLM 5.2 open source, and can I self-host it?

GLM 5.2 ships as open weights from Z.ai (on Hugging Face under zai-org), so you can run it yourself. If you would rather not manage GPUs, OpenRelay hosts it for you behind one API, and you can move to self-hosting later without changing your prompts or tools.

Code with GLM 5.2 today.

Grab an API key, point your agent at OpenRelay, and ship with an open coding model. Pay per token, no monthly plan. Deposit $5 to get $10.