Current location: Home> Cursor ai Tutorial> How to register OpenAI API to Cursor

How to register OpenAI API to Cursor

Author: LoRA Time: 20 Mar 2025

Cursor AI is an intelligent code editor that integrates AI, which can greatly improve the programming efficiency of developers. To fully utilize its AI code completion and smart assistant capabilities, users can manually register the OpenAI API to use a custom AI model. This article will explain in detail how to register the OpenAI API in Cursor and configure its use.

Get OpenAI API Key

Before registering the OpenAI API to Cursor, you need to obtain the API key on the OpenAI official website. The steps are as follows:

1. Visit the OpenAI official website and log in to your account.

2. In the user panel, enter API Keys Management (API Keys).

3. Click Create new secret key to generate your API key.

4. Copy the key and save it properly, because OpenAI will only display it once.


Register OpenAI API in Cursor

1. Open Cursor Settings

  • Start Cursor AI and enter Settings.

  • Find API Settings in the left navigation bar.

2. Add OpenAI API Key

  • In the API Configuration interface, find the OpenAI API Key option.

  • Paste the OpenAI API key you just obtained into the corresponding input box.

    20250320-160317.jpg

3. Select the API model

  • Cursor allows you to choose to use GPT-3.5 or GPT-4 as a model for AI completion and chat assistants.

  • In the Model Selection section, select the OpenAI language model you want to use.

    20250320-160432.jpg

4. Save and test the API

  • Click Save Settings to complete the API binding.

  • Try using AI Code Completion or AI Chat features in the code editor to test if the API is working properly.