> For the complete documentation index, see [llms.txt](https://help.swarmia.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.swarmia.com/settings/integrations/ai-coding-tool-integrations/custom-ai-tool-integrations/connect-gemini-to-swarmia.md).

# Connect Gemini to Swarmia

Swarmia detects Gemini Code Assist's pull requests, reviews, and commits automatically. Send usage data to also see adoption and time-based PR attribution.

Swarmia detects Gemini Code Assist's pull requests, reviews, and commits automatically, including activity from recognized Gemini CLI identities. You can also send usage data for both tools to Swarmia to see adoption and add time-based pull request attribution.

{% hint style="info" %}
This page covers Gemini Code Assist Standard and Enterprise, and Gemini CLI with a paid Gemini API or Gemini Enterprise Agent Platform key. Google moved free, Google AI Pro, and Google AI Ultra users to [Antigravity](https://antigravity.google/) in June 2026. To track Antigravity, [add it as a custom AI tool](https://help.swarmia.com/settings/integrations/ai-coding-tool-integrations/custom-ai-tool-integrations.md#add-a-custom-ai-tool).
{% endhint %}

## Track Gemini's Git activity

Swarmia detects Gemini as soon as it's active in one of your repositories. [Settings → AI tools](https://app.swarmia.com/settings/ai-assistants) shows whether Swarmia has detected it.

Swarmia detects the following activity with high confidence:

* Pull requests opened by Gemini, or whose first commit Gemini authored, as [cloud agent](https://help.swarmia.com/features/ai-impact/ai-tool-detection-and-filters.md#cloud-agent) work
* Pull requests reviewed by Gemini as [review agent](https://help.swarmia.com/features/ai-impact/ai-tool-detection-and-filters.md#review-agent) work
* Commits Gemini authored or co-authored as [AI-assisted](https://help.swarmia.com/features/ai-impact/ai-tool-detection-and-filters.md#ai-assisted) work

## Send Gemini usage data (optional)

To show Gemini usage data in [Users and licenses](https://help.swarmia.com/features/ai-impact/ai-adoption/users-and-licenses.md), collect daily per-user data and send it to Swarmia's [additional AI integrations API](https://help.swarmia.com/settings/integrations/swarmia-apis/additional-ai-integrations.md) with `Gemini` as the `aiService`. The data goes to the built-in Gemini integration, so you don't need to create a custom AI tool.

### Find your Gemini data

Google provides different data sources for Gemini Code Assist and Gemini CLI:

* **Gemini Code Assist seats:** View assigned users through [license management](https://docs.cloud.google.com/gemini/docs/codeassist/manage-licenses) or the [license pool API](https://docs.cloud.google.com/marketplace/docs/reference/consumerprocurement/rest/v1/billingAccounts.orders.licensePool/enumerateLicensedUsers). Use your contract price or [Google's license pricing](https://cloud.google.com/products/gemini/pricing) for subscription costs.
* **Gemini Code Assist IDE usage:** [Configure Cloud Logging](https://docs.cloud.google.com/gemini/docs/configure-logging) and use the [metadata logs](https://docs.cloud.google.com/gemini/docs/log-gemini) for per-user activity. These logs cover IDE usage, not Gemini Code Assist reviews on GitHub or Gemini CLI usage.
* **Gemini CLI usage:** Use [Gemini CLI OpenTelemetry](https://geminicli.com/docs/cli/telemetry/) for activity, model, and token data. Swarmia doesn't accept this telemetry directly the way it does for [Claude Code](https://help.swarmia.com/settings/integrations/ai-coding-tool-integrations/claude-code-integration.md) and [Codex](https://help.swarmia.com/settings/integrations/ai-coding-tool-integrations/codex-integration.md), so collect it with your own collector and send daily per-user totals.
* **Gemini CLI API usage and cost:** When using pay-as-you-go API access, see [Gemini API billing and usage](https://ai.google.dev/gemini-api/docs/billing) and [Gemini CLI quotas and pricing](https://geminicli.com/docs/resources/quota-and-pricing/) for Gemini API and Vertex AI options. Billing data may not identify individual users or distinguish CLI usage from other API usage.

The available data depends on your plan and logging setup. For example, Code Assist IDE logs don't provide a complete per-user token breakdown.

### Data to send to Swarmia

Send one record per user and day, combining Code Assist and CLI data for that person. Include the user's email and date, and report:

* **Access (`is_enabled`):** Whether the person had a Code Assist seat or other Gemini access, including pay-as-you-go API access.
* **Activity (`is_active`):** Whether the person sent a message, accepted a suggestion, or ran a CLI prompt that day.
* **Subscription spend (`subscription_spend_minor`, optional):** The per-day portion of the person's subscription seat price, including days they didn't use it.
* **Extra usage spend (`extra_usage_spend_minor`, optional):** Additional usage charges, including pay-as-you-go API costs. Don't count usage included in the subscription again.

You can also include other available details, such as subscription tier and model or token breakdowns.

Sending another record for the same user, tool, and date replaces the previous record, so include data from both tools when updating it. See [send usage data to the API](https://help.swarmia.com/settings/integrations/ai-coding-tool-integrations/custom-ai-tool-integrations.md#send-usage-data-to-api) for authentication and import details.

Swarmia uses daily usage records for [time-based, low-confidence AI-assisted attribution](https://help.swarmia.com/features/ai-impact/ai-tool-detection-and-filters.md#ai-assisted). Use the [high-confidence-only filter](https://help.swarmia.com/features/ai-impact/ai-tool-detection-and-filters.md#ai-assisted-high-confidence-only) to exclude this attribution.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.swarmia.com/settings/integrations/ai-coding-tool-integrations/custom-ai-tool-integrations/connect-gemini-to-swarmia.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
