Skip to main content
Z.ai (rebranded from Zhipu AI in 2025) publishes the GLM model family — GLM-5, GLM-4.7, GLM-4.5, plus vision variants and OCR. Voight ships pricing entries for every model in the official Z.ai catalogue, so events from GLM calls land in your dashboard with the same cost / token / latency capture as any other provider. The Z.ai API at 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:

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:
Every call captures prompts, tokens, response text, tool calls, finish reason, and latency. The cost is computed from the Voight backend’s 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.
The 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:
The cost matcher resolves 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

Vision models

Longest-prefix lookup handles overlapping family names — e.g. an event tagged 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