z.ai uses an API token for authentication.
-
Environment variable (preferred)
ZAI_API_TOKENenvironment variable
-
Config file (fallback)
- Reads from z.ai config folder
| Platform | Paths |
|---|---|
| Windows | %APPDATA%/zai/config.json |
| macOS | ~/Library/Application Support/zai/config.json |
| Linux | ~/.config/zai/config.json, ~/.zai/config.json |
{
"api_token": "...",
"apiToken": "...",
"token": "..."
}Any of these keys will work.
| Endpoint | Purpose |
|---|---|
GET https://api.z.ai/v1/usage |
Quota + MCP windows |
Authorization: Bearer <token>
Content-Type: application/json
| Field | Source |
|---|---|
| Primary usage | quota.percent_used |
| Secondary usage | First MCP window usage |
| Reset date | quota.reset_at |
| Plan | user.plan |
| Account | user.email |
src/main/providers/zai.ts- Provider implementation