npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zhivex-ai/zai

v0.2.0

Published

Z.ai GLM adapter for Zhivex AI SDK.

Readme

@zhivex-ai/zai

Native Z.ai GLM adapter for Zhivex AI SDK.

Install

bun add @zhivex-ai/zai @zhivex-ai/core zod

GLM-5.3 Flash

glm-5.3-flash is available through the general Model API and GLM Coding Plan. It has a 1M-token context window, native image understanding, required thinking, streamed tool calls, and the same text parameter contract as GLM-5.3. The general pay-as-you-go endpoint remains the provider default:

import { generateText } from "@zhivex-ai/core";
import { createZAI } from "@zhivex-ai/zai";

const zai = createZAI({ apiKey: process.env.ZAI_API_KEY });

const result = await generateText({
  model: zai("glm-5.3-flash"),
  messages: [
    {
      role: "user",
      parts: [
        { type: "text", text: "Review this architecture diagram." },
        {
          type: "image",
          image: "https://example.com/architecture.png",
          mediaType: "image/png"
        }
      ]
    }
  ],
  reasoning: { effort: "max" }
});

console.log(result.text);

The default base URL is https://api.z.ai/api/paas/v4. ZAI_BASE_URL or the baseURL option can override it for compatible gateways. Image parts preserve their message order and accept public HTTP(S) URLs, image Data URLs, or raw base64 normalized to a Data URL. Multiple images are supported; audio, video, and generic file parts remain outside this model contract.

General API and Coding Plan

Use the default general endpoint for pay-as-you-go glm-5.3-flash, glm-5.3, or glm-5.2 calls. Select the Coding Plan endpoint explicitly when using a Coding Plan credential:

const coding = createZAI({
  apiKey: process.env.ZAI_API_KEY,
  endpoint: "coding"
});

const result = await generateText({
  model: coding("glm-5.3-flash"),
  prompt: "Review this authorization boundary.",
  reasoning: { effort: "max" }
});

Coding Plan is limited by Z.ai's usage policy to supported coding and agent tools. Use the general endpoint when exact pay-as-you-go routing or model behavior matters.

Contract

  • Text generation and SSE streaming through Chat Completions.
  • Local function-tool loops with automatic tool selection. Forced, required, none, hosted tools, and provider-advertised parallel calls are not exposed because only tool_choice: "auto" is currently documented.
  • reasoning_content is preserved as Z.ai provider-data and replayed unchanged across tool turns. The adapter sends thinking.clear_thinking: false when tool state must be preserved.
  • GLM-5.3 and GLM-5.3 Flash require thinking and accept shared efforts low, high, and max. none, disabled, and unsupported aliases fail before network I/O. Flash defaults thinking.clear_thinking to false, matching the model-specific recommendation.
  • GLM-5.2 maps none/minimal to disabled thinking, low/medium to high, and xhigh to max.
  • GLM-5.3 Flash exposes image understanding through ordered image_url content blocks. Other Z.ai models remain text-only until their individual media contracts are modeled.
  • Structured output uses Z.ai JSON-object mode plus a schema prompt, followed by local Zod validation. Z.ai does not document strict native JSON Schema enforcement.
  • Cached input usage and documented provider finish reasons are normalized into the shared contract.
  • The adapter does not claim embeddings, audio, realtime, hosted web search, or remote MCP. Vision is exposed only for GLM-5.3 Flash.

Use providerOptions for documented Z.ai fields such as thinking, reasoning_effort, top_p, do_sample, stop, request_id, and user_id. Do not put private information in provider user identifiers.

Live smoke

General GLM-5.3 Flash smoke:

ZAI_API_KEY=... \
ZAI_INTEGRATION_MODEL=glm-5.3-flash \
ZAI_EXTENDED_INTEGRATION=1 \
bun run test:integration:zai

Add ZAI_INTEGRATION_IMAGE_URL=https://... and optionally ZAI_INTEGRATION_IMAGE_MEDIA_TYPE=image/png to include the authenticated vision smoke.

Coding Plan GLM-5.3 Flash smoke:

ZAI_API_KEY=... \
ZAI_ENDPOINT=coding \
ZAI_INTEGRATION_MODEL=glm-5.3-flash \
ZAI_EXTENDED_INTEGRATION=1 \
bun run test:integration:zai

A skipped smoke or offline fixture test is not authenticated provider certification.