Free / Budget Mainstream models Direct connect ★ 4.4 / 5

Zhipu AI GLM Review: Pricing & Comparison

Official Zhipu API — GLM-4.7-Flash permanently free, 200K context + 59.2% SWE-bench, mainland direct connect

Last verified: 2026-07-07 · Visit official site →

A fact that’s hard to believe

GLM-4.7-Flash, Zhipu AI’s strongest free model, is permanently free with no usage cap (after identity verification, at a rate of roughly 1 req/s).

How strong is this model? A 31B total-parameter/3B-active MoE architecture, 200K-token ultra-long context, 59.2% on SWE-bench Verified (roughly 2.7x Qwen3-30B-A3B’s 22.0%), 91.6% on the AIME 25 math benchmark, and 75.2% on GPQA reasoning.

Getting this much for free is still an outlier in the 2026 large-model market. This review covers the full Zhipu AI GLM API lineup — pricing from free to enterprise tier, benchmark performance, integration code, multimodal capabilities, and a head-to-head comparison against DeepSeek, Kimi, and Qwen.

Who is Zhipu AI

Zhipu AI was founded in 2019, growing out of Tsinghua University’s Computer Science Department NLP lab. Before ChatGPT broke into the mainstream, Zhipu’s GLM (General Language Model) series was already among the most widely used pretrained language models in China’s academic and industry circles. The name GLM comes from its pretraining method — General Language Model Pretraining with Autoregressive Blank Infilling — which, unlike BERT’s masked-language modeling or GPT’s autoregressive generation, blends the strengths of both. That’s the technical foundation behind its balanced performance on Chinese comprehension and generation.

After 2023, as large-model commercialization took off, Zhipu opened up the GLM API (on the bigmodel.cn platform), and in 2025 unified its international brand under Z.AI (z.ai), offering two access points:

  • Mainland: https://open.bigmodel.cn/api/paas/v4/ (direct connect, no proxy needed)
  • International: https://api.z.ai/api/openai/v1 (OpenAI-compatible) or https://api.z.ai/api/anthropic (Anthropic-compatible)

Worth noting: Zhipu AI itself is not an AI API relay — it’s the original developer and official API provider of the model, similar to Moonshot in China. Calling GLM directly through Zhipu means you’re using a first-hand model service, not going through an intermediary layer.

Full model lineup and pricing

Text models

ModelContextInput ($/1M)Cache hit ($/1M)Output ($/1M)Notes
GLM-5.2200K$1.40$0.26$4.40Current flagship
GLM-5.1200K$1.40$0.26$4.40SWE-bench Pro 58.4%
GLM-5128K$1.00$0.20$3.20
GLM-5-Turbo128K$1.20$0.24$4.00
GLM-4.7128K$0.60$0.11$2.20
GLM-4.7-FlashX128K$0.07$0.01$0.40Ultra-fast, low price
GLM-4.5-X$2.20$0.45$8.90Extended reasoning version
GLM-4.5-Air128K$0.20$0.03$1.10Lightweight general-purpose
GLM-4.7-Flash200KFreeFreePermanently free
GLM-4.5-Flash128KFreeFreePermanently free

Vision and multimodal models

ModelInput ($/1M)Output ($/1M)Notes
GLM-5V-Turbo$1.20$4.00Flagship vision understanding
GLM-4.6V-FlashX$0.04$0.40Ultra-fast vision
GLM-4.6V-FlashFreeFreeFree vision-understanding tier

Generation services

ServicePriceModel
Image generation$0.015 / imageGLM-Image (CogView series)
Video generation$0.200 / clipCogVideoX-3
Speech recognition (ASR)$0.030 / 1M tokensGLM-ASR-2512
Web search$0.010 / call

New-user bonus: after identity verification, you get 20 million tokens of free credit usable on any paid model — plenty for light development work.

GLM-4.7-Flash: benchmark numbers for a free model

GLM-4.7-Flash uses a MoE (Mixture-of-Experts) architecture: 31B total parameters, but only 3B are activated per inference. That keeps performance strong while sharply cutting inference cost — the technical basis for why it can stay permanently free.

