Connect Gemini CLI to Nbility
Gemini CLI supports a custom gateway in Gemini API key mode. This setup uses the native Gemini protocol: set the gateway to https://api.nbility.ai, without /v1.
Install
Install an LTS version of Node.js supported by the current Gemini CLI from nodejs.org, then run:
node --version
npm --version
npm install -g @google/gemini-cli
gemini --version
Check the official Gemini CLI documentation for current requirements.
macOS / Linux
Set these variables in the terminal you will use to launch the CLI. Replace the model placeholder with a Gemini model available to your token in Models:
export GOOGLE_GEMINI_BASE_URL="https://api.nbility.ai"
export GEMINI_API_KEY="YOUR_API_KEY"
export GEMINI_MODEL="YOUR_GEMINI_MODEL"
gemini
When prompted for authentication, choose Use Gemini API Key. Google account sign-in and Vertex AI mode use different authentication paths and do not replace this gateway configuration.
Windows PowerShell
$env:GOOGLE_GEMINI_BASE_URL = "https://api.nbility.ai"
$env:GEMINI_API_KEY = "YOUR_API_KEY"
$env:GEMINI_MODEL = "YOUR_GEMINI_MODEL"
gemini
These values apply to the current terminal and its child processes. For persistent configuration, follow the official guide for private environment files and keep real keys out of project repositories.
Verify
Ask for a one-sentence explanation of API gateways, then confirm the model in Usage logs. Tool calling, image input, and context limits depend on the selected model and channel. A successful connection does not establish support for every feature.
Troubleshoot
- Still asks for Google sign-in: switch the authentication method to Gemini API key.
- 401: ensure the launching terminal has the variables and update the key.
- 404: remove an accidental
/v1or/v1betasuffix from the base URL and check the complete model ID. - Model access denied: check token groups and model restrictions, then list models again.
See Gemini compatibility for protocol examples.
References
Informed by the aicentos Gemini CLI tutorial (CC BY 4.0). Addresses, verification, and troubleshooting have been rewritten for Nbility. Consult the official configuration reference for environment variable definitions.