Skip to content
| Marketplace
Sign in
Visual Studio Code>Machine Learning>Gemini CLI ChatNew to Visual Studio Code? Get it now.
Gemini CLI Chat

Gemini CLI Chat

TC Chan

|
570 installs
| (0) | Free
Complete Gemini AI integration for VSCode with chat interface, terminal commands, file writing, conversation export, and persistent history. Uses secure gcloud login authentication by default, with optional API key support.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Gemini Code Assistant

A VSCode extension that provides a chat interface for Google's Gemini CLI, enabling AI-powered coding assistance directly in your editor.

Features

  • Chat Interface: Interactive chat panel with Google's Gemini AI models
  • Multiple Models: Support for various Gemini models (2.5-flash, 2.5-pro, 1.5-flash, 1.5-pro)
  • Direct API Support: Use Google AI API directly or Gemini CLI
  • Command Mode: Execute terminal commands directly in chat (like Augment)
  • File Writing: Automatic file creation from AI responses
  • Code Analysis: AI-powered code review and improvement suggestions
  • Diff Generation: Generate code changes and view as VSCode diffs
  • Multi-file Generation: Create entire project structures and components
  • Template System: Generate from predefined project templates
  • File Context Integration: Automatically include open file content in prompts
  • Code Review Mode: Analyze selected code with specific review prompts
  • Keyboard Shortcut: Quick access with Cmd+Shift+G (Mac) or Ctrl+Shift+G (Windows/Linux)
  • Real-time Responses: Streaming responses with live updates
  • Configurable: Customizable model selection and API/CLI options
  • Debug Tools: Built-in debugging for API and CLI connections

Requirements

Option 1: Direct API (Recommended)

  • Google AI API Key: Get one from Google AI Studio
  • No additional setup required

Option 2: Gemini CLI

  • Google Cloud CLI (gcloud): Must be installed and authenticated
  • Gemini CLI: Must be installed and accessible
  • Active Google Cloud Project: With Gemini API access enabled

Installation Prerequisites

For Direct API:

  1. Get API key from Google AI Studio
  2. Configure in VSCode settings (see Extension Settings below)

For Gemini CLI:

  1. Install Google Cloud CLI: https://cloud.google.com/sdk/docs/install
  2. Install Gemini CLI: npm install -g @google/gemini-cli
  3. Authenticate: gcloud auth login
  4. Set up your project: gcloud config set project YOUR_PROJECT_ID

Extension Settings

This extension contributes the following settings:

Authentication Settings:

  • geminiCode.authMethod: Choose authentication method - "login" (gcloud) or "apikey" (API key) (default: login)
  • geminiCode.apiKey: Google AI API Key (required when using API key authentication)
  • geminiCode.useDirectAPI: Use direct API calls instead of CLI (default: false)

General Settings:

  • geminiCode.model: Choose the Gemini model to use (default: gemini-2.5-pro)
  • geminiCode.persistChatHistory: Save and restore chat history across sessions (default: true)
  • geminiCode.maxHistoryMessages: Maximum number of messages to keep in history (default: 100)
  • geminiCode.geminiPath: Custom path to Gemini CLI executable (auto-detected if empty)

File Context Settings:

  • geminiCode.autoIncludeFileContext: Automatically include open file content in chat prompts (default: true)
  • geminiCode.maxFileContextLines: Maximum number of lines to include from file context (default: 500)
  • geminiCode.includeRelatedFiles: Include content from related files (imports, dependencies) (default: false)

Usage

Basic Chat

  1. Start Chat: Press Cmd+Shift+G or use Command Palette → "Start Gemini Chat"
  2. Type your question in the chat interface
  3. Get AI responses powered by Google's Gemini models

Command Mode (Terminal Integration)

  1. Enter Command Mode: Type ! followed by any terminal command
    • Example: !ls, !pwd, !git status, !npm install
  2. Execute Commands: Press Enter to run the command in your workspace
  3. Exit Command Mode: Press Escape to return to chat mode
  4. Real-time Output: See command output streamed in real-time

