Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

GLM-4.7 Setup

Use GLM-4.7 with agentful for 10x cost savings.

Quick Start

# Option 1: Coding Tool Helper (easiest)
npx @z_ai/coding-helper
 
# Option 2: GLM CLI
npm install -g @xqsit94/glm
glm --model glm-4.7
/agentful-start
 
# Option 3: Manual setup
export ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
export ANTHROPIC_AUTH_TOKEN=your_zai_api_key
claude

Get API Key

  1. Visit Z.AI
  2. Sign up → API Keys → Generate
  3. Copy key
Or use Coding Tool Helper:
npx @z_ai/coding-helper

This automatically configures Claude Code, Windsurf, Cursor, and other coding tools.

Configure Claude Code

Persistent (~/.claude/settings.json):

{
  "environmentVariables": {
    "ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "your_zai_api_key",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7"
  }
}
Session-based:
export ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
export ANTHROPIC_AUTH_TOKEN=your_zai_api_key
claude

Verify

claude
 
You: What model are you?
Assistant: I am GLM-4.7, running via Z.AI API.

Model Variants

  • glm-4.7 - Latest, 200K context, 128K output (recommended)
  • glm-4.5-air - Faster, cheaper, use for simple tasks
  • glm-4-long - Ultra-long context

Switch Back to Claude

# Temporary
unset ANTHROPIC_BASE_URL
export ANTHROPIC_API_KEY=your_claude_key
claude
 
# Permanent - edit ~/.claude/settings.json and remove GLM config

Resources