> ## 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.

# Cost allocation labels in Nebius AI Cloud

Add labels to resources to group your costs the way you need, and see how costs are allocated across the groups. You can group resources by label where each label represents, for example, a particular service, application, or team. To see a breakdown of costs, filter your costs by label on the [Billing → Usage](https://console.nebius.com/billing/consumption) page, or [export usage data as a CSV file](https://docs.nebius.com/signup-billing/usage/export.md) and check the `Tags` column.

A *label* represents a key-value pair you set on a resource when you create or update it. Keys and values can be arbitrary — set the ones convenient for you. On the **Usage** page, you can filter resources by both keys and values. For example, to check costs by application and team, you can set such labels as `application = argo-cd` and `application = gatekeeper` or `team = engineering` and `team = support`.

> [!NOTE]
>
> Cost allocation labels are only available for [Compute billable resources](https://docs.nebius.com/compute/resources/pricing.md). Labels assigned to other resources are unavailable in the billing report.

## How to set labels on resources

> [tab] CLI
>
> In the `create` or `update` command, add the `--labels` parameter. Example for a virtual machine:
>
> ```bash theme={null}
> nebius compute instance create --labels <key>=<value> ...
> ```
>
> To make sure that you've assigned the label to the resource successfully, check the resource configuration by using the `get` or `get-by-name` commands. For example:
>
> ```bash theme={null}
> nebius compute instance get <VM_ID>
> ```
>
> The labels should be specified in the `metadata.labels` parameter.

> [tab] Terraform
>
> In the resource configuration, add the `labels` parameter. Example for a virtual machine:
>
> ```hcl theme={null}
> resource "nebius_compute_v1_instance" "my_vm" {
>   labels = {
>     <key> = "<value>"
>   }
>   ...
> }
> ```

> [tab] Go SDK
>
> In the `Create` or `Update` method, add the `Labels` parameter. Example for a virtual machine:
>
> ```go theme={null}
> // Create the labeled VM.
> operation, err := sdk.Services().Compute().V1().
>     Instance().Create(
>         ctx,
>         &compute.CreateInstanceRequest{
>             Metadata: &common.ResourceMetadata{
>                 Labels: map[string]string{"<key>": "<value>"},
>                 ...
>             },
>             ...
>         },
>     )
> if err != nil {
>     return fmt.Errorf("create VM: %w", err)
> }
> // Wait for creation and store the VM ID for the next step.
> if _, err = operation.Wait(ctx); err != nil {
>     return fmt.Errorf("wait for VM creation: %w", err)
> }
> if err := os.Setenv("VMID", operation.ResourceID()); err != nil {
>     return fmt.Errorf("store VM ID: %w", err)
> }
> ```
>
> To make sure that you've assigned the label to the resource successfully, check the resource configuration by using the `Get` or `GetByName` methods. For example:
>
> ```go theme={null}
> instance, err := sdk.Services().Compute().V1().
>     Instance().Get(
>         ctx,
>         &compute.GetInstanceRequest{
>             Id: "<VM_ID>",
>         },
>     )
> if err != nil {
>     return fmt.Errorf("get VM: %w", err)
> }
> fmt.Println(instance)
> ```
>
> The labels should be specified in the `Metadata.Labels` parameter.

> [tab] Python SDK
>
> In the `create` or `update` method, add the `labels` parameter. Example for a virtual machine:
>
> ```python theme={null}
> # Create the labeled VM.
> instance_service = InstanceServiceClient(sdk)
> operation = await instance_service.create(
>     CreateInstanceRequest(
>         metadata=ResourceMetadata(
>             labels={"<key>": "<value>"},
>             ...
>         ),
>         ...
>     ),
> )
> # Wait for creation and store the VM ID for the next step.
> await operation.wait()
> os.environ["VMID"] = operation.resource_id
> ```
>
> To make sure that you've assigned the label to the resource successfully, check the resource configuration by using the `get` or `get_by_name` methods. For example:
>
> ```python theme={null}
> instance_service = InstanceServiceClient(sdk)
> instance = await instance_service.get(
>     GetInstanceRequest(id="<VM_ID>"),
> )
> print(instance)
> ```
>
> The labels should be specified in the `metadata.labels` parameter.

> [tab] JavaScript SDK
>
> In the `create` or `update` method, add the `labels` parameter. Example for a virtual machine:
>
> ```ts theme={null}
> // Create the labeled VM.
> const instanceService = new InstanceService(sdk);
> const operation = await instanceService.create(
>   CreateInstanceRequest.create({
>     metadata: ResourceMetadata.create({
>       labels: {"<key>": "<value>"},
>       ...
>     }),
>     ...
>   }),
> ).result;
> // Wait for creation and store the VM ID for the next step.
> await operation.wait();
> process.env.VMID = operation.resourceId();
> ```
>
> To make sure that you've assigned the label to the resource successfully, check the resource configuration by using the `get` or `getByName` methods. For example:
>
> ```ts theme={null}
> const getInstanceService = new InstanceService(sdk);
> const instance = await getInstanceService.get(
>   GetInstanceRequest.create({
>     id: "<VM_ID>",
>   }),
> );
> console.log(instance);
> ```
>
> The labels should be specified in the `metadata.labels` parameter.

> [tab] REST API
>
> When you create or update a resource, add the `labels` parameter to its configuration. Example for a virtual machine:
>
> ```bash theme={null}
> curl --request POST \
>   --url 'https://api.nebius.cloud/compute/v1/instances' \
>   --header "Authorization: Bearer <access_token>" \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "metadata": {
>       ...
>       "labels": {
>         "<key>": "<value>"
>       }
>     },
>     ...
>   }'
>
> ```
>
> To make sure that you've assigned the label to the resource successfully, check the resource configuration by using the `GET` method. For example:
>
> ```bash theme={null}
> curl --request GET \
>   --url "https://api.nebius.cloud/compute/v1/instances/<VM_ID>" \
>   --header "Authorization: Bearer <access_token>"
> ```
>
> The labels should be specified in the `metadata.labels` parameter.

## How to view the cost allocation breakdown by labels

You can check the cost allocation breakdown in the dashboard or in an exported CSV file.

> [tab] Dashboard
>
> 1. In the [web console](https://console.nebius.com/), go to  **Billing** → **Usage**.
>
> 2. If you select the  **Table** view:
>
>    1. In the **Filter by** field, select `Label`.
>    2. In the **Labels** field, select the keys and values of the needed labels.
>
>       If you only select a key, all its values are automatically included.
>
> 3. If you select the  **Chart** view:
>
>    1. In the **Group by** field, select `Label`.
>    2. In the **Labels** field, select the keys of the needed labels. All values of the selected keys are automatically included.
>
> As a result, the dashboard only shows the resources and costs that are relevant to the selected labels.

> [tab] Export
>
> 1. [Export usage data as a CSV file](https://docs.nebius.com/signup-billing/usage/export.md#how-to-create-an-export).
> 2. Open the CSV file.
> 3. Filter data by the `Tags` column.
>
> As a result, the report only shows the resources and costs that are relevant to the selected labels.
