AI ChatModelsPriceDocsGuides

How to use Cursor with your own API key and base URL

In Cursor, open Settings, then Models. Paste your sk- key into OpenAI API Key, turn on Override OpenAI Base URL and enter https://api.macloudai.com/v1, click + Add model to add model names from the models page, then click Verify. Chat and agent requests with those models are then billed per token to your own balance.

Updated 2026-11-01 · MaCloud AI

Why use your own key in Cursor?

Cursor works out of the box with its own plans. Bringing your own key is useful when you want to pay per token instead of a fixed plan, use a model that is not in Cursor's default list, or keep all your AI spending on one balance with your other tools. With an OpenAI-compatible gateway, one key covers Claude, GPT, Gemini and DeepSeek.

Step by step

  1. Create an API key at API Keys. Name it "cursor" so you can recognize it in the usage log.
  2. In Cursor, open Settings (the gear icon, or Cursor Settings from the command palette) and go to Models.
  3. Find the OpenAI API Key field and paste your sk- key.
  4. Turn on Override OpenAI Base URL and enter https://api.macloudai.com/v1.
  5. Click + Add model and type a model name exactly as it appears on the models page, for example hk-5-5. Repeat for each model you want.
  6. Click Verify. When it passes, enable the models you added and turn off the ones you do not want.
  7. Open the chat panel, pick one of your models in the model selector, and send a test message.

The base URL for Cursor must end in /v1: https://api.macloudai.com/v1. This is different from Claude Code, which uses https://api.macloudai.com without /v1. Cursor's settings layout changes between versions; if you cannot find a field, search the settings for "OpenAI API Key" or "Base URL".

Which model names should I add?

Add only names that are listed on the models page, copied exactly. A few useful combinations:

UseExample model to add
Main coding model for chat and agenthk-5-5
Second opinion or general questionstt-6-luna
Large files and long contextgem-3.8-flash
Cheaper bulk edits and explanationsdeepseek-v4.1-flash

All of these go through the same OpenAI key and base URL, because the gateway accepts the OpenAI format for every model family. For help choosing, see which model for which job.

What does the custom key cover?

Your key is used when you select one of your added models in chat, the composer or agent mode. Some built-in Cursor features, such as Tab autocomplete, run on Cursor's own models and may not use your key at all, and some features may require a Cursor plan. Check the current Cursor documentation for what your plan includes. You can always confirm what was billed to you on Usage, which lists the last 50 calls with model, tokens and cost.

Troubleshooting Verify and chat errors

SymptomLikely causeFix
Verify fails with 401Key copied wrong or deletedPaste a fresh key from the console, no spaces
Verify fails with 404Base URL missing /v1, or a model name typoUse https://api.macloudai.com/v1; copy names from the models page
403 when chattingBalance too lowTop up and retry
Model missing in selectorNot enabled after addingTurn on the toggle next to the model in Settings, Models
Other OpenAI models stopped workingThe base URL override applies to every OpenAI-key modelUse only names listed on the gateway while the override is on

While Override OpenAI Base URL is on, every request that uses the OpenAI key goes to https://api.macloudai.com/v1. If you also have an official OpenAI key, you cannot use both at the same time in this field; switch the override off to go back.

Cline and other VS Code extensions

The same key works in other editors. In Cline (VS Code extension), choose API Provider OpenAI Compatible, set Base URL to https://api.macloudai.com/v1, paste the key and type a model ID. Or choose Anthropic, enable the custom base URL option and enter https://api.macloudai.com without /v1, then pick a Claude model. Any tool that has an "OpenAI-compatible" or "custom base URL" option can be set up the same way.

Test the key outside Cursor

If Verify keeps failing, check the key with curl. If this works, the problem is in the Cursor settings, not the key:

curl https://api.macloudai.com/v1/chat/completions \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{"model": "hk-5-5", "messages": [{"role": "user", "content": "ping"}]}'

Costs are per token, input and output priced separately. Agent mode sends large amounts of file context, so it uses many more input tokens than a short chat:

Real prices now

Estimated from the prices on the models page: 2,000 input tokens and 500 output tokens per chat. The console shows the actual charge.

ModelsPer chat1,000 chats
GEM 3.8 FlashRp 4Rp 4.434
TT-6 LunaRp 11Rp 10.642
TT-6.1 TerraRp 7Rp 7.263
HK-5.5Rp 3Rp 3.487
GEM 4 ArgonRp 85Rp 84.649
TT-6.1 SolRp 15Rp 14.526

FAQ

Q1What base URL do I put in Cursor?
Use https://api.macloudai.com/v1 in the Override OpenAI Base URL field. Cursor uses the OpenAI format, so the /v1 is required.
Q2Can I use Claude in Cursor with an OpenAI key field?
Yes. The gateway accepts the OpenAI format for Claude models. Add the Claude model name from the models page with + Add model.
Q3Why does Verify fail?
Most often the base URL lacks /v1, the key has extra characters, or the model name does not match the models page exactly.
Q4Does Tab autocomplete use my key?
Not necessarily. Some built-in Cursor features run on Cursor's own models. Your key is used for the models you add and select in chat and agent mode.
Q5How do I see what Cursor cost me?
Open Usage in the MaCloud AI console. Every call is listed with the model, input and output tokens, and the cost.

More guides