File Writing

  1. Ask for Code: Request Gemini to write code and save to a file
    • Example: "write a Python script and save to hello.py"
  2. Manual Save: Use the 📝 button to save any response to a file
  3. Auto-open: Created files automatically open in VSCode

Export Conversations

  1. Export to Markdown: Use the 📋 button to copy entire conversation as markdown
  2. Formatted Output: Includes proper markdown formatting for all message types
  3. Clipboard Ready: Automatically copies to clipboard for easy sharing
  4. Command Palette: Use "Gemini Code: Export Conversation" command

Chat History Management

  1. Persistent History: Chat history automatically saves and restores across VSCode sessions
  2. Save Sessions: Save current conversation as a named session for later reference
  3. Load Sessions: Quickly switch between different saved conversation sessions
  4. Manage Sessions: View, load, or delete saved chat sessions
  5. Clear History: Remove all chat history when needed

Code Analysis & Generation

  1. Generate Code Diff: Select code → Right-click → "Generate Code Diff"
  2. Analyze and Improve: Right-click on code or files → "Analyze and Improve Code"
  3. Multiple Analysis Types: General analysis, performance, security, documentation, cleanup
  4. VSCode Diff View: See changes side-by-side in VSCode's native diff viewer
  5. Apply Changes: Choose to apply changes, save as new file, or dismiss

Multi-file Code Generation

  1. Generate Project Structure: Right-click on folder → "Generate Project Structure"
  2. Generate Component/Module: Right-click on folder → "Generate Component/Module"
  3. Generate from Template: Command Palette → "Generate from Template"
  4. Project Types: Web apps, mobile apps, APIs, libraries, CLI tools, and more
  5. Component Types: React, Vue, Angular components, utilities, tests, and more
  6. Template Library: Pre-built templates for popular frameworks and tools

File Context Integration

  1. Automatic Context: Open files are automatically included in chat prompts
  2. Smart Detection: Context is added when questions are code-related
  3. Related Files: Optionally include imported/dependent files
  4. Context Limits: Configurable maximum lines to include from files
  5. Chat with Context: Explicitly start chat with current file context

Code Review Mode

  1. Review Selected Code: Select code → Right-click → "Review Selected Code"
  2. Explain Code: Get detailed explanations of code functionality
  3. Find Bugs: Analyze code for potential issues and vulnerabilities
  4. Suggest Improvements: Get optimization and enhancement suggestions
  5. Add Comments: Generate comprehensive documentation and comments
  6. Multiple Review Types: Comprehensive, focused, or custom analysis

Available Commands

  • API Connection: Command Palette → "Gemini Code: Test Direct API"
  • CLI Connection: Command Palette → "Gemini Code: Test CLI Connection"
  • Command Help: Command Palette → "Gemini Code: Show Command Mode Help"
  • Export Chat: Command Palette → "Gemini Code: Export Conversation"
  • Save Session: Command Palette → "Gemini Code: Save Chat Session"
  • Load Session: Command Palette → "Gemini Code: Load Chat Session"
  • Manage Sessions: Command Palette → "Gemini Code: Manage Chat Sessions"
  • Clear History: Command Palette → "Gemini Code: Clear Chat History"
  • Generate Diff: Command Palette → "Gemini Code: Generate Code Diff"
  • Analyze Code: Command Palette → "Gemini Code: Analyze and Improve Code"
  • Generate Project: Command Palette → "Gemini Code: Generate Project Structure"
  • Generate Component: Command Palette → "Gemini Code: Generate Component/Module"
  • Generate from Template: Command Palette → "Gemini Code: Generate from Template"
  • Review Code: Command Palette → "Gemini Code: Review Selected Code"
  • Explain Code: Command Palette → "Gemini Code: Explain Code"
  • Find Bugs: Command Palette → "Gemini Code: Find Bugs and Issues"
  • Suggest Improvements: Command Palette → "Gemini Code: Suggest Improvements"
  • Add Comments: Command Palette → "Gemini Code: Add Comments/Documentation"
  • Chat with Context: Command Palette → "Gemini Code: Chat with File Context"
  • Switch Auth Method: Command Palette → "Gemini Code: Switch Authentication Method"
  • Test Authentication: Command Palette → "Gemini Code: Test Authentication"

