Skip to content
| Marketplace
Sign in
Visual Studio Code>AI>Grok AI / xAI for VS CodeNew to Visual Studio Code? Get it now.
Grok AI / xAI for VS Code

Grok AI / xAI for VS Code

GM DevCore

|
3 installs
| (0) | Free
Integrate xAI's Grok into VS Code — chat, explain, generate, fix, and get inline completions.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Grok AI for VS Code

Integrate xAI's Grok directly into VS Code — just like the built-in GitHub Copilot Chat or Claude extension.


Features

  • 💬 Sidebar Chat — Full conversation history with streaming responses
  • 💡 Explain Code — Select any code → right-click → "Grok: Explain Selected Code"
  • 🔧 Refactor Code — Improve readability and best practices
  • 🐛 Fix Bugs — Identify and fix issues in selection
  • 📝 Add Comments — Generate docstrings and inline comments
  • ✨ Generate Code — Describe what you need, get working code
  • 📋 Copy / Insert — One-click copy or insert code blocks into your editor
  • 🔄 Streaming — Token-by-token streaming with stop button
  • 💾 History — Chat history persists across VS Code sessions (per workspace)

Setup

  1. Install the extension
  2. Get your API key from console.x.ai
  3. Press Ctrl+Shift+P → Grok: Set API Key
  4. Open the chat panel via the Grok icon in the Activity Bar, or press Ctrl+Shift+G

Keyboard Shortcuts

Action Windows/Linux Mac
Open Chat Ctrl+Shift+G Cmd+Shift+G
Explain Selection Ctrl+Shift+E Cmd+Shift+E

Settings

Setting Default Description
grok.apiKey — Your xAI API key
grok.model grok-3 Model: grok-3, grok-3-fast, grok-3-mini, etc.
grok.streamResponses true Enable token streaming
grok.maxTokens 4096 Max tokens per response
grok.temperature 0.7 Temperature (0–2)

Right-Click Menu

Select code in any editor, right-click, and you'll see:

  • Grok: Explain Selected Code
  • Grok: Refactor Selected Code
  • Grok: Fix Bug in Selection
  • Grok: Add Docstring / Comments

Requirements

  • VS Code 1.85+
  • xAI API key (console.x.ai)

Building from Source

npm install
npm run compile
# Install vsce globally to package:
npm install -g @vscode/vsce
vsce package

This produces a .vsix file you can install via Extensions: Install from VSIX.

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