explaingit

d3-vin/glm-zai-2api

Analysis updated 2026-05-18

25GoAudience · developerComplexity · 3/5Setup · moderate

TLDR

GLM-ZAI-2API is a Go proxy that makes Z.AI's GLM language models work with tools built for OpenAI's chat API, including coding assistants like Claude Code.

Mindmap

mindmap
  root((GLM-ZAI-2API))
    What it does
      OpenAI-compatible proxy
      Talks to Z.AI GLM models
      Handles captcha checks
      Adapts tool calling
    Tech stack
      Go
      SQLite
      Headless Chrome
    Use cases
      IDE integration
      Self-hosted API endpoint
      Function calling support
    Audience
      Developers using GLM models

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Point an OpenAI-compatible coding assistant like OpenCode or Claude Code at GLM models via a local proxy.

USE CASE 2

Use function calling with GLM models even though Z.AI does not natively support it.

USE CASE 3

Run a self-hosted API endpoint for GLM-4.7 or GLM-5 models without writing custom integration code.

What is it built with?

GoSQLiteChrome DevTools Protocol

How does it compare?

d3-vin/glm-zai-2apiadisbladis/nix-cache-beaconaspecttaleadapter/adobe-lightroom-classic-15-3-full
Stars252525
LanguageGoGoGo
Setup difficultymoderatehardeasy
Complexity3/54/51/5
Audiencedeveloperops devopsgeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires Chrome for the token collector and a Z.AI account token to unlock GLM-5 models.

Provided as-is for educational and interoperability purposes, no formal open-source license specified.

In plain English

GLM-ZAI-2API is a small proxy program, written in Go, that lets tools built for OpenAI's chat API talk to Z.AI's GLM language models instead. It ships as a single binary with no separate services to run, and it handles the captcha checks Z.AI requires behind the scenes. The main idea is compatibility. Many coding assistants and IDE plugins, such as OpenCode, Claude Code, and Roo Code, already know how to speak to an OpenAI-style API. By pointing one of these tools at this proxy's local address instead of OpenAI's servers, a developer can use GLM models without changing any of that tool's configuration beyond the base URL and API key. The proxy also translates GLM's responses so that function calling, also called tool calling, works even though Z.AI does not support it natively. It does this by rewriting the request as a special prompt, then parsing the model's reply back into the expected format. Running it requires downloading a prebuilt release for your operating system, or building from source with Go. Before first use, you also need to run a separate helper program that opens a headless Chrome browser to collect device tokens the proxy needs to pass Z.AI's captcha checks. After that, you copy an example configuration file, optionally add a Z.AI account token to unlock the larger GLM-5 models, and start the server. Once running, it shows a small status dashboard in the browser and accepts requests at the familiar chat completions endpoint. Without an account token, only the smaller glm-4.7 model works in guest mode. This project is meant for developers who already use GLM models through Z.AI and want to plug them into existing OpenAI-compatible coding tools without writing custom integration code themselves.

Copy-paste prompts

Prompt 1
Walk me through downloading and running GLM-ZAI-2API, then collecting device tokens with the token-collector tool.
Prompt 2
How do I configure OpenCode to use GLM-ZAI-2API as a custom OpenAI endpoint?
Prompt 3
Explain how GLM-ZAI-2API implements tool calling for a model that does not support it natively.
Prompt 4
Show me a curl request that streams a chat completion from GLM-ZAI-2API using the glm-4.7 model.

Frequently asked questions

What is glm-zai-2api?

GLM-ZAI-2API is a Go proxy that makes Z.AI's GLM language models work with tools built for OpenAI's chat API, including coding assistants like Claude Code.

What language is glm-zai-2api written in?

Mainly Go. The stack also includes Go, SQLite, Chrome DevTools Protocol.

What license does glm-zai-2api use?

Provided as-is for educational and interoperability purposes, no formal open-source license specified.

How hard is glm-zai-2api to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is glm-zai-2api for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.