Authentication Management

  1. Switch Authentication Method: Use "Switch Authentication Method" command to change between login and API key
  2. Test Authentication: Use "Test Authentication" command to verify your setup is working
  3. Automatic Validation: Extension automatically checks authentication before processing requests
  4. Error Handling: Clear error messages guide you to fix authentication issues
  5. Flexible Setup: Choose the authentication method that works best for your workflow

Authentication Methods:

Login Authentication (Default)

  • Uses gcloud CLI authentication
  • Requires gcloud auth login
  • Works with existing Google Cloud setup
  • No API key needed

API Key Authentication

  • Uses Google AI API key directly
  • Get key from Google AI Studio
  • No gcloud CLI required
  • Simpler setup for API-only usage

Multi-file Generation Examples

Project Types Available:

  • 🌐 Web Applications: React, Vue, Angular, or vanilla web apps
  • 📱 Mobile Apps: React Native, Flutter, or native mobile applications
  • 🖥️ Desktop Applications: Electron, Tauri, or native desktop apps
  • 🔧 APIs/Backend: REST APIs, GraphQL servers, microservices
  • 📚 Libraries/Packages: NPM packages, Python libraries, Rust crates
  • 🤖 CLI Tools: Command-line applications and utilities
  • 🎯 Custom Projects: Any project type you can describe

Component/Module Types:

  • ⚛️ React Components: Functional components with hooks and TypeScript
  • 🟢 Vue Components: Vue 3 with Composition API and TypeScript
  • 🅰️ Angular Components: Angular components with TypeScript and services
  • 🎨 UI Component Libraries: Reusable component sets with Storybook
  • 🔧 Utility Modules: Helper functions, hooks, and utilities
  • 📊 Data Models: Database schemas, API models, and types
  • 🌐 API Modules: Controllers, routes, and middleware
  • 🧪 Test Suites: Unit tests, integration tests, and test utilities

Template Library:

  • React + TypeScript: Modern React app with Vite and testing setup
  • Vue 3 + TypeScript: Vue app with Composition API and build tools
  • Angular Application: Full Angular app with CLI structure
  • Node.js Express API: RESTful API with TypeScript and middleware
  • Python FastAPI: Modern Python API with async support
  • Rust CLI Tool: Command-line tool with Clap and proper structure
  • React Native App: Cross-platform mobile app template
  • Electron App: Desktop application with React frontend
  • NPM Package: TypeScript library with build and publish setup
  • Testing Framework: Complete testing setup with utilities

Configuration

The extension can be configured through VSCode settings:

File Context Settings:

  • geminiCode.autoIncludeFileContext: Automatically include open file content in chat prompts (default: true)
  • geminiCode.maxFileContextLines: Maximum number of lines to include from file context (default: 500)
  • geminiCode.includeRelatedFiles: Include content from related files (imports, dependencies) (default: false)

Other Settings:

  • geminiCode.model: The Gemini model to use (gemini-2.5-pro, gemini-2.5-flash, etc.)
  • geminiCode.useDirectAPI: Use direct API instead of CLI (default: false)
  • geminiCode.apiKey: Google AI API Key for direct API access
  • geminiCode.persistChatHistory: Save and restore chat history across sessions (default: true)
  • geminiCode.maxHistoryMessages: Maximum number of messages to keep in history (default: 100)

Known Issues

  • Requires active internet connection
  • Subject to Google Cloud quotas and rate limits
  • Requires proper gcloud authentication

Release Notes

0.1.0

Initial release with:

  • Chat interface for Gemini CLI
  • Multiple model support
  • Configurable settings
  • Debug tools

Following extension guidelines

Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.

  • Extension Guidelines

Working with Markdown

You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:

  • Split the editor (Cmd+\ on macOS or Ctrl+\ on Windows and Linux).
  • Toggle preview (Shift+Cmd+V on macOS or Shift+Ctrl+V on Windows and Linux).
  • Press Ctrl+Space (Windows, Linux, macOS) to see a list of Markdown snippets.

For more information

  • Visual Studio Code's Markdown Support
  • Markdown Syntax Reference

Enjoy!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft