gemini-api connects coding agents and shell scripts to Gemini models, media generation, file analysis, and managed agents. One Go binary runs on macOS, Linux, and Windows.
Overview
Gemini API CLI (gemini-api) is a command-line tool that lets shell-based agents and scripts call Google Gemini through a single binary. After configuring an API key, agents can generate text, images, speech, music, and video, analyze documents and media, transcribe audio, upload files, and run or poll managed agents.
Commands are grouped for creation, understanding, and management tasks, with flags for streaming, JSON or TOON output, dry-run validation without network access, and embedded JSON Schema via --schema. Media commands write files locally and print paths for downstream automation. Background agent runs return interaction IDs for status and retrieval.
The tool is stateless per invocation and exposes --help, --usage, and installable agent skills so Codex, Claude Code, Cursor, Antigravity, and similar tools discover syntax from the binary itself. Authentication can use environment variables, OS keychain storage, or a config file.
Prebuilt archives and go install targets macOS, Linux, and Windows. Advanced commands cover sandbox environments, webhooks, triggers, and credentials for managed agent workflows.
Key features
- Text and multimodal generation
- Image, TTS, music, and video output
- PDF and media analyze commands
- Transcription to text or SRT
- Managed agent run and poll
- Dry-run request validation
- JSON Schema per command
- Embedded agent skill installer
Use cases
- Agent-driven media asset creation
- Shell scripts calling Gemini APIs
- Document Q&A from the terminal
- Background research agent delegation
- CI jobs with pinned CLI releases