<br />

> [!WARNING]
>
> **Preview**
>
>
> This product or feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section
> of the [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA products and features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

To set up
[Gemini Cloud Assist in Cloud Billing](https://docs.cloud.google.com/billing/docs/how-to/gemini/overview),
perform the following steps:

1. [Enable the Gemini Cloud Assist API in a Google Cloud project](https://docs.cloud.google.com/billing/docs/how-to/gemini/set-up-gemini#enable-api).
   An administrator typically performs this step.

2. [In the Google Cloud project, grant Identity and Access Management (IAM) roles](https://docs.cloud.google.com/billing/docs/how-to/gemini/set-up-gemini#grant-iam)
   to the same users who access Cloud Billing cost and utilization
   data. An administrator typically performs this step.

3. For users who need access to Cloud Billing data and
   Gemini Cloud Assist in Cloud Billing,
   [grant IAM roles in the Cloud Billing account](https://docs.cloud.google.com/billing/docs/how-to/gemini/set-up-gemini#grant-billing-iam)
   that's
   [linked to the project](https://docs.cloud.google.com/billing/docs/how-to/view-linked#view-all-projects-ba-links)
   where the Gemini Cloud Assist API is enabled. An administrator
   typically performs this step.

## Enable the Gemini Cloud Assist API in a Google Cloud project

This section describes the steps required to enable the
Gemini Cloud Assist API in a Google Cloud project.

### Console

1. To enable the Gemini Cloud Assist API, go to the
   **Gemini Cloud Assist API** page.

   [Go to the Gemini Cloud Assist API](https://console.cloud.google.com/marketplace/product/google/geminicloudassist.googleapis.com)
2. In the project selector, select the project you want to use as a
   "Gemini" project.

   You can enable the Gemini Cloud Assist API in more than one
   project. For Cloud Billing users who have
   [billing-account-level permissions](https://docs.cloud.google.com/billing/docs/how-to/reports#required-permissions)
   on the Cloud Billing account, we recommend that you use a
   [FinOps administration project](https://docs.cloud.google.com/billing/docs/how-to/create-billing-account#set-up-billing-project)
   to contain the API.
3. Click **Enable**.

   The page updates and shows a status of **API Enabled**.

### gcloud


1. In the Google Cloud console, activate Cloud Shell.

   [Activate Cloud Shell](https://console.cloud.google.com/?cloudshell=true)
2. In the project selector menu, select the project you want to use as a
   "Gemini" project.

   You can enable the Gemini Cloud Assist API in more than one
   project. For Cloud Billing users who have
   [billing-account-level permissions](https://docs.cloud.google.com/billing/docs/how-to/reports#required-permissions)
   on the Cloud Billing account, we recommend that you use a
   [FinOps administration project](https://docs.cloud.google.com/billing/docs/how-to/create-billing-account#set-up-billing-project)
   to contain the API.
3. Enable the Gemini Cloud Assist API using
   the [`gcloud services enable` command](https://docs.cloud.google.com/sdk/gcloud/reference/services/enable):

       gcloud services enable geminicloudassist.googleapis.com

   If you want to enable the Gemini Cloud Assist API in a different
   Google Cloud project, add the
   `--project` parameter:

       gcloud services enable geminicloudassist.googleapis.com --project PROJECT_ID

   Replace `PROJECT_ID` with your Google Cloud project
   ID.

   The output is similar to the following:

   ```
   Waiting for async operation operations/acf.2e2fcfce-8327-4984-9040-a67777082687 to complete...
   Operation finished successfully.
   ```

After you enable the Gemini Cloud Assist API in the specified
Google Cloud project, Gemini Cloud Assist is now available to
all users who have the
[required IAM roles](https://docs.cloud.google.com/billing/docs/how-to/gemini/set-up-gemini#grant-iam)
on the specified project.

## Grant IAM roles in a Google Cloud project

This section describes the steps to grant the required project permissions to
use Gemini Cloud Assist. In the Google Cloud project where you
enabled the Gemini Cloud Assist API, grant the following
IAM roles to users
([principals](https://docs.cloud.google.com/iam/docs/overview#concepts_related_identity))
on the project:

- Gemini Cloud Assist User
- Service Usage Consumer

### Console

1. To grant the IAM roles that are required to use
   Gemini Cloud Assist, go to the **IAM \& Admin** page.

   [Go to IAM \& Admin](https://console.cloud.google.com/projectselector/iam-admin/iam)
2. In the **Principal** column, find a
   [principal](https://docs.cloud.google.com/iam/docs/overview#concepts_related_identity)
   for which you want to enable access to Gemini Cloud Assist, and
   then click **Edit principal** in
   that row.

3. In the **Edit access** pane, click
   **Add another role**.

4. In **Select a role** , select **Gemini Cloud Assist User**.

5. Click **Add another role** and select **Service Usage Consumer**.

6. Click **Save**.

### gcloud


1. In the Google Cloud console, activate Cloud Shell.

   [Activate Cloud Shell](https://console.cloud.google.com/?cloudshell=true)
2. In the project selector menu, select a project.

3. Grant the **Gemini Cloud Assist User** role:

   ```
   gcloud projects add-iam-policy-binding PROJECT_ID \
     --member=PRINCIPAL --role=roles/geminicloudassist.user
   ```

   Replace the following:
   - `PROJECT_ID`: the ID of your Google Cloud project---for example,`1234567890`.
   - `PRINCIPAL`: the [identifier](https://docs.cloud.google.com/iam/docs/principal-identifiers) for the principal---for example, `user:cloudysanfrancisco@gmail.com`.

   The output is a list of policy bindings that includes the following:

       - members:
         - user:PRINCIPAL
         role: roles/geminicloudassist.user

4. Repeat the previous step for the role `roles/serviceusage.serviceUsageConsumer`.

For more information, see
[Grant a single role](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access#grant-single-role)
and
[`gcloud projects add-iam-policy-binding`](https://docs.cloud.google.com/sdk/gcloud/reference/projects/add-iam-policy-binding).

All of the users (principals) who are granted these roles can access
Gemini Cloud Assist features in the Google Cloud console.
If the users also have
[access to view Cloud Billing data](https://docs.cloud.google.com/billing/docs/how-to/gemini/set-up-gemini#grant-billing-iam)
they can use Gemini Cloud Assist in Cloud Billing **Reports**
and the **FinOps hub** to get AI assistance to create cost reports and to
summarize key insights about cloud costs and optimization recommendations.
For more information, see
[Gemini Cloud Assist in Cloud Billing overview](https://docs.cloud.google.com/billing/docs/how-to/gemini/overview).

### Advanced IAM setup tasks for projects

Instead of using the Google Cloud console or the gcloud CLI to
grant predefined IAM roles on a project, you can do any of the
following:

- Use [IAM REST APIs](https://docs.cloud.google.com/iam/docs/reference/rest)
  or [IAM client libraries](https://docs.cloud.google.com/iam/docs/reference/libraries)
  to grant roles.

  If you use these interfaces, use the fully qualified role names:
  - `roles/geminicloudassist.user`
  - `roles/serviceusage.serviceUsageConsumer`

  For more information about granting roles, see
  [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access).
- Create and grant custom roles.

  Any [custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles)
  for *project* permissions that you create need the following permissions to
  access Gemini Cloud Assist:
  - `geminicloudassist.companions.generateChat`
  - `geminicloudassist.companions.generateCode`
  - `serviceusage.services.use`

## Grant IAM roles in a Cloud Billing account

For users who need access to Cloud Billing cost data, you need to grant
permissions on the Cloud Billing account that are adequate to access
the **Reports** page and the **FinOps hub** . To use
Gemini Cloud Assist in Cloud Billing, grant users access
to the Cloud Billing account that is
[linked to the project](https://docs.cloud.google.com/billing/docs/how-to/view-linked#view-all-projects-ba-links)
where the Gemini Cloud Assist API is enabled.

- Required permissions: for detailed guidance about the permissions
  required to access Billing **Reports** , see the
  [Permissions required to access reports](https://docs.cloud.google.com/billing/docs/how-to/reports#required-permissions)
  section available in the
  "Analyze billing data and cost trends with Reports" article.

- Required permissions: for detailed guidance about the permissions
  required to access the Billing **FinOps hub** , see the
  [Permissions required to access the FinOps hub](https://docs.cloud.google.com/billing/docs/how-to/finops-hub#required-permissions)
  section available in the
  "Optimize costs with FinOps hub" article.

- Grant access: for guidance on how to grant access to a
  Cloud Billing account, see the
  [Update user permissions for a Cloud Billing account](https://docs.cloud.google.com/billing/docs/how-to/grant-access-to-billing#update-cloud-billing-permissions)
  section available in the
  "Manage access to Cloud Billing accounts" article.

## What's next

- Learn more about [AI assistance that's available in Gemini Cloud Assist in Cloud Billing](https://docs.cloud.google.com/billing/docs/how-to/gemini/overview).
- Learn more about the different [types of generative AI assistance available in Gemini Cloud Assist](https://docs.cloud.google.com/gemini/docs/overview).
- Learn [how Gemini Cloud Assist uses your data](https://docs.cloud.google.com/gemini/docs/discover/data-governance).
- Learn more about [Google Cloud compliance](https://cloud.google.com/compliance).