explainx.ai0k
TrendingAI News TodayPathwaysSkills
Pricing
explainx.ai

Upskill in AI — 16 free pathways, live workshops & bootcamps, and 50+ courses from practitioners. Plus the skills, tools, and MCP servers to practice on.

follow us

follow on google

Add explainx.ai as a preferred source

corporate training

support@explainx.ai

get started

Find your pathTake Free Evaluation

community

Join the community

learn

mind: share how you thinkpathways — start freeworkshopsbootcampscoursescompare Explainxcertificationsmock testsexplainx universitycorporate traininglearn skills & mcp

discover

skillsmcp serversexplainx mcptoolsmdx readeragentsllmsdesignsdictionarypeopleagi trackerfelony benchranks

company

aboutvisionmissionteaminstructorsteach on explainxpartnershipscommunityhackathonscareers

content

daily AI newsstate of AI — live resultsblogreleasespromptsgeneratorsresource libraryfor LLMsexplainx.ai kids

solutions

all solutionsdeveloper upskillingmarketing upskillingproduct manager upskillingleadership upskilling

newsletter · weekly

Get AI news, tools, and insights in your inbox.

supportcontactprivacytermsdata rightshow we create contentsubmission guidelines

© 2026 AISOLO Technologies Pvt Ltd

explainx.ai

On this page

  • TL;DR: what you need to know
  • What does the Gemini API CLI actually do?
  • How do you install and try it?
  • Why is it built for agents rather than humans?
  • Managed agents and Deep Research from the shell
  • How does it compare with Gemini CLI and other vendor CLIs?
  • The models behind the defaults
  • What are the limits and risks?
  • What people are asking
  • What this means for what you build
  • Related reading
← Back to blog

explainx / blog

Gemini API CLI: Google's Open-Source gemini-api Command Gives Any Coding Agent Images, Video, Music and Deep Research

Gemini, Google, CLI Tools, AI Agents, Developer Tools

Part of Google Gemini and DeepMind

Google released gemini-api, an Apache-2.0 CLI that lets Claude Code, Codex or any shell agent generate images, video, music, speech and launch Deep Research.

Oct 22, 2026·9 min read·Yash Thakker
add explainx.ai
go deep
Gemini API CLI: Google's Open-Source gemini-api Command Gives Any Coding Agent Images, Video, Music and Deep Research

Google has released a beta command line tool, gemini-api, that lets any coding agent with shell access call the Gemini API. The Gemini API CLI is a single Go binary under the Apache-2.0 license. One command can generate an image, a voiceover, music or a video, analyze a PDF, transcribe a recording, or start a background Deep Research run. It is published in the google-gemini/gemini-api-cli repository and introduced on Google AI Studio.

The pitch is in the README's first line: "Gemini models and managed agents for the agent you already use." Google names Codex, Claude Code, Antigravity, OpenClaw and Hermes as hosts. Your agent plans the work, and Gemini supplies models and media. That makes this less a competitor to other coding agents and more a plug-in for them.

Weekly digest3.6k readers

Catch up on AI

Curated AI updates on agents, skills, and MCP — delivered to your inbox. Unsubscribe anytime.

TL;DR: what you need to know

table · 2 cols
QuestionAnswer
What is it?A stateless CLI, gemini-api, for the Gemini API
Who is it for?Coding and assistant agents with shell access, plus scripts and CI
LicenseApache-2.0 for the code, CC BY 4.0 for other materials
StatusBeta; Google warns breaking changes may land between releases
PlatformsmacOS, Linux, Windows (single Go binary)
NeedsA Gemini API key from Google AI Studio
Can it write code?No. It generates assets and answers; your agent does the coding
Is it Gemini CLI?No, that is a separate terminal agent
ContributionsNot accepted yet; feedback goes in GitHub Issues

What does the Gemini API CLI actually do?

A coding agent building an app often needs something it cannot make by itself: a hero image, a narrated demo, a second opinion on a design, or an answer buried in a PDF. The usual route is to write SDK code, handle base64, and manage uploads. The README says the CLI replaces that with commands an agent can discover and run.

The command groups, as listed in the repository, with their default models:

table · 3 cols
CommandWhat it doesDefault model per README
generateText and multimodal generationgemini-3.8-flash
imageGenerate or edit imagesgemini-nano-banana-2.1
ttsText to speech, including multi-speakergemini-3.8-flash-tts
musicMusic generationlyria-3.5
videoVideo generation and editing, with --asyncgemini-omni-1.1-flash
analyzeQuestions about PDFs, images, audio, video, CSV or YouTube URLsgemini-3.8-flash
transcribeAudio or video to Markdown, text, JSON or SRTgemini-3.8-flash
agentRun, check and cancel managed agents; manage definitionsn/a
filesUpload and manage files (48-hour retention)n/a

