Independent AI intelligence Two editions daily · ET
Fervor AI

Analysis · November 25, 2026 · repo

gemini-api-cliGemini APIagent-harnessclaude-codecodexfrontier-modelsagent-security

Gemini API CLI Turns Claude Code and Codex Into Multimodal Agents. Scope It First.

Google's new command-line tool lets Claude Code, Codex or any agent with a shell call Gemini. Here's the setup that keeps it to the jobs you meant.

Coding agents are good at code and stubborn about everything else. Ask one to build a landing page and it writes the HTML, then leaves a gray box where the hero image should go. Ask it to read a 90-minute recording and it has nowhere to send the file.

The usual fix has been an MCP server, a plug-in that hands the agent new tools. Google just took a plainer route. Its new gemini-api-cli is a single command-line program. Put it on your PATH, give it an API key, and any agent that can run shell commands can now call Gemini models, generate images, audio and video, analyze files, and launch Gemini's managed agents (agents Google runs on its own servers, such as Deep Research).

That's useful. It also means your agent now holds a key that can spend money and start background jobs. The tool is easy to install. The part worth five extra minutes is deciding which of its commands your agent may run without asking.

What it is

gemini-api-cli (the command is gemini-api) is a Go program from the google-gemini GitHub organization, licensed Apache-2.0. The README pitches it as "Gemini models and managed agents for the agent you already use", naming Codex, Claude Code, Antigravity, OpenClaw and Hermes. The latest release is v0.5.0, published November 20, 2026, and it was #8 on Trendshift's daily board on the morning of November 25.

It's stateless. Each command runs on its own, returns a result, and exits. Your agent keeps any IDs it wants to reuse. Media commands write files straight to disk and print only the file path, so the agent can drop the path into the code it's writing:

gemini-api image "A friendly robot mascot for a developer tool" --out ./assets/

