Google's Gemini CLI is Here for FREE! STOP using Claude Code!

Mervin PraisonAbout 3 min readJun 26, 2025Watch original
THE SUMMARYAI-generated

Gemini CLI Deep Dive: Building a URL Shortener

Key Concepts:

  • Gemini CLI: A command-line interface for interacting with the Gemini AI model.
  • Context Window: The amount of text (code, data, etc.) the AI model can process at once (1 million tokens in this case).
  • npm: Node Package Manager, used for installing JavaScript packages.
  • API Key: A secret key used to authenticate with the Gemini AI service.
  • REST API: An architectural style for building web services.
  • Node.js: A JavaScript runtime environment.
  • Express: A popular Node.js web application framework.
  • OpenAPI Spec: A standard format for describing REST APIs.
  • Token Usage: A measure of how much of the context window is being used.

1. Installation and Setup:

  • Prerequisites: Requires Node.js and npm installed. Installation instructions for npm are available at npmjs.com (link in description).
  • Installation Command: npm install -g @google/gemini-cli
  • API Key Generation: Obtain an API key from studio.google.com.
  • Environment Variable: Set the GEMINI_API_KEY environment variable: export GEMINI_API_KEY=<your_api_key>
  • Free Usage: Gemini CLI offers 60 model requests per minute and 1,000 model requests per day for free.
  • Open Source: The Gemini CLI code is available on GitHub.

2. Gemini CLI Interface and Commands:

  • Accessing the CLI: Type gemini in the terminal.
  • Initial Setup: First-time users are prompted to select a theme.
  • Gemini 1.5 Pro: The CLI uses Gemini 1.5 Pro.
  • Available Commands:
    • /chat: Chat with your codebase.
    • /add_mcp: Add something related to MCP (the transcript doesn't specify what MCP is).
    • /store, /restore, /retrieve: Store, restore, and retrieve memory.
    • /integrate: Integrate with external editors (Cursor, Vim, VS Code).
    • /authenticate: Authenticate using API key or Google account.
    • /stats: View token usage and cost.
    • /theme: Choose a theme.
    • /compress: Compress the codebase if it exceeds the 1 million token limit.
    • @<filename>: Refer to a specific file in the project.

3. Building a URL Shortener Application:

  • Prompt: "Build a rest API in NodeJS express to create short URLs redirect and track click counts provide open API spec and tests"
  • Planning Phase: Gemini CLI outlines the technology stack, core API endpoints, and development process.
  • Package Initialization: The CLI initializes the package.json file and installs required npm packages.
  • Code Generation: Gemini CLI automatically generates the code for the URL shortener application, including tests.
  • Testing: The CLI automatically runs the tests after building the application.
  • Running the Application: The user can instruct the CLI to run the application.
  • Verification: The application is accessible at localhost:3000. The user tests the URL shortening functionality with google.com and verifies that the shortened URL redirects correctly.

4. Example Usage and Features:

  • File Explanation: The user demonstrates how to use @<filename> to ask Gemini CLI to explain a specific file in the project.
  • Drag and Drop: Files can also be dragged and dropped into the CLI.
  • Stats: The CLI provides statistics on token usage, total duration, and total wall duration.

5. Key Arguments and Perspectives:

  • Comparison to Cloud Code: The speaker compares Gemini CLI to Cloud Code, highlighting Gemini CLI's free usage (up to a limit) and larger context window (1 million tokens).
  • Smooth Development Process: The speaker emphasizes the smooth and efficient application development process facilitated by Gemini CLI.

6. Conclusion:

The Gemini CLI is a powerful tool for building applications from scratch or integrating with existing codebases. Its large context window, free usage tier, and seamless integration with code editors make it a compelling alternative to other AI-powered coding assistants like Cloud Code. The speaker is impressed with its ability to generate code, install packages, run tests, and even deploy the application, all from a single prompt. The speaker expresses a desire for GitHub Actions/GitLab integration.

AI summaries can miss context or contain errors. Check important details against the original video.

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.