Skip to content

Gemini CLI

Google's Gemini AI assistant with broad knowledge and multimodal capabilities.

Overview

Gemini CLI is Google's command-line interface for the Gemini AI model. It excels at:

  • Broad knowledge and general questions
  • Documentation and explanations
  • Multimodal tasks (when supported)
  • Research and information gathering

Installation

Install Gemini CLI from Google:

# Verify installation
which gemini
gemini --version

Basic Usage

# Use Gemini with clinvk
clinvk --backend gemini "explain how this algorithm works"
clinvk -b gemini "write documentation for this API"

Models

Model Description
gemini-2.5-pro Latest and most capable model
gemini-2.5-flash Faster, optimized for speed

Specify a model:

clinvk -b gemini -m gemini-2.5-flash "quick explanation"

Configuration

Configure Gemini in ~/.clinvk/config.yaml:

backends:
  gemini:
    # Default model
    model: gemini-2.5-pro

    # Enable/disable this backend
    enabled: true

    # Extra CLI flags
    extra_flags: []

Environment Variable

export CLINVK_GEMINI_MODEL=gemini-2.5-flash

Session Management

Gemini uses --resume for session resume:

# Resume with clinvk
clinvk resume --last --backend gemini
clinvk resume <session-id>

Sandbox Mode

Gemini supports sandbox mode for controlled execution:

backends:
  gemini:
    extra_flags:
      - "--sandbox"

Unified Options

These options work with Gemini:

Option Description
model Model to use
max_tokens Maximum response tokens
max_turns Maximum agentic turns

Best Practices

Use for Explanations

Gemini's broad knowledge makes it excellent for explaining concepts and providing context.

Leverage for Documentation

Use Gemini to write or improve documentation with its clear explanations.

Research Tasks

Gemini is great for gathering information and research-oriented queries.

Use Cases

Documentation

clinvk -b gemini "write comprehensive documentation for this module"

Explanations

clinvk -b gemini "explain the architecture of this microservice"

Research

clinvk -b gemini "what are the best practices for implementing rate limiting"

Code Review

clinvk -b gemini "review this code and explain potential issues"

Comparison with Other Backends

Aspect Gemini Claude Codex
Knowledge breadth Excellent Good Good
Code generation Good Excellent Excellent
Explanations Excellent Excellent Good
Speed Fast Moderate Fast

Workflow Example

Use Gemini for research and documentation:

{
  "steps": [
    {
      "name": "research",
      "backend": "gemini",
      "prompt": "research best practices for authentication in Go"
    },
    {
      "name": "implement",
      "backend": "claude",
      "prompt": "implement authentication based on: {{previous}}"
    },
    {
      "name": "document",
      "backend": "gemini",
      "prompt": "write documentation for: {{previous}}"
    }
  ]
}

Troubleshooting

Backend Not Available

# Check if Gemini is installed
which gemini

# Check clinvk detection
clinvk config show | grep gemini

Authentication

Ensure you have valid Google Cloud credentials configured for the Gemini CLI.

Next Steps