Skip to main content

Introduction

Gemini CLI is Google’s official command-line tool that allows developers to interact with Gemini AI models through the terminal. By configuring ElkAPI API, you can use various advanced AI models provided by ElkAPI in Gemini CLI, including GPT, Claude, and Gemini series.

Prerequisites

Before getting started, ensure you have:
  1. Node.js and npm installed
    Download and install from Node.js official website (v16 or higher recommended)
  2. ElkAPI API Key
    Log in to ElkAPI Console to obtain your API key (starts with sk-)
Tip: If you don’t have an ElkAPI account yet, register at ElkAPI first and obtain an API key.

Step 1: Install Gemini CLI

1.1 Global Installation

Install Gemini CLI globally using npm:

1.2 Verify Installation

Check if the installation was successful:
If it displays a version number, the installation was successful.

Step 2: Configure ElkAPI API

2.1 Temporary Environment Variables

For testing or one-time use, expires when terminal is closed: Windows (PowerShell):
macOS/Linux (Bash):
Write configuration to system, automatically applies on every terminal session: Windows (PowerShell):
  1. Run PowerShell as Administrator
  2. Execute the following commands to set user-level environment variables:
  1. Restart PowerShell or execute the following commands to refresh environment variables:
macOS/Linux (Bash):
  1. Edit the configuration file (choose based on your shell):
  1. Add the following at the end of the file:
  1. Save the file and reload configuration:

2.3 Using .env File

Create a .env file in your project directory:
Then load environment variables before running commands: macOS/Linux:
Windows (PowerShell):
Important:
  • Replace sk-xxxxxxxxxxxx with your actual API key from ElkAPI Console
  • Set GEMINI_BASE_URL to https://api.elkapi.com/v1 to ensure Gemini CLI connects to ElkAPI
  • If using .env file, add it to .gitignore to avoid exposing your API key

2.4 Verify Configuration

Check if environment variables are set correctly: macOS/Linux:
Windows (PowerShell):
If the correct values are displayed, the configuration is successful.

Step 3: Start Using Gemini CLI

3.1 Basic Conversation

Start interactive conversation:
Or send a one-time request:

3.2 Specify Model

Chat with a specific model:
Or:

Step 4: Using ElkAPI API with Code

2.1 Using Python SDK

2.2 Using JavaScript/TypeScript

2.3 Using cURL

Step 3: Choose the Right Model

Gemini Series: GPT Series: Claude Series:
Model Selection Tips:
  • 🚀 Google Ecosystem: gemini-3.1-flash-lite-preview, gemini-3.1-pro-preview
  • 💡 Code Development: claude-sonnet-4-6, gpt-5.5
  • 💰 Cost Optimization: gpt-5.4-mini, claude-sonnet-4-6
  • Fast Response: gemini-3.1-flash-lite-preview, gpt-5.4-mini

Advanced Features

Multimodal Support

Streaming Output

FAQ

Q1: How to verify API configuration?

Q2: Supported Programming Languages?

ElkAPI API supports all programming languages that can send HTTP requests:
  • Python - Recommended with OpenAI SDK
  • JavaScript/TypeScript - Node.js and browser
  • Java - HTTP client
  • Go - Standard library or third-party packages
  • PHP - cURL or Guzzle
  • Ruby - HTTP library
  • C#/.NET - HttpClient
  • Swift - URLSession
  • Other languages - Any language supporting HTTP

Features

Using Google AI Studio + ElkAPI, you can:
  • 🤖 Multi-model Support - Access GPT, Claude, Gemini, and more
  • 🌍 OpenAI Compatible - Standard OpenAI API format
  • High Performance - Low latency, high concurrency
  • 💰 Transparent Pricing - Clear pay-as-you-go pricing
  • 📊 Usage Monitoring - Real-time API call tracking
  • 🔒 Secure & Reliable - Enterprise-grade security
  • 🚀 Quick Integration - Simple API calls
  • 📚 Complete Documentation - Detailed development docs and examples

Support & Help

If you encounter any issues:

Get Started with ElkAPI

Sign up for ElkAPI now, get your API key, and use multiple AI models in Google AI Studio!