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

|
1,474 installs
| (1) | 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 / 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.5.1 — Web search fixed

  • Fixed Web search returned an HTTP 410 error — xAI retired the API it used, so web search now runs on xAI's current endpoint. You'll see a "🌐 Searching the web…" indicator while Grok searches (it takes a little longer than a normal reply), then the full grounded answer arrives with its Sources list
  • Improved Finding the error log is now easier to discover: View → Output, then pick "Grok Errors" from the dropdown — or run "Grok: Show Errors Log" from the Command Palette

🌐 v6.5.0 — Live web search and visible reasoning

Grok can now search the web for you. Click the new 🌐 Web button in the input toolbar and Grok will search the internet while answering — perfect for current events, latest library versions, or anything newer than its training data. Answers come back with a Sources list of the pages it used, so you can verify everything with one click. Toggle it off any time to keep responses fully offline.

See when Grok is thinking. Reasoning models (like Grok 4.20 Reasoning) work through a problem before they start writing. Previously that looked like the extension had frozen — now you'll see a "🧠 Reasoning" indicator while the model thinks, which switches to the live response the moment it starts writing.

v6.4.2 — Your model choice is respected

  • Changed When you deliberately pick a model from the picker, the extension now uses it — even if your account's model list hasn't caught up yet. During staged rollouts (like Grok 4.5 right now), xAI's list can lag behind actual availability, and previously the extension would quietly switch you away before even trying
  • Changed If a model genuinely isn't available to your account, the error now says so plainly and points you to the model picker and the "Refresh Model List" command, instead of a vague deprecation warning
  • Important setup step Models must be enabled on your API key before they appear in the extension: go to https://console.x.ai/ → API Keys → click your key → open the Models dropdown → select the chat models you want (e.g. grok-4.5). If a model is missing from the picker or returns errors, this is almost always the fix. The extension's first-run banner and API-key prompts now walk you through this

v6.4.1 — Your model list now matches your account

The model picker now shows exactly what your xAI account can use. Model names are loaded live from xAI, so newly released models appear automatically and ones your account doesn't have won't trip you up. The built-in list was also corrected to the current model names (including the Grok 4.20 "0309" variants and the new Multi-Agent model).

No more errors from unavailable models. If your selected model isn't available on your account (for example, Grok 4.5 hasn't rolled out in your region yet), the extension now automatically switches to the best model you do have — like Grok 4.3 — and tells you, instead of failing with a confusing error.

Pick any model xAI offers. The extension no longer blocks model names it doesn't recognise, so if xAI gives your account something new or unusual, you can select and use it right away — no extension update needed.

✨ v6.4.0 — Speed control, text size, and smoother reading

Choose how hard Grok thinks. A new Reasoning Effort setting (Settings → Grok) lets you pick Low, Medium, or High for Grok 4.5. Low gives you snappy answers for quick questions; High takes longer but thinks a problem through. Applies to both chat and Agent Mode.

Make the chat easier to read. A new Chat Font Size setting (10–20px) adjusts the text size in the chat panel. Changes apply instantly — no reload needed.

Reading old messages no longer fights you. Previously, while Grok was responding, the chat kept yanking you to the bottom even if you'd scrolled up to re-read something. Now the chat only follows the response when you're already at the bottom. When you scroll up, a ↓ button appears — tap it to jump back to the live response.

🚀 v6.3.0 — Grok 4.5 support

  • Added Grok 4.5 — xAI's new flagship for coding and agentic tasks (released July 8), now the default chat model. 500k context, priced $2/$6 per M tokens
  • Added Grok Build 0.1 — xAI's coding-specialised low-cost model, now the default for inline completions and stream-to-editor ($1/$2 per M tokens)
  • Changed Token counter context limit now adapts to the selected model (500k for Grok 4.5, 1M for Grok 4.3, 256k for Grok Build) instead of a hardcoded 128k
  • Changed Cost tracking updated with official per-model pricing from xAI's docs
  • Note Grok 4.5 is not yet available in the EU (xAI expects mid-July); EU users can select Grok 4.3 from the model picker

🏗 v6.2.0 — TypeScript source reconstructed

  • Changed The full TypeScript source has been reconstructed from the compiled output — the project once again has a real build pipeline (npm run compile), type-checking against the VS Code API, and maintainable source files. All 21 modules compile with zero errors and load-verify cleanly
  • Added npm run compile / npm run watch build scripts and a proper tsconfig.json
  • Changed Shipped VSIX now excludes source, sourcemaps, and toolchain files (leaner install); full source is distributed separately

v6.1.8 — Security hardening + inline completion cost fix

  • Security Fixed a path-boundary check in @ file mentions and the agent's write-diff preview — a workspace at /home/user/proj could previously match sibling paths like /home/user/proj-evil; the check now requires a path separator
  • Fixed Inline completions had a debounce timer that was declared but never used — every typing pause fired a full API request. A real 350ms debounce now cancels superseded requests before they reach the API, cutting inline completion cost significantly during active typing

