Skip to main content
Configure Gemini CLI to use Nordlys’s Mixture of Models model.
Mixture of Models model with prompt‑activated specialists. Works as a drop-in replacement for Gemini CLI’s API backend with lab-grade quality and cost control.

Benefits of Using Gemini CLI with Nordlys

When you integrate Gemini CLI with Nordlys, you unlock powerful capabilities:
  • Mixture of Models Activation: The right specialists activate per prompt
  • Cost Optimization: Lower costs without sacrificing quality
  • Consistent Quality: Stable outputs across coding tasks
  • Usage Analytics: Monitor model usage, costs, and performance in real-time
  • Simplified Configuration: Single API key for all Gemini model variants

Get Your Nordlys API Key

Sign up here to create an account and generate your API key.

Quick Setup

Run Automated Installer

curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/gemini-cli.sh | bash
The installer will automatically:
  • Install Gemini CLI if not present (via npm)
  • Configure environment variables for Nordlys Nordlys model
  • Add configuration to your shell profile (~/.bashrc, ~/.zshrc, etc.)
  • Verify the installation

Verify Configuration

gemini --version
echo $GEMINI_API_KEY
echo $GOOGLE_GEMINI_BASE_URL

Start Using

gemini "explain quantum computing"
Nordlys will activate the right specialists for the task.

Manual Installation

If you prefer to set up Gemini CLI manually or need more control over the installation process:

Step 1: Install Gemini CLI

npm install -g @google/gemini-cli

Step 2: Configure Environment Variables

# Gemini CLI with Nordlys AI model API Configuration
export GEMINI_API_KEY="your-nordlys-api-key-here"
export GOOGLE_GEMINI_BASE_URL="https://api.nordlylabs.com/v1beta"

Step 3: Apply Configuration

# For Bash/Zsh
source ~/.bashrc  # or ~/.zshrc

# For Fish
source ~/.config/fish/config.fish

# Or restart your terminal

Step 4: Verify Installation

gemini --version
gemini "test connection"

Alternative Setup Methods

export NORDLYS_API_KEY='your-api-key-here'
curl -fsSL https://raw.githubusercontent.com/Nordlys-Labs/nordlys/main/scripts/installers/unix/gemini-cli.sh | bash
# The installer will automatically configure your shell

Advanced Configuration

Model Selection

Set the model ID explicitly when needed:
export GEMINI_MODEL='nordlys/hypernova'
gemini "analyze this codebase"

Usage Examples

# Start interactive chat session
gemini

# Or with a specific prompt
gemini "help me debug this code"

Troubleshooting

Problem: Gemini CLI installation failsSolutions:
  • Ensure Node.js 18+ is installed: node --version
  • Install Node.js if needed:
    # Using nvm (recommended)
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
    nvm install 22
    
  • Check npm permissions: npm config get prefix
  • Try with sudo (not recommended): sudo npm install -g @google/gemini-cli
Problem: “Unauthorized” or “Invalid API key” errorsSolutions:
  1. Verify your API key at nordlylabs.com/dashboard
  2. Check environment variables are set:
    echo $GEMINI_API_KEY
    echo $GOOGLE_GEMINI_BASE_URL
    
  3. Ensure variables are exported in your shell config:
    # Bash/Zsh
    source ~/.bashrc  # or ~/.zshrc
    
    # Fish
    source ~/.config/fish/config.fish
    
  4. Restart your terminal if changes were made to shell config
  5. Verify the base URL is correct: https://api.nordlylabs.com/v1
Problem: Cannot connect to Nordlys APISolutions:
  • Check internet connectivity
  • Verify base URL is correct: echo $GOOGLE_GEMINI_BASE_URL
  • Test API directly:
    curl -X POST https://api.nordlylabs.com/v1/chat/completions \
      -H "Authorization: Bearer $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "nordlys/hypernova",
        "messages": [{"role": "user", "content": "Hello"}]
      }'
    
  • Check if your network/firewall blocks the API endpoint
Problem: Requests fail due to a model ID errorSolutions:
  1. Set the model ID explicitly:
    export GEMINI_MODEL='nordlys/hypernova'
    
  2. Confirm the value is spelled exactly and matches the docs.
Problem: Slow response times or timeoutsSolutions:
  • Verify rate limits aren’t exceeded
  • Check your internet connection speed
  • Reduce prompt size or request complexity

Uninstallation

If you need to remove Gemini CLI or revert to Google’s API:
1

Remove Gemini CLI

npm uninstall -g @google/gemini-cli
2

Remove Environment Variables

Edit your shell config file and remove these lines:
# Gemini CLI with Nordlys AI model API Configuration
export GEMINI_API_KEY="..."
export GOOGLE_GEMINI_BASE_URL="..."
3

Reload Shell Configuration

source ~/.bashrc  # or ~/.zshrc or ~/.config/fish/config.fish

Next Steps


Was this page helpful? Contact us at [email protected] for feedback or assistance with your Gemini CLI integration.