Benchmark results (vs. Qwen3-30B-A3B)

BenchmarkGLM-4.7-FlashQwen3-30B-A3BGap
SWE-bench Verified (coding)59.2%22.0%+169%
tau-2 Bench (tool calling)79.549.0+62%
BrowseComp (web agent)42.82.29+1769%
AIME 25 (math competition)91.685.0+8%
GPQA (scientific reasoning)75.273.4+2%
LiveCodeBench v6 (coding)64.066.0-3%

What does a 59.2% SWE-bench Verified score actually mean? These are code-fix tasks on real GitHub issues — 59.2% means more than half of real-world bugs can be auto-fixed by this free model. Compared to GPT-4o (just over 30%) and Llama 3.3 70B (~30%), GLM-4.7-Flash’s agentic capability far exceeds open-source models in its class.

A score of 79.5 on tau-2 Bench (the tool-calling benchmark) points to high reliability in function calling — important for agent scenarios that need to integrate external APIs or databases.

GLM-5.1 flagship performance

GLM-5.1 is currently Zhipu AI’s best-value flagship option (priced the same as GLM-5.2, but with a more stable track record):

  • SWE-bench Pro: 58.4% (ahead of GPT-5.4’s 57.7% and Claude Opus 4.6’s 57.3%)
  • GPQA: 83.9 (87th percentile — top-tier scientific reasoning)
  • Intelligence index: 35.4 (91st percentile)

That means on both coding-agent and scientific-reasoning dimensions, GLM-5.1 has caught up to — and in some cases surpassed — OpenAI’s and Anthropic’s contemporaneous flagship models.

API integration: OpenAI-compatible interface

The GLM API is fully compatible with the OpenAI SDK, so integration cost is close to zero.

Basic text chat

from openai import OpenAI

# Mainland users
client = OpenAI(
    api_key="your GLM API key",
    base_url="https://open.bigmodel.cn/api/paas/v4/"
)

# International users (z.ai endpoint)
# client = OpenAI(
#     api_key="your GLM API key",
#     base_url="https://api.z.ai/api/openai/v1"
# )

response = client.chat.completions.create(
    model="glm-4.7-flash",   # free model
    messages=[
        {"role": "system", "content": "You are a senior software engineer skilled at code review and refactoring advice"},
        {"role": "user", "content": "Please review the following Python code for performance issues:\n\n```python\ndef find_duplicates(lst):\n    duplicates = []\n    for i in range(len(lst)):\n        for j in range(i+1, len(lst)):\n            if lst[i] == lst[j] and lst[i] not in duplicates:\n                duplicates.append(lst[i])\n    return duplicates\n```"}
    ],
    max_tokens=2048,
    stream=True   # streaming output recommended
)

for chunk in response:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end='', flush=True)

Switching from OpenAI to GLM with no friction

import os

# Only two lines need to change — everything else stays the same
os.environ["OPENAI_API_KEY"] = "your GLM API key"
os.environ["OPENAI_BASE_URL"] = "https://open.bigmodel.cn/api/paas/v4/"

# Your existing OpenAI-calling code doesn't need to change
from openai import OpenAI
client = OpenAI()  # automatically reads the environment variables

# Just swap in the GLM model name
response = client.chat.completions.create(
    model="glm-4.7-flash",  # used to be "gpt-4o"
    messages=[{"role": "user", "content": "Hello"}]
)

Anthropic-compatible endpoint

Z.AI also offers an Anthropic-compatible endpoint that can directly replace the Claude API address — useful for projects that have the Anthropic SDK hardcoded:

import anthropic

client = anthropic.Anthropic(
    api_key="your GLM API key",
    base_url="https://api.z.ai/api/anthropic"
)

message = client.messages.create(
    model="glm-5.1",   # use a GLM model name
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Analyze the time complexity of this code"}
    ]
)

