Grok API

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.
Create an account

Setting up Cursor

1

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
2

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.

3

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.

Enter your OpenAI API Key

Override OpenAI Base URL

Change the base URL for OpenAI API requests.

https://api.llm-gate.tech/v1
Cursor Settings → Models → API Keys. Turn on Override OpenAI Base URL and paste the GrokAPI endpoint into the field underneath.
4

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

Secret saved. Enter a new key to replace it

Override OpenAI Base URL

Change the base URL for OpenAI API requests.

https://api.llm-gate.tech/v1
Create a key
5

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.

Add or search model
grok-4.5
Add grok-4.5 through Add or search model, then switch it on. The name has to match the model ID exactly.

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.

What's next