How to use Grok API key with Cursor

@condor I read many times and still absolutely have no idea how to apply my Grok API key to cursor. Absolutely incomprehensible what to do.

@fridary I extracted your comment as it is not relevant to the other thread.

  1. Go to Cursor Settings > Models, and scroll down to bottom until you see > API Keys

  2. Expand API Keys, enter your Grok API key in OpenAI API Key and enable “Override OpenAI Base URL” then paste there the Grok API URL.

Note: While it says OpenAI, any OpenAI compatible API is supported.

  1. In Model settings check that Grok 4 is enabled, or if not available then add it from your Grok account .

  2. Go to Chat, select the Grok 4 model and send a request.

Thank you for detailed answer. Do I understand right that I can’t use both ChatGPT and Grok in cursor? Otherwise I should rewrite API keys each time, which is very inconvenient.

1 Like

Yes GPT is from OpenAI and Grok would then re-use the connection we reserve for OpenAI.

This is at the moment a limitation.

Can you please ask a Cursor technical team to add separate API key field for grok please.

1 Like

Hey, thanks for the suggestion. We’ll consider it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.