Help Center/ ModelArts/ Best Practices/ DeepSeek Inference Applications on MaaS/ Building a Code Editor Using a ModelArts Studio (MaaS) DeepSeek API and Cursor
Updated on 2025-08-12 GMT+08:00

Building a Code Editor Using a ModelArts Studio (MaaS) DeepSeek API and Cursor

This section describes how to use Cursor to call a DeepSeek model deployed on ModelArts Studio to build a code editor.

Context

Cursor is a modern code editor for developers that uses AI technology. It combines the strong features of traditional editors like VS Code with AI-powered smart coding tools. These include smart code completion, natural language programming, and code library understanding, which boost development speed. Cursor also supports popular AI models like OpenAI's GPT-4 and DeepSeek, and offers flexible customization. This makes it ideal for users from beginners to professionals.

ModelArts Studio (MaaS) deploys DeepSeek models on its platform, allowing developers use them via API calls.

Prerequisites

Step 1: Downloading and Installing Cursor

Download and install Cursor from the official website.

Step 2: Preparing for MaaS Model API Access

  1. Create an API key.

    Each key is displayed only once after creation. Keep it secure. If the key is lost, it cannot be retrieved. In this case, create a new API key.

    1. Log in to ModelArts Studio (MaaS) console and select CN Southwest-Guiyang1 from the top navigation bar.
    2. In the navigation pane, choose API Keys.
    3. On the API Keys page, click Create API Key, enter the tag and description, and click OK.

      The tag and description cannot be modified after the key is created.

      Table 1 Parameters

      Parameter

      Description

      Tag

      Tag of the API key. The tag must be unique. The tag can contain 1 to 100 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

      Description

      Description of the custom API key. The value can contain 1 to 100 characters.

    4. In the Your Key dialog box, copy the key and store it securely.
    5. After the key is saved, click Close.

      After you click Close, the key cannot be viewed again.

  2. Use a model from My Services.
    1. In the navigation pane of the ModelArts Studio (MaaS) console, choose Real-Time Inference.
    2. Click the My Services tab and click Deploy Model in the upper right corner to create a model service. For details, see Deploying a Model Service in ModelArts Studio (MaaS).
    3. Choose More > View Call Description in the Operation column of the target running model service.
    4. Check the basic API URL and model name on the page. You will need these for the next steps in configuring Cursor.

Step 3: Configuring the MaaS API in Cursor

  1. Click the settings icon in the upper right corner of the Cursor platform.
  2. In the Cursor Settings area, choose Models and click Add model.
    Figure 1 Adding a model
  3. Enter the model name obtained in Step 2.2 in the text box and click Add model on the right.
  4. Select only the added MaaS model. Choosing others might cause the verification to fail.
    Figure 2 Selecting a MaaS model
  5. In the OpenAI Key area, enter the API key created in Step 2.1.
    Figure 3 Entering the API key
  6. Click Override Openai Base URL. Change the basic API URL to the one from Step 2.2, removing /chat/completions at the end. Then click Save.
  7. Click Verify to verify the API connectivity. If no errors show, the setup is complete and you can start using the API.
    Figure 4 Verifying connectivity

Step 4: Using the MaaS API in Cursor to Generate Code

On the code editing page, choose the configured model in the red box for tasks like dialog, code generation, and code parsing.

Figure 5 Using the MaaS API