v6.1.7 — Apply-diff fix, agent context capping

  • Fixed The apply button's diff view (when no text was selected) showed a bogus comparison — it diffed an empty virtual document against your live file instead of showing the proposed change. The diff now correctly shows current ↔ proposed content
  • Fixed Long agent runs ballooned the API payload — tool outputs (up to 20 KB each) accumulated across turns and were re-sent on every call. The agent now trims its oldest exchanges mid-run (keeping the system prompt and recent context within a ~12k token budget), so 20-turn sessions stay fast and don't overflow the context window

v6.1.6 — Agent context parity, live model list, polish

  • Fixed Agent Mode ignored .grok/memory.md and @ file mentions — the agent now receives the same project context as regular chat, so it follows your conventions when acting on the workspace
  • Fixed @ mention autocomplete never saw files created after the first fetch — the file list now refreshes automatically (5-second throttle) while you type
  • Changed The in-chat model picker now loads the live model list from your xAI account (cached 5 minutes), so newly released models appear without an extension update; the static list remains as instant fallback
  • Fixed Multiple duplicate "Grok Errors" channels appeared in the Output panel dropdown — all components now share a single channel

v6.1.5 — Usage tracking fix, agent write diffs, smarter sessions

  • Fixed Token usage statistics always showed zero — the tracker was wired up but never actually recorded anything; both regular chat and agent mode now record usage after every exchange
  • Added Agent write_file to an existing file now opens a diff preview (current ↔ proposed) before you decide, with a non-modal Allow / Always allow / Block prompt so you can scroll the diff while deciding
  • Added Sessions are auto-named from your first message (e.g. "fix the login timeout bug…") instead of "Chat 12/05/2026 3:44 PM" — only applies if you haven't renamed the session yourself
  • Fixed Markdown task checkboxes (- [ ] / - [x]) rendered as literal text — now shown as ☐ / ☑

v6.1.4 — Reliability: history cap, retry, real stop

  • Fixed Long conversations could overflow the context window and fail or run up cost — the API now receives a capped window (most recent ~12k tokens / 40 messages); your full chat history is still shown and saved
  • Added Automatic retry with exponential backoff on transient errors (429 rate limits, 500/502/503/504 server errors, and network resets) — up to 2 retries at 800ms then 1600ms
  • Fixed The Stop button now actually aborts the in-flight HTTP request instead of just stopping the display, so no more tokens are consumed after you stop

v6.1.3 — Agent persistence + tool output formatting

  • Fixed Agent stopped after a single tool call instead of continuing — it now persists through multiple tool calls until the task is genuinely complete
  • Fixed Tool output (directory listings, command results) was rendered as a code block with copy/insert/apply buttons — now shown as a clean blockquote
  • Changed System prompt rewritten to emphasise persistence: explore subfolders, chain tool calls, don't stop early or ask the user mid-task
  • Added Loop nudges the model (up to 4 times) if it describes an action without emitting a tool call, and detects genuine completion via summary/question patterns

v6.1.2 — Agent / autonomous mode loop fix

  • Fixed Autonomous mode stopped after the first response — the tool-call parser was too strict and failed on reasoning models that wrap the JSON in markdown fences or format it slightly differently
  • Fixed Agent now retries once if the model describes what it will do instead of acting, nudging it to emit a real tool call
  • Fixed Streaming text no longer drops characters around <tool_call> tag boundaries
  • Changed Parser now handles fenced JSON, bare JSON objects, trailing commas, and validates tool names before executing

✨ v6.1.1 — Slash commands, @ mentions, Apply button, project memory

Four new productivity features:

/ slash commands — type / at the start of the input for an autocomplete menu: /explain, /fix, /test, /docs, /optimize, /review, /commit, /agent, /clear. Arrow keys to navigate, Enter or Tab to select.

@ file mentions — type @ followed by a filename to attach that file as context (e.g. @auth.ts what does this do?). Autocomplete shows matching workspace files; the file's contents are sent with your message.

Apply button on code blocks — every code block now has an apply button alongside copy/insert. With text selected it replaces the selection; with no selection it opens a diff view so you can review before accepting.

Project memory file — run Grok: Create Project Memory File to scaffold .grok/memory.md. Grok reads it automatically and includes it as context in every chat — perfect for teaching it your stack, conventions, and things to avoid. Persists per-project.

v6.0.5 — HTML tag rendering fix

  • Fixed Grok occasionally emitted literal HTML tags like <strong>, <em>, <code> instead of markdown — now converted to markdown equivalents before rendering

v6.0.4 — Dynamic model list

  • Added Grok: Refresh Model List from xAI fetches the real list of models your API key can access

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

  1. Install the extension from the VSIX file
  2. Get your API key from console.x.ai
  3. Press Ctrl+Shift+P → Grok: Set API Key
  4. 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

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

Build from Source

npm install
npm install -g typescript @vscode/vsce
npx tsc -p tsconfig.json
vsce package --no-dependencies
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft