AvailableZhipu AIChatCache 75% off
glm-5.2

Build next-gen apps with GLM

API Code Example

Pricing

Default

Per 1M Tokens
Official Price
Input $1.18 / Output $4.12 / Cache Read $0.2941 / Cache Write $0.00
TokenLab Price
Input $1.18 / Output $4.12 / Cache Read $0.2941 / Cache Write $0.00
Discount
-

One-click test

Sign in once and Web Agent keeps this model, prompt, and request preset for you.

Test glm-5.2 in Web Agent with a short request at /v1/messages, then show request body, latency, and response.

API workbench

The default route for production. The code sample below uses this endpoint with the format you pick.

Text to textOpenAI Compatible
POST/v1/messages
API Format:
curl https://api.tokenlab.sh/v1/messages \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk-xxx" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "glm-5.2",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'

Use cases

01

Agents and tools

Drive reasoning, support triage, tool calls, and multi-step task flows.

02

Developer workflows

Generate, review, or debug code without rewiring your stack.

03

Knowledge assistants

Ship chat, search, and retrieval with predictable cost and behavior.

04

Side-by-side test

Compare real response quality, latency, and price for production defaults.

Prompt examples

Write a concise support reply and list the assumptions behind it.

Review this API design and call out the top three integration risks.

Turn a long changelog into release notes a non-engineer would read.

Cost Calculator

1M
0.5M
Estimated Monthly Cost$3.24

FAQ

How much does GLM cost?

On TokenLab, GLM costs Input $1.18 / Output $4.12 Per 1M Tokens. The pricing table above shows the full breakdown.

What is GLM best for?

GLM is a strong fit for JSON Mode, Prompt Cache, Tool Use. You can call it through TokenLab with one API key.

How do I call the GLM API?

Get a TokenLab API key, then send your request to https://api.tokenlab.sh/v1/messages. The API workbench above has a recommended endpoint and copy-ready code.

Which endpoint should GLM use?

Use https://api.tokenlab.sh/v1/messages as the default for GLM. If a provider-native format is supported, the API workbench shows that endpoint too.

Can I test GLM before integrating it?

Yes. Try in Web Agent opens a ready test for GLM and keeps your prompt after sign-in, so you don’t lose context.

Which operations does GLM support?

GLM supports Text to text. Pick an operation in the API workbench above to see the matching endpoint and code sample.

Related Models