# Gemini CLI

Source: https://docs.aicentos.com/en/clients/gemini-cli

Language: en

> Use aicentos in Gemini CLI — configure a custom gateway through environment variables

Gemini CLI is an official command-line tool from Google that supports configuring a custom gateway through environment variables to connect to the Codex Proxy service, letting you chat with Gemini models in the terminal.

## Prerequisites

Gemini CLI is installed globally via npm, so you need Node.js 18+ and npm ready first.

### Install Node.js

* Visit the official Node.js download page: [https://nodejs.org/en/download](https://nodejs.org/en/download)
* macOS/Windows: download and install the LTS version
* Linux: install using the distro instructions on that page
* macOS (Homebrew users): run `brew install node`

### Verify the installation

```bash
node -v
npm -v
```

## Install Gemini CLI

Install Gemini CLI globally with npm:

```bash
npm install -g @google/gemini-cli
```

Verify the installation:

```bash
gemini --version
```

## Configure environment variables

Gemini CLI supports connecting to a custom gateway through the following three environment variables:

| Environment variable     | Description                                                             |
| ------------------------ | ----------------------------------------------------------------------- |
| `GOOGLE_GEMINI_BASE_URL` | Root address of the gateway service; replaces Google's default endpoint |
| `GEMINI_API_KEY`         | Your API Key                                                            |
| `GEMINI_MODEL`           | The default model to use                                                |

### Example configuration

```bash
export GOOGLE_GEMINI_BASE_URL="https://aicentos.com"
export GEMINI_API_KEY="your_api_key_here"
export GEMINI_MODEL="gemini-2.0-flash"
```

### Notes

* `GOOGLE_GEMINI_BASE_URL` takes the service root address; no specific API path is needed
* Quick tests: run the export commands above directly in the current shell session
* To persist: add the export statements to `~/.zshrc` or `~/.bashrc`, then run `source ~/.zshrc` to apply them

## Launch Gemini CLI

Once configured, start it by running:

```bash
gemini
```

After launching, you can chat with Gemini models right in the terminal.

## Verify the connection

Start a conversation in Gemini CLI; if replies come back normally, the integration is working.

### Troubleshooting

* For authentication errors, confirm that `GEMINI_API_KEY` is correct
* Check that `GOOGLE_GEMINI_BASE_URL` points to the correct service address

## Notes

* The service already supports the Gemini-compatible interface and works with Gemini CLI directly
* Add the environment variables to a shell configuration file so they persist
* Gemini CLI appends the API path automatically; there is no need to add a specific API path to the BASE\_URL

## Related links

* Official documentation: [https://docs.aicentos.com/clients/gemini-cli.html](https://docs.aicentos.com/clients/gemini-cli.html)