This is especially useful for claude-code-router or other tools built on the Anthropic SDK: just change one base_url and requests get routed to GLM without touching any business logic.

Function calling (Tool Use): agents in practice

GLM-4.7-Flash’s 79.5 score on the tau-2 tool-calling benchmark reflects its reliability in agent scenarios. A practical example:

import json

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_stock_price",
            "description": "Get the current price of a given stock",
            "parameters": {
                "type": "object",
                "properties": {
                    "symbol": {
                        "type": "string",
                        "description": "Stock ticker, e.g. AAPL, 600036"
                    },
                    "market": {
                        "type": "string",
                        "enum": ["US", "CN"],
                        "description": "Market: US (U.S. stocks) or CN (A-shares)"
                    }
                },
                "required": ["symbol", "market"]
            }
        }
    }
]

response = client.chat.completions.create(
    model="glm-4.7-flash",
    messages=[
        {"role": "user", "content": "Look up today's stock price for China Merchants Bank"}
    ],
    tools=tools,
    tool_choice="auto"
)

# Parse the function call
if response.choices[0].message.tool_calls:
    tool_call = response.choices[0].message.tool_calls[0]
    func_name = tool_call.function.name
    func_args = json.loads(tool_call.function.arguments)
    print(f"Calling function: {func_name}")
    print(f"Arguments: {func_args}")
    # Output: Calling function: get_stock_price
    # Output: Arguments: {'symbol': '600036', 'market': 'CN'}

GLM-4.7-Flash has a clear edge in tool-call argument-extraction accuracy over comparable Qwen3-tier models (79.5 vs. 49.0), making it well suited to building agent workflows that call external tools frequently.

Building a zero-cost code-review bot with GLM-4.7-Flash

GLM-4.7-Flash’s most direct real-world application is as the underlying model for automated code review — it’s free, has long enough context (200K), and posts excellent coding benchmarks.

Here’s a complete skeleton for a GitHub PR code-review bot — the cost of reviewing 100 PRs a day is zero:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["GLM_API_KEY"],
    base_url="https://open.bigmodel.cn/api/paas/v4/"
)

CODE_REVIEW_PROMPT = """You are a senior software engineer focused on code review.
Analyze the following code change (Git diff), paying particular attention to:
1. Potential bugs (edge cases, null pointers, concurrency issues)
2. Performance issues (O(n²) algorithms, unnecessary database queries, memory leaks)
3. Security vulnerabilities (SQL injection, XSS, sensitive-data leaks)
4. Maintainability (naming conventions, function length, coupling)

Output in the following format:
## Critical issues
## General suggestions
## Strengths"""

def review_pr(diff_content: str) -> str:
    response = client.chat.completions.create(
        model="glm-4.7-flash",  # permanently free
        messages=[
            {"role": "system", "content": CODE_REVIEW_PROMPT},
            {"role": "user", "content": f"```diff\n{diff_content}\n```"}
        ],
        max_tokens=3000,
        temperature=0.1  # code review needs deterministic output
    )
    return response.choices[0].message.content

# Example usage
with open("pr.diff") as f:
    diff = f.read()
print(review_pr(diff))

Cost comparison: for the same code-review bot, using GPT-4o ($5/M input) to review 100 PRs a day (averaging 3K tokens per PR) runs about $45/month; using GLM-4.7-Flash costs $0.

Integrating GLM with claude-code-router for smart routing

claude-code-router is an open-source Claude Code API routing tool that can dispatch requests to different models. GLM’s Anthropic-compatible endpoint lets it plug in seamlessly:

{
  "ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
  "ANTHROPIC_API_KEY": "your GLM API key",
  "providers": {
    "zhipu-flash": {
      "baseURL": "https://api.z.ai/api/anthropic",
      "apiKey": "your GLM API key",
      "model": "glm-4.7-flash"
    },
    "zhipu-flagship": {
      "baseURL": "https://api.z.ai/api/anthropic",
      "apiKey": "your GLM API key",
      "model": "glm-5.1"
    }
  },
  "router": {
    "default": "zhipu-flash",
    "background": "zhipu-flash",
    "thinking": "zhipu-flagship"
  }
}

