Route requests to
GLM-5
with Merge Gateway

Apply your own routing policies, reduce token costs automatically, and see every routing decision in real time with Merge Gateway.

How GLM-5 performs*

Intelligence - general reasoning and knowledge
50
Coding - code generation and problem-solving
44

What GLM-5 costs to run

| Vendor | Input / 1M tokens | Output / 1M tokens | Zero data retention | | --- | ---: | ---: | --- | | Baseten | $0.9500 | $3.15 | Yes | | Parasail | $1.00 | $3.20 | Yes | | Z.AI | $1.00 | $3.20 | No |

Test GLM-5
with Gateway’s Simulator

See a prompt's output, token spend, latency, and more with GLM-5.

Route requests to GLM-5 in minutes

To get started in seconds, add our Gateway Implementation skill to your project, or pick your preferred SDK below. Check out our other quick start skills here.
Install the Merge Gateway SDK
Python
Copied!
1$ pip install merge-gateway-sdk
Send a request
Python
Copied!
1from merge_gateway import MergeGateway
2
3client = MergeGateway(api_key="YOUR_API_KEY")
4
5response = client.responses.create(
6    model="openai/gpt-5.2",
7    input=[
8        {"type": "message", "role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
9        {"type": "message", "role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
10    ],
11)
12
13print(response.output[0].content[0].text)
Try a diffrent model
Swap the model string to route to a different provider. No other code changes needed.
Anthropic
Copied!
1response = client.responses.create(
2    model="anthropic/claude-sonnet-4-20250514",
3    input=[
4        {"type": "message", "role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
5        {"type": "message", "role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
6    ],
7)
Point to Gateway
Python
Copied!
1from openai import OpenAI
2
3client = OpenAI(
4    api_key="YOUR_API_KEY",
5    base_url="https://api-gateway.merge.dev/v1/openai",
6)
Send a request
Use the standard chat.completions.create method. No provider prefix needed on the model name.
Python
Copied!
1response = client.chat.completions.create(
2    model="gpt-5.2",
3    messages=[
4        {"role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
5        {"role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
6    ],
7)
8
9print(response.choices[0].message.content)
Install packages
Copied!
1npm install merge-gateway-ai-sdk-provider ai
Create the provider
TypeScript
Copied!
1import { createMergeGateway } from "merge-gateway-ai-sdk-provider";
2
3const gateway = createMergeGateway({
4  apiKey: "YOUR_API_KEY",
5});
Send a request
Use generateText to send a request. Model names use the provider/model format.
TypeScript
Copied!
1import { generateText } from "ai";
2
3const { text } = await generateText({
4  model: gateway("openai/gpt-4o"),
5  prompt: "Explain the concept of recursion in programming with a simple set of examples.",
6});
7
8console.log(text);
If you already have @ai-sdk/openai installed, point it at Gateway with a base URL change:
TypeScript
Copied!
1import { createOpenAI } from "@ai-sdk/openai";
2
3const gateway = createOpenAI({
4  apiKey: "YOUR_API_KEY",
5  baseURL: "https://api-gateway.merge.dev/v1/ai-sdk",
6});
7
8// All generateText/streamText calls work unchanged
Install the Merge Gateway SDK
Anthropic SDK
Copied!
1from anthropic import Anthropic
2
3client = Anthropic(
4    api_key="YOUR_API_KEY",
5    base_url="https://api-gateway.merge.dev/v1/anthropic",
6)
7
8message = client.messages.create(
9    model="claude-sonnet-4-20250514",
10    max_tokens=1024,
11    messages=[
12        {"role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
13    ],
14)
15
16print(message.content[0].text)

Explore other models available in Merge Gateway

model logo
Amazon Nova 2 Lite
model logo
Amazon Nova 2 Sonic
model logo
Amazon Nova Lite
model logo
Amazon Nova Micro
model logo
Amazon Nova Premier
model logo
Amazon Nova Pro
model logo
Claude 3.7 Sonnet
model logo
Claude Haiku 4.5 (20251001)
model logo
Claude Opus 4.6
model logo
Claude Opus 4.7
model logo
Claude Opus 4.8
model logo
Claude Sonnet 4.5
model logo
Claude Sonnet 4.6
model logo
Claude Sonnet 5
model logo
Codestral
model logo
Codestral 25.08
model logo
Command R 08-2024
model logo
Command R+ 08-2024
model logo
Command R7B 12-2024
model logo
DeepSeek R1
model logo
DeepSeek V3
model logo
DeepSeek V3.2
model logo
DeepSeek V4 Flash
model logo
DeepSeek V4 Pro

GLM-5 FAQ

If you have additional questions about GLM-5, we've addressed several more below. Keep in mind that this information was written in June, 2026 and may change over time.

Heading

What other models does Zhipu AI (Z.AI) offer?

Zhipu AI's GLM family spans from lightweight, cost-efficient models to large-scale reasoning flagships. Here are some other models Zhipu AI supports:

  • GLM-4.5: A mid-range general-purpose model suited for instruction-following, summarization, and text generation tasks. It sits below the reasoning-focused GLM-5 tier in capability and price, making it a practical option for teams that do not require extended chain-of-thought output
  • GLM-4.5 Air: The most cost-efficient model in the GLM lineup, priced at $0.17 per 1M input tokens and $0.98 per 1M output tokens with a 128k token context window. It is designed for high-volume, budget-constrained deployments where peak accuracy is not required
  • GLM-4.7 Flash: A reasoning-capable model with a 200k token context window and a blended rate of approximately $0.10 per 1M tokens, making it the lowest-cost entry point for chain-of-thought workloads in the GLM family. Output speed reaches 101.6 tokens per second on Artificial Analysis
  • GLM-5.1: The current top-tier model from Zhipu AI, scoring 51 out of 100 on the Artificial Analysis Intelligence Index and ranking in the top 5 of all evaluated reasoning models. It is priced at $1.40 per 1M input tokens and $4.40 per 1M output tokens, targeting workloads where maximum accuracy is worth the premium over GLM-5

How does GLM-5 differ from Zhipu AI's other models?

GLM-5 is Zhipu AI's primary large-scale reasoning model, positioned just below the GLM-5.1 flagship in accuracy while offering a more favorable cost structure.

  • Intelligence score: GLM-5 achieves an Intelligence Index score of 50 out of 100 on Artificial Analysis, placing it at #6 out of 88 tracked reasoning models. GLM-5.1 scores 51 and ranks #4, while GLM-4.7 Flash scores 30 and GLM-4.5 Air scores 23
  • Pricing: GLM-5 is priced at $1.00 per 1M input tokens and $3.20 per 1M output tokens. This is roughly six times the input cost of GLM-4.7 Flash ($0.07) and about 30% less than GLM-5.1 ($1.40 input), making it the performance-to-cost sweet spot in the upper tier of the GLM family
  • Context window: GLM-5 supports 200k tokens, the same as GLM-4.7 Flash and GLM-5.1, and well above the 128k window of GLM-4.5 Air. This makes it suitable for long-document tasks and multi-step reasoning over large inputs
  • Speed: GLM-5 generates output at 84.2 tokens per second on Artificial Analysis, which is above the median for its class but notably slower than GLM-4.7 Flash at 101.6 tokens per second. The tradeoff is higher reasoning accuracy at comparable latency to GLM-5.1's 56.3 tokens per second
  • Architecture: GLM-5 uses a Mixture of Experts architecture with 744 billion total parameters and 40 billion active parameters, identical to GLM-5.1, and is released under an MIT license for commercial use

GLM-5 is the right choice when you need near-flagship reasoning accuracy from Zhipu AI at a price point below GLM-5.1, and your workload involves long documents, multi-step reasoning, or complex instruction sets.

What models should I consider using alongside GLM-5?

No single model is optimal for every task. Here are models worth pairing with GLM-5 depending on what your product needs:

  • GLM-4.7 Flash for routing lower-complexity requests within the Zhipu AI family. At a blended rate of $0.10 per 1M tokens, it handles straightforward tasks at a fraction of GLM-5's cost, freeing budget for requests that genuinely require GLM-5's reasoning depth
  • Claude Sonnet 4.5 when structured output, multi-turn reliability, and precise instruction-following are priorities. Anthropic's mid-tier model complements GLM-5 well in agentic pipelines where output formatting consistency is critical
  • Kimi K2.6 for tasks requiring the highest reasoning ceiling across open-weight models. With an Intelligence Index score of 54 out of 100 on Artificial Analysis, it outperforms GLM-5 on complex reasoning benchmarks, though at a higher cost of $0.95 per 1M input tokens and $4.00 per 1M output tokens
  • Gemini 3.1 Flash Lite Preview when high-throughput, low-latency inference is needed at scale. At 279 tokens per second and a blended cost of $0.22 per 1M tokens, it handles burst traffic and fast-turnaround tasks that do not require GLM-5's reasoning depth
  • GPT-4o Mini for cost-sensitive classification, tagging, or extraction tasks where OpenAI's ecosystem compatibility matters. It pairs well with GLM-5 in a multi-provider routing setup where the routing layer directs complex requests to GLM-5 and simple ones elsewhere

What are the challenges of using GLM-5 in my product?

Like any production LLM, GLM-5 comes with tradeoffs worth planning for:

  • Provider dependency: Zhipu AI is primarily a China-based infrastructure provider. Routing all requests through a single regional provider creates fragility when the provider experiences downtime or deprecates a model version in favor of GLM-5.1 or later releases
  • Cost at scale: At $1.00 per 1M input tokens and $3.20 per 1M output tokens, GLM-5 costs compound quickly at high request volumes. Without active budget governance and fallback routing to lower-cost models like GLM-4.7 Flash, monthly spend can escalate rapidly
  • Verbosity: Artificial Analysis evaluation notes that GLM-5 is "very verbose," generating substantially more output tokens than comparable models at the same intelligence tier. This increases per-request output costs and can affect latency in streaming applications
  • English-language ecosystem gaps: Zhipu AI's documentation, SDKs, and community resources are less comprehensive in English than those of OpenAI or Anthropic. Teams building outside China may encounter gaps in troubleshooting and integration support
  • No multimodal input: GLM-5 is a text-only model. Workloads that require image, audio, or video understanding must route to a multimodal model, adding complexity to any multi-modal pipeline that also uses GLM-5 for text tasks

Why should I use Merge Gateway to route LLM requests with GLM-5 and every other model?

Using GLM-5 through Merge Gateway gives you access to the model itself and the infrastructure layer around it:

  • One API, every provider: Access GLM-5 and every other major LLM through a single endpoint and API key. Change providers by swapping the model string — no application code changes required
  • Intelligent routing and automatic failover: Merge routes around Zhipu AI outages automatically. Routing policies based on cost, latency, or quality can reduce spend by 40–60% without touching your application code
  • Cost governance: Set hard or soft project budgets so GLM-5 spend stays within plan. Every request is attributed to a model, project, and tag in a unified billing dashboard across all providers
  • Build Your Own Router: Define what "best" means for your traffic by selecting from curated ML benchmarks or adding your own eval scores. The router scores each available model against your weights and picks the winner per request, with a plain-language explanation of every decision
  • Security and compliance controls: Apply DLP rules and prompt injection protection before every request reaches Zhipu AI. Enforce per-project model and region policies without adding that logic to your application

How can I start routing requests to GLM-5 via Merge Gateway?

Getting GLM-5 running through Merge Gateway takes a few minutes:

1. Create an account and get your API key from the dashboard.

2. Install the Merge Gateway SDK: run pip install merge-gateway-sdk (Python) or npm install merge-gateway-sdk (Node). Alternatively, if you're already using the OpenAI SDK, set base_url = "https://api-gateway.merge.dev/v1/openai" and your existing code works as-is.

3. Make your first request using the provider/model format. For GLM-5, the model string is zhipu/glm-5. Swap the model string to route to any other provider without changing anything else.

4. Configure a routing policy in the dashboard to set failover behavior, cost limits, and optimization strategy. Your first policy can be as simple as naming GLM-5 as primary with one fallback.

Full setup instructions and SDK references are in the Merge Gateway docs.

Try GLM-5 through Merge Gateway

Route, observe, and control AI requests across providers from one API.