> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to set up the Nebius AI Cloud CLI

To start working with the Nebius AI Cloud CLI, configure a profile for the Nebius AI Cloud CLI by using one of the supported account types:

* [A user account](#how-to-set-up-the-cli-for-a-user-account) offers personalized access and accountability. It can be used when you, as a human user, need to manage and interact with resources.
* [A service account](#how-to-set-up-the-cli-for-a-service-account) automates the interaction of applications and services with resources.

Both flows below assume that you can open a browser or copy key details from the web console. If you are working in an environment without a browser, such as a Docker container or a CI/CD runner, see [How to authenticate the Nebius AI Cloud CLI in environments without a browser](https://docs.nebius.com/cli/no-browser.md).

> [!WARNING]
>
> **Use one profile per project**
>
> Create a separate Nebius AI Cloud CLI profile for each project to ensure correct [region](https://docs.nebius.com/overview/regions.md)-specific configuration.

## How to set up the CLI for a user account

Choose the non-interactive flow to specify the configuration parameters in advance, or the interactive flow to enter them step by step.

> [tab] Non-interactive flow
>
> 1. Create a name for the new profile in the Nebius AI Cloud CLI and save it to an environment variable:
>
>    ```bash theme={null}
>    export PROFILE_NAME=<new_profile_name>
>    ```
>
> 2. [Get the project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli) and save it to an environment variable:
>
>    ```bash theme={null}
>    export PROJECT_ID=<project_ID>
>    ```
>
> 3. Create the CLI profile:
>
>    ```bash theme={null}
>    nebius profile create \
>      --profile $PROFILE_NAME \
>      --endpoint api.nebius.cloud \
>      --federation-endpoint auth.nebius.com \
>      --parent-id $PROJECT_ID
>    ```
>
>    If you have access to multiple tenants, you can specify the tenant that you want to use with this profile in the `--tenant-id` parameter.
>
>    If you are added to someone else's [tenant](https://docs.nebius.com/iam/overview.md#tenants) and know the ID of its [federation](https://docs.nebius.com/iam/overview.md#federations), you can specify it either in the `--federation-id` parameter, or when logging in to the Nebius AI Cloud web console after running the command.
>
> 4. On the browser tab that opens, log in to the web console if prompted. After logging in (or if you have already been logged in), you will see the following message:
>
>    ```plaintext theme={null}
>    Login is successful, you may close the browser tab and go to the console
>    ```
>
> 5. Close the browser tab and go back to your terminal window.
>
>    Example output:
>
>    ```plaintext theme={null}
>    profile "<profile_name>" configured and activated
>    ```
>
> 6. Check that your new profile has been created and set as the default one:
>
>    ```bash theme={null}
>    nebius profile list
>    ```
>
>    Example output:
>
>    ```plaintext theme={null}
>    ...
>    <profile_name> [default]
>    ```

> [tab] Interactive flow
>
> 1. Create a CLI profile:
>
>    ```bash theme={null}
>    nebius profile create
>    ```
>
> 2. Set up the new profile:
>
>    1. Specify the profile name and press `Enter`.
>
>    2. Keep the default value for **Set api endpoint** (`api.nebius.cloud`) and press `Enter`.
>
>    3. Under **Select authorization type**, keep `federation` and press `Enter`.
>
>    4. Keep the default value for **Set federation endpoint** (`auth.nebius.com`) and press `Enter`.
>
>    5. On the browser tab that opens, log in to the Nebius AI Cloud web console if prompted. After logging in (or if you have already been logged in), you will see the following message:
>
>       ```plaintext theme={null}
>       Login is successful, you may close the browser tab and go to the console
>       ```
>
>    6. Close the browser tab and go back to your terminal window.
>
>    7. If you have access to multiple tenants, choose the tenant that you want to use with this profile. If you only have access to one tenant, it is selected by default.
>
>    8. Choose the project that you want to use as the default for this profile.
>
>       Example output:
>
>       ```plaintext theme={null}
>       profile "<profile_name>" configured and activated
>       ```
>
> 3. Check that your new profile has been created and set as the default one:
>
>    ```bash theme={null}
>    nebius profile list
>    ```
>
>    Example output:
>
>    ```plaintext theme={null}
>    ...
>    <profile_name> [default]
>    ```

## How to set up the CLI for a service account

Before you begin, [create a service account](https://docs.nebius.com/iam/service-accounts/manage.md). You can do it with a user account or another service account within a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant; for example, the default `admins` group. You can check the group's role in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

Choose the non-interactive flow to specify the configuration parameters in advance, or the interactive flow to enter them step by step.

> [tab] Non-interactive flow
>
> 1. On the [Service accounts](https://console.nebius.com/iam/service-accounts) page in the web console, copy the service account ID from the **ID** column for the service account that you want to use. Then select the service account, click **Authorized keys** and copy the public key ID from the **ID** column.
>
> 2. Open your terminal.
>
> 3. Save the service account details to environment variables:
>
>    ```bash theme={null}
>    export SA_ID=<service_account_ID>
>    export PUBLIC_KEY_ID=<...>
>    export PRIVATE_KEY_PATH=<...>
>    ```
>
> 4. Create a name for your profile and save it to an environment variable:
>
>    ```bash theme={null}
>    export SA_PROFILE_NAME=<...>
>    ```
>
>    For example, `gpu-monitoring-sa`.
>
> 5. [Get the project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli) and save it to an environment variable:
>
>    ```bash theme={null}
>    export PROJECT_ID=<project_ID>
>    ```
>
> 6. Create the CLI profile:
>
>    ```bash theme={null}
>    nebius profile create \
>      --endpoint api.nebius.cloud \
>      --service-account-id $SA_ID \
>      --public-key-id $PUBLIC_KEY_ID \
>      --private-key-file $PRIVATE_KEY_PATH \
>      --profile $SA_PROFILE_NAME \
>      --parent-id $PROJECT_ID
>    ```
>
>    Example output:
>
>    ```plaintext theme={null}
>    profile "<profile_name>" configured and activated
>    ```
>
> 7. Check that your new profile has been created and set as the default one:
>
>    ```bash theme={null}
>    nebius profile list
>    ```
>
>    Example output:
>
>    ```plaintext theme={null}
>    ...
>    <profile_name> [default]
>    ```

> [tab] Interactive flow
>
> 1. On the [Service accounts](https://console.nebius.com/iam/service-accounts) page in the web console, copy the service account ID from the **ID** column for the service account that you want to use. Then select the service account, click **Authorized keys** and copy the public key ID from the **ID** column.
>
> 2. Open your terminal.
>
> 3. Create a CLI profile:
>
>    ```bash theme={null}
>    nebius profile create
>    ```
>
> 4. Set up the new profile:
>
>    1. Specify the profile name and press `Enter`.
>    2. Keep the default value for **Set api endpoint** (`api.nebius.cloud`) and press `Enter`.
>    3. Under **Select authorization type**, choose `service account` and press `Enter`.
>    4. Under **Set service account ID**, specify the **Service account ID** from the web console.
>    5. Under **Set public key ID**, specify the **Public key ID** from the **Authorized keys** tab.
>    6. Under **Set path to PEM encoded private key (file can be removed afterwards)**, specify the path to the [private key in PEM format](https://docs.nebius.com/iam/service-accounts/authorized-keys.md#creating-a-key-pair) that corresponds to the authorized public key.
>    7. If you have access to multiple tenants, choose the tenant that you want to use with this profile. If you only have access to one tenant, it is selected by default.
>    8. Choose or specify the project that you want to use as the default for this profile.
>
>       Example output:
>
>       ```plaintext theme={null}
>       profile "<profile_name>" configured and activated
>       ```
>
> 5. Check that your new profile has been created and set as the default one:
>
>    ```bash theme={null}
>    nebius profile list
>    ```
>
>    Example output:
>
>    ```plaintext theme={null}
>    ...
>    <profile_name> [default]
>    ```
