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

# Gemini CLI

> Add a telemetry block to your Gemini CLI settings to ship session telemetry — prompts, tool calls, and model API requests with token counts — to Sazabi via Gemini CLI's built-in OTLP exporter.

[All Gemini integration capabilities](https://docs.sazabi.com/catalogs/integrations/gemini-cli)

## About

Ship Gemini CLI session telemetry to Sazabi using Gemini CLI's built-in OpenTelemetry exporter. Once configured, every session emits structured events covering startup configuration, user prompts, tool calls, and model API requests with token counts and latency, plus spans for model calls and tool calls — no code changes to your projects required.

Events include names like `gemini_cli.config`, `gemini_cli.user_prompt`, `gemini_cli.tool_call`, and `gemini_cli.api_request`, along with `prompt`, `model`, `session.id`, `installation.id`, `user.email`, and token counts per API call.

> [!WARNING]
>
> With `logPrompts` set to `true`, Gemini CLI exports raw prompt text, including any sensitive content typed during sessions. Set it to `false` unless you understand the privacy implications for your team.

## Prerequisites

* Gemini CLI installed, with a login that can call models: Gemini Code Assist Standard or Enterprise, Code Assist for GitHub, a paid Gemini API key, or Vertex AI. Free individual access and Google AI Pro and Ultra moved to [Antigravity CLI](https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli/) on June 18, 2026.
* Your Sazabi intake URL, shown above — open the log source and copy the **Intake URL** from its setup screen (the public key is embedded in the URL)

## Set up in the dashboard

**Step 1**

### Add a telemetry block to Gemini CLI settings

Open or create `~/.gemini/settings.json` and add the following `telemetry` block. If the file already has a `telemetry` object, set these keys inside it instead of adding a second one:

```json title="~/.gemini/settings.json" theme={"system"}
{
  "telemetry": {
    "enabled": true,
    "target": "local",
    "otlpProtocol": "http",
    "otlpEndpoint": "<your intake URL>",
    "logPrompts": true
  }
}
```

Replace `<your intake URL>` with the intake URL shown above.

Keep `otlpProtocol` at `http` — Gemini CLI defaults to gRPC, and your intake URL takes OTLP over HTTP. Gemini CLI adds the `/v1/logs` and `/v1/traces` paths itself, so paste the URL as shown. Leave `traces` unset: it adds full prompts and tool outputs to spans.

**Step 2**

### Restart Gemini CLI

Gemini CLI loads settings at startup. Quit and relaunch Gemini CLI for the new telemetry settings to take effect.

## Set up with the CLI

You can also register the Gemini CLI log source with the [Sazabi CLI](https://docs.sazabi.com/reference/cli.md) (installed and authenticated — see [CLI reference](https://docs.sazabi.com/reference/cli/log-sources.md)).

Registering the source mints the same intake URL the dashboard shows above (the public key is embedded in its hostname):

```bash theme={"system"}
sazabi log-sources create gemini_cli --mode manual
```

The command prints the intake URL for the new source — copy the whole URL and point your sender at it using the configuration shown above. Run `sazabi log-sources get <log-source-id>` at any time to reprint the endpoint, or `sazabi log-sources list` to see every log source in the project.

## Verify

Start a Gemini CLI session and run a prompt. Open the [Intake page](https://docs.sazabi.com/guides/instrument/intake.md) in the Sazabi dashboard and confirm events from the **Gemini CLI** source appear within a minute or two.

Start a thread and search for `gemini_cli.api_request` to find model API requests with token counts, or search for `session.id` to view all events from a single session.

## Troubleshooting

**No events after restarting** — Confirm `~/.gemini/settings.json` is valid JSON, `telemetry.enabled` is `true`, and `otlpProtocol` is `http`. Environment variables such as `GEMINI_TELEMETRY_OTLP_ENDPOINT`, `GEMINI_TELEMETRY_TARGET`, or `OTEL_EXPORTER_OTLP_ENDPOINT` override the settings file, and a `.gemini/settings.json` inside a project overrides it for that project. An `outfile` key in the `telemetry` block writes telemetry to a file instead of sending it; remove it.

**Only a `gemini_cli.config` event arrives** — Gemini CLI started but could not call a model. Check that your login still has access; see [Prerequisites](#prerequisites).

**Headless runs send nothing** — `gemini -p` in a folder Gemini CLI does not trust exits before the first prompt. Trust the folder, or pass `--skip-trust`.

**Events appear but prompts are missing** — Confirm `logPrompts` is `true`, then restart Gemini CLI. Prompt text is exported starting with the next session.

**Unexpected metric records appear** — Gemini CLI always sends metrics alongside logs and traces, and no setting turns them off. Sazabi stores each metric data point as a log record with `telemetry.type` set to `metric`, and those records count toward your intake volume.

## Further reading

> [card] [Gemini CLI telemetry](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/telemetry.md)
>
> Gemini CLI's reference for every telemetry setting and event.

> [card] [Intake](https://docs.sazabi.com/guides/instrument/intake.md)
>
> See per-source ingestion volume and health.

> [card] [Log sources](https://docs.sazabi.com/catalogs/log-sources.md)
>
> Browse the full log source catalog.


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