Thanks to visit codestin.com
Credit goes to github.com

Skip to content

rv192/gem-cli

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gen CLI

Gemini CLI CI

Gemini CLI Screenshot

An enhanced command-line AI workflow tool forked from Google Gemini CLI with improved reliability, model fallback mechanisms, and flexible configuration options.

πŸš€ Key Features

Enhanced Reliability

  • πŸ”„ Automatic Model Fallback: When your primary model is unavailable (quota exhausted, streaming errors), automatically switches to backup models
  • βš™οΈ Flexible Configuration: Easy-to-use .env file configuration with environment variable support
  • πŸ”‘ Multiple Auth Methods: Support for both OpenAI-compatible APIs and Google Gemini API
  • πŸ›‘οΈ Intelligent Error Handling: Recognizes and handles model exhaustion, rate limits, and streaming failures

Core Capabilities

  • Query and edit large codebases in and beyond Gemini's 1M token context window
  • Generate new apps from PDFs or sketches using multimodal capabilities
  • Automate operational tasks like querying pull requests or handling complex rebases
  • Use tools and MCP servers to connect new capabilities
  • Ground your queries with Google Search integration

πŸš€ Quick Start

Prerequisites

Installation

Option 1: Install globally

npm install -g @rv192/gem-cli
gen

Option 2: Run directly

npx https://github.com/rv192/gen-cli

Configuration

Create a .env file in your project root or home directory:

# OpenAI-compatible API (Recommended)
OPENAI_BASE_URL=https://your-api-endpoint.com
OPENAI_API_KEY=your-api-key
DEFAULT_MODEL=gemini-2.5-pro
FALLBACK_MODELS=gemini-2.5-flash,gemini-1.5-pro,gemini-2.0-flash

# Or use Google Gemini API directly
GEMINI_API_KEY=your-gemini-api-key

Authentication Options

OpenAI-Compatible APIs (Recommended)

Perfect for using with SiliconFlow, OpenRouter, or other OpenAI-compatible services:

export OPENAI_BASE_URL="https://api.siliconflow.cn/v1"
export OPENAI_API_KEY="your-api-key"

Google Gemini API

For direct Google Gemini API access:

  1. Generate a key from Google AI Studio
  2. Set the environment variable:
    export GEMINI_API_KEY="your-api-key"

πŸ’‘ Usage Examples

Once configured, start the CLI and begin interacting:

<<<<<<< HEAD

gen

======= 3. Pick a color theme 4. Authenticate: When prompted, sign in with your personal Google account. This will grant you up to 60 model requests per minute and 1,000 model requests per day using Gemini.

You are now ready to use the Gemini CLI!

Use a Gemini API key:

The Gemini API provides a free tier with 100 requests per day using Gemini 2.5 Pro, control over which model you use, and access to higher rate limits (with a paid plan):

  1. Generate a key from Google AI Studio.

  2. Set it as an environment variable in your terminal. Replace YOUR_API_KEY with your generated key.

    export GEMINI_API_KEY="YOUR_API_KEY"
  3. (Optionally) Upgrade your Gemini API project to a paid plan on the API key page (will automatically unlock Tier 1 rate limits)

Use a Vertex AI API key:

The Vertex AI provides free tier using express mode for Gemini 2.5 Pro, control over which model you use, and access to higher rate limits with a billing account:

  1. Generate a key from Google Cloud.

  2. Set it as an environment variable in your terminal. Replace YOUR_API_KEY with your generated key and set GOOGLE_GENAI_USE_VERTEXAI to true

    export GOOGLE_API_KEY="YOUR_API_KEY"
    export GOOGLE_GENAI_USE_VERTEXAI=true
  3. (Optionally) Add a billing account on your project to get access to higher usage limits

For other authentication methods, including Google Workspace accounts, see the authentication guide.

Examples

Once the CLI is running, you can start interacting with Gemini from your shell.

You can start a project from a new directory:

12d231e6408f319a1b3af375b8c2eb8ab3ea5b3b

Start a New Project

cd new-project/
gen
> Write me a TODO app in React with Tailwind CSS that can track daily tasks

Work with Existing Code

cd your-project/
gen
> Analyze this codebase and suggest performance improvements
> Implement a new feature based on GitHub issue #123

Model Fallback in Action

When your primary model (e.g., gemini-2.5-pro) is unavailable:

Trying model: gemini-2.5-pro
Model gemini-2.5-pro failed: Streaming failed after 3 retries, trying next model...
Trying model: gemini-2.5-flash
βœ… Successfully connected with gemini-2.5-flash

βš™οΈ Advanced Configuration

Environment Variables

Variable Description Example
DEFAULT_MODEL Primary model to use gemini-2.5-pro
FALLBACK_MODELS Comma-separated backup models gemini-2.5-flash,gemini-1.5-pro
OPENAI_BASE_URL API endpoint URL https://api.siliconflow.cn/v1
OPENAI_API_KEY API authentication key your-api-key
GEMINI_API_KEY Google Gemini API key your-gemini-key

Model Priority

The CLI selects models in this order:

  1. Command line --model parameter
  2. DEFAULT_MODEL environment variable
  3. GEMINI_MODEL environment variable (legacy)
  4. Built-in default model

Fallback Mechanism

When a model fails due to:

  • Quota exhaustion
  • Rate limiting
  • Streaming errors
  • Server errors

The CLI automatically tries the next available model from your FALLBACK_MODELS list.

🎯 Popular Use Cases

Code Analysis & Development

> Describe the main pieces of this system's architecture
> What security mechanisms are in place?
> Implement a first draft for GitHub issue #123
> Help me migrate this codebase to the latest version of Java

Project Automation

> Make me a slide deck showing git history from the last 7 days
> Create a full-screen web app for displaying GitHub issues
> Generate a project status report from recent commits

File & System Operations

> Convert all images in this directory to PNG format
> Organize my PDF invoices by month of expenditure
> Analyze log files and summarize error patterns

Development Workflows

> Review this pull request and suggest improvements
> Generate unit tests for the selected functions
> Create documentation for this API endpoint

πŸ”§ Troubleshooting

Common Issues

Model not responding:

  • Check your API key is valid
  • Verify your API endpoint URL
  • Ensure you have sufficient quota/credits

"Streaming failed" errors:

  • The fallback mechanism should handle this automatically
  • Check your FALLBACK_MODELS configuration
  • Verify backup models are available

Configuration not loading:

  • Ensure .env file is in the correct location
  • Check environment variable names are correct
  • Restart the CLI after configuration changes

For more help, see the troubleshooting guide.

πŸ“š Documentation

πŸ—‘οΈ Uninstall

npm uninstall -g @rv192/gem-cli

For detailed uninstallation instructions, see the Uninstall Guide.

πŸ“„ Legal

This project is forked from Google Gemini CLI. For terms of service and privacy notice, see the Terms of Service and Privacy Notice.

🀝 Contributing

Contributions are welcome! Please read the Contributing Guide for details on our development process.

About

Agents of C.L.I.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 95.0%
  • JavaScript 4.7%
  • Other 0.3%