Z.ai GLM Models & API

Compare the Z.ai GLM models available on TokenHub, including GLM-5.2, GLM-5.1, GLM-4.7, and GLM-4.7 Flash. Review pricing, context, capabilities, and model IDs, then call Z.ai, GLM, Zhipu AI, and ChatGLM through one OpenAI-compatible API workflow.

Z.ai GLM Models & API Pricing

Compare current Z.ai GLM API pricing, input and output token costs, context windows, endpoints, and model IDs. The catalog may include GLM-5.2, GLM-5.1, GLM-4.7, and GLM-4.7 Flash; availability follows the live TokenHub model list.

Compare input, output, and cache-read prices for the available Z.ai GLM models. Open a model page to confirm the current billing unit and model ID.

Tên mô hìnhĐầu vào/ triệu tokenĐầu ra/ triệu tokenĐọc cache/ triệu token

Z.ai

GLM-4.5glm-4.5
$0.4286$2-

Z.ai

GLM-5glm-5
$0.5714$2.5714$0.1143

Z.ai

GLM-5.1glm-5.1
$0.8571$3.4286$0.1714

Z.ai

GLM-5.2glm-5.2
$1.1429$4$0.2857

Z.ai

GLM-5.3glm-5.3
$1.1429$4$0.2857

Compare context windows, maximum output, reasoning, tool calling, endpoints, and release dates across GLM-5.2, GLM-5.1, GLM-4.7, and GLM-4.7 Flash.

Tên mô hìnhPhương thứcCửa sổ ngữ cảnhMax outputReasoningTool callingEndpointNgày phát hành

Z.ai

GLM-4.5glm-4.5
131.1K
98.3K
Anthropic / gemini / OpenAI
28 thg 7, 2025

Z.ai

GLM-5glm-5
204.8K
131.1K
OpenAI / Anthropic / gemini
11 thg 2, 2026

Z.ai

GLM-5.1glm-5.1
200K
131.1K
OpenAI / Anthropic / gemini
27 thg 3, 2026

Z.ai

GLM-5.2glm-5.2
1M
131.1K
OpenAI / Anthropic / gemini
13 thg 6, 2026

Z.ai

GLM-5.3glm-5.3
1M
128K
OpenAI / Responses / Anthropic
19 thg 8, 2026
Catalog data

Pricing, model availability, context windows, and endpoint support reflect the current TokenHub catalog. Confirm the model detail page before a production release because specifications and availability can change.

Last updated: 2026-08-25

Get Started With the Z.ai GLM API

Create a TokenHub API key, copy a published Z.ai GLM model ID, and call it with OpenAI Chat Completions, Responses, or Claude Messages. Existing OpenAI SDK projects can usually switch by changing the API key, Base URL, and model ID.

  1. 01Create a TokenHub API key
  2. 02Choose an available Z.ai GLM model
  3. 03Choose an API protocol
  4. 04Copy the published Z.ai GLM model ID
  5. 05Send your first request

Choose an API protocol

import OpenAI from "openai"

const client = new OpenAI({
  apiKey: process.env.TOKENHUB_API_KEY,
  baseURL: "https://us-api.tokenhub.com/v1",
})

const result = await client.chat.completions.create({
  "model": "glm-4.5",
  "messages": [
    {
      "role": "user",
      "content": "Explain why low latency matters for an AI product in one sentence."
    }
  ]
})
console.log(result.choices[0]?.message?.content)
import json
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("TOKENHUB_API_KEY"),
    base_url="https://us-api.tokenhub.com/v1",
)

request = json.loads("{\"model\":\"glm-4.5\",\"messages\":[{\"role\":\"user\",\"content\":\"Explain why low latency matters for an AI product in one sentence.\"}]}")
result = client.chat.completions.create(**request)
print(result.choices[0].message.content)
curl 'https://us-api.tokenhub.com/v1/chat/completions' \
  -X 'POST' \
  -H "Authorization: Bearer $TOKENHUB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "glm-4.5",
  "messages": [
    {
      "role": "user",
      "content": "Explain why low latency matters for an AI product in one sentence."
    }
  ]
}'
const response = await fetch("https://us-api.tokenhub.com/v1/chat/completions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TOKENHUB_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "glm-4.5",
    "messages": [
      {
        "role": "user",
        "content": "Explain why low latency matters for an AI product in one sentence."
      }
    ]
  }),
})
const data = await response.json()
console.log(data)
import os
import requests

response = requests.request(method="POST", url="https://us-api.tokenhub.com/v1/chat/completions",
    headers={
        "Authorization": f"Bearer {os.environ['TOKENHUB_API_KEY']}",
        "Content-Type": "application/json",
    },
    json=__import__("json").loads("{\"model\":\"glm-4.5\",\"messages\":[{\"role\":\"user\",\"content\":\"Explain why low latency matters for an AI product in one sentence.\"}]}"),
)
response.raise_for_status()
print(response.json())
import OpenAI from "openai"

const client = new OpenAI({
  apiKey: process.env.TOKENHUB_API_KEY,
  baseURL: "https://us-api.tokenhub.com/v1",
})

