Skip to main content
Gemini CLI uses the Gemini API. Set the API key and the gateway root URL before starting Gemini CLI.

Prerequisites

  • Gemini CLI installed, with Node.js 20+ recommended
  • An AIOHub sk- API key
  • A group assigned to the API key that can access Gemini models
  • A positive account balance
You can check local versions first:
node -v
npm -v
gemini --version

Setup

Set the variables in the shell where you start Gemini CLI:
export GEMINI_API_KEY="sk-your-api-key"
export GOOGLE_GEMINI_BASE_URL="https://api.aiohub.org"
gemini

Persist in your shell profile

echo 'export GEMINI_API_KEY="sk-your-api-key"' >> ~/.zshrc
echo 'export GOOGLE_GEMINI_BASE_URL="https://api.aiohub.org"' >> ~/.zshrc
source ~/.zshrc
Gemini CLI appends the API version path itself. Do not set GOOGLE_GEMINI_BASE_URL to a URL that already includes /v1beta.

Verify

gemini
It is often better to specify a model visible to your API key:
gemini -m gemini-2.5-flash
A normal response means the setup is working.

Troubleshooting

Restart the session and confirm that the group assigned to the API key can access Gemini models.
Clear or restart the session, then confirm that the model exists in the /v1beta/models response.
Check whether the current directory contains a .env file or Gemini CLI config that overrides the API key, model, or Base URL. Remove the conflicting setting, then reopen the terminal.