Gemini CLI

Gemini CLI is Google’s AI coding agent for the terminal, powered by Gemini models. It can analyze codebases, generate and edit files, run commands, and handle complex multi-step coding workflows with built-in thinking capabilities. Respan gives you full observability over every conversation including thinking, tool calls, and responses — and gateway routing through the Respan endpoint.

Create an account at platform.respan.ai and grab an API key. For gateway, also add credits or a provider key.

Run npx @respan/cli setup to set up with your coding agent.

Setup

Prerequisite: Gemini CLI must be installed before integrating with Respan.

$npm install -g @google/gemini-cli
1

Install the Respan CLI

$npm install -g @respan/cli
2

Set your API key

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
3

Integrate

$respan integrate gemini-cli

This automatically configures Gemini CLI’s hooks to send traces to Respan.

4

Use Gemini CLI normally

$gemini "Write unit tests for the payment service"

All conversations are now traced automatically.

5

View your trace

Open the Traces page to see your Gemini CLI conversations with thinking, tool calls, and responses.

Gemini CLI uses native OpenTelemetry support. The respan integrate command configures the OTLP endpoint and auth headers automatically.

Configuration

Customize the integration with flags.

$respan integrate gemini-cli --customer-id "frank" --project-id "proj-123"
FlagEnv varDefaultDescription
--globalWrite user-level config (~/.gemini/settings.json).
--localLocalWrite per-project config (.gemini/settings.json).
--customer-idRESPAN_CUSTOMER_IDCustomer/user identifier for traces.
--project-idRESPAN_PROJECT_IDRespan project ID.
--attrsCustom attributes JSON.
--base-urlRESPAN_BASE_URLhttps://api.respan.ai/apiRespan API base URL.
--dry-runPreview changes without writing files.

Captured data

DataDescription
User promptThe user’s input text.
Assistant responseGemini CLI’s final response.
Thinking blocksThinking / reasoning content.
Tool callsTool name, input, and output.
Token usageInput, output, and cache tokens.
TimingStart time, end time, latency.
ModelModel name (e.g. gemini-2.5-pro, gemini-2.5-flash).

Span types

Spanlog_typeDescription
RootagentThe complete conversation turn.
ThinkinggenerationThinking / reasoning blocks.
TooltoolTool invocations.

Uninstall

$respan integrate gemini-cli --remove