Large Language Models

Using Grok With Visual Studio Code

Published 2025-10-06. Last modified 2025-10-08.
Time to read: 4 minutes.

This page is part of the llm collection.

Grok, from x.ai, excels at analysing untyped code and reasoning about it. Furthermore, it checks assumptions by going to appropriate sources and updating itself with the latest information before responding. Google Gemini does not do this.

However, Grok is very weak at maintaining context across conversational interactions. It does not accumulate context with each interaction. Conversational threads provide rich context for interaction, but Grok sometimes stumbles badly here. Each query needs to be self-contained, which can lead to progressivly longer queries.

Email support@x.ai.

xAI API developer Discord.

tutorial.

Trade Privacy For Free API Credits

The Grok free tier works quite well. However, an API key is required to use a Visual Studio Code extension. The API requires credits.

X.ai offered free credits until May 2025 in exchange for a loss of privacy.

European Union countries disallow data sharing so their citizens were not eligable for free API credits.

xAI is offering $150 per month in free API credits for teams that opt in to data sharing (available in eligable countries). By opting in, you agree to share your API requests with xAI. To qualify for free credits, your team must have already spent a minimum of $5 on the API before choosing to opt in.

  • Data sharing is set at the team level.
  • You can have multiple teams—some opted in, others not.
  • Only team admins can enable data sharing.
  • To opt in, go to the Credits Section on the xAI API Console Billing page.
  • After a team has chosen to opt-in to data sharing, the team cannot opt-out.

Teams

Everyone gets a new Personal Team upon signup. However, I decided to create a new team so I could easily stop data sharing in the future if I so desired.

Each team has a unique API key, which is useful for managing different projects or levels of data sharing.

You can view and manage your teams with the X.ai dashboard.

Getting Started

Getting started instructions that are provided at The Hitchhiker’s Guide to Grok at docs.x.ai.

Create an xAI Account.

You could generate a personal API key, but this is not necessary if you create a new team.

I created a new team, which yields a team API key. This should allow me to opt out of data collection more easily in the future.

Set an environment variable to hold the API key in ~/.bashrc:

~/.bashrc
export XAI_API_KEY="your_api_key"

Establish the environment variable:

Shell
$ source ~/.bashrc

Install the Visual Studio Code Simply Grok for VSCode extension.

Purchase credits in USD.

If you trust x.ai enough to give the monster direct access to your bank account, you can get a $5 refund.

I opted to pay by credit card instead.

Pick a model. At the time of writing, the grok-4-fast-reasoning model seemed to be the most cost-effective choice for programming tasks.

grok-4-fast-reasoning is a cost-efficient language model by xAI, released in late September 2025. It offers high-quality logical inference and problem-solving at a lower cost and faster speed than its predecessor, Grok-4. It uses fewer "thinking tokens" but maintains benchmark performance, features a 2 million token context window, and can switch between deep reasoning and rapid response modes. The model also has integrated tool use, including web browsing, and supports image and video analysis through its connection with X.

Simply Grok for VSCode

This is a rather primitive extension for Visual Studio Code. In particular, it does not display chat history in a separate panel, or to edit your previous prompts. The extension also does not allow you to select a portion of the code and then ask Grok to refactor or explain it.

This extension does not allow Grok models to access any of your files in Visual Studio. This is a huge limitation. Gemini Code Assist does this.

Features

  • Query Grok about your entire project to get a comprehensive overview or solve cross-file issues.
  • Focus on the active file and ask questions specific to its content.
  • Get explanations or suggestions for the function or method at your cursor position.
  • Select code and ask Grok for insights or assistance on the selection
  • Display Grok's responses in a new editor tab or the Output panel.
  • Review the data being sent to the Grok API before submission, with configurable settings for when previews appear.
  • Select from a variety of Grok models to suit your needs.

Usage

The Simply Grok for VSCode extension requires the API key, and for you to choose a Grok model. The choices for the models were quite out of date. I picked grok-code-fast because it was closest to what I want. After I making these changes, my user settings for the extension in %AppData%/Code/User/settings.json looked like this:

"vscodeGrok.apiKey": "xai-blahblahblah",
"vscodeGrok.model": "grok-code-fast"

I edited the file manually and set the model to grok-4-fast-reasoning.

"vscodeGrok.apiKey": "xai-blahblahblah",
"vscodeGrok.model": "grok-4-fast-reasoning"

Meh

how can i ask grok to convert an entire project with many files from one computer language to another?

I'm sorry, but attempting to access the Google Drive folder URL again via automated tools still results in a sign-in requirement and CAPTCHA challenge, blocking retrieval of INSTRUCTIONS.md or any folder contents. This is a common limitation with shared Drive links that aren't fully public. To move forward productively:

Paste the Contents: Please copy and paste the full text of INSTRUCTIONS.md directly into your next message. I'll analyze it immediately and provide a detailed, structured response based on its guidance. Alternative Sharing: Upload INSTRUCTIONS.md to a public site (e.g., GitHub Gist, Pastebin) and share that link—my browsing tool can fetch plain-text or Markdown from there without auth issues.

Regarding the ZIP request: As a text-based AI, I can't generate or serve actual downloadable files (like a .zip) in this interface—my responses are limited to formatted text, code blocks, and embeds. If you'd like, I can format my "work" (e.g., analysis notes, simulated outputs) as a ready-to-copy Markdown file below, which you can save locally and zip yourself. Here's a sample structure based on prior context—once I have the instructions, I'll expand it fully.

Actually, Grok cannot even open a zip file.

* indicates a required field.

Please select the following to receive Mike Slinn’s newsletter:

You can unsubscribe at any time by clicking the link in the footer of emails.

Mike Slinn uses Mailchimp as his marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp’s privacy practices.