api.foo
api.foo / Docs / Cursor custom API key

Cursor API Key Setup (2026): Use Your Own OpenAI, Anthropic, Google Key or a Custom Base URL

Updated · Tested on: Cursor 3.9.16 settings (from the installed app) and Cursor's official docs
On this page

Short answer: open Cursor Settings → Models, scroll to API Keys, paste your OpenAI, Anthropic or Google key and save. For any OpenAI-compatible provider, also fill in Override OpenAI Base URL, then use Add Custom Model for the provider's model names. Own keys need a Premium plan or higher, they work for chat and Agent models but not for Tab, and requests still pass through Cursor's servers.

The setting names here come from the Cursor 3.9.16 app itself and from Cursor's documentation as of October 15, 2026.

Which plans allow your own key

Cursor is now sold as part of a combined subscription with Grok and X, and plan names changed in 2026:

Plan Price Own API keys / third-party models
Free $0 No third-party models
Plus $8/mo No: Cursor's own models only
Premium $30/mo Yes
Super $100/mo Yes
Ultra $200/mo Yes
Teams / Enterprise per seat / custom Yes, plus a $0.25 per million token Cursor Token Rate
Legacy Pro, Pro+, Ultra — Yes

On individual plans, requests made with your own key are billed by your provider and don't use your included Cursor usage, so you can make as many as your provider allows. On Teams and Enterprise plans, Cursor still charges its Token Rate on those tokens.

What your own key covers, and what it doesn't

With your own key
Chat and Agent with that provider's models Billed to your key
Tab completion Always Cursor's built-in models
OpenAI models Cursor's docs say standard, non-reasoning chat models. The model picker shows which
Cursor's Zero Data Retention Does not apply. Your provider's privacy policy does
Where requests go Through Cursor's servers, which build the final prompt, then on to your provider

The last row has practical consequences. Your key travels with each request (Cursor says it isn't stored), and a custom base URL must be reachable from the internet. localhost or a private network address won't work.

Add a key from OpenAI, Anthropic or Google

  1. Open Cursor Settings: the gear icon at the top right, or Cursor Settings in the Command Palette.
  2. Go to Models and scroll to API Keys.
  3. Paste your key into OpenAI API Key, Anthropic API Key or Google API Key. Azure OpenAI and AWS Bedrock have their own sections.
  4. Save. That provider's models now use your key and appear in the model picker.

If a key is invalid or the provider rejects it, requests to that provider fail until you fix or remove the key. Need a key? See How to get an OpenAI API key or How to get a Claude API key.

Use an OpenAI-compatible provider (custom base URL)

Under the OpenAI key field, Override OpenAI Base URL ("Change the base URL for OpenAI API requests") lets Cursor send OpenAI-format requests to another service, such as a self-hosted model server or an API gateway. The field's default is https://api.openai.com/v1.

  1. OpenAI API Key: paste the key from that provider, not your OpenAI key.
  2. Override OpenAI Base URL: the provider's OpenAI-compatible base URL, including /v1, for example https://api.foo/v1 for api.foo, the gateway that publishes these docs.
  3. Add Custom Model (in the same Models settings): enter each model name exactly as the provider spells it, and enable it.
  4. Pick the model in the chat or Agent model picker and send a test message.

Keep in mind:

  • It's OpenAI format only. The override changes where Cursor's OpenAI requests go. Your provider must implement the OpenAI Chat Completions API. See OpenAI-compatible APIs explained.
  • Use the provider's exact model IDs. A mistyped name returns a "model not found" error from the provider.
  • Public HTTPS only, because requests come from Cursor's servers, not your machine.
  • To go back to Cursor's own OpenAI models, clear the base URL override and the key.

Troubleshooting

My own key doesn't seem to be used

Check your plan first. Plus and Free plans don't support your own keys. Then make sure you selected one of that provider's models in the picker. Tab always uses Cursor's models, whatever keys you've added.

"Model not available"

Cursor's docs say some models are unavailable in certain regions because of restrictions set by the model providers, and those models don't appear in Cursor at all.

Custom base URL errors

Symptom Likely cause
401 / invalid key The key in the OpenAI field belongs to a different service than the base URL
404 The base URL is missing /v1, or you included a full path such as /chat/completions
Model not found The custom model name doesn't match the provider's ID exactly
Timeouts or connection errors The URL isn't publicly reachable, or the provider is down

For the meaning of each status code, see LLM API errors and rate limits.

FAQ

Can I use my own API key in Cursor?

Yes, on Premium, Super and Ultra plans (and legacy Pro, Pro+ and Ultra plans). Open Cursor Settings → Models, find the API Keys section, paste a key for OpenAI, Anthropic, Google, Azure OpenAI or AWS Bedrock, and save. The Plus plan doesn't allow your own keys.

Does my own API key work for Cursor Tab?

No. Custom API keys only apply to chat models. Tab completion always uses Cursor's built-in models.

Do I pay Cursor when I use my own API key?

On individual plans, no. Your provider bills you directly and the requests don't use your included usage. On Teams and Enterprise plans, Cursor adds a Cursor Token Rate of $0.25 per million tokens, even with your own key.

Can I use a custom OpenAI base URL in Cursor?

Yes. Under the OpenAI API key there's an Override OpenAI Base URL setting (default https://api.openai.com/v1). Enter an OpenAI-compatible provider's URL, add its model names with Add Custom Model, and select them in the model picker.

Is my API key stored on Cursor's servers?

Cursor says the key isn't stored on its servers, but it's sent to its backend with every request, because all requests are routed through Cursor's servers for final prompt building. That's also why a custom base URL has to be reachable from the public internet.

Found a mistake? Email [email protected].