spiderai
Log inGet an API key

DOC 04Clients

Gemini CLI Setup Guide

Install Gemini CLI, configure the spiderai endpoint and key, and verify the connection from the command line.

Tested 2026-11-04 · Gemini CLI 0.66.0
Your system

Gemini CLI is Google’s official AI assistant for the terminal. Follow these steps to install it and connect it to spiderai.

Note
Before you start, complete the Node.js installation guide.

Step 1: Install Gemini CLI

BASH
sudo npm install -g @google/gemini-cli

On macOS you can also use Homebrew:

BASH
brew install gemini-cli

Verify installation; a version number means it worked:

TERMINAL
gemini --version

Step 2: Configure environment variables

Set these three environment variables to connect Gemini CLI to spiderai:

GOOGLE_GEMINI_BASE_URLEndpoint, without /v1
https://api.spiderai.fun
GEMINI_API_KEYAPI key from a Gemini group
YOUR_API_KEY
GEMINI_MODELModel to use
gemini-3.8-flash

Temporary (current terminal only):

BASH
export GOOGLE_GEMINI_BASE_URL="https://api.spiderai.fun"
export GEMINI_API_KEY="YOUR_API_KEY"
export GEMINI_MODEL="gemini-3.8-flash"

Persistent (applies to new terminals):

BASH
echo 'export GOOGLE_GEMINI_BASE_URL="https://api.spiderai.fun"' >> ~/.bashrc
echo 'export GEMINI_API_KEY="YOUR_API_KEY"' >> ~/.bashrc
echo 'export GEMINI_MODEL="gemini-3.8-flash"' >> ~/.bashrc
source ~/.bashrc
Tip
Replace YOUR_API_KEY with a Gemini group key copied from API Keys. To use another model, change GEMINI_MODEL.

Step 3: Start using Gemini CLI

Run this from your project directory:

TERMINAL
gemini

On the first start, choose Trust folder, then choose Use Gemini API Key as the sign-in method (preselected when GEMINI_API_KEY is set) and press Enter. You can then start chatting.

Test command

After the first-start setup, ask a one-off question in the same directory:

TERMINAL
gemini -p "Hello"
Settings for command-line mode (-p) onlyRunning gemini -p before the first-start setup fails with Invalid auth method selected.

Write ~/.gemini/settings.json to select API key sign-in:

BASH
mkdir -p ~/.gemini
cat > ~/.gemini/settings.json << 'EOF'
{ "security": { "auth": { "selectedType": "gemini-api-key" } } }
EOF
Note
This overwrites an existing settings.json; if you have one, merge security.auth.selectedType into it instead.

In a folder you have not trusted, add --skip-trust:

TERMINAL
gemini -p "Hello" --skip-trust

For more information, see the Google AI documentation.