# Google Gemini

Read Gemini and Vertex AI spend from the Cloud Billing export to BigQuery.

AI Spendbook documentation, Billing sources. Web page: https://www.aispendbook.com/docs/google-gemini

Gemini spend comes from the **Cloud Billing export to BigQuery**. Turn on the export for the billing account first, then give AI Spendbook a dedicated service account that can only read the export.

- Roles: `roles/bigquery.dataViewer` on the billing export dataset, and `roles/bigquery.jobUser` on the project that runs the queries.
- Create a JSON key for the service account and upload it in the Google connector. It is stored encrypted and never shown again.
- Rows read: Cloud Billing export rows for Gemini and Vertex AI services, with SKU, project, usage amounts and billed cost after credits.
- Export rows can arrive with a delay, so the newest days may show as estimates until the export catches up. Each sync reads the trailing 5 days again.
- Provisioned Throughput purchases are kept as billed cost with their commitment term.
- Optional: daily Vertex AI token counts from Cloud Monitoring (beta), and GKE and Compute Engine GPU cost as infrastructure cost lines for the [Infrastructure](https://www.aispendbook.com/docs/infrastructure) page.
- Without the BigQuery export there is no billed Gemini cost: the Gemini API has no usage or billing endpoint, so use [telemetry](https://www.aispendbook.com/integrations/gemini-api-direct) instead.

This connector has not been run against a live account. It was written from Google's public documentation and tested against mocked responses.
