Cursor Custom API Base URL:
Bring Your Own OpenAI Key

Add your own OpenAI key in Cursor and override the base URL to use an OpenAI-compatible API. Setup, plan requirements, region errors and the Claude limit.

Updated 12 min read

Yes, with conditions. In Cursor’s settings you can add your own OpenAI API key and turn on a base URL override, which sends requests for OpenAI models to any OpenAI-compatible API. Claude only accepts an official Anthropic key, and Cursor offers no custom endpoint for it. Bringing your own key also requires a paid Cursor plan, so you still pay Cursor’s subscription.

Based on Cursor’s settings screen since version 3.20 and Cursor’s official docs, checked 2026-11. Cursor ships updates often, so the wording in your version may differ.

When a custom base URL makes sense

Cursor is an AI code editor. Claude, GPT and Gemini inside Cursor come from Anthropic, OpenAI and Google. Each vendor serves only its own list of regions; see Anthropic’s supported regions and OpenAI’s supported countries. Neither list includes Russia, Belarus, Iran, Hong Kong, Macau or mainland China, and Cursor hides those models in regions where the vendor isn’t available.

Teams outside those regions have another reason: on Premium and above, third-party model usage is billed at API list price from prepaid credit. With your own key, the model cost goes to your API provider instead.

Your options:

Option What you get Requirements
Cursor’s own models (Grok, Composer) Agent, Chat and Tab completion A Cursor account. Free and Plus include only these models
Your own OpenAI key with a base URL override OpenAI models in chat Premium or higher, plus an OpenAI-compatible API
Your own Anthropic key Claude An official Anthropic account, in a region Anthropic serves
Claude Code or Codex instead Claude or GPT for coding One API key; see Claude Code API key setup and Codex CLI custom provider setup

For OpenAI models inside Cursor, follow the setup steps below. For Claude, skip to the last row.

Why Cursor says a model isn’t available in your region

Cursor’s explanation: some model providers have location-based restrictions. If your region isn’t supported, those models don’t appear in Cursor, and all other models keep working (Cursor: Regions and model availability). Cursor adds that availability follows each provider’s terms and policies, and that it plans to restore models when a provider allows access from your region (Cursor: Regions).

On the Cursor forum, staff have said model routing follows the regions each provider serves, and users elsewhere see messages like “This model provider doesn’t serve your region.”

So it isn’t a problem with your account or install. It comes from the provider’s region policy. Cursor suggests three things:

  1. Pick Auto and let Cursor choose an available model for each request.
  2. Pick any model that’s still available to you.
  3. If a provider serves your region, add that provider’s API key in Cursor Settings > Models. Cursor also warns that calls may still fail with your own key if the provider blocks your region.

Where Anthropic and OpenAI don’t operate, option 3 doesn’t work with their official keys. An OpenAI-compatible API that works in your region is the path that does.

Can Cursor use your own API key?

Yes. Cursor calls it “Bring your own API key” (Cursor: Bring your own API key). The main points:

Item What Cursor says
Where Cursor Settings > Models
Providers OpenAI, Anthropic, Google, Azure OpenAI, AWS Bedrock
Custom endpoint Only OpenAI has a base URL override switch (Cursor 3.20 release notes)
Scope Your key is used for chat models only; Tab completion keeps using Cursor’s built-in models
OpenAI models Standard, non-reasoning chat models; the model picker shows which ones are available
Plans Individual Premium, Super and Ultra, plus the legacy Pro, Pro+ and Ultra. Plus doesn’t include your own API keys
Cost Individual plans: your provider bills the model cost, and it doesn’t use your included usage or prepaid credit. Teams and Enterprise: eligible third-party models carry a Cursor Token Rate of $0.25 per million tokens, own keys included
Data Every request goes through Cursor’s servers to build the final prompt. Your key is sent with each request and, per Cursor, not stored. Cursor’s Zero Data Retention policy doesn’t apply when you use your own keys
Admin control Enterprise admins can stop members from using their own keys

The Cursor 3.20 release notes describe the current screen. Under Settings > Models, each provider has its own API Key field. A Use API Key switch appears once a key is saved. OpenAI also gets a base URL override switch with its own field. A key saves when you leave the field or press Enter, and clearing the field deletes it (Cursor release notes). The “Override OpenAI Base URL” option in older guides is this switch.

Cursor’s docs don’t spell out two things, so test them yourself. One is how Agent and other features behave on your own key. The other is whether reasoning models such as GPT-5.6 work with your own key, since the docs only mention standard, non-reasoning chat models.

