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:
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
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
- 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