šŸš€ Integrating Cursor with CodingPlanX Custom Models

Introduction: Cursor is an AI-powered code editor deeply loved by developers, featuring powerful built-in Large Language Model (LLM) capabilities. However, due to network restrictions, cost control (using third-party proxy APIs or cheaper models like DeepSeek), or enterprise intranet deployment needs, we often need to configure a custom API URL and API Key.

This tutorial will guide you step-by-step on how to easily complete this configuration.


šŸ“‹ Prerequisites

Before starting, please ensure you have the following information ready:

  1. Installed Cursor: Make sure your Cursor is updated to the latest version.
  2. API Key: e.g., sk-xxxxxxxxxxxxxxxxxxxxxxxx.
  3. Base URL: Your custom API proxy address.
    • Note: It usually needs to end with /v1, for example, https://api.codingplanx.ai/v1.
  4. Model Name: The standard name of the model you intend to use (e.g., gpt-4o, claude-3-5-sonnet, deepseek-chat, etc.).

āš™ļø Detailed Configuration Steps

Step 1: Open Cursor Settings

  1. Launch the Cursor editor.
  2. Click the Gear icon āš™ļø in the top right corner, or use the shortcut to open settings:
    • Windows / Linux: Ctrl + ,
    • macOS: Cmd + ,

Step 2: Go to the Models Configuration Page

In the left navigation bar of the settings panel, find and click the Models tab.

Step 3: Configure the API Key

  1. Scroll down the Models page to find the OpenAI API Key section.
  2. Paste your custom API Key into the input box.
  3. Click the Verify button on the right. (If verification fails at this point, don't worry, as we haven't configured the URL yet).
  4. āš ļø Important Note: Please ensure that the official Cursor Tab and other paid subscription toggles above are in the appropriate state (if you are using a free third-party API, it is recommended to turn off the official model toggles).

Step 4: Configure the Base URL (Override Default Endpoint)

This is the most crucial step, as it determines where your requests are sent:

  1. Below the OpenAI API Key input box, find the Override OpenAI Base URL option.
  2. Expand this option and enter your custom interface address into the box.

    šŸ’” Example Format:

    • CodingplanX AI: https://api.codingplanx.ai/v1
  3. After filling it in, you must press the Enter key to save the settings.

If the model you are using is not in Cursor's default list (e.g., deepseek-coder), you need to add it manually:

  1. Scroll to the top of the Models page and find the Model Names section.
  2. Click + Add Model.
  3. Type your model name accurately (e.g., deepseek-chat), then press Enter to confirm.
  4. Toggle on the switch next to the model you just added, and it is recommended to turn off other models you don't use to prevent selecting the wrong one.

āœ… Testing and Verification

After configuration, we need to test if it works:

  1. Return to the code editing interface.
  2. Press Ctrl + L (Windows) or Cmd + L (macOS) to bring up the Chat window on the right.
  3. At the bottom of the chat window, click the currently displayed model name and switch to the model you just configured (e.g., gpt-4o or deepseek-chat).
  4. Send a simple greeting, for example: "Who are you? Please tell me your model version."
  5. If the AI replies normally and quickly, congratulations, the configuration is successful! šŸŽ‰

ā“ FAQ & Troubleshooting

SymptomPossible CauseSolution
Connection Timeout / 404 Not FoundBase URL format error.Check if the URL is missing the /v1 suffix, or if /chat/completions was added by mistake. The correct format should be https://xxx.com/v1.
Model not foundThe requested model name is not supported by your API channel.Check if the model name selected in Cursor exactly matches the name supported by your API provider (case-sensitive).
Authentication failedIncorrect API Key or insufficient balance.Check if the Key is copied completely (without extra spaces), and go to the API provider's dashboard to check your account balance.
Cannot use Cursor Tab (Autocomplete)Cursor's inline code completion (Copilot) uses an independent model.Third-party APIs can only take over Chat and Cmd+K features. Cursor Tab completion typically still relies on official Cursor services or requires special configuration supporting FIM models.

šŸ“ Conclusion: Mastering custom API configuration not only significantly reduces the cost of using AI-assisted programming but also allows you to freely switch between various cutting-edge LLMs. If you found this tutorial helpful, feel free to share it with your developer friends!