Complete guide to integrating Z.AI GLM models with OpenCode CLIOpenCode is a powerful AI coding agent that can be configured to use Z.AIβs GLM models.

Step 1: Installing OpenCode
The easiest way to install OpenCode is through the install script.Step 2: Getting Started
- Head over to the Z.AI API Console to get your API key.
-
Run
opencode auth login
and select Z.AI.
- Enter your Z.AI API key.
- Run
opencode
to launch OpenCode.
/models
command to select a model like GLM-4.5.
Share
OpenCodeβs share feature allows you to create public links to your OpenCode conversations, so you can collaborate with teammates or get help from others.How it works
When you share a conversation, OpenCode:- Creates a unique public URL for your session
- Syncs your conversation history to our servers
- Makes the conversation accessible via the shareable link β
opencode.ai/s/<share-id>
Share
By default, conversations are not shared automatically. You can manually share them using the/share
command:
Un-share
To stop sharing a conversation and remove it from public access:IDE Extensions
OpenCode integrates with VS Code, Cursor, or any IDE that supports a terminal.Installation
To install OpenCode on VS Code and popular forks like Cursor, Windsurf, VSCodium:- Open VS Code
- Open the integrated terminal
- Run
opencode
- the extension installs automatically
Usage
- Quick Launch: Use
Cmd+Esc
(Mac) orCtrl+Esc
(Windows/Linux) to open OpenCode in a split terminal view, or focus an existing terminal session if one is already running. - New Session: Use
Cmd+Shift+Esc
(Mac) orCtrl+Shift+Esc
(Windows/Linux) to start a new OpenCode terminal session, even if one is already open. You can also click the OpenCode button in the UI. - Context Awareness: Automatically share your current selection or tab with OpenCode.
- File Reference Shortcuts: Use
Cmd+Option+K
(Mac) orAlt+Ctrl+K
(Linux/Windows) to insert file references. For example,@File#L37-42
.
GitHub Workflow
OpenCode integrates with your GitHub workflow. Mention/opencode
or /oc
in your comment, and OpenCode will execute tasks within your GitHub Actions runner.
Features
- Triage issues: Ask OpenCode to look into an issue and explain it to you.
- Fix and implement: Ask OpenCode to fix an issue or implement a feature. And it will work in a new branch and submits a PR with all the changes.
- Secure: OpenCode runs inside your GitHubβs runners.
Installation
Run the following command in a project that is in a GitHub repo:Examples
Here are some examples of how you can use OpenCode in GitHub.- Explain an issue
- Fix an issue
- Review PRs and make changes
Resources
- Documentation: opencode.ai/docs
- GitHub Issues: github.com/sst/opencode/issues
- Discord: opencode.ai/discord