The logic behind this config: routine tasks go to GLM-4.7-Flash (free), while complex reasoning and deep-thinking tasks switch to GLM-5.1 ($1.4/M) — overall cost comes in more than 90% below running everything through Claude Opus.

The GLM Coding plan

Zhipu AI launched a dedicated GLM Coding plan (bigmodel.cn/glm-coding) for coding use cases, offering higher concurrency limits and lower per-unit pricing to users who heavily use kimi-k2.7-code or GLM’s coding models.

Main benefits for plan subscribers:

  • Higher concurrency limits: the higher the plan tier, the more concurrent model requests you can make
  • Dynamic off-peak boosts: during off-peak server hours, plan subscribers get dynamic concurrency priority
  • Priority queue for GLM-4.7-Flash: plan subscribers’ free-model requests get priority in the queue

If you’re a heavy coding-assistant user (averaging more than 200 calls a day), the Coding plan’s concurrency benefits work out more cost-effective than pay-as-you-go.

Context caching: controlling cost on long conversations

The GLM-5 series supports context caching, working similarly to Kimi’s: once a long system prompt or document you pass in for the first time gets cached, subsequent requests that hit the cache are billed at a lower rate for those tokens (roughly 18-20% of the normal price).

# Assume you have a 20,000-word codebase as context
CODEBASE_CONTEXT = "...your codebase content..."

# First call: not cached, billed at $1.4/M
response1 = client.chat.completions.create(
    model="glm-5.1",
    messages=[
        {"role": "system", "content": f"Here is the project codebase:\n{CODEBASE_CONTEXT}"},
        {"role": "user", "content": "Find all possible memory-leak points"}
    ]
)

# Subsequent call: the same prefix content is already cached, input billed at $0.26/M (81% savings)
response2 = client.chat.completions.create(
    model="glm-5.1",
    messages=[
        {"role": "system", "content": f"Here is the project codebase:\n{CODEBASE_CONTEXT}"},
        {"role": "user", "content": "Generate unit tests for this codebase"}
    ]
)

# Check the cache-hit stats
usage = response2.usage
print(f"Total input tokens: {usage.prompt_tokens}")
if hasattr(usage, 'prompt_tokens_details'):
    print(f"Cache hit: {usage.prompt_tokens_details.cached_tokens}")

For scenarios where you’re repeatedly asking different questions against the same codebase or document, caching delivers substantial cost savings — GLM-5.1’s cache-hit price of $0.26/M vs. the normal $1.40/M is an 81% saving.

The full multimodal stack

Vision understanding (the GLM-V series)

import base64

# Image understanding (local image)
with open("chart.png", "rb") as f:
    image_data = base64.b64encode(f.read()).decode()

response = client.chat.completions.create(
    model="glm-4.6v-flash",   # free vision model
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "image_url",
                    "image_url": {"url": f"data:image/png;base64,{image_data}"}
                },
                {
                    "type": "text",
                    "text": "Analyze the data trend in this chart and summarize three key takeaways"
                }
            ]
        }
    ]
)

Image generation (CogView)

response = client.images.generate(
    model="cogview-4",
    prompt="A cyberpunk-style night view of the Shanghai Bund, neon lights reflecting on the Huangpu River, ultra-high-definition detail",
    size="1024x1024",
    n=1
)
image_url = response.data[0].url

Price: $0.015/image, roughly ¥0.11/image — on the low end among current domestic image-generation APIs.

Video generation (CogVideoX-3)

# Text-to-video (async task)
response = client.videos.generate(
    model="cogvideox-3",
    prompt="An orange cat yawning in the afternoon sun, fluffy texture, slow motion",
    duration=5,   # seconds
    resolution="720p"
)
task_id = response.id
# Video generation usually takes 30 seconds to a few minutes; poll for the result

Price: $0.20/video clip, roughly ¥1.5/clip.

Speech recognition (ASR)

