@howaboua/pi-glm-via-anthropic

Use Z.ai GLM models in pi through Z.ai's Anthropic-compatible endpoint.

Package details

extension

Install @howaboua/pi-glm-via-anthropic from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@howaboua/pi-glm-via-anthropic
Package
@howaboua/pi-glm-via-anthropic
Version
0.1.1
Published
Mar 31, 2026
Downloads
85/mo · 15/wk
Author
howaboua
License
MIT
Types
extension
Size
5.7 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@howaboua/pi-glm-via-anthropic

Use Z.ai GLM models in pi through Z.ai's Anthropic-compatible endpoint.

It overrides pi's built-in zai provider to send requests to https://api.z.ai/api/anthropic.

Why

This package exists because many GLM Coding Plan users prefer Z.ai's Anthropic-compatible route over the default coding endpoint.

Why:

  • Z.ai officially exposes an Anthropic-compatible endpoint for coding tools.
  • Z.ai's Claude Code docs describe that setup around "Code faster" and "rock-solid reliability".
  • Community reports and benchmarks commonly describe the Anthropic route as faster, lower-latency, or less flaky than the default coding endpoint.

What it does

  • keeps the provider name as zai
  • reuses your existing Z.ai credentials in pi
  • switches pi to the Anthropic-compatible transport for these models:
    • zai/glm-5.1
    • zai/glm-5-turbo
    • zai/glm-4.7
    • zai/glm-4.5-air

Install

pi install npm:@howaboua/pi-glm-via-anthropic

Project-local install:

pi install npm:@howaboua/pi-glm-via-anthropic -l

One-off usage without installing:

pi -e npm:@howaboua/pi-glm-via-anthropic

Credentials

If you already use Z.ai in pi, you probably do not need to do anything.

This package keeps the provider name as zai, so pi continues using the normal Z.ai credential sources:

  1. ~/.pi/agent/auth.json
  2. ZAI_API_KEY

Example auth.json entry:

{
  "zai": { "type": "api_key", "key": "your-zai-key" }
}

Or use an environment variable:

export ZAI_API_KEY=your-zai-key

Remove

pi remove npm:@howaboua/pi-glm-via-anthropic

Optional override

If you want to point the adapter at a different Anthropic-compatible base URL, set:

export ZAI_ANTHROPIC_BASE_URL=https://your-proxy.example.com

References