5 min read
0%

GLM-5 on Zed: Full Agentic Setup

Back to Blog
GLM-5 on Zed: Full Agentic Setup

GLM-5 on Zed: Full Agentic Setup

Z.ai’s GLM-5 is a 744B-parameter model built specifically for agentic engineering — file reading, multi-step tasks, tool calls, the works. At $10/month for the coding plan it’s one of the cheapest ways to get a capable coding agent. But drop it into Zed with a basic config and you’ll hit a wall: the model can’t read your files, asks you to paste code manually, and acts like it has no idea your project exists.

The fix is three settings. This guide walks through the full setup.

The Problem

When you add GLM-5 to Zed as a generic OpenAI-compatible provider, Zed defaults to conservative assumptions about what the model supports. Without explicit capability flags, tool calling is either disabled or unreliable — so the agent can’t invoke Zed’s built-in tools for reading files, searching the codebase, or running commands.

The model is capable. The configuration just hasn’t told Zed to use it that way.

Step 1: Get the Subscription API Key

The GLM Coding Plan uses a different endpoint than the pay-per-use API. Make sure you’re using the right one.

  1. Go to z.ai/subscribe and sign up for a plan

    • Lite — $3/month, ~120 prompts per 5-hour window
    • Pro — $10/month, more prompts, GLM-5 access
    • Max — $15/month, highest limits
  2. After subscribing, open your dashboard and go to API Keys

  3. Generate a new key and copy it

The subscription endpoint is different from the standard API:

https://api.z.ai/api/coding/paas/v4

Not https://api.z.ai/api/paas/v4. The /coding/ path is what routes your requests through the subscription quota instead of billing by token.

Step 2: Configure Zed

Open your Zed settings (cmd+, on Mac, ctrl+, on Linux/Windows) and add this under language_models:

{
  "language_models": {
    "openai_compatible": {
      "Z.ai": {
        "api_url": "https://api.z.ai/api/coding/paas/v4",
        "available_models": [
          {
            "name": "glm-5",
            "display_name": "GLM-5",
            "max_tokens": 200000,
            "max_output_tokens": 128000,
            "max_completion_tokens": 128000,
            "capabilities": {
              "tools": true,
              "images": false,
              "parallel_tool_calls": true,
              "prompt_cache_key": true
            }
          },
          {
            "name": "glm-4.7",
            "display_name": "GLM-4.7",
            "max_tokens": 200000,
            "max_output_tokens": 128000,
            "max_completion_tokens": 128000,
            "capabilities": {
              "tools": true,
              "images": false,
              "parallel_tool_calls": true,
              "prompt_cache_key": true
            }
          }
        ]
      }
    }
  }
}

You also need to configure the agent profile to enable tool permissions. Add this alongside the language_models block in the same settings file:

{
  "agent": {
    "tool_permissions": {
      "default": "allow"
    },
    "default_profile": "agentic",
    "profiles": {
      "agentic": {
        "name": "agentic",
        "tools": {
          "terminal": true,
          "file_system": true,
          "search": true
        },
        "enable_all_context_servers": true
      }
    },
    "default_model": {
      "provider": "Z.ai",
      "model": "glm-5"
    }
  }
}

Without this, the agent profile defaults to restricted permissions and the model can’t actually invoke file, terminal, or search tools even with "tools": true in the model capabilities. The "default": "allow" under tool_permissions is the key line — it opts the agent into allowing tool calls rather than prompting per-call.

The three capability flags that matter for agentic use:

FlagWhat it unlocks
"tools": trueFile reading, code search, terminal — all of Zed’s built-in agent tools
"parallel_tool_calls": trueThe model can invoke multiple tools in one turn, e.g. read several files simultaneously
"prompt_cache_key": trueCaches the system prompt context so repeated long-context calls are faster

Without "tools": true, Zed treats the model as chat-only. The agent panel still shows up, but none of the file tools are wired in.

Step 3: Add the API Key

Zed reads API keys from your environment. It looks for a variable named after the provider in screaming snake case:

Z_AI_API_KEY=your_key_here

Add this to your shell profile (.zshrc, .bashrc, or equivalent) and restart Zed. You can verify it’s picked up by opening the Zed agent panel — the provider dropdown should show “Z.ai” with your configured models available.

Alternatively, Zed will prompt you for the key the first time you select the provider and store it in your OS keychain.

Step 4: Set GLM-5 as the Agent Model

In the Zed agent panel (the chat-style panel on the right), click the model selector at the top and choose Z.ai › GLM-5.

To make it the default so you don’t have to switch every session, add this to your settings:

{
  "assistant": {
    "default_model": {
      "provider": "openai_compatible/Z.ai",
      "model": "glm-5"
    },
    "version": "2"
  }
}

What You Get After This

With tools enabled, Zed’s agent has access to its full built-in toolset:

  • Read files — the model can open any file in your project without you pasting it
  • Edit files — proposes diffs you review and accept
  • Search codebase — semantic and text search across the whole project
  • Run terminal commands — with your approval per command, or auto-allow patterns you configure
  • Create files — scaffolds new files directly into your project structure

This is what “agentic” means in Zed’s model: the AI drives a loop of tool calls until the task is done, rather than just replying to a single prompt.

If You Prefer OpenCode Instead

Zed’s GLM integration works well, but if you want a terminal-first workflow, OpenCode has native Z.ai Coding Plan support with zero extra config:

npm install -g opencode-ai
opencode auth login
# Select "Z.AI Coding Plan" → paste your key

Then run opencode from any project directory. It reads your files, runs commands, and handles multi-step tasks without needing the capability flags configured manually — the integration handles it.

Both work. Zed gives you a GUI-integrated experience with inline diffs and a visual agent panel. OpenCode is leaner and more terminal-native.

Common Issues

“LLM provider is not configured” — Zed can’t find your API key. Make sure Z_AI_API_KEY is exported in your shell and that you’ve restarted Zed after setting it.

Model doesn’t appear in the dropdown — The available_models entry isn’t being picked up. Check for JSON syntax errors in your settings file. The language_models key must be at the top level, not nested inside assistant.

Agent responds but can’t read files — Two possible causes: "tools": true is missing from the model capabilities, or the agent.tool_permissions.default is not set to "allow". Both are required — the capability flag tells Zed the model supports tools, and the permission setting actually grants them.

Using subscription quota but getting billed per token — You’re hitting the standard API endpoint (/api/paas/v4) instead of the coding plan endpoint (/api/coding/paas/v4). Update api_url in your config.

Hitting prompt limits fast — The Lite plan’s 120-prompt window depletes quickly with agentic tasks because each tool call counts as a prompt round-trip. Upgrade to Pro or Max if you’re doing long sessions.


Canvas is not supported in your browser