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
- Create an API key at API Keys. Name it "cursor" so you can recognize it in the usage log.
- In Cursor, open Settings (the gear icon, or Cursor Settings from the command palette) and go to Models.
- Find the OpenAI API Key field and paste your
sk-key. - Turn on Override OpenAI Base URL and enter
https://api.macloudai.com/v1. - 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. - Click Verify. When it passes, enable the models you added and turn off the ones you do not want.
- 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:
| Use | Example model to add |
|---|---|
| Main coding model for chat and agent | hk-5-5 |
| Second opinion or general questions | tt-6-luna |
| Large files and long context | gem-3.8-flash |
| Cheaper bulk edits and explanations | deepseek-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
| Symptom | Likely cause | Fix |
|---|---|---|
| Verify fails with 401 | Key copied wrong or deleted | Paste a fresh key from the console, no spaces |
| Verify fails with 404 | Base URL missing /v1, or a model name typo | Use https://api.macloudai.com/v1; copy names from the models page |
| 403 when chatting | Balance too low | Top up and retry |
| Model missing in selector | Not enabled after adding | Turn on the toggle next to the model in Settings, Models |
| Other OpenAI models stopped working | The base URL override applies to every OpenAI-key model | Use 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.
| Models | Per chat | 1,000 chats |
|---|---|---|
| GEM 3.8 Flash | Rp 4 | Rp 4.434 |
| TT-6 Luna | Rp 11 | Rp 10.642 |
| TT-6.1 Terra | Rp 7 | Rp 7.263 |
| HK-5.5 | Rp 3 | Rp 3.487 |
| GEM 4 Argon | Rp 85 | Rp 84.649 |
| TT-6.1 Sol | Rp 15 | Rp 14.526 |
FAQ
Q1What base URL do I put in Cursor?
Q2Can I use Claude in Cursor with an OpenAI key field?
Q3Why does Verify fail?
Q4Does Tab autocomplete use my key?
Q5How do I see what Cursor cost me?
More guides
- One API key for Claude, GPT, Gemini and DeepSeek
- How to use Claude Code with a custom API endpoint
- Claude Code API errors and fixes: 401, 403, 404, 429, 5xx
- Claude vs GPT vs Gemini vs DeepSeek: which model for which job
How AI API token pricing works and how to estimate your bill
- Add AI to n8n workflows with an OpenAI-compatible API