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-idbelow with its exact ID.
Install Gemini CLI
Install the official package and check its version:Configure the gateway endpoint
Store your RunBridge AI key asRUNBRIDGE_API_KEY in your shell or secret manager. Map that value to the environment variables Gemini CLI expects:
- macOS / Linux
- Windows PowerShell
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:
/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 opengemini --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:
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.