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

# Gemini CLI

> Connect Gemini CLI to track AI-assisted development

Connect Gemini CLI to track AI-assisted code generation metrics across your team.

## What's tracked

* **Code generation** — AI-generated code from Gemini CLI sessions
* **Usage metrics** — How often Gemini CLI is used across your team
* **Token usage** — input, output, and cached tokens per model

## Prerequisites

* Gemini CLI installed
* Admin access to your Weave organization

## Setup

Gemini CLI connects via a settings file and environment variables deployed to each developer's machine.

Gemini CLI collector mode is not offered yet. Its current `telemetry.otlpEndpoint` is an exact URL
used for both logs and metrics, while a standard OTLP/HTTP collector expects separate `/v1/logs`
and `/v1/metrics` paths. The Weave-generated settings use a signal-detecting ingest endpoint.
Changing only its host to a stock collector could lose one or both signals. Keep the generated
direct configuration until a Gemini version with per-signal endpoints or a tested demultiplexing
adapter can preserve both signals and user attribution after redaction.

<Steps>
  <Step title="Create an API key in Weave">
    Go to **Data** → **Gemini**, select **In the terminal** under **How does your team use Gemini?**, click **Set up API keys** on the **Gemini CLI** card, and then click **Create API key**. Save the settings JSON and environment variables. You will only see the full key once.
  </Step>

  <Step title="Install the settings file">
    Download or copy `settings.json` and place it at one of these locations:

    | Scope | Path |
    | - | - |
    | User-wide | `~/.gemini/settings.json` |
    | Repository-specific | `./.gemini/settings.json` |
  </Step>

  <Step title="Set environment variables">
    Set the required environment variables by either:

    * Creating a `.env` file in the same folder as the settings file, or
    * Adding them to your shell profile (`~/.zshrc`, `~/.bashrc`) and running `source ~/.zshrc`
  </Step>

  <Step title="Verify connection">
    Use Gemini CLI and check that activity appears in Weave after a few minutes
  </Step>
</Steps>

## Metrics enabled

Once connected, you can track:

* **[AI code LOC](/metrics/ai-code-loc)** — Lines generated by Gemini CLI
* **[AI output percentage](/metrics/ai-output-percentage)** — Portion of output from Gemini CLI
* **[AI efficiency index](/metrics/ai-efficiency-index)** — Impact on productivity

## Cost tracking

Gemini CLI does **not** expose cost data. Its OpenTelemetry stream reports token counts (input, output, cached) and model names but no dollar amount, and Google does not offer a per-developer cost-attribution API for Gemini CLI the way Anthropic and Cursor do. As a result, Weave captures Gemini CLI **token usage** but does not produce a per-engineer dollar cost from it.

**Settings** → **Financial** → **Tool subscription costs** has no Gemini CLI entry, so Gemini CLI spend isn't included in Weave's cost reporting. For exact spend, use your Google Cloud billing console. Gemini CLI usage on a Gemini API key or Vertex AI is billed there, but it isn't attributable to individual engineers.

## Data privacy

Weave syncs usage metadata and prompt content from Gemini CLI:

* Code generation statistics
* Token usage per model
* Tool usage decisions
* User prompt text (used for activity classification; system messages are excluded)

**We never access:**

* Source code content or diffs
* Gemini's responses
* File paths or project structure

## Related integrations

* [Claude Code](/ai-tools/claude-code) — CLI-based AI assistant
* [Cline](/ai-tools/cline) — VS Code extension for AI coding
* [Cursor](/ai-tools/cursor) — AI IDE


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.