Skip to main content

Gemini CLI

Gemini CLI is Google's official CLI agent. As a Jetty runtime, it runs your runbook inside a sandbox using Google's Gemini models via the Google AI Studio API.

Use gemini-cli when:

  • You're running a Gemini model (gemini-2.5-pro, gemini-3.1-pro-preview, etc.)
  • You want native Google grounding, search, or multimodal features

For other model families, use claude-code, codex, or hermes.

Provider support

ProviderSupportedHow it routes
Google (AI Studio)GEMINI_API_KEY / GOOGLE_API_KEY
Vertex AI⚠️Pass-through wired in env_for_provider (forwards GOOGLE_GENAI_USE_VERTEXAI, GOOGLE_CLOUD_PROJECT, etc.) but no first-class Vertex provider yet — set the env vars directly on the collection
OpenAIUse codex
AnthropicUse claude-code
AWS BedrockUse hermes

Confirmed-working models

ProviderModel IDNotes
Google AI Studiogemini-2.5-proDefault for the runtime when model is unset
Google AI Studiogemini-3.1-pro-previewLatest preview model
Google AI Studiogemini-2.5-flashFast / cheap option

The CLI strips any vendor prefix from the model ID, so google/gemini-2.5-pro and gemini-2.5-pro are equivalent.

Setup

TOKEN="$(cat ~/.config/jetty/token)"
cat <<'BODY' | curl -s -X PATCH \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"https://flows-api.jetty.io/api/v1/collections/{COLLECTION}/environment" \
--data-binary @-
{
"environment_variables": {
"GEMINI_API_KEY": "..."
}
}
BODY

For Vertex AI:

{
"environment_variables": {
"GOOGLE_GENAI_USE_VERTEXAI": "true",
"GOOGLE_CLOUD_PROJECT": "my-project",
"GOOGLE_CLOUD_LOCATION": "us-central1",
"GOOGLE_APPLICATION_CREDENTIALS": "/secrets/gcp.json"
}
}

Use it in a runbook

---
agent: gemini-cli
model: gemini-2.5-pro
snapshot: python312-uv
---

# My Runbook

Do something interesting. Write the result to `{{results_dir}}/output.md`.

Or via the Chat Completions API:

{
"model": "gemini-2.5-pro",
"jetty": {
"runbook": true,
"agent": "gemini-cli",
"collection": "my-collection",
"task": "my-task"
}
}

How it runs

gemini --yolo --skip-trust -m <model> --prompt='<runbook content>'

--yolo bypasses interactive approval prompts (the Daytona sandbox provides isolation). --skip-trust skips the workspace-trust prompt that would otherwise block headless runs.

Token usage

Gemini CLI emits plain text to stdout — there's no per-turn JSON event stream. Token usage is captured post-run by reading the session JSON that gemini-cli writes (copied to /logs/agent/gemini-cli.trajectory.json by Jetty) after the agent exits.

Limitations

  • No structured event streaming. Tool calls and intermediate messages aren't surfaced into the trajectory log in real time the way they are for claude-code and codex. The final assistant message and aggregate usage are persisted; mid-run visibility is limited to the raw text stream.
  • Vertex AI is pass-through only. A first-class Vertex provider that handles credential resolution and signing isn't wired yet — set the standard GOOGLE_* env vars on the collection if you need Vertex.
  • No MCP server config. The current runner doesn't write a Gemini MCP config; runbooks that need MCP-only tools should use claude-code instead.