Grok AI / xAI for VS Code
GMDevCore · GMDevCore.gm-grok-vscode
Integrate xAI's Grok directly into VS Code — sidebar chat, inline completions, code actions, git integration, and more.
Changelog
v6.0.5 — HTML tag rendering fix
- Fixed Grok occasionally emitted literal HTML tags like
<strong>, <em>, <code> in responses instead of markdown — these are now converted to their markdown equivalents (**bold**, *italic*, code) before rendering, so users see proper formatting instead of raw tags
v6.0.4 — Dynamic model list
- Added
Grok: Refresh Model List from xAI command — fetches the real list of models your API key has access to from /v1/models, then lets you pick one as your default
- Why xAI deprecates models frequently; hardcoded lists go stale. Run this command any time chat returns a 404 to see what's actually available.
- Tip Run this once after installing to confirm your API key works and to populate the model picker with current models
v6.0.3 — Verbose error logging
- Added
Grok Errors output channel logs every error with full HTTP status, response body, and timestamp
- Added
Grok: Show Errors Log command in the Command Palette opens it instantly
- Changed Generic "An error occurred" replaced with the first 200 chars of the actual error message — fall-through case now shows what really went wrong
- Added Pattern matching for HTTP 400 / 403 / 404 / 500-class errors with specific guidance for each
- Added API key validation requests are logged with status code and response body
v6.0.2 — Silent migration + API key validation
- Added API key is validated against xAI before every chat send (cached per-session). Invalid or expired keys show a clear actionable message instead of a generic error
- Fixed "Unknown inline model" warning kept appearing for users upgrading from older versions — stale model settings are now silently migrated to
grok-4.3 on activation with no warning
v6.0.1 — Model migration fix
- Fixed Chat threw an error after the v6.0.0 model update — six other files (
tokenTracker, chatViewProvider, inlineProvider, streamToEditor, statusBar, configValidator) still hardcoded the old grok-3 defaults and were sending invalid model names to the API
- Fixed Settings panel showed deprecated models —
configValidator allowlist now matches the new model list (grok-4.3, grok-4.20-reasoning, grok-4.20-non-reasoning)
- Changed Token tracker pricing updated for new models
🚀 v6.0.0 — Major release
- Changed Models updated to latest xAI lineup —
grok-4.3 (default), grok-4.20-reasoning, grok-4.20-non-reasoning; all deprecated models removed
- Added Token counter now shows percentage of context used (e.g.
4.2k tokens (3%)) with larger, bolder text and a thicker progress bar
- Added Agent intro banner on first launch — walks new and upgrading users through Agent Mode with a two-column layout and one-click mode activation
- Fixed Autonomous mode was still showing approval dialogs — check was missing from the callback
- Fixed Agent button was cut off at minimum sidebar width — moved from header to input toolbar
- Fixed All overlay panels (Sessions, Templates, Theme) clip-proof via
position:absolute inside position:relative wrapper
- Fixed Sessions dropdown showed only a shadow — root cause was
overflow:hidden on all ancestor elements; replaced with full-area overlay
- Fixed Delete session did nothing — two-click confirm state machine was reset by its own auto-cancel timer; simplified to single-click
- Fixed Context and Files buttons silently failed —
executeCommand indirection blocked when sidebar had focus; now handled directly in provider
- Fixed No-key banner referenced a non-existent 🔑 icon; replaced with a prominent amber button
🤖 v5.9 — Agent Mode
Let Grok act directly in your workspace. Click Agent in the input toolbar to cycle through three modes:
- 🤖 Agent (purple) — every action shows an Allow / Always allow / Block dialog
- ⚡ Autonomous (red war-room) — no approvals, Grok acts immediately; chat turns red
- Off — standard chat
Tools: read file, write file, run shell command, list directory, search files. All workspace-sandboxed.
v5.7 — Theme system
- Added 🎨 theme picker with six themes: VS Code Auto (default), Dark, Light, Midnight, Ocean, Warm
- Fixed "You" bubble invisible on grey/light VS Code themes
- Fixed Tooltip contrast — fixed dark charcoal background regardless of host theme
Features
💬 Chat Panel
Full sidebar chat with streaming responses, session management, message editing, and export.
- Named, persistent chat sessions — switch, rename, delete from the All Chats panel
- Edit any sent message with ✏ — conversation rewinds and regenerates from that point
- Export chat as Markdown to clipboard or file (
Ctrl+Shift+X)
- In-webview model switcher — click the model chip to change without leaving the sidebar
- Per-session custom system prompt — override Grok's persona for the current chat
- Token counter bar shows context usage toward the 128k limit
🤖 Auto File Context
The current open file is automatically included with every message — Grok always knows what you're looking at. A blue 📄 filename chip in the header shows when it's active.
✍️ Code Actions (right-click)
Select any code → right-click → Grok submenu:
| Command |
What it does |
| Explain Selected Code |
Plain-English explanation |
| Refactor Code (Chat) |
Suggests a cleaner version |
| Refactor Code (Diff View) |
Side-by-side diff to review before applying |
| Fix Bug (Chat / Diff View) |
Identifies and fixes bugs |
| Write Unit Tests |
Comprehensive tests with mocks and edge cases |
| Add Comments / Docstrings |
Language-specific documentation |
| Optimize Code |
Performance improvements with explanation |
| Translate to Another Language |
Convert code to a target language |
| Explain Error |
Explains diagnostics at cursor |
⚡ Direct Editor Integration
Stream code directly into your file — no copy-paste:
| Shortcut |
Action |
Ctrl+Shift+I |
Generate Code at Cursor — describe what you need |
Ctrl+Shift+C |
Continue Writing — streams a natural continuation |
Ctrl+Shift+D |
Fill TODO — replaces the nearest TODO/FIXME comment |
👁 Code Lens
Clickable Explain / Tests / Docs buttons appear above every function and class. Supports TypeScript, JavaScript, Python, Rust, Go, C/C++, C#, Java, Swift, Kotlin, Ruby, PHP, Vue, Svelte.
🔴 Diagnostic Hover
Hover over any red squiggle to get Explain this error and Fix it links inline.
📝 Inline Completions
Copilot-style ghost-text suggestions as you type. Press Tab to accept, Escape to dismiss.
📋 Templates
13 built-in prompt templates (Security Audit, PR Review, Unit Tests, JSDoc, README, etc.) plus custom templates you can save and reuse.
🌿 Git Integration
- Generate Commit Message — reads your staged diff, writes a Conventional Commits message directly to the SCM input box
- Explain Diff — explain staged, working tree, or last commit changes
- Generate PR Description — structured PR template from diff + commits
🖥 Terminal Integration
Right-click in the terminal or use the Command Palette:
- Explain Terminal Output — what did that command do?
- Explain Terminal Error — why did it fail?
- Fix Terminal Error — get a corrected command
📊 Usage Statistics
Local token and cost estimates (no data sent anywhere). Hover the status bar chip or run Grok: Show Usage Statistics.
Setup
- Install the extension from the VSIX file
- Get your API key from console.x.ai
- Press
Ctrl+Shift+P → Grok: Set API Key
- Click the Grok icon in the Activity Bar, or press
Ctrl+Shift+G
Your API key is stored in VS Code's encrypted SecretStorage (OS keychain) — never in settings.json.
Keyboard Shortcuts
| Action |
Windows / Linux |
macOS |
| Open Chat |
Ctrl+Shift+G |
Cmd+Shift+G |
| Explain Code |
Ctrl+Shift+E |
Cmd+Shift+E |
| Fix Bug (Diff) |
Ctrl+Shift+F |
Cmd+Shift+F |
| Quick Ask |
Ctrl+Shift+A |
Cmd+Shift+A |
| Use Template |
Ctrl+Shift+T |
Cmd+Shift+T |
| New Chat |
Ctrl+Shift+N |
Cmd+Shift+N |
| Generate at Cursor |
Ctrl+Shift+I |
Cmd+Shift+I |
| Continue Writing |
Ctrl+Shift+C |
Cmd+Shift+C |
| Fill TODO |
Ctrl+Shift+D |
Cmd+Shift+D |
| Export Chat |
Ctrl+Shift+X |
Cmd+Shift+X |
Settings
| Setting |
Default |
Description |
grok.model |
grok-4.3 |
Chat model |
grok.inlineModel |
grok-4.3 |
Model for inline completions and stream-to-editor |
grok.inlineSuggestions |
true |
Enable ghost-text completions |
grok.codeLens |
true |
Show Explain / Tests / Docs above functions |
grok.diagnosticHover |
true |
Grok actions on error squiggles |
grok.autoFileContext |
true |
Auto-include current file in every message |
grok.maxTokens |
4096 |
Max tokens per response |
grok.temperature |
0.7 |
0 = deterministic, 2 = creative |
Requirements
Build from Source
npm install
npm install -g typescript @vscode/vsce
npx tsc -p tsconfig.json
vsce package --no-dependencies