Skip to content
Relaykit
DocsCursor

IDE guide

Cursor setup: use your own key with an OpenAI base URL override

Use Claude, GPT, Grok and DeepSeek in Cursor Chat and Agent via your OpenAI API key and Override OpenAI Base URL, with custom models, checks and known limits.

Updated OpenAI formatIDEView .md
On this page
https://api.oneaiapikey.com/v1

Cursor lets you bring your own OpenAI-format key and point it at a different base URL. Because our gateway speaks the OpenAI Chat Completions format for every model in the catalogue, one key and one URL give Cursor access to Claude, GPT, Grok and DeepSeek, all billed from the same prepaid balance.

What you need

  • The Cursor desktop app, signed in.
  • A funded account (top-ups start at $3): sign up here.
  • An API key from the API keys page, starting with sk-.

Before you start: what bring-your-own-key covers

Be aware of how Cursor routes requests so nothing surprises you later:

  • Your key and base URL are used for local Chat and Agent requests with the models you enable.
  • Cursor’s own features such as Tab autocomplete, Auto model selection, cloud or background agents and the Cursor CLI keep using Cursor’s infrastructure. They don’t go through your key.
  • Override OpenAI Base URL is a single global switch. While it’s on, OpenAI-family requests go to the overridden URL, including some of Cursor’s built-in models. Turn it off when you want to go back to models from your Cursor plan.

Step 1: open the model settings

Open Cursor Settings (the gear icon in the top-right corner, or Ctrl+Shift+J / Cmd+Shift+J). Make sure you’re in Cursor’s own settings, not the VS Code-style editor settings: only Cursor Settings has a Models section. Select Models and scroll to the API Keys area.

Step 2: add the key and override the base URL

In the OpenAI section:

  1. Turn on OpenAI API Key and paste your sk- key.
  2. Turn on Override OpenAI Base URL and enter the URL below, including /v1:
Override OpenAI Base URL
https://api.oneaiapikey.com/v1
  1. Click Verify (or save). Cursor sends a small test request; a success message means the key and URL were accepted.

Step 3: add the models you want

Back in the model list, click Add Custom Model (labelled + Add model in some versions) and type a model id exactly as it appears in our catalogue. Add as many as you like, then make sure each one is toggled on. Good choices for Cursor (USD per 1M tokens):

Model idGood forInputOutput
claude-sonnet-5Daily coding, Code review, Writing$2.20$11
claude-opus-5-5Agentic coding, Large refactors, Complex reasoning$4.40$22
gpt-6.1-solCodex CLI, Tool calling, Long context$2.20$11
grok-4.6Fast answers, Research, Chat$2.20$6.60
deepseek-v4-flashBudget coding, Sub-agents, Batch jobs$0.24$0.96

claude-sonnet-5 is a great everyday Agent model; reach for claude-opus-5-5 on big refactors and deepseek-v4-flash when you want to keep costs low. See the full catalogue on the models page.

If Cursor replies that a model already exists, the id matches one of Cursor’s built-in entries. Don’t add a duplicate: simply enable the built-in entry. With the override on, Cursor sends that lowercase id to our gateway unchanged.

Step 4: verify it works

Optional but quick: confirm the key outside Cursor by listing the models your key can use.

curl
curl -sS https://api.oneaiapikey.com/v1/models -H "Authorization: Bearer sk-your-key-here"
PowerShell
Invoke-RestMethod -Uri "https://api.oneaiapikey.com/v1/models" -Headers @{ Authorization = "Bearer sk-your-key-here" }

Then open a Chat or Agent panel, choose one of the models you added from the model picker, and send a short prompt. The reply should arrive normally, and the request will appear in the usage log in your console within a few seconds. If you see the request there, routing works.

Troubleshooting

Verify fails or chat shows 401 / invalid API key. Re-copy the key from the console and paste it without spaces. Confirm the key isn’t disabled and your balance is above zero. If you recently rotated the key, update it in Cursor too.

404 or a generic network error. Check the override URL. It must be https://api.oneaiapikey.com/v1, with /v1 and without a trailing slash or an endpoint path such as /chat/completions.

“Model not found” or “the requested model is not available”. The custom model name doesn’t match a catalogue id. Ids are case-sensitive and use the exact dots and dashes shown above. Also check that the model is toggled on.

Cursor’s built-in models stopped working. That’s the global override at work: OpenAI-family requests are going to our gateway. Turn off Override OpenAI Base URL while you use your Cursor plan models, and turn it back on when you switch back.

Tab completions don’t show up in my usage log. Expected. Tab always runs on Cursor’s own models, whatever key you configure.

Long answers stop partway. Cursor streams responses, which keeps long generations alive. If you call the API from your own code, set "stream": true for long outputs, since proxies cut idle non-streaming requests at about 100 seconds.

Next steps

Using a terminal agent too? See the Claude Code and Codex CLI guides, or browse all tool guides. Prices for every model are on the pricing page.

↑ ↓ moveEnter openEsc close