@don_tech1: If you're using Gemini 4 Neon, I highly recommend installing a small tool that Google just open-sourced for your Agent: gemini-api-cli. This new google-gemini/ggemini-api-cli (command: gemini-api)...
Summary
Google has open-sourced gemini-api-cli, a zero-dependency, single-file Go CLI tool that lets coding Agents like Codex and Claude Code call Gemini's multimodal capabilities (image generation, video, TTS, subtitles, file analysis, etc.) directly. Tests show it saves around 85.8% of tokens and nearly doubles the speed.
View Cached Full Text
Cached at: 11/24/26, 03:13 AM
If you’re using Gemini 4 Neon, I highly recommend installing a small tool Google just open-sourced for your Agent: gemini-api-cli.
The newly released google-gemini/gemini-api-cli (command name gemini-api) is a zero-dependency, single-file Go binary built specifically as a “multimodal add-on” for your AI Agent. Install it, configure an API key, and add the official gemini-api-cli Skill — and your coding agent can do all of this right from the terminal:
- Generate images from a single prompt, edit images (Nano Banana), generate videos (Veo)
- Synthesize multi-speaker voiceover (TTS), generate instrumental music tracks (Lyria)
- Analyze local PDFs, OCR images, or even just drop in a YouTube link for it to watch
- Convert audio/video straight to timestamped SRT subtitles, and kick off background Deep Research
The most interesting part is the real-world numbers from Google DeepMind engineers themselves: previously, when an Agent needed multimodal capabilities, it had to guess model names on its own, write throwaway Python scripts, or hand-craft curl commands — and it would often stuff piles of Base64 into the context and blow past the window limit.
Switch to this CLI + Skill, and files are written straight to disk while the terminal just outputs a file path: measured average savings of 85.8% in tokens, and runs nearly 2× faster. No need to fuss with always-on MCP servers or set up a runtime environment — it natively ships with --help, --schema, and --dry-run, so an Agent can pick it up and start using it immediately.
If you’re doing full-stack or indie development, you can write code and let the Agent handle the page illustrations, sound effects, and demo videos all in one go.
Project: http://github.com/google-gemini/gemini-api-cli
Official Skill: http://github.com/google-gemini/gemini-skills
google-gemini/gemini-api-cli
Source: https://github.com/google-gemini/gemini-api-cli
Gemini API CLI (gemini-api)
Release · License: Apache 2.0
Gemini models and managed agents for the agent you already use.
Give Codex, Claude Code, Antigravity, OpenClaw, Hermes, or any other agent with shell access the ability to use the Gemini API. Configure an API key, put gemini-api on PATH, and let your agent choose a model, generate an asset, analyze a file, or launch a managed agent to handle a task. Your agent plans the work. Gemini provides models and managed agents. This stateless CLI connects them through standard shell commands:
gemini-api image "A friendly robot mascot for a developer tool" --out ./assets/
A prompt goes in. An image lands in your project. Your agent gets the file path and keeps building. The same binary can return an analysis, a voiceover, a transcript, or the interaction ID of a background managed-agent run.
Installation · Quick start · Command overview · Agent discovery · Workflows · Self-hosted environments · Contributing · Gemini API docs
Bugs and feedback: Open a GitHub Issue. We do not accept pull requests — see CONTRIBUTING.md.
Why this CLI
A coding agent building an app may need a hero image, a voiceover, a second opinion on a design, or an answer inside a PDF. An assistant may need to turn a recording into captions or delegate multi-step research. Give that agent gemini-api and an API key, and it can call those capabilities directly when the task requires them.
- One binary for models, media, and managed agents: Access text and reasoning models, multimodal file analysis, image/audio/music/video generation, and managed agents from the command line.
- Delegate long-running work: Start a Gemini managed agent in the background, keep the returned interaction ID, and retrieve the result when needed.
- Self-describing interface: Commands, flags, request schemas (
--schema), and machine-readable usage (--usage) are built into the binary so an agent can inspect what it needs on the fly. - Safe dry-run validation:
--dry-runvalidates inputs and prints the resolved HTTP request with credentials redacted—without making a network call or reading the OS keychain. - Script- and agent-friendly output: Stream text, write media directly to disk, emit structured JSON (
--output-format json) or compact TOON (--output-format toon), or filter fields inline with--jq. - Stateless execution: Each invocation runs independently. Your agent supplies the context, chooses the model, and controls the next step.
Built for headless use by coding agents and assistant tools, with the same interface available to shell scripts and CI jobs. A single Go binary runs on macOS, Linux, and Windows.
Installation
macOS and Linux
curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash
Windows (PowerShell)
iwr -useb https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.ps1 | iex
Go install
Install the latest release with Go:
go install github.com/google-gemini/gemini-api-cli/cmd/gemini-api@latest
To build the current development version, use @main instead of @latest. Current main requires Go 1.26.10 or later (Go’s automatic toolchain selection downloads the required version if needed).
Prebuilt binaries
Download prebuilt archives for macOS, Linux, and Windows from GitHub Releases and place gemini-api on your PATH.
Quick start
1. Configure your API key
Create an API key in Google AI Studio (see the Gemini API key docs) and make it available to your shell or your agent’s subprocess environment:
export GEMINI_API_KEY="YOUR_API_KEY"
Workstation tip: To persist your key in your OS keychain (macOS Keychain, Linux Secret Service, or Windows Credential Manager) or
~/.config/gemini-api/config.yaml, rungemini-api configure --api-key "YOUR_API_KEY"or open the interactive form withgemini-api configure --interactive. Check your active configuration and credential source at any time withgemini-api whoami.
Verify your setup locally with --dry-run (no network call), then remove --dry-run to call the API:
gemini-api generate "Hello from my agent" --dry-run
gemini-api generate "Hello from my agent"
2. Give your agent instructions
Add the following block to your agent’s instructions (AGENTS.md, CLAUDE.md, .cursorrules, or tool configuration):
You have access to gemini-api through the shell. Use it to call Gemini models, generate or edit media, analyze files, or launch managed agents.
1. Inspect --help or --usage to choose a command, and --schema when building a --body JSON payload.
2. Preview API calls with --dry-run (or --dry-run --output-format json).
3. For discrete JSON output or --jq filtering on streaming commands (generate, agent run, agent status --stream), pass --stream=false --output-format json (--background on agent run returns a single interaction without streaming unless --stream is passed).
4. Capture returned file paths (from media commands) and interaction IDs (from agent/model runs) to continue multi-step tasks.
3. Put your agent to work
Prompt your host agent as usual:
Build a landing page for this app. Use Gemini to create a mascot image and a welcome voiceover, and launch a managed research agent to investigate competing products. Incorporate the assets and findings into the page.
Your agent chooses the commands, runs them in its shell, and uses the returned file paths and interaction IDs in its own workflow.
Command overview
Run gemini-api --help to see all top-level commands, or gemini-api <command> --help for command-specific flags and examples.
| Category | Command | Subcommands / Key Flags | Description & default model |
|---|---|---|---|
| Create | gemini-api generate | -m, -i/--input, --stdin, --system, --stream=false, --body | Text and multimodal generation (gemini-4-hydrogen) |
gemini-api image | -m, -i/--input, --stdin, --out, --body | Generate or edit images (gemini-nano-banana-2.1) | |
gemini-api tts | -f/--file, --stdin, --voice, --voice-prompt, --style, --multi-speaker, --out | Text-to-speech audio generation (gemini-3.8-flash-tts) | |
gemini-api music | -m, -f/--file, --stdin, --out, --body | Music generation (lyria-3.5) | |
gemini-api video | -m, -i/--input, --stdin, --async, --out, --body | Conversational video generation and editing (gemini-omni-1.2-flash) | |
| Understand | gemini-api analyze | -i/--input (repeatable), --stdin, --system, -m | Ask questions about PDFs, images, audio, video, CSV/text files, or YouTube URLs (gemini-4-hydrogen) |
gemini-api transcribe | -i/--input (repeatable), --format (md, text, json, srt), --out | Transcribe audio or video to Markdown (md), plain text (text), JSON (json), or SRT captions (srt) (gemini-3.5-transcribe) | |
| Manage | gemini-api agent | run, status, cancel, delete-interaction, create, list, get, delete | Run interactions with models or managed agents (run, status, cancel) and manage agent definitions |
gemini-api files | upload, list, get, generated-files-list, register, delete | Upload, list, inspect, register, and delete files via the Files API (48-hour retention) | |
gemini-api models | (bare catalog), list (--all), get | View the offline model catalog, or query live API models (list, get) | |
gemini-api voices | create, list (--all), get, delete | Design, replicate, list, inspect, and delete custom voices | |
gemini-api configure | --api-key, --interactive, --output-format | Configure authentication, global parameters, and persistent preferences | |
gemini-api auth / whoami | auth login, auth whoami, auth logout | Manage stored credentials (auth) or inspect active authentication and configuration (whoami) | |
| Advanced | gemini-api environments | create, list, get, delete, files (list, upload, download), connect, poll, serve | Manage sandbox environments, upload/list/download environment files, or run self-hosted environments |
gemini-api credentials | create, list, get, update, delete | Manage stored server-side credentials for managed agents | |
gemini-api webhooks | create, list, get, update, ping, rotate-signing-secret, delete | Manage webhook endpoints and signing secrets for event delivery | |
gemini-api triggers | list, get, update, run, list-executions, delete | Inspect, run, update, and delete cron triggers for managed agents | |
| Utility | gemini-api explore / version | — | Launch the interactive command explorer (explore) or print the CLI version (version) |
Agent discovery and machine interface
Everything an agent needs to use gemini-api is discoverable from the binary itself, without external documentation or credentials:
| When an agent needs to… | It runs… |
|---|---|
| Discover commands and flags | gemini-api --help or gemini-api --usage |
| Inspect a request body schema | gemini-api agent run --schema |
| Validate and preview a call offline | gemini-api image "A robot mascot" --dry-run |
| Parse a complete structured response | gemini-api generate "Hello" --stream=false --output-format json |
| Extract a single field inline | gemini-api agent list --jq '.agents[].id' |
--usageoutputs the complete command tree, flags, defaults, environment variables, and config keys as machine-readable KDL.--schemaprints the bundled JSON Schema (draft 2020-12) for any command that accepts a request body.--dry-runvalidates flags and payloads and previews the HTTP request without credentials or network access (use--dry-run --output-format jsonfor machine-parseable JSON request previews).--no-interactivedisables all interactive prompts and TUI forms.--agent-mode(orGEMINI_CLI_AGENT_MODE=1) enables structured JSON error envelopes onstderrand defaultsstdoutto compact TOON output (--output-format jsonexplicitly selects JSON).- Exit codes distinguish success (
0), runtime/API failures (1), invalid usage/validation errors (2), and authentication/authorization failures (3).
Run gemini-api --help-global to see all global authentication, network, output, and diagnostic flags.
Agent workflows
1. Generate and edit creative assets
Coding agents like Codex, Claude Code, or Antigravity can generate images, speech, music, and video while building an app:
# Generate an image and capture the written file path
MASCOT_PATH=$(gemini-api image "A friendly robot mascot, soft studio lighting" --out ./assets/mascot.jpg)
# Edit an existing image with -i / --input
gemini-api image "Add a winter scarf and snowy background" -i "$MASCOT_PATH" --out ./assets/mascot-winter.jpg
# Generate single-speaker or multi-speaker voiceovers
gemini-api tts "Welcome. Let's build something together." --out ./assets/welcome.wav
gemini-api tts "Alice: Welcome to the demo! Bob: Let's dive right in." \
--multi-speaker "Alice=Kore,Bob=Puck" \
--out ./assets/dialogue.wav
# Generate background music and video
gemini-api music "Warm ambient music for a product walkthrough" --out ./assets/
gemini-api video "A slow camera move through a sunlit workshop" --out ./assets/
Media commands write files locally and print only the written file path to stdout. When --out points to a directory (or is omitted), the CLI names the file automatically using the file extension that matches the API’s returned MIME type (for example, .jpg for image/jpeg, .wav for audio/wav, .mp3 for audio/mpeg, and .mp4 for video/mp4).
2. Analyze documents and transcribe recordings
Assistants like OpenClaw or Hermes can turn documents, media files, and YouTube URLs into answers and deliverables:
# Analyze a PDF or compare multiple images
gemini-api analyze --input product-brief.pdf "What should we build first, and why?" > plan.md
gemini-api analyze --input before.png --input after.png "Summarize the visual design changes"
# Transcribe audio or video (valid formats: md, text, json, srt)
gemini-api transcribe --input interview.mp4 --format srt --out interview.srt
For larger media files (over ~14 MB raw / 20 MB base64-encoded), upload once with files upload --wait and reuse the returned files/ URI across analyze, transcribe, generate, image, video, or agent run:
FILE_URI=$(gemini-api files upload interview.mp4 --wait --output-format json --jq '.name')
gemini-api analyze --input "$FILE_URI" "List the key action items with timestamps"
3. Launch and poll a background managed agent
Delegate multi-step research or coding tasks to a Gemini managed agent such as Deep Research. Pass --background so the CLI returns a single interaction (no stream, unless --stream is passed) with the interaction ID immediately instead of holding open an SSE stream:
INTERACTION_ID=$(gemini-api agent run "Research battery recycling approaches and cite sources" \
--agent deep-research-preview-04-2026 \
--background \
--jq '.id')
echo "Started interaction: $INTERACTION_ID"
Check progress or retrieve the finished output using the returned INTERACTION_ID:
gemini-api agent status "$INTERACTION_ID" --stream=false --output-format json
You can also stream live progress events (gemini-api agent status "$INTERACTION_ID" --stream) or cancel an active run (gemini-api agent cancel "$INTERACTION_ID").
4. Choose the right model
Use --model (-m) on generation and analysis commands to pick a model for reasoning, fast text, multimodal understanding, or media generation:
# View the curated offline model catalog grouped by capability
gemini-api models
# Query all live models available to your API key (--all auto-paginates across pages)
gemini-api models list --all
gemini-api models get gemini-4-hydrogen
# Run a prompt with a specific model
gemini-api generate "Review this approach: cache immutable responses by content hash" --model gemini-4-hydrogen
Go deeper: custom request bodies (--schema to --body)
Short flags cover common tasks; --body gives your agent full access to the underlying Interactions API request schema while keeping the CLI’s file output and error handling. Firs
Similar Articles
@mingzi206: Gemini 4 Neon being GOAT-tier wasn't enough — Google secretly open-sourced its entire multimodal power toolkit! The official nuclear-grade terminal tool just dropped: gemini-api-cli. Blunt to the point of absurdity: type one command in your terminal and get Gemini's insane video understanding, ...
Google officially open-sourced gemini-api-cli, a terminal tool built purely in Go. With a single command, you can tap into Gemini's full suite of multimodal capabilities — image generation, TTS, video understanding, OCR, and audio/video generation — right from your terminal. It also works as a backend asset library for agents like Claude Code and Codex.
@ohouhou717: Holy shit, Google is throwing money around again! You can actually use the Gemini 4 Hydrogen API for free now! A 1-million-token context window and roughly 1,500 requests a day—absolutely awesome for building agents. Just head to AI Studio, create a key, and set the model to gemin…
Google has started offering free API credits for the Gemini 4 Hydrogen model, with a 1-million-token context window and approximately 1,500 calls per day. Users only need to create a key in AI Studio to get started, making it ideal for developing agent applications.
@stormzhangV: I recommend every agy + neon user install this officially open-sourced Google project. The repo contains 2 core Skills — deep-research (just 21 lines): a minimal guide to multi-agent parallel deep research that defines a 5-step pipeline …
Google officially open-sourced the Gemini team's DemoLab repo, featuring two core Skills: deep-research (multi-agent parallel deep research with a blind-eval win rate over 90%) and gemini-frontend-design (a non-AI-look frontend design spec with a 67%–75% win rate), installable via various AI coding assistants and CLIs.
google/agents-cli
Google released `agents-cli`, a CLI tool and skill set for building, deploying, and managing enterprise-grade agents on the Gemini Enterprise Agent Platform, designed to integrate with popular coding assistants like Claude Code and Codex.
Gemini Agent (18 minute read)
Google Cloud 在 Gemini at Work 2026 上发布 Gemini agent——一个面向工作场景的统一智能体,可在单一提示框中回答问题、处理知识工作、创建媒体、编写并运行代码,并深度集成 Google Workspace、行业专属技能与企业级安全治理能力。