Overseas access: www.kdjingpai.com
Ctrl + D Favorites

Gemini CLI is an open source command line tool developed by Google, based on the Gemini 2.5 Pro model, that allows users to work with AI functionality directly in the terminal. It supports tasks such as working with large code bases, generating applications, automating workflows, and managing files. It is free to use with a personal Google account, with up to 60 requests per minute and 1,000 requests per day.The Gemini CLI is licensed under the Apache 2.0 license, and the code is publicly available for developers to modify and contribute. It is lightweight, easy to use, suitable for developers to efficiently complete complex tasks in the terminal.

Gemini CLI:Google开源的命令行AI编程工具-1

 

Function List

  • code base operation : Query and edit a codebase of over a million tokens to support complex project analysis.
  • Application Generation : Generate new applications from PDFs or hand-drawn sketches, utilizing Gemini's multimodal capabilities.
  • Workflow automation : Handle pull requests, complex rebases, or generate git history reports.
  • multimodal support : Handles a wide range of data such as text, code, images, audio and video.
  • Real-time search : Provides real-time external information to the model via Google search.
  • Document management : Batch convert image formats or organize PDF files by date.
  • tool integration : Connect to media generation tools such as Imagen, Veo or Lyria via MCP servers.
  • Customized settings : Personalize the interactive experience by adjusting system prompts through configuration files.

 

Using Help

Installation process

To use the Gemini CLI, users need to complete the following installation and configuration steps:

  1. environmental preparation
    Ensure that Node.js (version 18 or above) is installed. Node.js can be downloaded from Node.js official website Download and install.
  2. Installing the Gemini CLI
    There are two mounting options:

    • Running via npx (no global installation required):
      Runs in the terminal:
    npx https://github.com/google-gemini/gemini-cli
    

    This will directly download and run the latest version.

    • global installation ::
      Run the following command to install globally:
    npm install -g @google/gemini-cli
    

    After the installation is complete, run gemini Enter the interactive mode.

  3. Select Topic
    The first time you run it, you will be prompted to choose a color theme (e.g. ascii,dark,light). Select on demand, the default is asciiThe
  4. Authentication Configuration
    The Gemini CLI requires a Google account or API key for authentication:

    • Personal Google Account : Run gemini Afterwards, the system will guide you to sign in to your Google account and authorize you to use it, with 60 free requests per minute and 1,000 per day.
    • API key ::
      1. interviews Google AI Studio Generate the key.
      2. Set environment variables in the terminal:
        export GEMINI_API_KEY="YOUR_API_KEY"
        

        interchangeability YOUR_API_KEY for the actual key. the API key is suitable for users who need a higher request quota.

    • Google Workspace account : Reference Certification Guide Configuration.
  5. Starting the Gemini CLI
    After authentication is complete, run:

    gemini
    

    The system enters interactive mode, displaying gemini > Cue, prepare to receive orders.

Main Functions

The core functionality of the Gemini CLI centers around AI interactions in the terminal. Below are detailed instructions on how to do this:

1. Code base operations

The Gemini CLI handles large code bases and is suitable for analyzing and editing complex projects. For example:

  • Analyzing Project Architecture : Go to the project directory and run it:
gemini > Describe the main pieces of this system's architecture

The system returns an overview of the architecture of the code base.

  • Query Security Mechanism : Input:
gemini > What security mechanisms are in place?

The system analyzes the code and lists security measures.

  • Implementing GitHub Issues : Input:
gemini > Implement a first draft for GitHub issue #123

The system generates a first draft of the code and provides a save option.

2. Application generation

Leverage Gemini's multimodal capabilities to generate applications from PDFs or sketches. Example:

  • Generate applications from PDF : Place the PDF in the project directory and run it:
gemini > Generate an app from requirements.pdf

The system parses the PDF content and generates the application code.

  • Generate applications from sketches : Upload a hand-drawn sketch image, enter:
gemini > Create a web app from sketch.jpg

The system generates a sketch-based web application.

3. Workflow automation

The Gemini CLI supports automated development tasks. For example:

  • Generating a git history report : Input:
gemini > Make a slide deck showing the git history from the last 7 days, grouped by feature and team member

The system generates a slide show containing the git history.

  • Handling complex rebases : Input:
gemini > Help me perform a complex rebase on branch feature-x

The system provides step-by-step instructions to complete the rebase.

4. Document management

The Gemini CLI manages files efficiently. For example:

  • Convert Image Formats : Runs in the image directory:
gemini > Convert all the images in this directory to png, and rename them to use dates from the exif data

The system converts the image to PNG format and renames it according to the EXIF date.

  • Organize PDF files : Input:
gemini > Organise my PDF invoices by month of expenditure

The system categorizes PDFs by month based on metadata.

5. Multimodal support and media generation

The Gemini CLI supports the handling of multiple data types and integrates media generation tools through MCP servers. For example:

  • Generate Discord Robot : Input:
gemini > Write a Gemini Discord bot that answers questions using a FAQ.md file

The system generates a robot code based on FAQ.md.

  • Generate media content : Generate images or videos via Imagen or Veo, input:
gemini > Generate a promotional image for a tech event

The system will call the media generation tool and return the results.

6. Real-time search

The Gemini CLI can be searched via Google for real-time information. For example:

gemini > Search for recent JavaScript frameworks and summarize their features

The system searches for the latest frames and generates summaries.

7. Customized settings

Users can access the GEMINI.md file to set up a system prompt. For example, creating GEMINI.md::

System Prompt: Respond in a concise and technical tone.

(of a computer) run gemini, the system will adjust the output style according to the prompts.

command parameter

The Gemini CLI supports multiple parameters for enhanced flexibility:

  • -m, --model: Select the model (e.g. gemini-2.5-pro). Example:
    gemini -m gemini-2.5-pro
    
  • -s, --style: Set the output theme (e.g. dark). Example:
    gemini -s dark
    
  • -w, --wrap: Sets the output newline length. Example:
    gemini -w 80
    

caveat

  • Ensure that Node.js version is 18 or above, otherwise compatibility issues may occur.
  • Check network connection, stable network is required for authentication and live search.
  • Free accounts have a request limit and an API key is required to exceed the limit.
  • consultation Troubleshooting Guide Solve common problems.
  • ferret out complete document Get more details.

 

application scenario

  1. Rapid prototyping
    Developers can generate application code from natural language descriptions. For example, generating a web application from a PDF requirements document saves development time.
  2. Codebase Analysis
    Developers new to a project can use the Gemini CLI to analyze the code base architecture or security mechanisms and quickly familiarize themselves with the project.
  3. automated operation and maintenance (O&M)
    DevOps engineers can automate pull requests or generate git history reports for more efficient team collaboration.
  4. Batch file processing
    Data Analyst can batch organize PDF invoices or convert image formats to simplify tedious document management.
  5. content creation
    Content creators can generate video scripts or promotional images to quickly turn ideas into actionable content.

 

QA

  1. Is there a fee for the Gemini CLI?
    Free with a personal Google account, 60 requests per minute, 1000 requests per day. Higher quotas require an API key or a paid plan.
  2. How do I contribute code?
    interviews Contribution Guidelines, clone the repository, submit an issue or pull request.
  3. What models are supported?
    Default use gemini-1.5-flashThis can be accomplished by -m The parameter switches to the gemini-2.5-pro and other models.
  4. What if the certification fails?
    Check network, Google account, or API key validity. Refer to Certification Guide Problem solving.
  5. How do I view supported commands?
    ferret out command file Learn about all available commands.
0Bookmarked
0kudos

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

inbox

Contact Us

Top

en_USEnglish