Skip to main content
Gemini CLI can connect through a custom Gemini API gateway. RunBridge AI uses the Gemini-native API for this integration.

Prerequisites

  • Node.js 22 LTS or a newer supported LTS release, and macOS, Linux, or Windows.
  • An active API key from the RunBridge AI console.
  • A Gemini text model available to your key that supports the Gemini API, streaming, and tool calling. Replace your-gemini-model-id below with its exact ID.

Install Gemini CLI

Install the official package and check its version:

Configure the gateway endpoint

Store your RunBridge AI key as RUNBRIDGE_API_KEY in your shell or secret manager. Map that value to the environment variables Gemini CLI expects:
GOOGLE_GEMINI_BASE_URL points Gemini CLI at the custom gateway. Use the API origin without /v1 or /v1beta; Gemini CLI adds the Gemini API version and model request path. It sends GEMINI_API_KEY using x-goog-api-key. The Google-login and Vertex environment switches select different authentication modes, so remove them from this shell when using RunBridge AI. For the API-key path, merge this setting into ~/.gemini/settings.json:
Keep existing settings in the file. This selects API-key authentication while the custom origin remains active. In an interactive session, /auth → Use Gemini API key selects the same method.
With Gemini CLI 0.60.0, set the API-key authentication method explicitly when using a custom endpoint. This prevents an Invalid auth method selected error in non-interactive mode.
To persist the settings, use Gemini CLI’s user-level ~/.gemini/.env file or your secret manager. Store the actual key as GEMINI_API_KEY and the origin as GOOGLE_GEMINI_BASE_URL; do not assume shell variable expansion inside a dotenv file. Keep credentials outside your project repository.

Verify the connection

First open gemini --model your-gemini-model-id in your test project and review its workspace trust prompt. Then run a non-interactive request with an explicit model from that trusted folder:
This sends a real API request and may incur usage. A response without authentication or endpoint errors confirms basic connectivity. Then launch gemini --model your-gemini-model-id in a test project to check a small coding task and tool calling.

Troubleshooting

See the official authentication guide and configuration reference for persistence and authentication details.
Last modified on September 23, 2026