How to set up a custom OpenAI base URL

You need an OpenAI-compatible API that works where you are. This guide uses Brioi as the example; for what to look for in a provider, see AI API gateways: what they are and how to choose. Brioi bills per use from one balance, at about 10–50% of the official price, and you can top up with USDT or an international card.

Before you start

  • Cursor 3.20 or later, on a plan that allows your own API keys (see the table above).
  • A Brioi account. If you don’t have one, sign up on the main site.
  • A terminal, to test the key once before you touch Cursor.

1. Create an API key

  1. Open the Brioi API keys page.
  2. Click Create API key and name it Cursor.
  3. Choose a group from the table below that includes the models you want in Cursor. If you’re unsure, choose default, which has every GPT model listed.
  4. Save.
Group GPT models included
default (default group) gpt-5.5, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, gpt-6-astra, gpt-6-sol, gpt-6-luna, gpt-6.1-sol, gpt-6.1-terra
GPT | Official (OpenAI official line) gpt-5.6-sol, gpt-5.6-terra, gpt-6-astra, gpt-6-sol, gpt-6.1-sol, gpt-6.1-terra
GPT | Azure (Azure GPT text line) gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, gpt-6-astra, gpt-6-sol, gpt-6-luna, gpt-6.1-sol

The group decides which models the key can call and how they are billed. The same model can be priced differently in different groups; see the pricing page.

2. Test the key in a terminal

Test outside Cursor first. If something fails later, you’ll know whether it’s the key or the Cursor settings. List the models this key can use:

curl https://vip.brioi.com/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"

Send a test request, with model set to one from that list:

curl https://vip.brioi.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-5.6-sol", "messages": [{"role": "user", "content": "Reply with BRIOI_OK only"}]}'

Python works too. The openai SDK only needs base_url:

from openai import OpenAI

client = OpenAI(
    base_url="https://vip.brioi.com/v1",
    api_key="YOUR_API_KEY",
)

resp = client.chat.completions.create(
    model="gpt-5.6-sol",
    messages=[{"role": "user", "content": "Reply with BRIOI_OK only"}],
)
print(resp.choices[0].message.content)

If you get BRIOI_OK back, the key and the model both work. This test uses a small amount of balance.

3. Add it in Cursor

  1. Open Cursor Settings > Models and find OpenAI.
  2. Paste your API key into the API Key field and press Enter to save.
  3. Turn on the Use API Key switch that appears after saving.
  4. Turn on OpenAI’s base URL override switch and enter https://vip.brioi.com/v1 in its field.

With Use API Key on, every OpenAI model in Cursor uses your key, and Brioi bills the usage. To go back to Cursor billing, turn the switch off. To remove the key entirely, clear the field.

4. Check that it works

Pick an OpenAI model in the chat panel’s model picker and send:

Reply with BRIOI_OK only

After the reply, open the request log in the Brioi console, confirm the request arrived and note the model name in the log. That is the model name Cursor actually sends.

  • No entry in the log: the request didn’t go to your URL. Check that both Use API Key and the base URL override are on.
  • 503 model_not_found: that model isn’t in the key’s group. Switch to a group that has it.
  • The OpenAI model you want isn’t in the picker: go by what the picker offers, then check on the pricing page that the group has a model with the same name.

Where the request goes

Your editor talks to Cursor’s servers. Cursor’s servers build the prompt and then call the URL you entered. Brioi handles the model API leg. The leg between your editor and Cursor’s servers is Cursor’s own service, and Cursor’s docs say nothing region-specific about it.

On a company network with a proxy, Cursor recommends setting HTTP Compatibility Mode to HTTP/1.1 under Cursor Settings > Network (Cursor team setup). Cursor also notes that a model reached through an OpenAI-compatible base URL carries the region of that endpoint (Cursor: Privacy and Data Governance). Teams with data requirements should ask the API provider how it handles data.

Can Cursor use Claude through a custom API?

Not according to Cursor’s docs. Only the OpenAI section has a base URL override, and the Anthropic section takes only an official Anthropic key. The docs also don’t describe connecting Claude through the OpenAI-compatible route. Other setups shared online aren’t in the docs, and this guide doesn’t cover them.

For Claude as a coding agent, Claude Code is the steadier choice. It officially supports ANTHROPIC_BASE_URL for sending requests to a compatible API, set in settings.json. For GPT, Codex supports custom model providers in config.toml. How the three compare:

