Integrates Z.ai (智谱AI) models into VS Code Copilot Chat with advanced features including vision support, tool calling, and thinking process display.
-
Multiple Model Support
- GLM-4.5: 131K context window, up to 96K output tokens
- GLM-4.5 Air: 131K context window, up to 96K output tokens
- GLM-4.6: 200K context window, up to 128K output tokens
- GLM-4.7: 200K context window, up to 128K output tokens
- GLM-4.7 Flash: Faster variant with 131K max output tokens
- GLM-5: 200K context window, up to 128K output tokens
- GLM-5.1: 200K context window, up to 128K output tokens
- GLM-5.2: 1M context window, up to 128K output tokens
- GLM-5-Turbo: 200K context window, up to 128K output tokens
- GLM-5V-Turbo: Multimodal coding model with vision support
- GLM-5-Code: 200K context window, up to 131K output tokens, optimized for coding
- GLM-4.6V: Vision model (internal only, not exposed to users)
-
Advanced Capabilities
- Tool calling support for VS Code chat participants
- Streaming responses via Server-Sent Events (SSE)
- Vision support via GLM-OCR and GLM-4.6V fallback
- Thinking/reasoning process display (configurable)
- Automatic image-to-text conversion for non-vision models
-
Secure API Key Management
- Stored securely in VS Code SecretStorage
- Managed via Command Palette (
Z.ai: Manage Z.ai Provider)
code --install-extension Ryosuke-Asano.zai-vscode-chat- Clone the repository:
git clone https://github.com/Ryosuke-Asano/zai-provider-extension.git
cd zai-provider-extension- Install dependencies:
npm install- Compile the project:
npm run compile- Package the extension:
npm run package- Install the
.vsixfile:
code --install-extension zai-vscode-chat-*.vsix- Open VS Code
- Open Command Palette (
Cmd/Ctrl + Shift + P) - Run
Z.ai: Manage Z.ai Provider - Enter your Z.ai API key
Get your API key from Z.ai Platform.
Once configured, select Z.ai as your chat provider in VS Code Copilot Chat:
- Open the Chat view (
Cmd/Ctrl + Alt + I) - Click the Pick Model button (
Cmd/Ctrl + Alt + .) - Open Manage Language Models menu (⚙️)
- Click Z.ai models under
Z.aicategory to "Show in the chat model picker" - Choose a Z.ai model (GLM-4.5, GLM-4.6, GLM-4.7, GLM-4.7 Flash, GLM-5, GLM-5-Turbo, GLM-5.1, GLM-5.2, GLM-5V-Turbo, or GLM-5-Code)
- Note: GLM-4.6V is used internally for image processing and is not selectable
| Setting | Type | Default | Description |
|---|---|---|---|
zai.enableThinking |
boolean | true |
Enable thinking/reasoning process display in chat responses |
| Model | Context Window | Max Output | Vision | Tools |
|---|---|---|---|---|
| GLM-4.5 | 131,072 | 98,304 | No | Yes |
| GLM-4.5 Air | 131,072 | 98,304 | No | Yes |
| GLM-4.6 | 200,000 | 131,072 | No | Yes |
| GLM-4.7 | 200,000 | 131,072 | No | Yes |
| GLM-4.7 Flash | 200,000 | 131,072 | No | Yes |
| GLM-5 | 200,000 | 131,072 | No | Yes |
| GLM-5-Turbo | 200,000 | 131,072 | No | Yes |
| GLM-5.1 | 200,000 | 131,072 | No | Yes |
| GLM-5.2 | 1,000,000 | 131,072 | No | Yes |
| GLM-5V-Turbo | 200,000 | 131,072 | Yes | Yes |
| GLM-5-Code | 200,000 | 131,000 | No | Yes |
| Model | Context Window | Max Output | Vision | Tools | Purpose |
|---|---|---|---|---|---|
| GLM-4.6V | 128,000 | 16,000 | Yes | Yes | Image analysis fallback for non-vision models |
This extension integrates with Z.ai's MCP (Model Context Protocol) servers:
- web-search-prime: Web search capabilities
- web-reader: URL to text/markdown conversion
- zread: GitHub repository file reading
- vision-mcp: Image analysis
See CONTRIBUTING.md for detailed development guidelines.
# Install dependencies
npm install
# Watch for changes
npm run watch
# Run tests
npm test
# Lint code
npm run lint
# Format code
npm run formatsrc/
├── extension.ts # Extension entry point, activation
├── provider.ts # Main chat provider implementation
├── types.ts # Type definitions and model configuration
├── mcp.ts # MCP client for tool integration
└── utils.ts # Utility functions for message/tool conversion
- VS Code 1.104.0 or later
- Node.js 20 or later (for development)
- Z.ai API key
If you don't see the ⚙️ Manage Language Models option in Copilot Chat, make sure you have Copilot set up and enabled in VS Code. See Set up Copilot for instructions.
If you see authentication errors:
- Run
Z.ai: Manage Z.ai Provider - Verify your API key is correct
- Ensure your API key has active credits
For non-vision models (GLM-4.5, GLM-4.6, GLM-4.7, GLM-5, GLM-5.1, GLM-5.2, GLM-5-Code):
- Images are automatically converted to text descriptions using GLM-OCR MCP
- If GLM-OCR fails, the extension internally uses GLM-4.6V for image analysis
- GLM-4.6V is not selectable by users—it is only used as an internal fallback
If you encounter token limit errors:
- Reduce the amount of code/context in your message
- The extension enforces model-specific context limits
See CHANGELOG.md for version history.
MIT © 2025 Ryosuke Asano