GLM-5.1

GLM-5.1 is a next-generation flagship model for agentic engineering with significantly stronger coding capabilities. It achieves state-of-the-art performance on SWE-Bench Pro and excels at repo generation and real-world terminal tasks. Unlike previous models that plateau quickly, GLM-5.1 sustains optimization over hundreds of rounds and thousands of tool calls.

Quick Reference

PropertyValue
Model IDz-ai/glm-5.1
Context window200,000 tokens
Max output8,192 tokens
Streaming
Function calling
Structured output
Batch API

Pricing

TypePrice
Input$0.12 / 1M tokens / 1M tokens
Output$0.48 / 1M tokens / 1M tokens

Strengths

  • Agentic engineering — State-of-the-art on SWE-Bench Pro
  • Code generation — Significantly stronger coding and repo generation
  • Chinese language — Outstanding Chinese understanding and generation
  • Iterative reasoning — Sustains optimization over hundreds of rounds

Example

from openai import OpenAI

client = OpenAI(
    base_url="https://openapi.linkwo.ai/v1",
    api_key="YOUR_API_KEY"
)

response = client.chat.completions.create(
    model="z-ai/glm-5.1",
    messages=[
        {"role": "user", "content": "请用中文解释量子计算的基本原理"}
    ]
)

print(response.choices[0].message.content)