https://api.z.ai/api/paas/v4 is officially OpenAI-compatible, which means the same Voight SDK family that wraps OpenAI / Anthropic also covers GLM — no separate package needed.
Three setup paths
Pick the one that matches how your app calls GLM:| Your stack | Path |
|---|---|
| Express / vanilla Node calling Z.ai via the OpenAI SDK | Direct wrapper |
Next.js / any app using the Vercel AI SDK + zhipu-ai-provider | Vercel AI SDK exporter |
| Autonomous bot / library code emitting events directly | Library mode |
Direct wrapper (@voightxyz/openai)
Because Z.ai is OpenAI-compatible, @voightxyz/openai works zero-code — just point the OpenAI client at Z.ai’s base URL:
MODEL_PRICING table using the GLM rates listed below.
Vercel AI SDK (@voightxyz/vercel-ai)
If your app uses the Vercel AI SDK with the community zhipu-ai-provider, @voightxyz/vercel-ai captures every streamText / generateText / streamObject / generateObject call automatically via OpenTelemetry — same as for OpenAI or Anthropic targets.
metadata.userId lifts onto metadata.tags.userId in Voight and powers the dashboard’s per-user spend sub-tab.
Library mode (@voightxyz/sdk)
For autonomous agents or library callers that don’t use either of the above SDKs, the library-mode client is provider-agnostic — call GLM however you like and emit a Voight event manually:
glm-4.5 to the table entry below; the family tag zhipu keeps the event grouped with other GLM traffic in the dashboard.
Pricing coverage
Verified against the official Z.ai pricing page (USD per 1M tokens).Text models
| Model | Input | Output |
|---|---|---|
| GLM-5.1 | $1.40 | $4.40 |
| GLM-5 | $1.00 | $3.20 |
| GLM-5-Turbo | $1.20 | $4.00 |
| GLM-4.7 | $0.60 | $2.20 |
| GLM-4.7-FlashX | $0.07 | $0.40 |
| GLM-4.7-Flash | Free | Free |
| GLM-4.6 | $0.60 | $2.20 |
| GLM-4.5 | $0.60 | $2.20 |
| GLM-4.5-X | $2.20 | $8.90 |
| GLM-4.5-Air | $0.20 | $1.10 |
| GLM-4.5-AirX | $1.10 | $4.50 |
| GLM-4.5-Flash | Free | Free |
| GLM-4-32B-0414-128K | $0.10 | $0.10 |
Vision models
| Model | Input | Output |
|---|---|---|
| GLM-5V-Turbo | $1.20 | $4.00 |
| GLM-4.5V | $0.60 | $1.80 |
| GLM-4.6V | $0.30 | $0.90 |
| GLM-4.6V-FlashX | $0.04 | $0.40 |
| GLM-4.6V-Flash | Free | Free |
| GLM-OCR | $0.03 | $0.03 |
model: 'glm-4.5-airx-20251130' matches glm-4.5-airx (not glm-4.5-air or glm-4.5) and bills at the correct rate.
Resources
- Z.ai pricing — source of truth for the table above
- Z.ai API reference
zhipu-ai-provider— community Vercel AI SDK provider- @voightxyz/openai on npm
- @voightxyz/vercel-ai on npm