with open("recording.mp3", "rb") as audio_file:
    transcript = client.audio.transcriptions.create(
        model="glm-asr-2512",
        file=audio_file,
        language="zh"   # Chinese preferred
    )
print(transcript.text)

Price: $0.03/1M tokens (about $0.0024/minute) — close to Whisper’s competitive pricing.

GLM vs. the competition

Zhipu AI GLMDeepSeek V4 FlashKimi K2.7-codeQwen3-30B-A3B
Free modelGLM-4.7-Flash (permanent)No long-term free tierNoneNo long-term free tier
Free-model context200K
SWE-bench (free/entry tier)59.2% (free!)22.0%
Flagship input price$1.40/M$0.14/M$0.95/M
Flagship output price$4.40/M$0.55/M$4.00/M
Mainland direct connect
Vision understanding✓ (incl. free tier)
Image generation✓ (¥0.11/image)✓ (Wanx)
Video generation✓ (¥1.5/clip)
Speech recognition
Context caching✓ (GLM-5 series)
Anthropic-compatible endpoint✓ (z.ai)

Key takeaways:

  • High free-tier volume + agent capability needed: GLM-4.7-Flash is close to the only choice — the combination of free + 59.2% SWE-bench is hard to match
  • Rock-bottom-priced flagship: DeepSeek V4 Flash wins outright at $0.14/M, well suited to high-frequency routine tasks
  • Long-document processing: Kimi K2.7’s 256K context plus document-specific optimization is a better fit
  • Full multimodal stack: GLM is the only domestic platform that covers all five — text, vision, image, video, and speech

When does Zhipu AI GLM make sense

Strongly recommended for:

  1. Individual developers / side projects: GLM-4.7-Flash is permanently free, and 1 req/s is more than enough for a personal project — effectively a strong, free Claude substitute
  2. Code-review and refactoring tools: a 59.2% SWE-bench score means GLM-4.7-Flash’s coding ability far exceeds anything else at its price point (zero), making it excellent value for a code-review bot or IDE plugin
  3. Multimodal SaaS products: text, vision, image, video, and speech all in one place, cutting down on multi-vendor management overhead
  4. Projects needing Claude/OpenAI API-compatible switching: the dual-compatible endpoints keep migration cost minimal
  5. High-concurrency, non-urgent batch tasks: the free tier’s 1 req/s isn’t suited to real-time applications, but works well for overnight batch document processing, report generation, and similar tasks

Less of a fit for:

  1. High-concurrency real-time services (e.g. live customer support): the paid tier isn’t as price-competitive as DeepSeek, and the free tier’s rate limit falls short — neither end has an advantage here
  2. Pure text generation at the lowest possible price: DeepSeek V4 Flash’s $0.14/M is far below GLM-5.1’s $1.40/M — a tenfold price gap
  3. Very large-scale enterprise deployments: OpenAI/Anthropic still have more mature enterprise SLAs, auditing features, and compliance certifications

Enterprise selection: at what scale does GLM deserve serious consideration

Startup / individual-developer stage (under 1M calls/month)

GLM-4.7-Flash is the best starting point. Validate your product idea at zero cost, and only consider upgrading to a paid tier once traffic picks up. Technical suggestions for this stage:

  • Use GLM-4.7-Flash for all non-real-time tasks (document processing, code review, batch summarization)
  • If real-time interaction is rate-sensitive, pair it with a relay like SiliconFlow for a faster GLM path
  • Use up the free credit (20 million tokens) before worrying about anything else

Growth stage (1M-100M calls/month)

This stage calls for serious price comparison. Key considerations:

ScenarioRecommended approachRationale
Code generation/reviewGLM-4.7-Flash + paid planStrongest SWE-bench score, ample concurrency
Ordinary chatDeepSeek V4 Flash$0.14/M is far below GLM-5’s $1.4/M
Long-document analysisKimi K2.7-code or GLM-5256K/200K context — pick based on document size
Multimodal content generationGLM (incl. image/video)The only full-stack option among competitors
Agent/function callingGLM-4.7-Flash (free)Leads with a 79.5 tau-2 score

