GLM-5 API: Access Zhipu AI's GLM-5

GLM-5 is the latest flagship model from Zhipu AI, one of China's leading AI research labs and the team behind the General Language Model (GLM) architecture. GLM-5 delivers strong reasoning, coding, and multilingual capability — with particular strengths in Chinese-language tasks and long-form analytical work.

Through AIsa, you access GLM-5 with a single OpenAI-compatible API key. No Zhipu account, no separate billing, no Chinese phone number required.


Supported GLM models

ModelContext windowBest forInput price*Output price*
GLM-5200,000 tokensGeneral reasoning, coding, Chinese-English bilingual tasks$0.4011/M$1.8053/M

* See marketplace.aisa.one/pricing for current AIsa rates.


Quickstart

Python

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_AISA_API_KEY",
    base_url="https://api.aisa.one/v1"
)

response = client.chat.completions.create(
    model="GLM-5",
    messages=[
        {"role": "user", "content": "Explain the key differences between transformer and state space model architectures."}
    ]
)
print(response.choices[0].message.content)

Node.js

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.AISA_API_KEY,
  baseURL: "https://api.aisa.one/v1",
});

const response = await client.chat.completions.create({
  model: "GLM-5",
  messages: [
    { role: "user", content: "Write a Python function that implements binary search with detailed comments." }
  ],
});
console.log(response.choices[0].message.content);

Streaming

stream = client.chat.completions.create(
    model="GLM-5",
    messages=[{"role": "user", "content": "Analyse the competitive dynamics of China's cloud computing market."}],
    stream=True
)

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

Model guide

GLM-5 — Zhipu AI's flagship

Zhipu AI has been building large language models since 2019 and GLM-5 represents the maturation of their architecture. The model is particularly strong on Chinese-language reasoning, structured analytical tasks, and code generation — making it a natural fit for applications targeting Chinese markets or bilingual workflows.

Use when you need:

  • High-quality Chinese-language generation and reasoning
  • Bilingual Chinese-English document processing or translation
  • Code generation and technical problem-solving in Chinese development contexts
  • A capable general-purpose model with a distinct training profile from Alibaba and ByteDance models
# Chinese-language reasoning
response = client.chat.completions.create(
    model="GLM-5",
    messages=[
        {"role": "system", "content": "你是一位资深商业分析师。"},
        {"role": "user", "content": "请分析中国新能源汽车市场的竞争格局,重点关注比亚迪、理想、蔚来的差异化战略。"}
    ]
)

# Bilingual document processing
response = client.chat.completions.create(
    model="GLM-5",
    messages=[
        {"role": "user", "content": "Translate the following contract clause to Chinese, then flag any terms that may require localisation for PRC law compliance:\n\n[clause text]"}
    ]
)

# Code generation
response = client.chat.completions.create(
    model="GLM-5",
    messages=[
        {"role": "system", "content": "You are an expert software engineer."},
        {"role": "user", "content": "Implement a thread-safe LRU cache in Python with a configurable max size and TTL."}
    ]
)

Function calling

GLM-5 supports function calling with the standard OpenAI tool-calling schema:

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_market_data",
            "description": "Retrieve financial market data for a given ticker symbol",
            "parameters": {
                "type": "object",
                "properties": {
                    "ticker": {"type": "string", "description": "Stock ticker symbol (e.g. 600519.SS for Moutai)"},
                    "period": {"type": "string", "enum": ["1d", "1w", "1m", "1y"]}
                },
                "required": ["ticker"]
            }
        }
    }
]

response = client.chat.completions.create(
    model="GLM-5",
    messages=[{"role": "user", "content": "Get the last month of data for BYD and summarise the trend."}],
    tools=tools,
    tool_choice="auto"
)

Switching from Zhipu AI's API directly

If you've been using Zhipu AI's BigModel platform directly, switching to AIsa takes one change:

# Zhipu AI direct
from zhipuai import ZhipuAI
client = ZhipuAI(api_key="your-zhipu-key")

# AIsa — OpenAI-compatible, same model
from openai import OpenAI
client = OpenAI(
    api_key="YOUR_AISA_API_KEY",
    base_url="https://api.aisa.one/v1"
)

response = client.chat.completions.create(
    model="GLM-5",
    messages=[{"role": "user", "content": "Your prompt here"}]
)

Benefits of routing via AIsa: unified billing across all your models, automatic failover, and no need to manage a separate Zhipu account or Chinese entity verification.


Data privacy

GLM-5 is accessed through AIsa's enterprise agreement with Zhipu AI. Customer data is not used for model training. For compliance requirements, contact us.


What's next