Back/Engineering/Cursor
IntermediateEngineering

How to Configure the Open-Weight GLM 5.2 Model in Cursor

setting up the cost-effective GLM 5.2 AI model in your Cursor code editor using an Open Router API key, unlocking powerful, affordable AI assistance for your coding tasks.

How to Configure the Open-Weight GLM 5.2 Model in Cursor

06:02 to 08:37: Claire connects Cursor to GLM 5.2 through OpenRouter by adding the key, custom base URL, and model identifier in settings.

Before you start

What you need

  • An OpenRouter account with billing enabled
  • A newly created OpenRouter API key
  • Cursor with access to custom model settings

What you’ll make

GLM 5.2 appears as a selectable Cursor model and completes a test request through OpenRouter.

Tools used

Step by step

The workflow

Follow the sequence once, then adapt the prompts, checks, and handoffs to your own setup.

5 steps

Step01

Get an Open Router API Key

Sign up for an Open Router account, add a credit card with an optional spending limit, and generate a new API key for accessing models through the service.

Example prompt
Sign up for an Open Router account, add a credit card with an optional spending limit, and generate a new API key for accessing models through the service.

My actual values:
[insert the files, settings, accounts, or constraints for this step]

Give me the exact commands, settings, or output to use. Finish with a pass or fail check for get an open router api key.
Step02

Navigate to Cursor Model Settings

In the Cursor application, open the Settings menu and go to the 'Models' tab to manage your AI model configurations.

Example prompt
In the Cursor application, open the Settings menu and go to the 'Models' tab to manage your AI model configurations.

My actual values:
[insert the files, settings, accounts, or constraints for this step]

Give me the exact commands, settings, or output to use. Finish with a pass or fail check for navigate to cursor model settings.
Step03

Add Open Router API Key

Find the 'API Keys' area and paste your API key from Open Router into the 'OpenAI API Key' field, then toggle it on.

Example prompt
Find the 'API Keys' area and paste your API key from Open Router into the 'OpenAI API Key' field, then toggle it on.

My actual values:
[insert the files, settings, accounts, or constraints for this step]

Give me the exact commands, settings, or output to use. Finish with a pass or fail check for add open router api key.
Step04

Set the Custom Base URL

Toggle on 'Override OpenAI Base URL' and set it to https://openrouter.ai/api/v1/cursor. This specific URL is critical for the integration to work.

Example prompt
Toggle on 'Override OpenAI Base URL' and set it to https://openrouter.ai/api/v1/cursor. This specific URL is critical for the integration to work.

My actual values:
[insert the files, settings, accounts, or constraints for this step]

Give me the exact commands, settings, or output to use. Finish with a pass or fail check for set the custom base url.
Step05

Add the Custom Model

Click 'View all Models', select 'Add a custom model', and enter the model name zai/glm-5.2 to add it to your list of available models in the Cursor chat.

Example prompt
Click 'View all Models', select 'Add a custom model', and enter the model name zai/glm-5.2 to add it to your list of available models in the Cursor chat.

My actual values:
[insert the files, settings, accounts, or constraints for this step]

Give me the exact commands, settings, or output to use. Finish with a pass or fail check for add the custom model.

What good looks like

  • The API key is stored in Cursor and never pasted into code or screenshots
  • The custom base URL points to OpenRouter
  • A test prompt returns a GLM 5.2 response without an authentication or model error

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

After the steps

Runbook notes

How to recover when the loop fails and where human judgment helps.

Recover

If it goes sideways

Cursor rejects the model or reports it cannot be found
Copy the current model identifier from OpenRouter and remove any spaces or display labels from the custom model field.
The request returns an authentication error
Create a new key, paste it once into Cursor settings, and confirm the OpenRouter account has available credit.

Start shipping
better products.

Join 100,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start
No credit card
SOC 2 certified
Enterprise ready