How to call Gemini 4 Hydrogen from Claude Code: gemini-api CLI, Docs MCP and skills
Google's docs describe ways to use Gemini from a coding agent such as Claude Code: the gemini-api CLI to call Gemini 4 Hydrogen from the shell, a Gemini Docs MCP server and installable skills. Here are the documented commands, what each is for, and what it costs.
Google released Gemini 4 Hydrogen on November 12, 2026, built for speed and efficiency in everyday coding and agent work, at $1.50 per million input tokens and $7.50 per million output tokens. If you work in Claude Code, the practical question is how to use it without leaving your setup. Google's coding-agent docs list five resources for connecting an agent to Gemini; three of them are the ones a Claude Code user needs, and this guide collects their documented commands.
We have not run these commands ourselves yet. They come from Google's developer documentation, pricing page and announcement, read on November 18, 2026; where we combine two documented pieces into one command, we say so next to it. The gemini-api CLI is an open-source beta, and Google warns that breaking changes can occur between minor versions.
Which Google tools work with Claude Code?
Three: the gemini-api CLI, which Claude Code runs through its shell to call Gemini models; the Gemini Docs MCP server; and Google's Gemini agent skills. None of them is a way to swap the model Claude Code itself uses; they let it call Gemini or read Gemini's docs.
- gemini-api CLI: a command-line client that Claude Code runs through its shell to send prompts and files to a Gemini model, including Hydrogen.
- Gemini Docs MCP server: gives Claude Code live search over the Gemini API documentation, for when you are writing code that calls Gemini.
- Gemini agent skills: rules and SDK patterns Claude Code loads when it works on Gemini API code.
Google's CLI page says gemini-api works with Antigravity, Claude Code, Cursor and any standard shell. It describes the tool as a stateless API client, not an interactive coding agent like its separate Gemini CLI. Google's fourth and fifth resources are an Antigravity-only plugin and Markdown versions of every docs page.
How do you install the gemini-api CLI?
Run Google's install script, install with Go, or download a prebuilt binary, then set a Gemini API key.
# macOS or Linux (Google's install script)
curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash
# Same script, pinned to a release tag
curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | GEMINI_VERSION=<release-tag> bash
# Windows (PowerShell)
iwr -useb https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.ps1 | iex
# Or with Go
go install github.com/google-gemini/gemini-api-cli/cmd/gemini-api@latestPiping a script into bash runs whatever the URL serves, so read install.sh first, or use the versioned prebuilt archives from the project's GitHub releases, which Google recommends for pinning exact versions in Docker images and CI. Pinning matters because the CLI is still in beta.
Create a key in Google AI Studio, then either export it or save it to your OS keychain (macOS Keychain, Linux Secret Service or Windows Credential Manager). Then check which credential is active and preview a request without sending it:
export GEMINI_API_KEY="YOUR_API_KEY"
# or store it in the macOS Keychain / Linux Secret Service
gemini-api configure --api-key "YOUR_API_KEY"
gemini-api whoami
gemini-api generate "Confirm CLI setup in one sentence." --dry-runGoogle's docs say to set GEMINI_API_KEY in both your shell and your agent's subprocess environment, to treat it as a secret, and to inject it from a secret store in CI rather than commit it. Passing --no-keyring stores the key in plain text in ~/.config/gemini-api/config.yaml instead of the keychain.
How do you call Gemini 4 Hydrogen from Claude Code?
Ask Claude Code to run gemini-api generate with the model flag set to gemini-4-hydrogen; it can pipe in a diff or a log with --stdin.
Each gemini-api command picks a default model for its task, and --model (or -m) chooses another. gemini-api models lists what is available. The generate command streams text to standard output, --stdin pipes text into the prompt, and --previous-interaction-id continues an earlier exchange. For example, a second-opinion review of your working changes:
git diff | gemini-api generate -m gemini-4-hydrogen --stdin \
"Review this diff for bugs. List each issue with file and line."That diff example is ours, built from the documented --stdin and -m flags. Check the diff for keys or customer data before sending it, and use a paid project for private code (see costs below). For output that Claude Code will parse, Google's docs say to add --stream=false with -o json, since streaming commands cannot return a single JSON object otherwise; --agent-mode returns structured JSON errors. gemini-api analyze -i takes files such as PDFs, screenshots, audio, video and CSV, inline up to 14 MB of raw data; larger files go through gemini-api files upload --wait, which returns a files/<id> URI you can reuse, and the Files API deletes uploads after 48 hours. Hydrogen itself outputs text only.
The CLI returns typed exit codes, which helps an agent react without parsing error text: 0 success, 1 runtime or API error (including rate limits), 2 usage error, 3 authentication failure.
How do you set Hydrogen's thinking level from the CLI?
Pass a generation_config with thinking_level through the --body flag, which takes Interactions API options that have no dedicated flag.
Hydrogen supports four thinking levels: low, medium, high (the default) and xhigh. Google's guidance is to start with high and reserve xhigh for hard multi-step problems, because it adds latency and tokens and can overthink simple extraction tasks. The --body flag merges a raw Interactions API payload with the command's flags, and the CLI docs list generation_config among the fields it can set. The thinking docs show thinking_level inside generation_config. The command below combines the two; it is not a published Google example, so check the field with --schema and preview with --dry-run before relying on it:
gemini-api generate --schema > generate-schema.json
gemini-api generate -m gemini-4-hydrogen \
--body '{"generation_config": {"thinking_level": "low"}}' \
"Summarize what this function does: ..." --dry-run -o jsonDrop --dry-run to send it. If --body and a flag set the same key, the command fails with exit code 2 rather than guessing. Google's docs also show "store": false in --body to skip storing the interaction. For picking a level, Google suggests testing all four with a high max_output_tokens and using the lowest one that meets your quality bar; minimal is not supported on Gemini 4 models.
How do you give Claude Code current Gemini API docs?
Add Google's Gemini Docs MCP server with one claude mcp add command, and optionally install Google's gemini-api-dev skill.
This route is for a different job. Google notes that coding agents often suggest deprecated models or the old google-generativeai SDK; connecting the docs helps Claude Code avoid that when it writes an app that calls the Gemini API. The MCP server provides two tools, gemini_search_docs and gemini_get_doc.
claude mcp add --transport http geminiDocs https://gemini-api-docs-mcp.dev
# Optional: Google's skill with SDK patterns and current model names
npx skills add google-gemini/gemini-skills --skill gemini-api-dev --globalRestart the Claude Code session afterwards; Google's troubleshooting notes say most agents load MCP servers and skills only when they start. To test it, Google suggests asking the agent to look up the Interactions API request schema; a configured agent will call gemini_search_docs. Run /mcp to check the server and /skills to check the skill. If a global skill is ignored, Google suggests installing it in the project root without --global.
Can your own app use Hydrogen through an OpenAI-compatible API?
Yes, in code you write (this does not change Claude Code): Google's OpenAI compatibility layer accepts the OpenAI Python and JavaScript libraries with a Gemini key and a different base URL.
from openai import OpenAI
client = OpenAI(
api_key="GEMINI_API_KEY",
base_url="https://generativelanguage.googleapis.com/v1beta/openai/"
)
response = client.chat.completions.create(
model="gemini-4-hydrogen",
reasoning_effort="high",
messages=[{"role": "user", "content": "Explain this stack trace: ..."}]
)The example is Google's Python snippet with our prompt and a reasoning_effort line added. Google maps OpenAI's reasoning_effort values onto Gemini 4 thinking levels: minimal and low both become low, medium stays medium, high stays high, and xhigh works only on gemini-4-hydrogen. Without reasoning_effort, the model's default applies; thinking cannot be turned off on Gemini 4 models.
What does it cost, and what limits apply?
Hydrogen costs $1.50 and $7.50 per million input and output tokens on the paid tier and is free on the Gemini API free tier, where Google uses your traffic to improve its products.
- Paid tier: $1.50 per million input tokens, $7.50 per million output tokens including thinking tokens, $0.075 per million for cached input (implicit caching only). Google bills every token the model processes, including tool instructions when using grounding.
- Free tier: no charge, but Google's pricing table marks free-tier data as used to improve its products. Paid-tier data is not. Keep private code on a paid project.
- Rate limits apply per project, not per key, across requests per minute, tokens per minute and requests per day; daily quotas reset at midnight Pacific time. Your project's limits are shown in AI Studio.
- Tier 1 (a project with a linked billing account) can have a spend-based limit of $10 per rolling 10 minutes, depending on billing history; hitting it returns 429 RESOURCE_EXHAUSTED. Tier 1's billing tier cap is $250.
- Context: 1,048,576 tokens shared by input and output. A synchronous call returns up to 65,536 output tokens by default; Google's long-decode mode goes up to 1,048,576.
Our related posts below compare Hydrogen with Claude Sonnet 5.5 on price and published benchmarks, and cover Hydrogen's launch pricing.
Copy-paste prompt for Claude Code
Try it with your AI. Paste this into Claude Code to set up gemini-api for second-opinion reviews with Gemini 4 Hydrogen. It asks before installing anything.
I want to call Google's Gemini 4 Hydrogen from this Claude Code session for
second-opinion code reviews, using Google's gemini-api CLI.
1. First check: run `gemini-api --help`. If it is not installed, show me Google's
install options from https://aistudio.google.com/docs/cli (prefer a pinned release)
and wait for my confirmation before running anything.
2. Do not ask me for my API key and never print it. Run `gemini-api whoami` to confirm a
key is active. If none is, stop and tell me to set GEMINI_API_KEY myself.
3. Run `gemini-api generate "Confirm CLI setup in one sentence." --dry-run` and show me
the result.
4. Run `git diff --stat` and scan the diff for keys, passwords or customer data. If you
find any, stop and tell me. Ask me whether my Gemini project is on the paid tier; do
not send private code otherwise.
5. Show me the exact command you will use, based on: `git diff | gemini-api generate -m
gemini-4-hydrogen --stdin "Review this diff for bugs and risky changes. List each
issue with file and line."`. Wait for my OK, then run it.
6. Summarize Gemini's findings next to your own view of each issue. Do not change any
files until I approve a specific fix.
Only use flags documented on Google's gemini-api CLI page. If a command fails, report
the exit code and stop.FAQ
What is the gemini-api CLI? A stateless command-line client from Google for agents with shell access, scripts and CI. Google says it works with Claude Code, Cursor and Antigravity; it is not an interactive coding agent.
Which thinking levels does Gemini 4 Hydrogen support? Low, medium, high (the default) and xhigh. Google suggests starting with high and keeping xhigh for hard, multi-step problems.
Related on claudefox
- Gemini 4 Hydrogen costs $1.50/$7.50, and it only gets much cheaper than Carbon on December 1
- Gemini 4 Hydrogen vs Claude Sonnet 5.5 for coding: price, speed and benchmarks
- Gemini 4 Carbon is available to paying API developers, with launch pricing that doubles after November 30
What we have not tested
We have not installed gemini-api or run any of these commands, and we have not compared Hydrogen's reviews with Claude's. Three examples are ours, built from documented flags: the git diff review, the --body thinking-level call, and the reasoning_effort line in the OpenAI snippet. If a command has changed by the time you read this, Google's CLI page is the reference.
Source: Introducing Gemini 4 Hydrogen (Google, Nov 12, 2026), Gemini API CLI (Google AI Studio docs), Coding agent setup and developer resources (Google AI Studio docs), OpenAI compatibility (Google AI Studio docs), Gemini thinking levels (Google AI Studio docs), Gemini 4 Hydrogen model page (Google AI Studio docs), Gemini API pricing (Google), Gemini API rate limits (Google AI Studio docs), gemini-api-cli (GitHub)
This story first appeared in the claudefox daily briefing for November 18, 2026.