Tool Form How it connects to a custom API Models
Cursor Code editor Settings > Models, base URL override in the OpenAI section OpenAI models in chat; Tab completion stays on Cursor’s models
Claude Code Terminal, IDE extensions ANTHROPIC_BASE_URL; see Claude Code API key setup Claude
Codex Desktop app, terminal Custom model provider in config.toml; see Codex CLI custom provider setup GPT

Claude Code and Codex change a config file on your machine. Model requests go straight from your computer to the API you set, billed per token, with no editor subscription in between.

Cursor plans and payment

Your own key saves on model cost, but the Cursor subscription is still due. Official prices (Cursor: Pricing and plans, checked 2026-11, USD, excluding tax):

Plan Monthly price Third-party models and your own keys
Free $0 Cursor’s own models only, limited usage
Plus $8 Cursor’s own models only; no third-party models or own keys
Premium $30 Third-party models at API list price from prepaid credit; own keys allowed
Super $100 Same, with 15x Plus usage
Ultra $200 Same, with 50x Plus usage
Teams $30, $100 or $200 per seat Cursor Token Rate on eligible third-party models

How payment works, per Cursor:

  • New subscribers sign up for The X Subscription, which combines Grok, Cursor and X. Billing lives at grok.com under Billing. Legacy Cursor plans bought before that are managed on cursor.com through Stripe (Cursor: Billing and payments).
  • On the web you can pay by card, Apple Pay, Google Pay, Link or Alipay. Some methods are only offered in certain countries, and checkout shows the ones available to you (The X Subscription payment methods).
  • If a payment fails, Cursor suggests retrying, checking the card number, expiry, CVC and billing address in Stripe, trying another card, and asking your bank to allow online charges (Cursor: Payment issues).
  • Invoices download from the Billing page. Company name, address and tax ID are edited in Stripe and apply to future invoices. Enterprise can pay by invoice through Cursor’s sales team.

Avoid shared accounts and unofficial resellers of Cursor subscriptions. The account can be banned, and your code may be exposed.

Common errors

Symptom Fix
No Claude or GPT in the model picker Cursor hides them in regions the provider doesn’t serve. Cursor suggests Auto or another available model. Its docs don’t say whether adding your own key brings these models back
No base URL option in settings Only the OpenAI section has it. If your screen looks different from this guide, update Cursor to 3.20 or later
No API Key settings Check that your plan allows your own keys. Plus doesn’t; on a team, an admin may have turned it off
Every OpenAI model fails after adding the key Per Cursor, when a key is invalid or rejected, all requests to that provider fail until you update or remove it. Test the key with the curl commands above
401 The key is missing, cut off when copied, or disabled
403 Balance is too low, or the key has no access to that group
503 model_not_found The group doesn’t include that model. Change the group or the model
Tab completion doesn’t use your key Expected. Per Cursor, Tab completion keeps using Cursor’s built-in models
Cursor won’t connect on a company network Set HTTP Compatibility Mode to HTTP/1.1 under Cursor Settings > Network

Keep your key safe

  • Don’t paste API keys into group chats, screenshots, repositories or public logs.
  • Cursor’s Zero Data Retention policy doesn’t apply to your own keys. If code confidentiality matters, read the API provider’s data handling terms first.
  • If you think a key has leaked, disable it on the Brioi API keys page right away and create a new one.

FAQ

Can I use my own API key on Cursor’s free plan?

Per Cursor’s docs, Free and Plus include only Cursor’s own models, and Plus explicitly excludes your own keys. The individual plans that allow them are Premium, Super and Ultra, plus the legacy Pro, Pro+ and Ultra.

If I use my own API key, do I still pay for Cursor?

Yes. Your own key requires a paid plan. On individual plans your API provider bills the model cost, and it doesn’t use Cursor’s included usage. On Teams and Enterprise you also pay the Cursor Token Rate of $0.25 per million tokens.

Can I use Claude in Cursor through a custom API?

Cursor doesn’t offer that path. The Anthropic section has no custom endpoint, and the docs don’t describe connecting Claude through the OpenAI-compatible route. For Claude, use Claude Code.

Cursor, Claude Code or Codex: which should my team use?

If you already live in Cursor and mostly chat with OpenAI models, set up your own key as above. If Claude is your main model, use Claude Code. If you want OpenAI’s own coding agent, use Codex. For a team rollout, sales can set up a trial.