AT AI Tool Jungle
cursorz-aiglm

How to Use Z.ai in Cursor: Connect GLM Models Step by Step

Learn how to use Z.ai's GLM models in Cursor with a custom model, the right Coding Plan base URL, correct model names, and which Cursor features won't use your key.

AT AI Tool Jungle team · · 5 min read · 6 sources
Churchill Club Top 10 Tech Tech Trends Debate 2013 — I chose Deep Learning / Machine Learning
Photo: jurvetson (CC BY 2.0) via Openverse

To use Z.ai in Cursor, add a custom model in Cursor’s Models settings, paste your Z.ai API key into the OpenAI API key field, and override the OpenAI base URL with Z.ai’s endpoint (https://api.z.ai/api/coding/paas/v4 if you have a GLM Coding Plan). Then add the GLM model name in uppercase, such as GLM-4.7, and pick it in the chat model selector.

That’s the short version. Below are the exact steps, the two settings people most often get wrong, and the Cursor features that will keep using Cursor’s own models no matter what you configure. Details are as of November 2026; both Cursor and Z.ai change their settings and model lineups frequently.

What you need before you start

  • Cursor Pro or higher. Z.ai’s Cursor setup page states that custom model configuration only works on Cursor Pro and above.
  • A Z.ai API key. You create this in your Z.ai account. Treat it like a password and never paste it into chats, repos, or shared screenshots.
  • To know which billing you’re on. If you subscribe to Z.ai’s GLM Coding Plan, you’ll use a dedicated “coding” endpoint. If you pay per use on the regular API, you’ll use the general endpoint. More on this below, because it matters.

How Z.ai connects to Cursor

Cursor doesn’t have a built-in “Z.ai” provider. Instead, Z.ai exposes an OpenAI-compatible API, and Cursor lets you swap the address it sends OpenAI-style requests to. You’re essentially telling Cursor: “send OpenAI-format requests to Z.ai, authenticate with this key, and ask for this model.”

That approach has one side effect worth knowing up front: the base URL override is global. Third-party gateway docs such as ngrok’s Cursor guide point out that while the override is on, Cursor routes its other OpenAI-model traffic to the custom endpoint too, which fails for models that endpoint doesn’t serve.

Step-by-step: set up Z.ai GLM in Cursor

  1. Open Cursor Settings and go to the Models section.
  2. Click “Add Custom Model” (in some versions you simply type a new model name into the model list).
  3. Choose the OpenAI protocol. Z.ai’s endpoint speaks the OpenAI API format, so this is the provider block you configure.
  4. Enter your Z.ai API key in the OpenAI API Key field and enable it.
  5. Turn on “Override OpenAI Base URL” and enter the endpoint:
    • GLM Coding Plan: https://api.z.ai/api/coding/paas/v4
    • Regular pay-as-you-go API: https://api.z.ai/api/paas/v4
  6. Add the model name in uppercase, for example GLM-4.7 or GLM-5.2, depending on what your plan includes.
  7. Save, then open a chat panel and select the GLM model you just added from the model dropdown.
  8. Send a short test prompt (“Explain what this file does”) to confirm responses come back without an authentication or model-not-found error.

Quick reference

SettingCoding Plan subscriberPay-as-you-go API
ProtocolOpenAIOpenAI
API key fieldYour Z.ai keyYour Z.ai key
Base URLhttps://api.z.ai/api/coding/paas/v4https://api.z.ai/api/paas/v4
Model nameUppercase, e.g. GLM-4.7Uppercase, e.g. GLM-4.7
Billed againstCoding Plan quotaRegular API usage

The two mistakes that break most setups

Using the wrong endpoint

Z.ai is explicit about this: incorrect endpoint configuration means you can’t use your GLM Coding Plan quota. If you subscribe to the Coding Plan but paste the general api/paas/v4 URL, your requests either fail or get billed as regular API usage rather than drawing on the subscription you already paid for. Double-check that /coding/ is in the path.

Lowercase model names

Z.ai’s Cursor documentation says the model name must be entered in uppercase in Cursor, like GLM-4.7. A lowercase glm-4.7 is a common reason for “model not found” style errors even when the key and URL are right.

Which GLM model should you pick?

This is where sources currently disagree, so check before you commit. Z.ai’s own pages use different examples: the Coding Plan Cursor page shows GLM-5.2, while other Z.ai pages use GLM-4.7. Community guides, like this DEV Community walkthrough, also cover GLM-5.2, and at least one third-party guide claims a newer GLM-5.3 is now the flagship. We couldn’t confirm the exact Cursor model string for that one from Z.ai’s documentation.

Practical advice: open Z.ai’s model list or your Coding Plan details, find the newest model your plan covers, and enter that ID in uppercase. If it errors, fall back to one shown in Z.ai’s Cursor guide.

What works with Z.ai in Cursor, and what doesn’t

Bringing your own key doesn’t swap out every AI feature in Cursor. Cursor’s Custom API Keys documentation says some features, including Tab completion, Apply from Chat, and Composer, rely on specialized models and won’t work with custom keys.

Cursor featureUses your Z.ai key?
Chat / Ask with the GLM model selectedYes
Tab autocompleteNo, always Cursor’s own models
Apply from Chat, ComposerNo, per Cursor’s docs
Agent modeUnclear; varies by Cursor version

Agent mode is the murky one. A Cursor staff member wrote on the Cursor forum that Tab and Agent were the two features likely never to work with an API key. Some 2026 gateway guides still say Agent doesn’t support custom keys, while others report Ask, Plan, and Agent working through an OpenAI-compatible proxy on recent Cursor builds. If Agent mode matters to you, test it in your own version rather than assuming either way.

Troubleshooting checklist

If GLM isn’t responding in Cursor, work through these in order:

  1. Confirm your Cursor plan is Pro or higher.
  2. Re-check the base URL, character by character, including /coding/ for Coding Plan users and no trailing spaces.
  3. Confirm the model name is uppercase and is a model your plan actually includes.
  4. Make sure the OpenAI key toggle is enabled, not just filled in.
  5. Turn off the override when you want Cursor’s built-in OpenAI models back, since the override applies globally.
  6. Regenerate your Z.ai key if you get authentication errors and suspect it was copied incorrectly or revoked.

One more tip from the community guides: connecting directly with a Z.ai key tends to behave better in Cursor than routing GLM through an aggregator like OpenRouter, because you avoid an extra layer of model-name mapping.

Is it worth it?

If you already pay for the GLM Coding Plan, pointing Cursor’s chat at it is a reasonable way to get more out of that subscription while keeping Cursor’s editor, Tab completion, and codebase context. Just go in with realistic expectations: you’re replacing the model behind chat, not every AI feature in the editor. If you mainly want GLM driving fully autonomous edits, Z.ai’s docs also cover setups for other tools, and it’s worth comparing those against how Agent mode behaves in your Cursor version.

Because both companies update their products frequently, recheck Z.ai’s Cursor page and Cursor’s API key docs if anything in the settings screen looks different from what’s described here.

Frequently asked questions

Do I need a paid Cursor plan to use Z.ai? +

According to Z.ai's documentation, custom model configuration is only supported in Cursor Pro and higher. On the free tier you won't be able to point Cursor at Z.ai's endpoint.

Why is my GLM Coding Plan quota not being used? +

The most common cause is the wrong base URL. Coding Plan subscribers must use https://api.z.ai/api/coding/paas/v4; the general API URL (https://api.z.ai/api/paas/v4) bills against regular API usage instead of your plan quota.

Can Cursor's Tab autocomplete use GLM models? +

No. Cursor's own docs and its staff say Tab completion relies on Cursor's specialized models and doesn't work with custom API keys, so it keeps running on Cursor's backend.

Which GLM model name should I enter? +

Use a model your Z.ai plan includes, typed in uppercase as Z.ai instructs, for example GLM-4.7 or GLM-5.2. Z.ai's model lineup changes often, so check the current list in Z.ai's docs before setting it up.

Sources

  1. Cursor - Z.ai Developer Docs (GLM Coding Plan) (docs.z.ai)
  2. Cursor - Z.ai Developer Docs (Develop Tools scenario) (docs.z.ai)
  3. Custom API Keys - Cursor Docs (docs.cursor.com)
  4. API Keys work on which models/actions? - Cursor Community Forum (forum.cursor.com)
  5. Cursor - ngrok AI Gateway Docs (ngrok.com)
  6. How to use GLM-5.2 with Claude Code, Cline and Cursor - DEV Community (dev.to)
About this guide. Researched and drafted with AI assistance from the sources above, then checked against our editorial rules. It reflects what was publicly known on November 8, 2026; details can change, so confirm with the official source before acting on it. How we work →

Our reviews

In-depth reviews from AI Tool Jungle that go with this topic.

Keep reading