> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kymaapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GLM 5.2

> Zhipu's newest frontier-open flagship on Kyma — the model the `glm-flagship` alias now resolves to — a 744B-parameter mixture-of-experts model with a 1M-token context window, built for long-horizon agentic coding.

## Overview

GLM 5.2 is the flagship of Zhipu's GLM line on Kyma and where the `glm-flagship` alias points. Released in June 2026 under the permissive MIT license, it is a mixture-of-experts model with roughly 744B total parameters and \~40B active per token, positioned squarely at coding and agentic workloads.

On the independent Intelligence Index v4.1 it scores 51 — the highest of any open-weight model, ahead of DeepSeek V4 Pro, MiniMax-M3, and Kimi K2.6, and ahead of several leading closed models. Through Kyma every call routes with automatic failover across multiple serving paths, so a degraded provider never surfaces as an error, and you reach it with the same OpenAI-compatible key as every other model.

The headline change over GLM 5.1 is context: the window grows from \~200K to a full 1M tokens, with output up to 131K. That holds an entire codebase plus an agent's working history in a single request. Function calling, structured outputs, and extended reasoning are all supported, and implicit prompt caching bills repeated prefixes at a steep discount — which matters for agents that resend a long system prompt on every step.

## Specs

| Field              | Value                                               |
| ------------------ | --------------------------------------------------- |
| Model ID           | `glm-5.2`                                           |
| Best for           | Agentic coding, SWE tasks, long-horizon, 1M context |
| Context window     | 1M                                                  |
| Max output tokens  | 131K                                                |
| Input modalities   | Text                                                |
| Output modalities  | Text                                                |
| Tool calling       | Yes                                                 |
| Structured outputs | Yes                                                 |
| Prompt caching     | Yes                                                 |
| Speed              | Medium                                              |
| Cost band          | Premium                                             |
| Release stage      | Stable                                              |

## Pricing

|        | Per 1M tokens |
| ------ | :-----------: |
| Input  |     \$1.89    |
| Output |     \$5.94    |

## Use this when

* **Long-horizon coding agents** — Its core design target — multi-step SWE tasks where the agent reads, edits, tests, and iterates across a repository over a long session.
* **Whole-repository context** — The 1M-token window lets an agent load a large codebase and its own history at once, instead of paging context in and out.
* **Complex reasoning** — Extended reasoning mode works through debugging, architecture decisions, and multi-constraint planning before committing to an answer.
* **Tool-calling pipelines** — Function calling plus structured outputs keep multi-step agent loops parseable and on schema, step after step.

## Not ideal for

Image inputs (it's text-only) or latency-sensitive chat UX — it's a medium-speed, premium-priced model that earns its cost on deep agentic work, not quick interactive replies.

## Example

```python theme={null}
from openai import OpenAI

client = OpenAI(base_url="https://kymaapi.com/v1", api_key="ky-...")

response = client.chat.completions.create(
    model="glm-5.2",
    messages=[{"role": "user", "content": "..."}],
    tools=[...],  # function calling supported
)
```

## FAQ

**How is GLM 5.2 different from GLM 5.1?**

GLM 5.2 expands the context window from \~200K to 1M tokens, raises max output to 131K, and tops the open-weight Intelligence Index. It's the newer flagship, so the `glm-flagship` alias now resolves to it; GLM 5.1 stays available by its own model ID.

**What is the `glm-flagship` alias?**

Kyma aliases let you write integrations that don't hardcode a model ID. Sending model `glm-flagship` currently resolves to GLM 5.2, and the X-Kyma-Model header on every response tells you exactly which model ran.

**Why run GLM 5.2 through Kyma?**

One API key and one OpenAI-compatible endpoint cover this and every other model on the platform. You get automatic failover when a serving path degrades, prompt caching discounts on repeated prefixes — a big deal for agents resending long system prompts — exact per-request cost in usage.cost, and \$0.50 free credit to try it with no card.

## Related aliases

| Alias          | Resolves to |
| -------------- | ----------- |
| `glm-flagship` | `glm-5.2`   |
