跪拜 Guibai
← Back to the summary

gemini-api-cli: Plug Gemini's Full Multimodal Stack Into Claude Code or Codex

Last week I wrote an article recommending the T3 Code project. A few days later, I noticed that T3 Code's discussion heat has remained high, but I found that people are discussing more about being able to directly use the Gemini model. Because the Coding Agent experience of Antigravity is very poor, many people simply use T3 Code to call Google models.

This also reflects a fact from the side: the Gemini models are powerful, and Antigravity is disappointing.

Whether it's Carbon, Neon, Hydrogen which are stable for coding and long-range reasoning, or Nano Banana 2.1 for image generation, 3.8 Flash TTS for voiceover, Lyria 3.5 for music, Omni 1.2 Flash for video generation, plus Deep Research that can chew through millions of context and automatically run deep research, almost all multimodal capabilities used in daily development are covered.

But using T3 Code goes through antigravity-acp, which solves the problem of switching to a more comfortable shell and using Gemini as the main agent.

These past two days I've been thinking about another high-frequency pain point: if I'm already using Claude Code, Codex, ZCode, or DeepSeek Harness as my main agent, and I don't want to switch windows or interrupt the context I've built up, how do I let the agent that's already working call Gemini conveniently?

Then while browsing GitHub, I found that Google has apparently also thought this through. Since it can't beat people's habits of using Claude Code and Codex, it simply doesn't force you to switch clients, and directly packages the entire Gemini API and managed agents into a zero-dependency, stateless, single-file command-line tool.

This is Google's open-source project gemini-api-cli. image.png

You just need to set up an API Key, put gemini-api into the system's PATH, and mention it in a rules file.

Then, your main agent can generate images, process PDFs, or run background deep research by typing a single command.

Philipp from Google DeepMind released this project on October 26. image.png

This article discusses gemini-api-cli, looks at how it differs from the well-known gemini-cli, and how to plug it into your daily agent as an external weapon library.

What's the difference between it and gemini-cli and traditional MCP?

Seeing the project name, those familiar with Google open-source projects might be confused: Google already open-sourced a gemini-cli before, why make another one?

In fact, the positioning of the two is completely different. Adding T3 Code mentioned earlier, there are basically three ways to call Gemini locally:

Three ways to call Gemini

Once you plug it into your local environment, you don't need to memorize complex API parameters at all. You can directly assign tasks in natural language to your current coding agent, for example:

After receiving such tasks, the host agent doesn't guess the interface format, but follows the machine interface built into gemini-api to run a clean four-step loop. gemini-api cross-agent collaboration architecture

The whole collaboration logic is clear from the diagram above, with three core points:

How to use

Now let's talk about how to install gemini-api-cli and plug it into your daily coding agent.

1. Installation, API Key configuration, and Pro / Ultra credit claiming

The whole tool is a Go native binary with no external dependencies, supporting macOS, Linux, and Windows.

The easiest is the one-line install script:

# macOS / Linux one-line install
curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash

Windows PowerShell users can use this line:

iwr -useb https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.ps1 | iex

If you have a Go environment, you can also go install directly, or download the pre-compiled archive for your architecture from GitHub Releases and place it in PATH:

go install github.com/google-gemini/gemini-api-cli/cmd/gemini-api@latest

After installation, I'll focus on authentication and quota, because many subscription users tend to step into a pitfall:

I specifically examined the auth login source of gemini-api. Its underlying path is purely the developer API channel, only recognizing GEMINI_API_KEY. Unlike T3 Code and gemini-cli, it doesn't support opening a webpage for personal Google account OAuth login, so it does not consume the quota from your subscription pool.

But, if you have a Google AI Pro or Google AI Ultra subscription, don't waste the official monthly API credits!

Now Google has connected the developer plan's cloud credits directly into Google AI Studio. The primary account of Pro and Ultra can claim a real API quota every month, which is perfect for feeding gemini-api-cli:

Google AI Pro and Ultra monthly API credits

I've also clarified the specific claiming and deduction rules:

image.png

image.png

After getting the API Key, for temporary script testing you can simply export GEMINI_API_KEY="your Key"; for long-term use on your main development machine, it's better to store it in the system's native keychain (macOS Keychain / Windows Credential Manager).

# Store in system keychain (you can also add --interactive to open an interactive form)
gemini-api configure --api-key "YOUR_API_KEY"

# Check the current active auth source and global configuration anytime
gemini-api whoami

2. Plug it into your main agent

To make Claude Code, Codex, and other agents learn to call it proactively, just add a short prompt block to the project's CLAUDE.md, AGENTS.md (or global rules file):

You can directly call the `gemini-api` command-line tool via shell to use Gemini models as needed, generate or edit multimodal assets, analyze local files, or launch managed agents in the background.
1. First use `--help` or `--usage` to view commands, and before constructing complex `--body` JSON, use `--schema` to verify the structure.
2. Before real requests, prefer adding `--dry-run` (or `--dry-run --output-format json`) for offline pre-check.
3. When you need discrete JSON or want to extract fields with `--jq`, add `--stream=false --output-format json` to streaming commands.
4. Carefully preserve the file paths returned by media commands and the interaction ID returned by `agent/generate` for subsequent multi-step chaining.

Or, even lazier, just throw the following text at your coding agent:

Help me pull and install Google's official gemini-api-cli (https://github.com/google-gemini/gemini-api-cli), confirm gemini-api is available in PATH, then run gemini-api version and --dry-run to verify the environment is normal, and write the call conventions into the current project's AGENTS.md.

3. Using with a coding agent

After adding gemini-api to PATH and AGENTS.md, just open your favorite coding agent (like Codex, Claude Code, or T3 Code) and speak naturally as usual.

I created a local empty directory containing only a few lines of AGENTS.md and tested it directly with Codex: I asked it to build a landing page skeleton for a new project called 'PulseNote voice flash notes', also use the local gemini-api to check the latest models, generate a 16:9 hero image and a two-person welcome voiceover, and launch a background Deep Research for competitor research.

Codex automatically reads AGENTS.md and explores calling gemini-apiCodex completes landing page integration and multimodal pre-check delivery

This is the PulseNote landing page preview it built:

Codex auto-built PulseNote landing page with asset paths

Real experience

If you want to use your personal monthly subscription quota and comfortably use Gemini 4 Neon / Hydrogen as your main interactive programming assistant, T3 Code + antigravity-acp is still the best choice.

But if you're already used to Claude Code, Codex, or your own automation workflows, then using gemini-api-cli is very good, mainly because Google is generous and also provides free credits.

Moreover, I increasingly feel that a form like gemini-api with a single-file zero-dependency CLI + self-describing --schema / --dry-run + a section of AGENTS.md is much cleaner in many scenarios than starting a bunch of persistent MCP servers.

Summary

Whether it's letting Claude Code automatically create a set of images and voiceover for a front-end project, using Gemini's multimodal base to quickly extract conclusions from hundreds of megabytes of recordings and long PDFs, or running a Deep Research in the background for long-range technical research, gemini-api-cli reduces the integration cost to nearly zero.

The open-source project link is here; if you're interested, you can pull it down and plug it into your own agent to try.

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