AIWave

Blog Model Guides

GLM-5 & GLM-4.6 API: Complete Guide 2026

Complete GLM-5 and GLM-4.6 API guide from Zhipu AI. Pricing $0.14/M input tokens, prepaid tier, Python & Node.js tutorials, function calling.

2026-06-26 5 min read
GLM-5Zhipu AIAPI GuideTutorial

Pricing verified as of 2026-08-19. DeepSeek changed to peak/off-peak pricing on 2026-08-17.

Zhipu AI (智谱AI) is one of China's leading AI research companies, and their GLM (General Language Model) family has become increasingly popular among developers worldwide. With the release of GLM-5 and the remarkably affordable GLM-4.6 Flash (available during evaluation), Zhipu AI offers compelling alternatives to both DeepSeek and GPT models.

This guide covers the entire GLM API family — including GLM-5, GLM-4.6, GLM-4.6 Flash, and GLM 5 (vision) — with pricing, code examples, and best practices.

The GLM Model Family

Model Status Context Best For
GLM-5 Flagship 128K Best overall performance, reasoning, coding
GLM-4.6 Previous gen 128K Solid quality, slightly lower cost
GLM-4.6 Flash Prepaid credits — pay only for what you use 128K Testing, prototyping, high-volume apps
GLM 5 (Vision) Vision model 128K Image understanding & analysis
ERNIE 4.0 (Baidu)$0.55$0.55Chinese NLP, search integration

All GLM models are available through the AIWave API — Email or GitHub account options are available.

GLM API Pricing

Model Input (per 1M tokens) Output (per 1M tokens) Context
GLM-5 $0.14 $0.14 128K
GLM-4.6 $0.93 $3.41 128K
GLM-4.6 Flash $0.00 🆓 $0.00 128K
GLM 5 (Vision) $1.55 $4.96 128K
DeepSeek V4 Pro (AIWave, 2026-08-19) $1.32 $3.96 128K
GPT-4o (reference) $2.50 $10.00 128K
ERNIE 4.0 (Baidu)$0.55$0.55Chinese NLP, search integration

💡 GLM-4.6 Flash is ultra-low cost to use — perfect for prototyping, testing, and high-volume applications. At $0.14/M tokens, GLM-5 matches DeepSeek V4 Pro on input pricing while being cheaper on output ($3.96 vs $3.96/1M).

Getting Started with GLM API

Step 1: Get Access

You can access all GLM models through AIWave's OpenAI-compatible API. Sign up for a $5 minimum top-up — Email or GitHub account options needed.

→ Get Your API Key at AIWave

Step 2: Install & Configure

pip install openai

Step 3: Python Examples

Using GLM-5 (Flagship):

from openai import OpenAI

client = OpenAI(
    base_url="https://aiwave.live/v1",
    api_key="***"
)

response = client.chat.completions.create(
    model="glm-5",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain the advantages of GLM-5 over GLM-4.6."}
    ]
)
print(response.choices[0].message.content)

Using GLM-4.6 Flash ($0.00 at the dated snapshot):

response = client.chat.completions.create(
    model="glm-5-flash",  # $0.00 at the dated snapshot to use!
    messages=[{"role": "user", "content": "Hello, how can I use the GLM API?"}]
)
print(response.choices[0].message.content)

Step 4: GLM 5 Vision Model

import base64

with open("chart.png", "rb") as f:
    image_b64 = base64.b64encode(f.read()).decode()

response = client.chat.completions.create(
    model="glm-5",  # Vision model
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Analyze this chart and explain the trends."},
                {"type": "image_url", "image_url": f"data:image/png;base64,{image_b64}"}
            ]
        }
    ]
)
print(response.choices[0].message.content)

Step 5: Function Calling with GLM-5

tools = [{
    "type": "function",
    "function": {
        "name": "search_database",
        "description": "Search product database",
        "parameters": {
            "type": "object",
            "properties": {
                "query": {"type": "string"},
                "limit": {"type": "integer"}
            },
            "required": ["query"]
        }
    }
}]

response = client.chat.completions.create(
    model="glm-5",
    messages=[{"role": "user", "content": "Find products under $50"}],
    tools=tools
)
print(response.choices[0].message.tool_calls)

GLM vs DeepSeek vs GPT-4o

Feature GLM-5 DeepSeek V4 Pro GPT-4o
Input Price (1M)$0.14$0.14$2.50
Output Price (1M)$0.14 🏆$0.28$10.00
Context Window128K128K128K
Coding⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Chinese Language⭐⭐⭐⭐⭐ 🏆⭐⭐⭐⭐⭐⭐⭐
Prepaid credits — pay only for what you use Available✅ GLM-4.6 Flash 🏆❌❌
Vision (Image Input)✅ GLM 5❌✅
ERNIE 4.0 (Baidu)$0.55$0.55Chinese NLP, search integration

🎯 Recommendation: Use GLM-4.6 Flash during evaluation prototyping. Use GLM-5 for production Chinese-language applications — it offers the best output pricing at $0.14/M. Use DeepSeek V4 Pro for coding-heavy workloads.

Best Practices

  • Start with GLM-4.6 Flash during evaluation testing and prototyping — it's ultra-low cost with identical API interface to GLM-5
  • Use GLM-5 for production Chinese applications — native Chinese understanding is superior to most competitors
  • Leverage GLM 5 for image analysis tasks like chart interpretation, document scanning, and visual QA
  • Combine with DeepSeek V4 Pro for coding tasks — switch models by changing one parameter
  • listed model routes share one API key — no need for multiple accounts or providers

Try GLM-5 with prepaid credits

A $5 minimum top-up. Email or GitHub account options are available. One API key for listed model routes.

Get Your API Key →

Including GLM-4.6 Flash access at its dated $0.00 rate

Frequently Asked Questions

Is GLM-4.6 Flash really ultra-low cost?

Yes. GLM-4.6 Flash is ultra-low cost to use through the AIWave API — no credit card required, route-specific limits apply for standard applications.

What is the difference between GLM-5 and GLM-4.6?

GLM-5 is the latest flagship with improved reasoning, coding, and overall performance. GLM-4.6 is the previous generation, still very capable but slightly less powerful. GLM-4.6 Flash is a distilled variant optimized for speed and cost.

Does GLM support function calling?

Yes. GLM-5 supports function calling (tools), JSON mode, and streaming, making it suitable for production applications.

Can I use GLM 5 for image analysis?

Yes. GLM 5 accepts image inputs and can analyze charts, documents, photographs, and more. It's available through the same API key.

References

Terms of ServicePrivacy PolicyContact © 2026 AIWave

Related: GLM-5 API guide · GLM-5 model

GLM-5 is ultra-low cost on AIWave. Low cost. High performance.

Explore Models →