The most valuable strategy at this stage is “tiered routing”: use claude-code-router or a similar tool to send simple tasks to GLM-4.7-Flash (free), complex reasoning to DeepSeek V4 Pro or GLM-5.1 (depending on the scenario), and vision tasks to the GLM-V series.

Enterprise/platform stage (over 100M calls/month)

At scale, GLM’s core advantage is mainland direct connect plus compliance. bigmodel.cn’s data centers are located domestically, satisfying data-localization requirements, and Zhipu AI offers enterprise contracts and customized SLAs. If your users are in data-sensitive sectors like government, finance, or healthcare, Zhipu AI’s compliance background (Tsinghua roots, recognized by domestic regulators) makes it a better choice than OpenAI/Anthropic.

Things to pay attention to at large scale:

  • Negotiating volume discounts (dedicated pricing is available at tens-of-millions-of-calls scale)
  • Private-deployment options (Zhipu AI offers on-premises enterprise deployment of GLM models)
  • Signing a framework agreement with Zhipu AI to lock in pricing and hedge against market fluctuations

Hands-on impressions: what GLM-4.7-Flash actually feels like

We tested a few real-world scenarios and recorded our subjective impressions:

Code review: given a Python snippet with 5 different types of bugs, GLM-4.7-Flash caught 4 and missed one timing-related concurrency bug. Overall, its accuracy on common bug types (null pointers, out-of-bounds, SQL injection) is high, with timing and concurrency bugs as a weak spot.

Long-document comprehension: given a 40,000-character technical document (about 1/5 of the 200K-token context window) and asked to extract 20 key technical decision points, GLM-4.7-Flash’s output was well-structured and did a decent job pulling together scattered information, though its precision on technical-term definitions was sometimes less rigorous than Claude’s.

Function calling: we tested 10 tool-call scenarios with different structures (nested parameters, enum types, optional fields, etc.), and GLM-4.7-Flash correctly parsed the parameter structure in every case, with no sign of the common “hallucinated parameter” or “missing parameter” problems — consistent with its high 79.5 tau-2 score.

Response speed: over a mainland direct connection, GLM-4.7-Flash’s time-to-first-token (TTFT) runs about 300-500ms, with output speed around 40-60 tokens/second. That’s a bit slower than DeepSeek V4 Flash, but perfectly acceptable for most use cases. The faster variant (GLM-4.7-FlashX) is noticeably quicker, but costs money ($0.07/M input).

Chinese-language quality: output quality on pure Chinese writing, Chinese translation, and mixed Chinese-English scenarios beats English-first models at the same price point. This comes from GLM’s accumulated history — high-quality Chinese pretraining corpus from its Tsinghua roots. Concretely, this shows up as accurate handling of idioms and colloquialisms, fluent classical-to-vernacular Chinese conversion, and better command of industry terminology (legal, medical, financial) than English-first models. This matters if your product is primarily Chinese-facing.

Signup and integration

Mainland users

  1. Go to bigmodel.cn and sign up with a phone number
  2. After identity verification, you get 20 million tokens of free credit, plus access to GLM-4.7-Flash’s permanently free allotment
  3. Create an API key in the console
  4. Endpoint: https://open.bigmodel.cn/api/paas/v4/

Rate limits for reference:

  • Free model (GLM-4.7-Flash): about 1 req/s, no concurrency cap
  • Paid plans: dynamic concurrency boosts during peak hours, depending on plan tier

International users / need the Anthropic-compatible endpoint

  1. Sign up at z.ai (no Chinese phone number required — email works)
  2. Create an API key
  3. OpenAI-compatible endpoint: https://api.z.ai/api/openai/v1
  4. Anthropic-compatible endpoint: https://api.z.ai/api/anthropic (usable with claude-code-router, Cursor, and similar tools)

GLM and AI API relays

Many AI API relays (SiliconFlow, AiHubMix, OpenRouter, and others) have also integrated the GLM series. There are trade-offs to weigh when calling GLM through a relay instead of directly:

