Skip to main content

1. Overview

Gemini CLI is Google’s official command-line AI coding tool that lets you interact with Gemini models directly from your terminal. Through GravitexAI as the gateway, you can:

Terminal-native

Call Gemini 3.5 / 3.1 / 2.5 models right from your shell

AI-assisted coding

Code generation, review and unit-test automation

Smart Q&A

Tech questions, architecture design and debugging

Docs generation

Auto-generate READMEs, API docs and JSDoc comments
Using GravitexAI as the gateway gives you optimized connectivity, unified API key management, and one-stop access to Claude, GPT and Gemini under a single account.

2. Prerequisites

  • Node.js ≥ 18.0.0
  • npm or yarn
  • An API key from the GravitexAI console (format sk-xxxxxxxxxx)

3. Quick Start

Step 1 — Install Gemini CLI

Step 2 — Get a GravitexAI API key

1

Sign in to GravitexAI

Go to maas.gravitex.ai and register or log in.
2

Create an API key

Open the API Keys page and click “Create new token”.
3

Copy the key

Copy the generated key (format: sk-xxxxxxxxxx) and store it safely.

Step 3 — Configure environment variables

Important: GOOGLE_GEMINI_BASE_URL must be set to https://api.gravitex.ai. Do not append /v1, /gemini, or any other path — it will break the connection.

Step 4 — Initialize and test

1

Start the CLI

2

First-time auth

In the interactive UI, type:
Choose Gemini API Key (AI Studio).
3

Test the connection

GravitexAI ships with the latest Gemini family. All of these are callable from the CLI:
Suggested defaults:
  • Complex coding / architecture: gemini-3.1-pro-preview
  • Daily coding & Q&A: gemini-3.5-flash
  • Batch / high-frequency: gemini-3.1-flash-lite-preview
See the GravitexAI model list for the full catalog.

5. Core Features

5.1 Code generation

Sample output:

5.2 Code review

5.3 Technical Q&A

5.4 Documentation generation

6. Interactive Commands

Switching models: use /model interactively, or specify via --model:

7. Advanced Usage

7.1 GitHub Actions (automated review)

7.2 Batch scripts

8. FAQ

Checklist:
  1. Env vars correct?
    Expected:
    • GOOGLE_GEMINI_BASE_URL: https://api.gravitex.ai (no /v1 or other path)
    • GEMINI_API_KEY: full sk-… key
  2. Reload env:
  3. Restart terminal: close and reopen the terminal window.
  4. Validate the key in the GravitexAI console — ensure it’s active and has balance.
Option A — interactive /model:
Option B — CLI flag:
Method 1: use /save
Method 2: shell redirection
Use nvm to manage Node:
Possible causes and fixes:
  1. Network: GravitexAI provides optimized routes; check status on the console.
  2. Model choice: use gemini-3.5-flash or gemini-3.1-flash-lite-preview for fastest responses.
  3. Token size: reduce request complexity and context length.
Benchmark:
PowerShell (recommended):
  1. Install Node.js from nodejs.org
  2. Open PowerShell as Administrator
  3. Set env vars:
  4. Restart PowerShell
  5. Install: npm install -g @google/gemini-cli
Or use WSL for a more native experience.

9. Best Practices

Prompt design

Be specific

❌ “Optimize this code”✅ “Optimize this code for performance, focus on loop efficiency and memory use”

Provide context

❌ “What’s wrong with this function?”✅ “This handles user login and throws an async error — help me find the bug”

Break into steps

❌ “Build the whole project”✅ “Step 1: design DB model; Step 2: build API routes; Step 3: …”

Ask for examples

❌ “Explain closures”✅ “Explain JS closures with 3 practical scenarios and code examples”
1

Define the problem

Clearly describe what you want to solve or build.
2

Get a solution

Use Gemini CLI to draft an initial solution or code.
3

Review & refine

Ask the AI to review its own output and flag issues.
4

Iterate

Improve step by step based on feedback.
5

Add docs

Generate comments and documentation.

10. References

Get going in 5 minutes: follow the “Quick Start” section above and you’ll be using Gemini CLI in no time.