Back to Documentation

Gemini CLI Integration Guide

This guide explains how to install and configure the Gemini CLI to use AI models via the ValueAPI platform. Gemini CLI is a powerful AI programming assistant that supports multiple programming languages and development environments.

1. Install Gemini CLI

Install the Gemini CLI globally using npm:

npm install -g @google/gemini-cli

2. Obtain API Key

Log in to the ValueAPI Dashboard, navigate to the API Keys section, and generate a new key. You will need this key for the configuration steps below.

3. Configure Gemini CLI

Step 1: Create Environment Variables File

Depending on your operating system, create a .env file in the following location:

Windows:

C:\Users\<YourUsername>\.gemini\.env

macOS / Linux:

~/.gemini/.env

If the .gemini directory does not exist, please create it manually first. Then, add the following content to the .env file:

GOOGLE_GEMINI_BASE_URL=https://api.valueapi.ai/

If the connection fails, try changing the GOOGLE_GEMINI_BASE_URL to https://api.valueapi.ai (without the trailing slash).

Step 2: Configure Model Settings

In the .gemini directory (the same directory as the .env file), create a settings.json file and add the following configuration:

{
  "ide": {
    "hasSeenNudge": true
  },
  "security": {
    "auth": {
      "selectedType": "gemini-api-key"
    }
  },
  "base": {
    "modelConfig": {
      "generateContentConfig": {
        "temperature": 0,
        "topP": 1
      }
    }
  },
  "chat-base": {
    "extends": "base",
    "modelConfig": {
      "generateContentConfig": {
        "thinkingConfig": {
          "includeThoughts": true
        },
        "temperature": 1,
        "topP": 0.95,
        "topK": 64
      }
    }
  },
  "chat-base-2.5": {
    "extends": "chat-base",
    "modelConfig": {
      "generateContentConfig": {
        "thinkingConfig": {
          "thinkingBudget": 8192
        }
      }
    }
  },
  "chat-base-3": {
    "extends": "chat-base",
    "modelConfig": {
      "generateContentConfig": {
        "thinkingConfig": {
          "thinkingLevel": "HIGH"
        }
      }
    }
  },
  "gemini-3-pro-preview": {
    "extends": "chat-base-3",
    "modelConfig": {
      "model": "gemini-3-pro-preview"
    }
  },
  "gemini-2.5-pro": {
    "extends": "chat-base-2.5",
    "modelConfig": {
      "model": "gemini-2.5-pro"
    }
  },
  "gemini-2.5-flash": {
    "extends": "chat-base-2.5",
    "modelConfig": {
      "model": "gemini-2.5-flash"
    }
  },
  "gemini-2.5-flash-lite": {
    "extends": "chat-base-2.5",
    "modelConfig": {
      "model": "gemini-2.5-flash-lite"
    }
  },
  "gemini-2.5-flash-base": {
    "extends": "base",
    "modelConfig": {
      "model": "gemini-2.5-flash"
    }
  },
  "classifier": {
    "extends": "base",
    "modelConfig": {
      "model": "gemini-2.5-flash-lite",
      "generateContentConfig": {
        "maxOutputTokens": 1024,
        "thinkingConfig": {
          "thinkingBudget": 512
        }
      }
    }
  },
  "prompt-completion": {
    "extends": "base",
    "modelConfig": {
      "model": "gemini-2.5-flash-lite",
      "generateContentConfig": {
        "temperature": 0.3,
        "maxOutputTokens": 16000,
        "thinkingConfig": {
          "thinkingBudget": 0
        }
      }
    }
  },
  "edit-corrector": {
    "extends": "base",
    "modelConfig": {
      "model": "gemini-2.5-flash-lite",
      "generateContentConfig": {
        "thinkingConfig": {
          "thinkingBudget": 0
        }
      }
    }
  },
  "summarizer-default": {
    "extends": "base",
    "modelConfig": {
      "model": "gemini-2.5-flash-lite",
      "generateContentConfig": {
        "maxOutputTokens": 2000
      }
    }
  },
  "summarizer-shell": {
    "extends": "base",
    "modelConfig": {
      "model": "gemini-2.5-flash-lite",
      "generateContentConfig": {
        "maxOutputTokens": 2000
      }
    }
  },
  "web-search": {
    "extends": "gemini-2.5-flash-base",
    "modelConfig": {
      "generateContentConfig": {
        "tools": [
          {
            "googleSearch": {}
          }
        ]
      }
    }
  },
  "web-fetch": {
    "extends": "gemini-2.5-flash-base",
    "modelConfig": {
      "generateContentConfig": {
        "tools": [
          {
            "urlContext": {}
          }
        ]
      }
    }
  },
  "web-fetch-fallback": {
    "extends": "gemini-2.5-flash-base",
    "modelConfig": {}
  },
  "loop-detection": {
    "extends": "gemini-2.5-flash-base",
    "modelConfig": {}
  },
  "loop-detection-double-check": {
    "extends": "base",
    "modelConfig": {
      "model": "gemini-2.5-pro"
    }
  },
  "llm-edit-fixer": {
    "extends": "gemini-2.5-flash-base",
    "modelConfig": {}
  },
  "next-speaker-checker": {
    "extends": "gemini-2.5-flash-base",
    "modelConfig": {}
  },
  "chat-compression-3-pro": {
    "modelConfig": {
      "model": "gemini-3-pro-preview"
    }
  },
  "chat-compression-2.5-pro": {
    "modelConfig": {
      "model": "gemini-2.5-pro"
    }
  },
  "chat-compression-2.5-flash": {
    "modelConfig": {
      "model": "gemini-2.5-flash"
    }
  },
  "chat-compression-2.5-flash-lite": {
    "modelConfig": {
      "model": "gemini-2.5-flash-lite"
    }
  },
  "chat-compression-default": {
    "modelConfig": {
      "model": "gemini-2.5-pro"
    }
  }
}

Step 3: Launch and Configure API Key

Execute the following command in your terminal:

gemini

On the first run, Gemini CLI will guide you through the configuration process:

  1. Select Authentication Method: Choose API Key authentication.
  2. Enter API Key: Paste the API Key you obtained from the ValueAPI platform.
  3. Confirm: Press Enter to confirm.

Once configured, you can start using Gemini CLI to interact with the ValueAPI platform!

4. Usage Examples

After configuration, you can use Gemini CLI directly in your terminal:

# Start an interactive chat session
gemini

# Ask a direct question
gemini "How do I use Python to open google.com and search for ValueAPI.ai?"