GLM-5.1 API

Z.AI's most powerful language model yet. GLM-5.1 doesn't just generate answers, it plans, executes, iterates, and delivers. Built for long-horizon autonomous tasks with a 200K context window and 128K token output capacity.

Modalities
TextText
In / Out price
$1.4/$4.4per 1M
Context window
200K tokens
Released
Apr 8, 2026

GLM-5.1 overview

GLM-5.1 by Zhipu AI

It aligns with the very best global models like Claude Opus 4.6 while excelling where it matters most: long-horizon planning, iterative optimization, and end-to-end delivery.

GLM-5.1 specs

Model ID
zhipu/glm-5.1
Developer
Zhipu AI
Context window
200,000 tokens
Max output
128,000 tokens
Input
Text
Output
Text
API
OpenAI-compatible, base URL https://api.aimlapi.com/v1

What is GLM-5.1 API?

GLM-5.1 is the latest flagship model from Z.AI (formerly Zhipu AI), the Chinese AI lab behind the GLM family of large language models. It marks a meaningful shift in how modern AI models are evaluated, not just on single-turn intelligence, but on how long they can work autonomously on a complex, multi-stage goal.

Where most language models are optimized for fast, isolated interactions, GLM-5.1 is purpose-built for tasks that require sustained effort: multi-hour engineering workflows, iterative optimization loops, and production-grade deliverables that span dozens of dependent steps. The model can plan, execute, encounter errors, course-correct, and finish without needing a human to hold its hand at each checkpoint.

In terms of raw capability, GLM-5.1 is benchmarked against the world's best. On overall performance, it aligns closely with Claude Opus 4.6, making it one of the few models genuinely competitive at the frontier level. On coding specifically, particularly on real-world software engineering tasks, it surpasses all other models on SWE-Bench Pro with a score of 58.4.

Model Name GLM-5.1 Developer Z.AI (Zhipu AI)
Model Family GLM-5 Series Positioning Flagship Foundation
Input Modality Text Output Modality Text
Context Length 200,000 tokens Max Output Tokens 128,000 tokens

Benchmark results

GLM-5.1's SWE-Bench Pro score of 58.4 is a new state-of-the-art result, outperforming GPT-5.4, Claude Opus 4.6, and Gemini 3.1 Pro. This benchmark tests real GitHub issue resolution on production codebases, arguably the most demanding proxy for real-world software engineering ability available today.

General and coding capability aligned with the global frontier

GLM-5.1 ranks among the world's top-tier models in both overall ability and coding performance. Overall performance aligns with Claude Opus 4.6, while coding performance on SWE-Bench Pro surpasses every other model in the world, setting a new state-of-the-art. Across 12 representative benchmarks spanning reasoning, coding, agents, tool use, and browsing, the model demonstrates a broad, balanced capability profile, not a narrow spike.

Long-horizon task execution: toward 8-hour sustained performance

GLM-5.1 shows especially strong improvements on long-horizon tasks, with major gains in sustained execution, closed-loop optimization, and engineering delivery under complex objectives. Under standardized evaluation, it is one of the few models capable of 8-hour autonomous execution and the first Chinese model to reach that level. This isn't just about a longer context window. It's about the model staying on-task across hundreds of decisions without losing the plot.

Engineering delivery: from code generation to autonomous agent

GLM-5.1's most significant breakthrough is its ability to form a genuine "experiment → analyze → optimize" loop in long-horizon tasks, rather than stopping at one-shot generation. The model can proactively run benchmarks, identify bottlenecks, adjust strategy, and iterate. In practice: it built a complete Linux desktop system from scratch in 8 hours, autonomously ran 655 optimization iterations on a vector database, and achieved a 3.6× geometric mean speedup on KernelBench Level 3, dramatically exceeding what torch.compile max-autotune achieves.

What GLM-5.1 API is built for

Six high-value use cases where GLM-5.1's combination of sustained execution, reasoning depth, and creative output genuinely outperforms lighter-weight alternatives.

Use cases

GLM-5.1 is documented as suited to complex coding and long-running agentic work, including tasks that require sustained planning, execution, and iterative optimization.

It is also documented as suited to open-ended question answering, complex instruction following, and multi-turn conversation, where stronger instruction adherence and long-context understanding are useful.

It is further documented as suited to document production tasks such as PPT, Word, PDF, and Excel creation, especially for long documents, reports, textbooks, and papers that require structured output and layout design.

A fourth documented use case is real engineering work with multi-stage dependencies, where the model is described as appropriate for complex programming problems and long-horizon development tasks.

Capabilities

  • Function calling
  • Streaming
  • Structured outputs
  • Reasoning

GLM-5.1 benchmarks by Artificial Analysis

See how GLM-5.1 compares in generation speed and latency. Data retrieved Nov 3, 2026.

Speed

Output tokens / second

Benchmark results

Compare 9 models available on AI/ML API across 5 independent benchmarks.

Humanity's Last Exam

Expert-written questions across academic subjects.

GLM-5.1 API pricing

GLM-5.1 pricing in US dollars
UsagePriceUnit
Input$1.41M tokens
Output$4.41M tokens
Cached input$0.261M tokens

Prices from the AI/ML API price list, checked on Nov 4, 2026.

GLM-5.1 vs other models: token prices

AI/ML API input and output rates for 5 models, per million tokens.

AI/ML API model prices in USD per million tokens
ModelInputOutput
GLM-5.1$1.4$4.4
GLM-5.3-Flash$0.15$0.5
GLM 5.3 FlashX$0.37$1.25
GLM-5.3$1.4$4.4
GLM 5.2 Fast Preview$3.5$11

How to use the GLM-5.1 API

View docs

Build with your agent

Give your agent the model details, code and documentation.

1Get your API key

Create API key
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"

2Make your first request

curl 'https://api.aimlapi.com/v1/chat/completions' \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "zhipu/glm-5.1",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about the ocean."
    }
  ]
}'

Related articles

All posts

GLM-5.1 FAQ

What is the context window of GLM-5.1?

GLM-5.1 has a 200,000 tokens context window and can return up to 128,000 tokens.

What inputs and outputs does GLM-5.1 support?

GLM-5.1 takes text as input and returns text.

What is the model ID for GLM-5.1?

Use zhipu/glm-5.1 as the model id. Requests go to https://api.aimlapi.com/v1/chat/completions.

When was GLM-5.1 released?

GLM-5.1 became available on April 8, 2026.

How much does GLM-5.1 cost?

GLM-5.1 costs $1.4 input and $4.4 output per 1M tokens on AI/ML API, billed as you go with no subscription.

Does GLM-5.1 support streaming?

Yes, GLM-5.1 can stream responses as they are generated.

Who created GLM-5.1?

GLM-5.1 was built by Zhipu AI.

Start building with GLM-5.1

GLM-5.1 API

zhipu/glm-5.1

Build with your agent

Give your agent the model details, code and documentation.

1Get your API key

Create API key
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"

2Make your first request

curl 'https://api.aimlapi.com/v1/chat/completions' \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "zhipu/glm-5.1",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about the ocean."
    }
  ]
}'