Reasons to choose official direct connect:

  • Latest model versions (relays typically lag behind)
  • Context caching works (some relays don’t forward the caching protocol)
  • A clean account system with accurate token-usage tracking

Reasons to choose a relay:

  • Unified billing (pay once across multiple vendors’ models, no need to juggle several API keys)
  • Some relays offer lower GLM pricing (bulk-purchase discounts)
  • Low migration cost for projects already built on relay infrastructure

Neither approach is strictly better — it depends on your usage volume and existing architecture. If GLM is your primary model, official direct connect is the steadier choice; if it’s just one option in a multi-model setup, managing it through a relay is more convenient.

LangChain

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="glm-4.7-flash",
    api_key="your GLM API key",
    base_url="https://open.bigmodel.cn/api/paas/v4/",
    temperature=0.7
)

# Works with LangChain's LCEL pipeline
from langchain_core.prompts import ChatPromptTemplate
prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a professional coding assistant"),
    ("user", "{input}")
])
chain = prompt | llm
response = chain.invoke({"input": "Implement an LRU cache in Python"})

GLM’s OpenAI-compatible endpoint lets it drop straight into LangChain’s ChatOpenAI, with no extra dependencies to install.

LlamaIndex

from llama_index.llms.openai import OpenAI as LlamaOpenAI

llm = LlamaOpenAI(
    model="glm-4.7-flash",
    api_key="your GLM API key",
    api_base="https://open.bigmodel.cn/api/paas/v4/"
)

# Build a RAG pipeline
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
documents = SimpleDirectoryReader("docs/").load_data()
index = VectorStoreIndex.from_documents(documents, llm=llm)
query_engine = index.as_query_engine()
response = query_engine.query("What is this document's central argument?")

LobeChat / Open WebUI

LobeChat, Open WebUI, and other open-source frontends support custom OpenAI-compatible endpoints, so you can plug in GLM’s endpoint directly and call it through a graphical interface. Configuration path: Settings → Model Provider → Custom → enter the bigmodel.cn endpoint and API key.

Cursor / Continue.dev

