Cursor is a widely used AI code editor. It comes with its own model quota, but it also lets you enter your own API Key and Base URL. For teams in China, using your own gateway has three benefits: more stable access, unified billing, and the freedom to switch models at any time.
This article explains how to configure a custom API in Cursor, the common pitfalls, and how to choose between a Cursor subscription and your own key.
Cursor updates frequently, so menu names may change. This article uses common versions as of October 2026; refer to Settings in your current version for specifics.
1. Understand the two ways to use Cursor
1. Use Cursor's included quota
It works out of the box and is billed according to your Cursor plan. It suits individual users who do not want to configure anything and have modest usage.
2. Use your own API Key
Enter the key and Base URL of a third-party OpenAI-compatible interface in Cursor, and usage is billed to your own API account. This suits:
- Users in China whose access to official APIs is unstable.
- Teams that want unified billing and quotas.
- Users who need to specify models or switch between multiple providers.
- Companies that want Cursor usage included in cost management.
Note: even with your own key, some Cursor features may still require a valid plan. Refer to the current Cursor version and plan rules.
2. Prepare an API Key
- Open the ZSQH AI Gateway and sign in.
- Go to "API Keys", create a new key, and name it
cursor-work-laptop. - Set a spending limit and expiration time.
- Copy the key and store it in a password manager.
- Top up your wallet and confirm the balance.
Use this Base URL:
https://ai.zhongshangqihang.com/v1
This is the OpenAI-compatible address. Cursor's custom API feature usually calls the OpenAI protocol, so do not enter Anthropic's root address.
3. Configure Cursor
Menu paths vary slightly between versions. They are usually under:
Cursor Settings → Models → OpenAI API Key
Steps:
- Open Cursor settings (the shortcut is usually
Cmd/Ctrl + ,). - Find the Models or OpenAI API Key section.
- Turn on "Override OpenAI Base URL" or a similar switch.
- Enter
https://ai.zhongshangqihang.com/v1as the Base URL. - Enter your
sk-...API key. - Add the model names you want to use to the model list, for example
gpt-5andclaude-sonnet-4-5. - Save, start a new chat, and select the custom model to test.
If Cursor reports "API Key invalid":
- Check that the key was copied completely.
- Check that the Base URL ends with
/v1. - Check that the balance is sufficient.
- Check that the model name is available to your account.
4. How to choose models
Tasks in Cursor usually fall into three categories:
| Task | Suggested model | Why |
|---|---|---|
| Daily completion and small bug fixes | Lightweight, fast model | Low latency and low cost |
| Multi-file refactoring, complex agents | Claude Sonnet / GPT flagship models | More reliable code understanding and tool calls |
| Hard reasoning and architecture design | Opus / high-end models | Stronger capability at a higher cost |
Model names must follow the model pricing page. Cursor's model dropdown may only show names it recognizes; if your custom model does not appear, add it manually or select a compatible alias.
5. Subscription vs. your own key
There is no universal answer; it depends on usage. You can estimate as follows:
- Count roughly how many requests you send per day and how much context each carries.
- Check the price and quota of your Cursor plan.
- Use the API pricing page to estimate the token cost for the same usage.
- Factor in stability, access speed, and billing management.
Rules of thumb:
- Low usage, one model: a plan may be simpler.
- High usage, frequent model switching, multiple team members: your own key plus a gateway is usually more controllable.
- Need stable access from China: the value of a gateway often outweighs the unit-price difference.
For specific prices, refer to model pricing and Cursor's official plan page.
6. FAQ and troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
| 401 | Wrong or expired key, wrong Base URL | Copy the key again; confirm /v1 |
| 404 | Duplicated path in the Base URL | Enter only up to /v1, without /chat/completions |
| Model unavailable | Wrong model name or not enabled | Copy the model name from the pricing page |
| Request timeout | Network or proxy | Check the network, switch between direct and proxy |
| Insufficient balance | No top-up or quota exhausted | Top up; check the key's quota |
| Truncated response | Context or output limit | Reduce context or raise the output limit |
7. Security recommendations
- Create a separate key for Cursor; do not share it with production services.
- Set a spending limit to prevent background IDE requests from consuming too much.
- Do not store keys long term on shared computers.
- Delete old keys when employees leave or machines are replaced.
- For teams, use a unified gateway and create a key per member for easier auditing.
8. Which teams benefit
- Agencies and outsourced teams: one key per project, with costs tracked by project.
- Startups: a unified entry point, models can be switched at any time, and no lock-in to a single vendor.
- Enterprise R&D: centralized management of members, quotas, logs, and billing.
- Individual developers: more stable access from China and more convenient payment.
Next steps
First register for the ZSQH AI Gateway, create a dedicated cursor key, and enter it in Cursor as described above. Once it works, adjust your primary model according to model pricing.
Related reading:
