Send Gemini CLI telemetry to Agent Authority

Send Gemini CLI OpenTelemetry token usage data to SecureAuth Agent Authority for per-user and per-model LLM usage analytics.

Gemini CLI emits OpenTelemetry usage data — tokens per user and per model. Point it at your gateway's …/gemini ingest endpoint and the gateway stores that data today; an upcoming release surfaces it in the LLM Usage tab in Analytics, with cost derived from those token counts.

Important: Gemini CLI defaults to OTLP over gRPC (otlpProtocol: "grpc", http://localhost:4317), which this gateway cannot accept — it only speaks OTLP over HTTP (protobuf or JSON). Set otlpProtocol to "http" explicitly, or Gemini CLI sends nothing and neither side reports an error.

.gemini/settings.json

Add the telemetry block to .gemini/settings.json, or ship it through your device-management tooling so it applies to every machine:

{
  "telemetry": {
    "enabled": true,
    "otlpEndpoint": "<endpoint>/gemini",
    "otlpProtocol": "http"
  }
}

Gemini CLI's settings have no field for request headers, but its OTLP exporter is built on the standard OpenTelemetry JS SDK, which reads the standard OTEL_EXPORTER_OTLP_HEADERS environment variable to authenticate. Set it alongside those settings:

export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <token>"

Replace <endpoint> with the OTLP endpoint shown when you created the ingest key (for example, https://telemetry.your-gateway-host/api/v1/telemetry) and <token> with the saai_ingest_… key.

Environment variables

Equivalent environment-variable form, useful for fleet provisioning scripts:

export GEMINI_TELEMETRY_ENABLED=true
export GEMINI_TELEMETRY_OTLP_ENDPOINT="<endpoint>/gemini"
export GEMINI_TELEMETRY_OTLP_PROTOCOL=http
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <token>"

Rolling it out org-wide

To enable telemetry for everyone automatically, mint one ingest key and ship this configuration to every developer machine through your provisioning or device-management tooling rather than asking each developer to edit their settings by hand. See the OpenTelemetry overview for the full rollout model.

Next steps

  • Analytics — see per-user and per-model token trends once data starts flowing.
  • Telemetry — the full OpenTelemetry rollout model, including how to push configuration to every machine.

On this page