Editors like these usually support custom model providers — through the Anthropic-compatible endpoint (https://api.z.ai/api/anthropic), you can wire GLM-4.7-Flash into Cursor’s background completion for free AI-assisted coding.

FAQ

Q: Is GLM-4.7-Flash really permanently free, not just a trial period? A: Yes. GLM-4.7-Flash and GLM-4.5-Flash are Zhipu AI’s permanently free tiers, with no trial-period limit. The constraint is rate (about 1 req/s), not time or a quota. Identity verification is the only requirement.

Q: How can I get around the free tier’s 1 req/s limit? A: Officially, you can’t bypass the rate limit. There are a few legitimate workarounds: (1) spread requests across multiple accounts (requires multiple verified phone numbers); (2) buy a paid plan to unlock higher concurrency; (3) use GLM-4.7-Flash for non-real-time batch tasks, where the rate limit matters less.

Q: Does the GLM API support streaming output? A: Yes. Just add stream=True to client.chat.completions.create() — it’s fully compatible with OpenAI’s streaming interface.

Q: Do I need to manually enable context caching? A: No. Context caching on the GLM-5 series is automatic — when a request’s prefix matches a previous request, the platform recognizes it and bills at the cache rate automatically, with no extra parameters needed.

Q: How good is GLM at handling long-form Chinese content? A: GLM-4.7-Flash and the GLM-5 series generally outperform comparable English-optimized models on Chinese. Zhipu AI grew out of Tsinghua’s NLP lab, so its Chinese-corpus coverage runs deep, with solid performance on Chinese instruction-following, Chinese document comprehension, and mixed Chinese-English scenarios.

Q: Where do I get a GLM API key in mainland China? A: Go to bigmodel.cn → register an account → verify your identity with your phone number → Console → API Keys → Create. The whole process takes under 5 minutes. GLM-4.7-Flash works with no top-up required. Once you have a key, we’d recommend setting a spending cap in the console right away, to guard against an unexpectedly large bill from stray calls.

Q: Does video generation support Chinese-language prompts? A: Yes. CogVideoX-3 accepts prompts in both Chinese and English, and its understanding of Chinese scenes (people, landscapes, cultural elements) is also more accurate than some overseas video-generation models.

Q: Does GLM offer an enterprise SLA? A: Yes. Zhipu AI offers enterprise contracts and SLAs — contact their business team for specific terms. The standard bigmodel.cn platform service doesn’t come with an SLA guarantee; for high-availability needs, we’d recommend signing a formal enterprise agreement with Zhipu AI.

Bottom line

Zhipu AI GLM has carved out an interesting position in the 2026 market: win over developers with GLM-4.7-Flash’s free, high-performance tier, then serve enterprise customers with the GLM-5 series’ flagship capability (notably its 58.4% SWE-bench Pro score, ahead of GPT-5.4).

For domestic developers, there are several good reasons to give GLM a serious spot in the toolbox:

  • Mainland direct connect: no proxy needed, the simplest deployment
  • Permanently free tier: GLM-4.7-Flash plus GLM-4.6V-Flash keep personal projects at close to zero cost
  • Full multimodal coverage: text, vision, image, video, and speech under one account
  • Dual API compatibility: OpenAI and Anthropic interfaces both supported, keeping migration cost minimal
  • Standout coding ability: 59.2% SWE-bench on the free tier, far ahead of every competitor at the same price (zero)

If your current stack only has OpenAI or Anthropic, spending 15 minutes wiring in GLM-4.7-Flash as a free backup layer is a small task with an outsized ROI.

Information verified 2026-07-07. GLM model versions and pricing continue to evolve — refer to the official bigmodel.cn and z.ai documentation for the latest details.

  • SiliconFlow: the largest domestic open-source model relay, low-price direct connect across the full DeepSeek/Qwen lineup
  • Moonshot Kimi: 256K ultra-long context, specifically optimized for document processing
  • AiHubMix: mainland direct connect to Claude/GPT, Prompt Caching integration, an enterprise favorite
  • OpenRouter: the world’s largest model router, 400+ models under one unified API, friendly for A/B testing

Quick facts

Pricing modelGLM-4.7-Flash and GLM-4.5-Flash are permanently free; the GLM-5.2 flagship runs $1.4/$4.4 per M tokens; context-cache hits cut input pricing by up to 80%
Model coverageGLM-5 series (flagship reasoning), GLM-4.7 series (coding/general-purpose), GLM-4.7-Flash (free MoE), plus a full vision/image/video stack
Latency / SLAMainland direct connect via bigmodel.cn, an overseas endpoint via z.ai, low latency on Zhipu's own inference cluster
Mainland direct connectDirect connect
Best forDevelopers / Enterprise
Referral programZhipu AI currently has no public affiliate program.

Pros

  • GLM-4.7-Flash is permanently free: a 31B-parameter/3B-active MoE architecture, 200K ultra-long context, 59.2% on SWE-bench Verified — flagship-grade coding capability at zero cost
  • Mainland direct connect, no proxy needed: the official bigmodel.cn endpoint is directly accessible to domestic developers, with no blocking — stable and reliable for production
  • Full multimodal stack: text, vision understanding, image generation (CogView), video generation (CogVideoX-3), and speech recognition (ASR) — all under one account

Cons

  • The free tier has a rate limit (about 1 req/s) — high-concurrency production use needs a paid plan
  • GLM-5 flagship pricing ($1.4/M input) is higher than DeepSeek V4 Flash ($0.14/M) — for high-frequency routine tasks, the cost-efficiency doesn't match the cheapest competitors
  • The international community ecosystem is weaker than OpenAI/Anthropic's — third-party plugin and open-source toolchain support is relatively limited

Compare more AI API relays

See the full comparison board — filter by price tier, model coverage, and mainland direct-connect status.

Back to the comparison board →