const result = await client.responses.create({
  "model": "glm-4.5",
  "input": "Explain why low latency matters for an AI product in one sentence."
})
console.log(result.output_text)
import json
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("TOKENHUB_API_KEY"),
    base_url="https://us-api.tokenhub.com/v1",
)

request = json.loads("{\"model\":\"glm-4.5\",\"input\":\"Explain why low latency matters for an AI product in one sentence.\"}")
result = client.responses.create(**request)
print(result.output_text)
curl 'https://us-api.tokenhub.com/v1/responses' \
  -X 'POST' \
  -H "Authorization: Bearer $TOKENHUB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "glm-4.5",
  "input": "Explain why low latency matters for an AI product in one sentence."
}'
const response = await fetch("https://us-api.tokenhub.com/v1/responses", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TOKENHUB_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "glm-4.5",
    "input": "Explain why low latency matters for an AI product in one sentence."
  }),
})
const data = await response.json()
console.log(data)
import os
import requests

response = requests.request(method="POST", url="https://us-api.tokenhub.com/v1/responses",
    headers={
        "Authorization": f"Bearer {os.environ['TOKENHUB_API_KEY']}",
        "Content-Type": "application/json",
    },
    json=__import__("json").loads("{\"model\":\"glm-4.5\",\"input\":\"Explain why low latency matters for an AI product in one sentence.\"}"),
)
response.raise_for_status()
print(response.json())
curl 'https://us-api.tokenhub.com/v1/messages' \
  -X 'POST' \
  -H "Authorization: Bearer $TOKENHUB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "glm-4.5",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Explain why low latency matters for an AI product in one sentence."
    }
  ]
}'
const response = await fetch("https://us-api.tokenhub.com/v1/messages", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TOKENHUB_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "glm-4.5",
    "max_tokens": 1024,
    "messages": [
      {
        "role": "user",
        "content": "Explain why low latency matters for an AI product in one sentence."
      }
    ]
  }),
})
const data = await response.json()
console.log(data)
import os
import requests

response = requests.request(method="POST", url="https://us-api.tokenhub.com/v1/messages",
    headers={
        "Authorization": f"Bearer {os.environ['TOKENHUB_API_KEY']}",
        "Content-Type": "application/json",
    },
    json=__import__("json").loads("{\"model\":\"glm-4.5\",\"max_tokens\":1024,\"messages\":[{\"role\":\"user\",\"content\":\"Explain why low latency matters for an AI product in one sentence.\"}]}"),
)
response.raise_for_status()
print(response.json())

Which Z.ai GLM Model Should You Choose?

Use this Z.ai GLM model selection guide for coding, reasoning, agent workflows, general chat, and long-context engineering. Compare price, context, reasoning, tool calling, and endpoint support before shipping.

API workloadStart withWhen it fitsVerify before launch
High-volume Z.ai GLM API callsGLM-4.5Fast iteration, chat, extraction, summarization, and batch workloads using Z.ai GLM.Z.ai GLM API pricing, throughput, and output-token cost
Z.ai GLM reasoning and codingGLM-4.5Multi-step analysis, code generation, debugging, and agent tasks where answer quality matters.Reasoning support, tool calling, latency, and total request cost
General Z.ai GLM applicationsGLM-4.5Everyday assistants, content generation, information extraction, and product features.Task accuracy, endpoint support, and production price
Long-context Z.ai GLM workloadsGLM-5.2Documents, codebases, research, and conversations where input length is the constraint.Context window, input-token price, maximum output, and streaming
Quality-first Z.ai GLM workloadsGLM-4.5Production outputs where capability matters more than the lowest unit cost.Task quality, latency, and the price difference versus a faster model

Z.ai GLM API FAQ

What are Z.ai, GLM, Zhipu AI, and ChatGLM?

Z.ai, GLM, Zhipu AI, and ChatGLM are names and search terms associated with this model family. TokenHub uses the published provider and model IDs shown in the live catalog.

Which Z.ai GLM models are available on TokenHub?

The live list above shows current availability. Relevant model searches include GLM-5.2, GLM-5.1, GLM-4.7, and GLM-4.7 Flash, but only models displayed in the TokenHub catalog can be called through this page.

How do I get a Z.ai GLM API key?

Z.ai GLM API and Z.ai GLM API key searches lead to the same TokenHub workflow: create an API key, select a published Z.ai GLM model ID, and use the TokenHub Base URL in your application.

How is Z.ai GLM API pricing calculated?

Pricing depends on the selected model and billing type. Compare input, output, cache, or per-request prices in the table and confirm the model detail page before production use.

Can I use the OpenAI SDK with Z.ai GLM?

Yes. Use the TokenHub Base URL, API key, and published Z.ai GLM model ID with the OpenAI Python or Node.js SDK. Endpoint support is shown for each model.

Which Z.ai GLM model should I use?

Choose based on the workload: coding, reasoning, agent workflows, general chat, and long-context engineering. Compare actual price, context, reasoning, tool calling, and output limits in the live catalog.

Start Building With Z.ai GLM

Choose a Z.ai GLM model, copy its model ID, create a TokenHub API key, and send your first request through one compatible API workflow.