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. 
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. 
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:

T3 Code + ACP: suitable if you already have an AI Pro / Ultra personal subscription and want a much more comfortable interface than Antigravity to use Gemini as your main interactive agent;
gemini-cli (command: gemini): Google's official interactive terminal main agent positioned against Claude Code, requiring you to switch into its dedicated REPL session window to modify code;
gemini-api-cli (command: gemini-api): as the official README's first line says—
"Gemini models and managed agents for the agent you already use."
It doesn't compete for the main entry point, but compiles to a stateless single-file binary in pure Go, serving as an underlying external helper for the Claude Code, Codex, OpenClaw, Hermes, or CI scripts you're already using.
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:
While writing front-end pages, generate a full set of multimodal assets on the fly:
"Help me write a modern landing page for this new tool. Call the local gemini-api to generate a mascot hero image and a two-person dialogue welcome voiceover, save them directly to ./assets directory, and embed them into the page components after getting the returned file paths."
Process large PDFs, meeting recordings, and design drafts for visual comparison:
"Use gemini-api to analyze product-brief.pdf in the current directory, compare the visual changes between before.png and after.png, transcribe interview.mp4 into an SRT subtitle with timestamps, and finally summarize into a first-phase development schedule written to plan.md."
Background asynchronous delegation of long-range research + cross-model review:
"First use gemini-api to launch a deep-research managed agent in the background to investigate mainstream competitors' caching solutions (note the returned interaction ID), and at the same time call gemini-4-neon to independently review the concurrency deadlock risk of the current cache module, then merge the conclusions after the background research completes."
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. 
The whole collaboration logic is clear from the diagram above, with three core points:
- Zero context burden when idle: unlike traditional MCP which fills the system prompt with dozens of tool schemas once connected,
gemini-apistays completely silent normally; only when needed does the main agent invoke--usageor--schemato check parameters on demand. - Offline pre-check before real debugging: before sending a real request, the agent can use
--dry-runto validate and preview the complete HTTP request body locally. - Results feed directly back into the main workflow: generated images, voiceovers, music, and videos automatically save to disk, and the standard output returns only a clean line with a local file path; document analysis or background Deep Research returns in compact
TOON/JSONformat that the main agent can use to continue modifying code.
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:

I've also clarified the specific claiming and deduction rules:
- Three tiers earn monthly: Google AI Pro gives $10 in API credits per month; Google AI Ultra 5x gives $40 per month; the top-tier Google AI Ultra 20x ($199.99/month) gives $100 per month directly (note: the $4.99 AI Plus doesn't get it, and only the subscription's primary account can claim; shared family sub-accounts don't receive it).
- Unused credits roll over: each granted credit lasts up to 12 months, and if you don't use it all in the month, it automatically accumulates into following months.
- How to claim them: log into Google AI Studio with your subscription's primary account, click Claim free API credits in the left menu, follow the guide to bind billing and an API Key, and check the box to automatically apply subsequent monthly credits.


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.


This is the PulseNote landing page preview it built:

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.