There are also advanced groups for sandbox environments, stored server-side credentials, webhooks and cron triggers for managed agents. Media commands write the file to disk and print only the path, which is exactly what an agent needs to keep building.

How do you install and try it?

On macOS or Linux, the README gives an install script, and go install github.com/google-gemini/gemini-api-cli/cmd/gemini-api@latest works if you have Go. Windows has a PowerShell installer, and prebuilt archives are on the Releases page. The main branch needs a recent Go toolchain, which Go can download automatically.

bash
export GEMINI_API_KEY="YOUR_API_KEY"
gemini-api generate "Hello from my agent" --dry-run
gemini-api generate "Hello from my agent"
gemini-api image "A friendly robot mascot for a developer tool" --out ./assets/

The first call with --dry-run validates your flags and prints the resolved HTTP request with credentials redacted, without any network call. Remove the flag to run it for real. To keep your key off the shell environment, gemini-api configure --api-key stores it in the OS keychain or a config file, and gemini-api whoami shows which credential is active.

Then tell your agent about it. The README suggests pasting a short block into AGENTS.md, CLAUDE.md or .cursorrules: tell the agent it has gemini-api in the shell, to inspect --help or --usage, preview with --dry-run, and capture file paths and interaction IDs. If you are new to those files, our guides to AGENTS.md support in Claude Code and agent skills explain the pattern.

A sample prompt from the README, which you give to your host agent rather than to the CLI: build a landing page, use Gemini to make a mascot and a welcome voiceover, and launch a managed research agent on competing products.

Why is it built for agents rather than humans?

Stateless calls resuming a multi-turn Gemini API CLI session by interaction IDStateless calls resuming a multi-turn Gemini API CLI session by interaction ID

Most CLIs are designed to be read by a person. This one is designed to be parsed by a model. Five details from the repository show it:

  • Self-describing. --usage prints the full command tree, flags, defaults and config keys as machine-readable KDL. --schema prints the bundled JSON Schema for any command that takes a request body.
  • Safe previews. --dry-run shows the exact request before anything is sent or billed.
  • Structured output. --output-format json, a compact format called TOON, and an inline --jq filter let an agent extract one field instead of parsing prose.
  • Agent mode. --agent-mode (or GEMINI_CLI_AGENT_MODE=1) switches errors to structured JSON envelopes on stderr.
  • Stable exit codes. 0 for success, 1 for runtime or API failures, 2 for invalid usage, 3 for authentication failures.

The CLI also holds no local conversation state. Each call is independent, and multi-turn work uses a previous_interaction_id returned by the API. The README says this is by design: your agent supplies the context and decides the next step. That fits the way Gemini's managed agents and Interactions API are built, and the CLI is explicitly "evolving alongside" that API.

Managed agents and Deep Research from the shell

Long-running background research task started from the Gemini API CLI and polled laterLong-running background research task started from the Gemini API CLI and polled later

The most interesting command for builders is agent run. The README shows starting a Deep Research agent in the background and getting back an interaction ID right away:

bash
INTERACTION_ID=$(gemini-api agent run "Research battery recycling approaches and cite sources" \
  --agent deep-research-preview-04-2026 \
  --background \
  --stream=false \
  --jq '.id')
gemini-api agent status "$INTERACTION_ID" --stream=false --output-format json

Your host agent can keep coding while the research runs, then poll agent status or stream events, or cancel with agent cancel. For large media, files upload --wait returns a files/<id> URI you can reuse across analyze, transcribe, video or agent run. The README puts the inline limit at roughly 14 MB raw, or 20 MB once base64-encoded.

This is a practical way to use a second vendor's strengths inside the tool you already prefer. It pairs naturally with what we covered in Claude Fable 5.1 and Gemini 3.8 Flash coding-agent routing, where different models handle different parts of a job.

How does it compare with Gemini CLI and other vendor CLIs?

The names are confusing, so here is the split:

table · 3 cols
ToolRoleDoes it plan and edit code?
Gemini API CLI (gemini-api)Thin shell interface to Gemini models, media and managed agentsNo
Gemini CLIOpen-source terminal coding agentYes
Claude Code, Codex, AntigravityCoding agents that can call gemini-api as a toolYes

