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

# Anyscale

> Learn how to integrate Vantage with Anyscale.

Vantage integrates with Anyscale using a [platform API key](https://docs.anyscale.com/administration/organization/user-auth#api-keys). Vantage ingests cost and usage data using the [Aggregated Instance Usage API](https://docs.anyscale.com/reference/aggregated-instance-usage). This data is normalized and displayed in reports, where it can be filtered and grouped by organization, project, cloud provider, and more. Usage data is available for Anyscale consumption, measured in credits.

<Note>
  All Anyscale platform API keys have revocable read-write access, with no option for finer permission scoping. We recommend submitting a feature request to Anyscale, and Vantage will adopt fine-grained permissions if they become available.
</Note>

## How Costs Are Calculated

Vantage ingests your Anyscale consumption, measured in credits, from the Aggregated Instance Usage data. The cost displayed in Cost Reports is calculated as the number of credits consumed multiplied by the rate per credit you configured when connecting the integration.

### Prerequisites

* You must have a Vantage **Organization Owner** or **Integration Owner** role to add or remove this integration. See the [Role-Based Access Control](/rbac) documentation for details.
* You need to be an [Organization Owner](https://docs.anyscale.com/administration/organization/permissions#org-owner) to generate a platform API key in the Anyscale console.
* Create a free Vantage account, then follow the steps below to integrate Anyscale costs.

### Create the Connection

<Note>
  Service accounts are available in Anyscale but currently only have collaborator permissions. At this time, personal API keys are recommended for integrations.
</Note>

#### Step 1 - Obtain an Anyscale API Key

<Tabs>
  <Tab title="CLI (Recommended)">
    The CLI method allows you to create API keys with custom expiry periods or permanent keys that don't expire, making it ideal for long-term integrations. For more information, see the [Anyscale CLI configuration documentation](https://docs.anyscale.com/reference/quickstart-cli#authenticate-the-anyscale-cli).

    <Steps>
      <Step>
        Install the Anyscale CLI by running:

        ```bash theme={null}
        pip install anyscale
        ```
      </Step>

      <Step>
        Authenticate using the CLI. You can use either:

        * `--no-expire` to create a permanent API key that never expires
        * `--expire-in-days=<days>` to set a custom expiry period

        For example, to create a permanent key:

        ```bash theme={null}
        anyscale login --no-expire
        ```

        Or to create a key that expires in 90 days (you'll need to update the key in Vantage when it expires):

        ```bash theme={null}
        anyscale login --expire-in-days=90
        ```

        A new browser window opens to confirm authentication. Once approved, the CLI stores the access token in `~/.anyscale/credentials.json`. For more details, see the [Anyscale CLI authentication documentation](https://docs.anyscale.com/reference/quickstart-cli#authenticate-the-anyscale-cli).
      </Step>

      <Step>
        Retrieve your API key. You can access the file using one of these methods:

        * **Using the command line**: Open a terminal and run:
          ```bash theme={null}
          cat ~/.anyscale/credentials.json
          ```
          Or on macOS/Linux, you can open it in a text editor:
          ```bash theme={null}
          open ~/.anyscale/credentials.json
          ```

        * **Using Finder (macOS)**: Press `Cmd+Shift+G` in Finder, then type `~/.anyscale` and press Enter. Open the `credentials.json` file.

        * **Using File Explorer (Windows)**: Navigate to `%USERPROFILE%\.anyscale\credentials.json` in File Explorer.

        The API key will be in the `cli_token` field in the JSON file.
      </Step>
    </Steps>
  </Tab>

  <Tab title="Console UI">
    The console UI method creates API keys with a maximum expiry of 30 days, requiring you to update the token every 30 days to maintain the integration. For more information, see the [Anyscale API keys documentation](https://docs.anyscale.com/administration/organization/user-auth#api-keys).

    <Steps>
      <Step>
        Log in to the [Anyscale console](https://console.anyscale.com/).
      </Step>

      <Step>
        On the top right, click your user icon, then select **API keys**.
      </Step>

      <Step>
        Click **+ Create**, then copy the newly created key.
      </Step>
    </Steps>
  </Tab>
</Tabs>

#### Step 2 - Add the Key to Vantage

<Steps>
  <Step>
    From the top navigation in Vantage, click **Settings**.
  </Step>

  <Step>
    On the left navigation, select **Integrations** > **Anyscale**.
  </Step>

  <Step>
    The Anyscale integrations page is displayed. Ensure you are on the **Connect** tab.
  </Step>

  <Step>
    At the bottom of the page, click **Add API Key** and paste your API key.
  </Step>

  <Step>
    Enter the **rate per Anyscale credit**. Vantage multiplies your consumed Anyscale credits by this rate to calculate the cost shown in reports. Set this to match your negotiated per-credit price with Anyscale so the dollar amounts are accurate.
  </Step>

  <Step>
    Click **Connect Account**.
  </Step>
</Steps>

After adding your integration, you will see the status of your integration change to **Importing** within the Vantage console. This status indicates that Vantage is actively importing your Anyscale cost data. The integration will fetch historical data up to your account's configured retention period. See the [Integration Status](/vantage_account#integration-status) documentation for details on integration statuses.

<Info>
  As soon as costs are processed, they will be available on your **All Resources** Cost Report. If you decide to remove your Anyscale integration from Vantage, all costs associated with your Anyscale API key will be removed from the Vantage console.
</Info>

#### Next Steps - Manage Workspace Access

Once the import is complete and the integration status changes to **Stable**, you can select which workspaces this integration is associated with. See the [Workspaces](/workspaces#manage-workspace-provider-integrations) documentation for information.

## Data Refresh

See the [provider data refresh documentation](/provider_data_refresh) for information on when data for each provider refreshes in Vantage.

## Anyscale Reporting Dimensions

On Anyscale [Cost Reports](/cost_reports), you can filter across several dimensions:

* Billing Account (Organization)
* Account (Project)—displays human-readable project names
* Service (e.g., Instances)
* Category (e.g., customer\_hosted)
* Subcategory (e.g., k8s)
* Resource ID (Resource ID)
* Charge Type (e.g., Usage)
* Tags: Includes [Virtual Tags](/tagging) created in Vantage for this provider. The following provider tags are automatically created by Vantage from Anyscale data and are available for filtering and grouping:
  * `anyscale:cloud_id`: The cloud ID associated with the cost, allowing you to filter and group costs by cloud.
  * `anyscale:workspace_id`: The workspace ID associated with the cost, allowing you to filter and group costs by workspace.
  * `anyscale:cloud_provider`: The cloud provider (e.g., AWS, GCP, Azure), allowing you to filter and group costs by cloud provider.
  * `anyscale:instance_type`: The instance type used, allowing you to filter and group costs by instance type.
  * `anyscale:user_email`: The user email associated with the cost when present in the source data, allowing you to filter and group costs by user email.
  * `anyscale:user_id`: The user ID associated with the cost when present in the source data, allowing you to filter and group costs by user ID.
