All Products
Search
Document Center

Platform For AI:Code configuration

Last Updated:Jun 21, 2026

When you submit tasks like model training, you often need custom code. PAI's code configuration feature lets you save your code as a reusable AI asset that you can reference in multiple tasks. This topic explains how to create a code configuration.

Prerequisites

  • Alibaba Cloud account: Has the necessary permissions to perform all operations by default.

  • RAM user: An administrator must add the RAM user to the workspace and assign a role with the required permissions. For more information about the permissions for each role, see Appendix: Roles and permissions.

Create a code configuration

  1. Go to the Code Configuration page.

    1. Log on to the PAI console.

    2. In the left-side navigation pane, click Workspaces and then click the name of the desired workspace.

    3. In the left-side navigation pane, choose AI Computing Asset Management > Source Code Repositories.

  2. On the Source Code Repositories page, click Create Code Build.

  3. On the Create Code Build page, configure the following parameters.

    Parameter

    Description

    Name

    The name of the code configuration.

    Description

    A brief description to help distinguish between different code configurations.

    Visibility

    The visibility of the code configuration. Valid values:

    • Private: The code configuration is visible only to you and administrators in this workspace.

    • Public: The code configuration is visible to all users in this workspace.

    Git Repository Address

    The address of the Git repository.

    Code Branch

    The code branch to use. The default value is master.

    Code Commit

    The commit ID. This has a higher priority than a code branch. If specified, the Code Branch setting is ignored.

    Git Username

    Specify this parameter if you need to access a private repository.

    Token

    Specify this parameter if you need to access a private repository. For information about how to obtain a GitHub token, see Appendix: Obtain a GitHub token.

    Local Directory

    The local path where the code is mounted during job execution. The default is /root/code/.

  4. Click Submit.

Manage code configurations

After you create a code configuration, you can manage it on the Code Configuration page. You can view details for each configuration, such as its name, local storage path, Git address, code branch, code commit, description, visibility, and creation time. In the Operations column, you can click Delete to remove a code configuration, or click Make Public to make a private one public.

Appendix: Obtain a GitHub token

  1. Log on to your GitHub account.

  2. Go to GitHub Developer settings.

  3. On the Personal access tokens page, click Generate new token in the upper-right corner.

  4. In the text box under Note, enter a name for the token. In the Select scopes area, select the permission checkboxes. We recommend that you select all permissions.

  5. Click Generate Token to generate the token.

    The generated token is displayed only once. Immediately copy the token and save it to a secure location, as it cannot be viewed again.