So you're ready to unlock custom models in Cursor, eh? Good. Here's exactly how to plug in OpenRouter.ai so you can run stuff like z-ai/glm-4.5 directly inside your coding flow.
Follow these steps carefully, or you’ll just end up confused and yelling at your terminal.
🚀 Step-by-Step: Integrating OpenRouter.ai into Cursor
- Open Cursor Settings
Click the gear icon (bottom-left). Yes, the thing you’ve ignored until now. - Navigate to Models
Once inside settings, go to the Models section. - Disable ALL Current Models
That’s right. Every single one. Disable anything that’s checked or active. - Scroll Down to > Api Keys
You’ll find a collapsible section labeled > Api Keys. Click it to expand. - Override the OpenAI Base URL
Under the OpenAI API Key area: - Check the box that says Override OpenAI Base URL
- Paste this into the field:
OpenRouter base URL https://openrouter.ai/api/v1
- Find the Right Model Name
This part matters. Go to https://openrouter.ai/models.
Find the proper name of the model you want to use, for example z-ai/glm-4.5. You’ll need to type it exactly like that when adding a new model. - Add the Model in Cursor
Back in Cursor: - Click Add New Model
- Paste the model name from OpenRouter (e.g., z-ai/glm-4.5)
- Save it
- Add Your OpenRouter API Key
Paste your API key into the OpenAI API Key section.
Then hit Verify.If everything goes well, you’ll see something like:With your cursor Pro+ subscription, you do not need to use your own OpenAI key unless you're using custom models.
- Test the Integration
Open the Cursor chat and try talking to your newly added model.
If it replies, congrats, you’re golden.
✅ Bonus Tips
- You can add multiple models from OpenRouter.ai now.
- Check out z-ai/glm-4.5-air:free: it’s one of the free models and surprisingly solid.
⚠️ Heads up: Free-tier models may use your prompts and completions as training data. So… maybe don’t use them for your nuclear launch codes.
Happy hacking.