The README makes the same distinction: this is a utility an agent calls, not an agent harness. It is also not the first vendor CLI of its kind. OpenAI shipped an official command line for its API, which we covered in the official OpenAI CLI guide. The shared idea is that the shell is now the universal tool interface for agents, so every lab wants a first-class command there.

For Google's own docs direction, see also our note on the Gemini API docs preview inside AI Studio.

The models behind the defaults

The README's defaults map to models we have covered. The text default, Gemini 3.8 Flash, is covered in the launch and coding benchmarks post. The speech default is explained in Gemini 3.8 Flash TTS and voice design. Music uses Lyria 3.5, and video uses the model family from Gemini Omni Flash. The image default, gemini-nano-banana-2.1, follows the line in our Nano Banana 2.5 post. Model names and availability can change quickly in a beta, so run gemini-api models for the offline catalog and gemini-api models list --all to see what your key can actually call.

What are the limits and risks?

It is beta. The README warns: "Breaking changes may occur between releases," and recommends pinning a release version in CI. The repository itself is described as experimental. Do not hard-wire it into production pipelines yet.

It costs money. The CLI is free software, but every call goes through your Gemini API key. Video and music generation are typically the pricey ones. Check current pricing in the Gemini API docs and set a budget alert.

Your agent holds the key. Any process your agent can launch can read GEMINI_API_KEY from the environment. Prefer the keychain option, use a key restricted to the project, and keep shell permissions tight. Agents that shell out freely are the same surface that attackers target; for runtime checks on what an agent is about to execute, see AgentBeam, the agent security platform from the explainx.ai team.

Generated assets need review. Image and video models can get facts and details wrong, so check what your agent generates before shipping it.

No pull requests. Google says it is not accepting contributions now, so fixes depend on Google's own release pace. Feedback goes in GitHub Issues.

What people are asking

Should I switch my agent to use it? Only if you need Gemini-specific media or Deep Research. If you already call the Gemini SDK from code you control, the CLI mostly saves boilerplate.

Can I use it in CI? Yes, the README says it targets headless use by agents, scripts and CI jobs. Pin the version and use --no-interactive.

Does it work without an agent? Yes. It is a normal CLI, and gemini-api explore opens an interactive command explorer.

How does it handle secrets in logs? --dry-run redacts credentials in the request preview. Other logging behavior is not detailed in the README, so test it before sharing logs.

What this means for what you build

If you build with coding agents, this is a low-effort way to add generated media and long-running research to a workflow without writing integration code. The cost model is the usual API one: you pay per call. The risk model is the usual agent one: you are handing over a key and a shell. Start with --dry-run, give the agent a narrow task such as "generate the three images this page needs," and review the output.

For the broader picture of where Google's developer stack is heading, see our coverage of Gemini managed agents and agent harness token costs.

Related reading

  • Gemini managed agents get files and credentials APIs
  • Gemini API docs preview inside Google AI Studio
  • Gemini 3.8 Flash launch and coding benchmarks
  • Claude Fable 5.1 and Gemini 3.8 Flash agent routing
  • The official OpenAI CLI guide
  • Gemini Omni Flash video generation
  • What are agent skills? Complete guide
  • Official: gemini-api-cli on GitHub, Gemini API docs

Details such as default models, flags and version numbers are accurate as of October 22, 2026 and may change as the CLI is in beta.

Spotted something out of date? Let us know.
Yash Thakker

Written by

Yash Thakker

Yash is an AI expert with over 300K learners. Join his workshops →

View Yash Thakker in People in AI →

Related posts

Oct 15, 2026

Google Deep Review Goes Public: Two Free Document Reviews a Week, Built From 16,000 Conference Papers

Google Research launched Deep Review worldwide on October 14, 2026. It grew out of the Paper Assistant Tool used on 16,000+ conference submissions and now reviews design docs, slides and legal or finance documents too. Here is how it works, what it costs and where it falls short.

Oct 8, 2026

Google Launches the Gemini Agent for Work: One Agent, Claude Models Included

At Gemini at Work 2026, Google Cloud introduced the Gemini agent, a single cloud-hosted agent that answers, works autonomously, and writes code, can run Claude models underneath, and is in private preview for enterprises. explainx.ai breaks down what shipped and what is still unproven.

Sep 23, 2026

Google Labs Launches "CC," an AI Agent for Running a Household

Google Labs shipped "CC," an experimental agent with its own verified Google account that up to six household members can share, built to handle school permission slips, shared calendars, and meal planning. The launch thread spent as much time confused about the name — which reads, to developers, exactly like Claude Code's shorthand — as it did discussing the product itself.