All Products
Search
Document Center

Alibaba Cloud Model Studio:Create an API key

Last Updated:Oct 27, 2025

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

1. Activate the Model Studio service

Use your Alibaba Cloud account to access Model Studio (Singapore or Beijing). If an activation prompt appears at the top of the page, activate the Model Studio service to claim the free quota for new users. Activating Model Studio is free. You are only charged for model calls that exceed your free quota. If no activation prompt appears, the service is already activated.

2. Create an API key

Important

This operation requires an Alibaba Cloud account or a RAM user with administrator or API-Key page permissions.

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

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

    image

  2. In the Create API Key dialog box, select an Owner Account and Workspace, enter a Description, and then click OK.

    • Owner Account: Select an Alibaba Cloud account or a RAM user. If an employee leaves or changes roles, you must remove their RAM user from the workspace. The corresponding API key is then automatically invalidated, and its call permissions are revoked.

    • Workspace: Typically, you can select the Default Workspace. To control which models a user can call or to separate model call costs, you can create or select a sub-workspace from the list. For more information, see Call models in a sub-workspace. Each workspace supports up to 20 API keys.

      Note

      The call permissions of an API key are determined by its 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 and speech synthesis.

      • API keys in the default workspace: can call all models and applications within the default workspace.

      • API keys in a sub-workspace: can call models that have been granted authorization for the sub-workspace and applications within that sub-workspace.

  3. Click the image icon (③ in the preceding figure) next to an API key to copy it.

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

3. Use the API key

  • Method 1: Call a model in a third-party tool

    If you call a model from a tool or platform, such as Chatbox, you may need to enter the following information:

    • The API key created in this topic

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

      If you use a model in the China (Beijing) region, use the following URL instead: 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, export the API key as an environment variable. This prevents the API key from being included in plaintext in your code and reduces the risk of exposure.

Never publicly expose your API key. This prevents security risks and financial losses that can result from unauthorized use.

API key validity

The API keys you create are permanently valid. They become invalid only when they are manually deleted.

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

FAQ

Q: How many API keys can be created under a single Alibaba Cloud account?

A: Each Alibaba Cloud account can have up to 10 workspaces, including the default workspace. You can create up to 20 API keys in each workspace.

Q: If a RAM user is deleted, are the API keys created by that user still active?

A: No. After you delete a RAM user in the RAM console, all API keys created by that user become invalid and can no longer be used to call models.