GLM 5
An open-weights model from Z.ai, released February 2026, with tool calling and structured output. Its clearest result is on Terminal-Bench, while math and abstract reasoning trail the registry.
Spec sheet
- Family
- Z.ai
- Released
- 12 Feb 20269 months ago
- Weights
- Open
- Context window
- 200k tokens
- Largest response
- 131k tokens
- Accepts
- text
- Supports
- tools, reasoning, structured output
- Knowledge cutoff
- –
- Intelligence index
- 54.5#67
- Input price
- $1 / 1M
- Output price
- $3.2 / 1M
- Blended price (3:1)
- $1.55 / 1M
- Index points per $
- 35.2#59
- Speed
- 45.5 tokens/sec#134
- Popularity
- #94 of 194by usage
- Providers
- 4
- Weights on
- zai-org/GLM-5
Benchmarks
Score · rank among models testedThe tick on each bar marks the registry median; hover over a bar for the numbers. Sources and how the index is computed: methodology.
Providers and prices
$ per 1M tokens · from genai-prices| Provider | Gateway | Pydantic AI model string | Input | Cached input | Output | Blended |
|---|---|---|---|---|---|---|
| Z.ai | BYOK | zai:GLM-5 | $1 | $0.2 | $3.2 | $1.55 |
| Zhipu AI | BYOK | – | $0.55 | $0.14 | $2.48 | $1.03 |
| Novita | BYOK | – | $1 | $0.2 | $3.2 | $1.55 |
| OpenRouter | BYOK | openrouter:z-ai/glm-5 | $1 | $0.2 | $3.2 | $1.55 |
The cheapest provider is highlighted. Blended price assumes three input tokens for each output token.
Example code
# /// script # dependencies = ["pydantic-ai"] # /// import os from pydantic_ai import Agent os.environ['ZAI_API_KEY'] = '...' agent = Agent('zai:GLM-5', instructions='Be concise, reply with one sentence.') result = agent.run_sync('Where does "hello world" come from?') print(result.output)
# /// script # dependencies = ["pydantic-ai"] # /// import os from pydantic import BaseModel from pydantic_ai import Agent os.environ['ZAI_API_KEY'] = '...' class CityLocation(BaseModel): city: str country: str agent = Agent('zai:GLM-5', output_type=CityLocation) result = agent.run_sync('Where were the olympics held in 2012?') print(result.output) #> city='London' country='United Kingdom'
# /// script # dependencies = ["pydantic-ai"] # /// import os import random from pydantic_ai import Agent, RunContext os.environ['ZAI_API_KEY'] = '...' agent = Agent( 'zai:GLM-5', deps_type=str, instructions="You're a dice game, roll the die and see if it matches the user's guess.", ) @agent.tool_plain def roll_dice() -> str: """Roll a six-sided die and return the result.""" return str(random.randint(1, 6)) @agent.tool def get_player_name(ctx: RunContext[str]) -> str: """Get the player's name.""" return ctx.deps result = agent.run_sync('My guess is 4', deps='Anne') print(result.output)
# /// script # dependencies = ["pydantic-ai"] # /// import asyncio import os from pydantic_ai import Agent os.environ['ZAI_API_KEY'] = '...' agent = Agent('zai:GLM-5') async def main(): async with agent.run_stream('Explain prompt caching in three bullet points.') as response: async for text in response.stream_text(delta=True): print(text, end='', flush=True) asyncio.run(main())
export ZAI_API_KEY='...' uvx pax --model 'zai:GLM-5'
# npm install -g @earendil-works/pi-coding-agent export ZAI_API_KEY='...' pi --model 'zai/GLM-5'
// npm install ai @ai-sdk/openai-compatible import { createOpenAICompatible } from '@ai-sdk/openai-compatible' import { generateText } from 'ai' process.env.ZAI_API_KEY = '...' const zai = createOpenAICompatible({ name: 'zai', baseURL: 'https://api.zai.example/v1', apiKey: process.env.ZAI_API_KEY, }) const { text } = await generateText({ model: zai('GLM-5'), system: 'Be concise, reply with one sentence.', prompt: 'Where does "hello world" come from?', }) console.log(text)
Ask GLM 5 a question with a Pydantic AI agent and print the answer. Run it with uv run hello.py.
Get validated, typed output from GLM 5 by giving the agent a Pydantic model. Run it with uv run structured_output.py.
Give GLM 5 two tools to call, one of which reads the agent's dependencies. Run it with uv run tools.py.
Stream GLM 5's reply to the terminal as it is generated. Run it with uv run streaming.py.
Chat with GLM 5 in your terminal using pax, the TUI for pydantic-ai-harness. Coming soon.
Use GLM 5 as the model behind the pi coding agent, with your own Z.ai key.
Call GLM 5 from TypeScript with the Vercel AI SDK.
Compare
Score against blended price per 1M tokens (log scale). GLM 5 DeepSeek V4 Flash 0423 other models
About GLM 5
Description written by an LLM from the data on this pageAn open-weights model from Z.ai, released February 2026, with tool calling and structured output. Its clearest result is on Terminal-Bench, while math and abstract reasoning trail the registry.
GLM 5 is an open-weights text model from Z.ai, released February 2026. It has a 200k context window, up to 131k output tokens, and supports tool calling, reasoning mode and structured output. Input costs $1 per million tokens and output $3.20, giving a blended price of $1.55, above the registry median of $1.01.
Its intelligence index of 54.5 ranks 70th of 114, below the median of 59.5. Terminal-Bench is its clearest strength at 52.4%, 13th of 35, and its LMArena text rating sits just above the median. Math and abstract reasoning lag behind: OTIS Mock AIME is at 80% and ARC-AGI-2 at 4.9%, both near the bottom of the registry.
The model is served by Z.ai, Zhipu AI, Novita and OpenRouter. It is a reasonable fit for agent workloads centred on tool use and terminal work, rather than on hard mathematical or abstract reasoning.
Strengths
- 52.4% on Terminal-Bench, 13th of 35, above the 43.2% median
- 1445.9 on LMArena text, 45th of 114, just above the median
- Open weights, with a 200k context window and 131k maximum output
- Supports tool calling, reasoning mode and structured output
Weaknesses
- 4.9% on ARC-AGI-2, 59th of 68, far below the 61.3% median
- 80.0% on OTIS Mock AIME, 81st of 95, below the 94.2% median
- Blended price of $1.55 per million tokens, above the $1.01 median
Best for
Agents running terminal tasks with tool calling and structured output, where math and abstract reasoning matter less.