Skip to content

Checking your reading list…

Retry

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Google's gemini-api-cli: Plug Gemini Models Into Any Agent, No Antigravity Needed

Google open-sourced gemini-api-cli, a stateless Go CLI that lets existing AI agents like Claude Code and Codex call Gemini models for generation, media, and Deep Research via simple commands, with built-in usage docs, dry-run, and background execution, but it's beta, pay-per-use, and doesn't replace coding agents.

Tool Overview

gemini-api-cli

is a single binary written in Go, licensed under Apache 2.0, currently at v0.5.0. Its README states its purpose: "for the Agent you already use, configure Gemini models and hosted Agents." It does not write code, store conversation history, or replace the host agent. It simply executes commands that return file paths or structured output the host agent can consume.

Key Capabilities

Media generation : image generation defaults to gemini-nano-banana-2.1, multi-speech TTS to gemini-3.8-flash-tts, music to lyria-3.5; also supports video, PDF/YouTube ingestion, and audio/video-to-SRT conversion. Media commands write files locally and print only the file path to stdout.

Deep Research with background execution : adding --background launches a hosted Deep Research agent asynchronously, immediately returning an interaction ID. The host agent can continue other work and poll for results later.

# Generate image, only local path returned to downstream
MASCOT_PATH=$(gemini-api image "A friendly robot mascot, soft studio lighting" --out ./assets/mascot.jpg)

# Launch Deep Research hosted agent in background, get interaction ID
INTERACTION_ID=$(gemini-api agent run "Research battery recycling approaches and cite sources" \
  --agent deep-research-preview-04-2026 --background --jq '.id')

CLI Designed for Agent Consumption

The tool bakes the entire command tree and request schemas into the binary so agents don't hallucinate parameters: --usage outputs complete KDL-formatted usage docs. --schema emits JSON Schema for programmatic parsing. --dry-run validates the HTTP request locally without network or keychain access. --agent-mode switches errors to structured JSON, stdout to token-efficient TOON format, and distinguishes exit codes for network failure, parameter errors, and auth failures.

Installation & Configuration

macOS/Linux: one-line install script. Windows: PowerShell script. With Go toolchain: go install. Authentication via GEMINI_API_KEY environment variable or gemini-api configure to store in system keychain.

curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash
export GEMINI_API_KEY="YOUR_API_KEY"
gemini-api generate "Hello from my agent" --dry-run

Agent Integration

To teach the host agent when to invoke the CLI, paste the provided few-shot prompts into AGENTS.md or CLAUDE.md, or install the companion gemini-skills repository (4.7k stars) which packages ready-to-use skill definitions.

Limitations & Project Status

Uses official Gemini API key — pay-per-use, no free Antigravity quota.

No local conversation persistence; does not modify code.

Marked beta; tracks the underlying Interactions API and may introduce breaking changes. CONTRIBUTING.md explicitly declines external PRs; only issues are accepted.

Historical Context

In May 2024 Google replaced the TypeScript-based Gemini CLI with a Go rewrite called Antigravity CLI, aiming for a unified workbench. Half a year later the workbench shell draws constant criticism, while this focused, pipe-only tool — also written in Go — has become the one developers actually want to adopt.

References

gemini-api-cli

: https://github.com/google-gemini/gemini-api-cli gemini-skills: https://github.com/google-gemini/gemini-skills

About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

CLIAI AgentsGoGoogleGeminideveloper-toolsAPI integrationgemini-api-cli

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion