Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Gemini API CLI

$ gemini-api Official Med Risk
Google Gemini · AI & Media · Apache-2.0 · macos / linux / windows

gemini-api exposes every Gemini REST resource as a shell command with -o json/toon, in-process --jq filtering, --dry-run, --no-interactive, and --agent-mode. Media (image, tts, music, video) and transcribe write artifacts to disk and print only file paths.

FCRS-1.0 Score
90 /100
Excellent
Medium Confidence
Zero-Friction Install
https://github.com/google-gemini/gemini-api-cli/releases
CLI vs MCP Decision CLI Preferred vs MCP

Stateless shell client (--agent-mode, --jq, --dry-run) that writes generated media directly to disk and prints paths, keeping large binaries out of LLM context.

Agent-Readiness Checklist

✓ JSON Output
✓ Field Filtering
✓ Non-Interactive
✓ Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
✓ Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 25 / 25

Purpose-built for agents: -o json|toon, built-in --jq, --dry-run, --no-interactive, --agent-mode, and file-path-only media output.

  • Supports --agent-mode, --jq, --dry-run, --no-interactive, and -o json
Trust & Safety 21 / 25

OS keychain storage by default, whoami credential masking, and --dry-run validation; API calls incur Gemini billing and files upload persists media for 48h TTL.

  • OS keychain auth + --dry-run offline preview; API calls incur billing
Setup & Portability 12 / 15

Static release binaries via install.sh / GitHub Releases, though lacks Homebrew core or npm/PyPI distribution.

  • Installed via official install.sh or GitHub release binaries
Utility & Efficiency 15 / 15

Unifies text, image, TTS, music, video, audio/video transcription, Deep Research, and sandboxes in one token-lean CLI.

  • Writes media/transcripts to disk and returns paths or compact --jq JSON
Maintenance & Lineage 9 / 10

Official google-gemini/gemini-api-cli repository under Apache-2.0.

  • Official google-gemini/gemini-api-cli repository
Docs & Verifiability 8 / 10

Rich skill/CLI docs, --help, and --schema, though --schema (~92 KB) must be piped to jq.

  • Official docs and gemini-api-cli agent skill

Security, Auth & Guardrails

Auth Modes
Env API Key OS Keychain Config File
Credential Storage

Resolves --api-key/--access-token, GEMINI_API_KEY/GEMINI_ACCESS_TOKEN, OS keychain (configure), then ~/.config/gemini-api/config.yaml (--no-keyring).

Side Effects
Read-Only Local Write Remote Write Billing Impact
Cost & Quotas

Apache-2.0 open-source CLI; live Gemini API generation, analysis, and Deep Research bill to your Google AI/Vertex project.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Gemini API CLI Agent Rules
- Check `gemini-api whoami` first because an exported `GEMINI_API_KEY` overrides keychain/config credentials.
- Pass `--no-interactive`, `--dry-run`, and `--jq` (or `--page-size 10` on `list`) instead of dumping `--usage` or `--schema` raw.

Agent-Ready Command Recipes

Safe Read-Only Queries

Check active Gemini credential source
gemini-api whoami -o json

Prints masked active credentials and whether GEMINI_API_KEY or keychain won.

Preview a redacted API request offline
gemini-api generate 'Hello' --dry-run -o json

Validates parameters and prints the redacted HTTP request locally without billing.

Controlled Writes & Previews

Generate an image and save to an explicit path
gemini-api image 'Isometric cloud architecture icon' --aspect-ratio 16:9 --out ./icon.png -o json

Calls Gemini image generation, writes ./icon.png to disk, and prints JSON metadata.

Strengths for Agents

  • + Built-in --jq, --dry-run, --agent-mode, and --no-interactive designed specifically for agent shells.
  • + Media and transcription commands write binaries locally and emit only compact paths/metadata.
  • + Covers text, images, TTS, music, video, transcription, and Deep Research in one CLI.

Caveats & Pitfalls

  • ! Exported GEMINI_API_KEY silently overrides OS keychain credentials—verify with gemini-api whoami.
  • ! Do not dump --schema or --usage raw without jq due to ~45–92 KB payload sizes.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI