API429 / Gemini CLI

Gemini CLI with API429: Gemini API key mode and Google GenerateContent

Gemini CLI communicates through Google's native GenerateContent contract rather than an OpenAI-compatible chat endpoint. To connect API429, configure the gateway origin without /v1, set the API version to v1beta, select Use Gemini API key and test gemini-3.8-flash in a disposable directory first.

Configuration is based on the application’s public documentation and the API429 contract. Native client execution, installation imports and agent workflows have not been verified here. Start with a short non-sensitive request and inspect the response in your installed version.

Connection settings

Protocol
Google GenerateContent
Connection mode
Gemini API key (x-goog-api-key)
Base URL
https://gateway.api429.com
Exact model ID to check
gemini-3.8-flash

Check access for your key with GET /v1/models. A public model card does not guarantee availability in your application. Store the key in the application’s secure credential store or the current session environment. Keep secret values out of command arguments and shared project files.

Verify Node.js prerequisites and the pinned CLI package

Check your local runtime against the official Gemini CLI installation requirements before installing the package: the inspected build requires Node.js 20 or newer. On the review date, @google/gemini-cli@0.65.0 was observed in npm while the published changelog page showed release 0.64.0 dated October 13. Those version numbers record inspected package metadata and documentation rather than a live execution claim across every operating system.

The installation example pins @google/gemini-cli@0.65.0 explicitly instead of pulling an unpinned latest tag, so future CLI changes do not silently alter environment variable names or authentication prompts. After installing, run gemini --version in a clean terminal to confirm which binary is on your PATH before you export any connection settings.

Reconcile authentication docs with the Code Assist transition

When reviewing official Google documentation, keep two dated facts in view. On May 19, 2026, Google announced the transition from Gemini CLI toward Antigravity CLI, stating that consumer free, Pro and Ultra Code Assist requests in Gemini CLI end on June 18, 2026. At the same time, the Gemini CLI authentication page continues to list Google sign-in alongside Use Gemini API key and Vertex AI.

Do not misread that May 19, 2026 consumer Code Assist notice as a blanket shutdown of every paid API-key or enterprise path, and do not assume that consumer login plans apply to a custom gateway. This guide covers only the paid API-key path selected via Use Gemini API key, which corresponds to the gemini-api-key connection mode. It does not claim compatibility with Antigravity CLI, which would require its own verified connection contract.

Set the Google origin, v1beta version and hidden key

In your current Bash session, export GEMINI_MODEL=gemini-3.8-flash, GOOGLE_GEMINI_BASE_URL=https://gateway.api429.com and GOOGLE_GENAI_API_VERSION=v1beta. Note that GOOGLE_GEMINI_BASE_URL must be the gateway origin without a trailing /v1 path segment. Collect GEMINI_API_KEY using hidden terminal input via read -r -s so the key never appears in shell history or process arguments, and unset all four environment variables as soon as you exit the client.

When Gemini CLI prompts for an authentication method, choose Use Gemini API key (gemini-api-key). Google OAuth login and Vertex AI use different credential flows and are not interchangeable with an API429 key. If you previously used Gemini CLI on the same machine, inspect your user settings first so a persisted sign-in mode does not override the API-key selection, and never overwrite credentials belonging to other workspaces.

Distinguish native GenerateContent from other CLI protocols

Gemini CLI requires native Google paths such as /v1beta/models/{model}:generateContent, :streamGenerateContent and :countTokens with x-goog-api-key authentication. The canonical API429 public OpenAPI checked on October 25 does not enumerate these generateContent, streaming or token-counting methods, their /gemini aliases, or this authentication header. These client settings describe a candidate configuration, not verified gateway support. Before launching, obtain a current documented contract for the exact native methods and authentication required by your installed CLI. Schema omission leaves support unconfirmed; a model catalog entry does not resolve it.

Keep this contract separate from other terminal coding tools. Gemini CLI calls /v1beta/models/{model}:generateContent with x-goog-api-key, Codex CLI calls OpenAI POST /v1/responses with Bearer authentication, and Claude Code CLI calls Anthropic POST /v1/messages with x-api-key (/en/integrations/claude-code). A working OpenAI Compatible configuration in an editor or another CLI cannot be transferred to Gemini CLI simply by changing the model name.

Run a disposable check and separate agent tools from token billing

Before starting the interactive CLI, confirm that gemini-3.8-flash appears in an authenticated GET /v1/models check for your key; a public catalog listing alone does not guarantee access for every credential. Launch gemini inside an empty test folder and send one short nonconfidential question. If you encounter a 404 or 401 error, inspect the origin URL, v1beta setting and selected authentication mode using redacted error output rather than retrying in a loop.

Even a separately documented native method would not prove that every Gemini CLI agent feature works end to end. Native CLI execution, MCP servers, local tool loops and sandbox modes were not run for this guide. Confirm generateContent, streamGenerateContent and countTokens support for your exact connection before relying on these settings. Token counting is not a hard spending limit: context assembly, follow-up turns and repeated commands can consume billed tokens.

Settings and examples

Check Node.js and install the pinned CLI version

node --version
npm install -g @google/gemini-cli@0.65.0
gemini --version

Bash: Google API environment variables and manual API key session

read -r -s -p "API429 key: " GEMINI_API_KEY
printf "\n"
export GEMINI_API_KEY
export GEMINI_MODEL=gemini-3.8-flash
export GOOGLE_GEMINI_BASE_URL=https://gateway.api429.com
export GOOGLE_GENAI_API_VERSION=v1beta
gemini
unset GEMINI_API_KEY GEMINI_MODEL GOOGLE_GEMINI_BASE_URL GOOGLE_GENAI_API_VERSION

Usage and next steps

Hypothetical hourly workload: 30 requests to gemini-3.8-flash, each with 5,000 ordinary input and 512 output tokens, costs approximately $0.05 at current API429 rates. Cache, tools, retries, application subscriptions and other fees are excluded. Catalog date: .

Actual usage depends on request count, context length and response size. Check your API429 account for actual charges.

API reference · API429 documentation · Help and diagnostics

Payment and a $10 test

  • Russian bank card. Top up your balance in the account.
  • Invoice for companies. Bank transfer with closing documents.
  • USDT and TON. Top up in crypto.

$10 test credit. Subscribe to our Telegram channel through the bot and get $10 on your balance for the first requests. Get $10 in the bot

Frequently asked questions

Why does GOOGLE_GEMINI_BASE_URL omit the /v1 path suffix?

Gemini CLI uses Google's native GenerateContent contract with GOOGLE_GENAI_API_VERSION=v1beta and builds /v1beta/models/{model}:generateContent from the origin https://gateway.api429.com.

Which authentication option should I select inside Gemini CLI?

Select Use Gemini API key (the gemini-api-key mode) so the client reads GEMINI_API_KEY and sends x-goog-api-key. Google account sign-in and Vertex AI use incompatible credential flows.

How does the May 19, 2026 Antigravity announcement affect this setup?

Google's May 19, 2026 update ended consumer free, Pro and Ultra Code Assist requests on June 18, 2026 while keeping paid API-key and enterprise paths distinct. Although auth docs still mention sign-in, use only Use Gemini API key here.

Does GenerateContent support prove MCP, sandbox or Claude Code parity?

No. Native /v1beta/models/{model}:generateContent differs from Claude Code's POST /v1/messages contract, and MCP servers, sandbox execution and full Gemini CLI agent loops were not executed.

Sources

The application documentation defines its interface and limitations; API429 documentation defines addresses, authentication and client methods. Connection configuration checked: .

Telegram