Setting up Grok in Cursor
Updated:
Grok in Cursor: setting it up through Grok API Dev takes under 5 minutes.
What Cursor is
Cursor is a code editor built on VS Code, with AI agents at its centre: Composer edits across several files at once, and the agent can read the whole repository. By default it runs on Cursor's own model list, but the editor also accepts a custom OpenAI-compatible provider. That single setting is what lets you route requests through your own key and pay per token.
Composer with your own model
A custom OpenAI-compatible key overrides the built-in model list, so the Grok model becomes available in the composer.
Billed per token
With your own key you pay for the tokens you actually spend, against a single GrokAPI balance.
What you'll need
- Cursor installed on macOS, Windows, or Linux.
- A Grok API Dev account — a new one comes with $0.25 in test credit and lets you issue an API key straight from the dashboard.
Setting up Cursor
Install Cursor
Download Cursor for macOS, Windows, or Linux from the official website and complete the installation. On first launch it offers to import your extensions and settings from VS Code.
Download Cursor ↗Open the model settings
Press Cmd+Shift+J on macOS or Ctrl+Shift+J on Windows and Linux to open Cursor Settings, then go to the Models section.
Open API Keys and override the base URL
Scroll down to the API Keys section. Switch on Override OpenAI Base URL and enter the GrokAPI endpoint in the field underneath.
API Keys
OpenAI API Key
You can put in your OpenAI key to use OpenAI models at cost.
Override OpenAI Base URL
Change the base URL for OpenAI API requests.
Paste the key
Put your GrokAPI key into the OpenAI API Key field. It is stored straight away — the field is replaced by a Secret saved state.
API Keys
OpenAI API Key
You can put in your OpenAI key to use OpenAI models at cost.
Secret saved
Override OpenAI Base URL
Change the base URL for OpenAI API requests.
Pick the model and check it works
Cursor has no separate test button: as soon as the key and the address are saved, requests go through GrokAPI. Add grok-4.5 to the model list, switch it on, and ask the composer about the open file. A streamed answer and a fresh usage entry in the GrokAPI dashboard confirm the editor is spending your balance.
Frequently asked questions
Do I still need a Cursor subscription?
Model requests made with your own key are billed to your GrokAPI balance, not to Cursor. Some editor-specific features may still require a paid Cursor plan, so check their current terms if you rely on those.
Why does every request return 404?
Almost always a base URL without the /v1 suffix. It has to be exactly https://api.llm-gate.tech/v1 — Cursor appends the endpoint path to whatever you enter, so dropping /v1 sends requests to an address that does not exist.
Which model name should I enter?
Enter any Grok model you want to use. Check the Models page for the current model IDs and copy the chosen ID exactly.
Does this work without a VPN?
Yes. GrokAPI is reachable from Russia, the CIS, China, and other regions where xAI is not directly accessible, so Cursor connects without any extra tunnelling.
How do I confirm Cursor is using my key?
Send one request and open the GrokAPI dashboard. If the usage counter moved, the editor is going through your key. If it did not, the base URL override is off or the key was not saved.