OpenCode is both a CLI + TUI AI coding agent that runs in your terminal and a plugin that integrates with editors like VS Code. It enables fast code generation, debugging, project analysis, file operations, and cross-project collaboration across different development environments. OpenCode becomes far more cost-effective with the GLM Coding Plan — delivering greater efficiency and stability for your development workflow. Description

Step 1: Installing OpenCode

The easiest way to install OpenCode is through the install script.
curl -fsSL https://opencode.ai/install | bash
You can also install it with npm:
npm install -g opencode-ai

Step 2: Getting Started

1. Obtain Your Z.AI API Key

Visit Z.AI to get your API Key.

2. Run opencode auth login and select Zhipu AI

$ opencode auth login

  Add credential

  Select provider
 Zhipu AI
  ...

3. Enter your Zhipu AI API key

$ opencode auth login

  Add credential

  Select provider
  Zhipu AI

  Enter your API key
  _

4. Run opencode to launch OpenCode

$ opencode
Use the /models command to select a model like GLM-4.5.
/models

5. Using OpenCode with the GLM Coding Plan

In ~/.config/opencode/opencode.json configure:
{
    "$schema": "https://opencode.ai/config.json",
    "provider": {
        "zhipuai": {
            "api": "https://api.z.ai/api/coding/paas/v4"
        }
    }
}