All Products
Search
Document Center

Alibaba Cloud Model Studio:Get an API key

Last Updated:Oct 10, 2025

Before you can use models or applications in Alibaba Cloud Model Studio, you must activate the service and obtain an API key for authentication.

1. Activate the model service for Alibaba Cloud Model Studio

Use your Alibaba Cloud account to access Alibaba Cloud Model Studio (Singapore or Beijing). If an activation prompt

2. Get an API key

Important

This operation must be performed by an Alibaba Cloud account or a RAM user that has administrator or API-Key page permissions.

After you activate Alibaba Cloud Model Studio, you must create an API key manually. The system does not generate one automatically.

  1. Go to the Key Management (Singapore or Beijing) page. On the API-Key tab (① in the figure below), click Create API-KEY (② in the figure below).

    image

  2. In the Create API-KEY dialog box, select an Owning Account and an Owning Workspace for the API key, enter a Description, and click OK.

    • Owning Account: You can select an Alibaba Cloud account or a RAM user. If an employee leaves or changes roles, you can simply remove their RAM user from the workspace. The corresponding API key is automatically invalidated and can no longer be used to make calls.

    • Owning Workspace: You can typically select the Default Workspace (or the main account's workspace). To control which models a user can call or to separate the billing for model calls, you can create or select a sub-workspace. For more information, see Model calls in a sub-workspace. A single workspace supports a maximum of 20 API keys.

      Note

      The call permissions of an API key are determined by its owning workspace. API keys within the same workspace have the same permissions. You do not need to create different API keys for different models, such as text-to-image or speech synthesis.

      • API key in the default workspace: Can be used to call all standard models and applications within the default workspace.

      • API key in a sub-workspace: Can be used to call standard models that have been granted to the sub-workspace and applications within that sub-workspace.

  3. Click the image icon (③ in the figure) next to the API key to obtain the key.

    An Alibaba Cloud account can view all API keys. A RAM user can only view the API keys that they created.

3. Use an API key

  • Method 1: Invoke the model in third-party tools.

    If you call a model in a tool or platform, such as Chatbox, you may be required to enter the following three pieces of information:

    • The API key obtained in this topic

    • base URL: https://dashscope-intl.aliyuncs.com/compatible-mode/v1

      If you use a model in the China (Beijing) region, replace the URL with: https://dashscope.aliyuncs.com/compatible-mode/v1

    • Model name, such as qwen-plus

  • Method 2: Call a model using code

    If you call a model using code, we recommend that you configure the API key as an environment variable. This prevents the API key from being exposed in plaintext in your code and reduces the security risk of a leak.

Do not expose your API key. This helps prevent security risks and financial losses that can result from unauthorized use.

API key validity details

An API key remains valid until it is manually deleted.

To provide temporary access to third-party applications or users, or to strictly control high-risk operations such as accessing or deleting sensitive data, you can generate a temporary API key. A temporary key is valid for 60 seconds. This method avoids exposing a long-term API key and reduces the risk of a leak.

FAQ

If an error occurs when you call a model, see the error message for information about how to resolve the issue.