The commands fall into a few groups, per the README:

  • Create: generate (text), image, tts (speech), music, video
  • Understand: analyze (ask questions about PDFs, images, audio, video or YouTube URLs) and transcribe (including SRT captions, the standard subtitle file format)
  • Manage: agent (run, check and cancel interactions, including Gemini's managed agents), files, models, voices
  • Advanced: environments, credentials, webhooks and triggers (cron schedules, meaning timed, repeating runs, for managed agents)

Why a CLI instead of an MCP server

The interesting design choice is how the agent learns the tool. With an MCP server, the tool descriptions sit in the agent's context. With this CLI, the agent asks the program itself.

The README calls this "self-describing". Three flags do the work:

  • --usage prints the whole command tree, flags, defaults and config keys in a machine-readable, config-style text format (KDL).
  • --schema prints the JSON Schema for any command that takes a request body.
  • --dry-run validates the command and prints the exact HTTP request it would send, with credentials redacted, without making a network call or reading your keychain.

There's also an --agent-mode flag (or GEMINI_CLI_AGENT_MODE=1) that switches errors to structured JSON, and exit codes that separate success (0), API failures (1), bad usage (2) and authentication failures (3). An agent can tell "I typed the flag wrong" apart from "the key was rejected" without reading prose.

Think of it like handing a new contractor a tool with the manual printed on the handle. The agent doesn't need you to explain it up front. It looks it up as it goes.

Install it and make one safe call

You'll need a Gemini API key from Google AI Studio. Then, on macOS or Linux:

curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash
export GEMINI_API_KEY="YOUR_API_KEY"

Go users can run go install github.com/google-gemini/gemini-api-cli/cmd/gemini-api@latest instead, and prebuilt binaries are on the releases page. On a workstation, gemini-api configure --api-key "YOUR_API_KEY" saves the key in your OS credential store or in ~/.config/gemini-api/config.yaml, and gemini-api whoami shows which credential source is active.

Before any real call, try the dry run:

gemini-api generate "Hello from my agent" --dry-run
gemini-api generate "Hello from my agent"

The first line makes no API request at all. The second is a real request, and depending on your account, model and free-tier limits, it may cost money.

The README also gives a short block to paste into your agent's instructions file (AGENTS.md, CLAUDE.md or similar). It tells the agent to inspect --help or --usage, preview with --dry-run, request JSON output with --stream=false --output-format json, and keep returned file paths and interaction IDs for later steps. Paste it as is. It's the cheapest way to make the agent use the self-description instead of guessing.

Three jobs to try first

Pick small tasks where a second model clearly helps, and watch how your agent uses the tool before you widen its reach.

A second opinion on a design choice. Ask your agent to run its plan past Gemini and summarize where they disagree. The README's example picks a model with --model:

gemini-api generate "Review this approach: cache immutable responses by content hash" --model gemini-4-hydrogen

gemini-api models lists the curated catalog offline, and gemini-api models list --all shows what your key can actually reach. The disagreements are the useful part. Agreement from a second model is weak evidence; a specific objection is something you can check.

Captions from a recording. This is the job coding agents usually can't do at all:

gemini-api transcribe --input interview.mp4 --format srt --out interview.srt

For files over roughly 14 MB, the README says to upload once with gemini-api files upload interview.mp4 --wait and reuse the returned files/<id> reference, which saves sending the same file twice.

Questions about a PDF. Point analyze at a brief or spec and save the answer where your agent can read it:

gemini-api analyze --input product-brief.pdf "What should we build first, and why?" > plan.md

All three produce an answer or a file and stop. That's the shape of command you can let an agent run on its own, and it's the line the next section draws.

Scope it before you hand it over

Here's the part most quick-start posts skip. One binary covers making a picture and scheduling a cron job for a managed agent. Those are not the same level of risk, and your agent shouldn't treat them the same.

A useful way to sort the commands: some produce an answer or a file and then stop. Others start something that keeps running, store something on Google's side, or change your account. The first group is fine to allow. The second group should ask you first.

In Claude Code, you can express that split with permission rules in your settings file (for one project, .claude/settings.json in the repo). A * in a Bash rule matches the rest of the command, and the docs advise putting it after the subcommand, so each rule names exactly one kind of action:

{
  "permissions": {
    "allow": [
      "Bash(gemini-api generate *)",
      "Bash(gemini-api analyze *)",
      "Bash(gemini-api image *)",
      "Bash(gemini-api transcribe *)"
    ],
    "ask": [
      "Bash(gemini-api agent *)",
      "Bash(gemini-api triggers *)",
      "Bash(gemini-api credentials *)",
      "Bash(gemini-api webhooks *)",
      "Bash(gemini-api configure *)"
    ]
  }
}

Add tts, music or video to the allow list if you want them. Video in particular is the kind of call where you may prefer a prompt, since each one is a heavier generation that can cost real money.

Why agent goes on the ask list: gemini-api agent run with --background starts a managed agent, such as Deep Research, and returns an interaction ID while the work continues on Google's side. That's the feature you want for long research, and it's also a job that runs after your session ends. Triggers go further: they're cron schedules for managed agents, and the CLI can run and update them.

Two more settings are worth knowing.

Storage. The CLI itself "stores no local conversation state", per the README, but server-side interactions and uploaded files keep their own retention on Google's side, and the Files API keeps uploads for 48 hours. The README's own custom-request example sets "store": false to disable server-side interaction storage. If your agent is sending client files, use that pattern for the requests you care about.

Version pinning. The README says the CLI is in beta, that "breaking changes may occur between releases", and recommends pinning a release version in CI and automated workflows. By default the install script fetches the latest published release, so in a pipeline pin it: the script accepts a GEMINI_VERSION setting, or you can download a specific release binary yourself.

Honest limitations

It's beta, and it moves. Two releases landed in November alone (v0.4.6 and v0.5.0). Pin it anywhere that matters.

Google doesn't take outside code. The README says pull requests "will be closed without review". You can file issues, but you can't fix it yourself upstream.

The key is the weak point. The README's setup puts GEMINI_API_KEY in the agent's subprocess environment, which means the agent, and anything it runs, can read it. Permission rules limit which gemini-api commands run without asking. They don't hide the key from a curl your agent writes by hand. Use a key you can revoke, and watch usage in AI Studio for the first week.

It isn't an MCP server. If your agent has no shell, or you want tool calls to show up as typed tools in a client that only speaks MCP, this isn't that.

And none of this tells you whether Gemini is better than your main model at a given job. It makes asking cheap. Whether the second opinion is worth paying for is something you'll learn from your own tasks.

The takeaway

The real shift here is small and practical: a second model is now one shell command away from any coding agent. That's a good thing for the gray-box problem, the missing image, the unread PDF, the recording nobody transcribed.

Install it, run the dry run, paste the instructions block, and write the allow and ask lists before the first real task. Five minutes of scoping is the difference between a helper that makes assets and one that can schedule work you never asked for.

Sources: gemini-api-cli README (read November 25, 2026, v0.5.0); gemini-api-cli releases; Claude Code permissions docs; Trendshift daily board, about 07:13 ET November 25, 2026.