Skip to content
The Code Street
Featured image of post Claude Code For Free in VS Code: Full Setup Guide with Ollama + Qwen 3.8

Claude Code For Free in VS Code: Full Setup Guide with Ollama + Qwen 3.8

Run Claude Code for free inside VS Code with no Claude login and no API bill. Install Ollama, download Qwen 3.8, set up the Claude Code extension with two small config changes, and build a full Space Shooter game from one prompt.

Claude Code is one of the best AI coding tools around. Using it normally means a Claude login, an API key and a bill that grows with every prompt.

In this guide I’ll show you how to run Claude Code completely free, right inside VS Code. There’s no Claude login, no third-party API and no monthly bill. The AI model runs on your own PC through Ollama, using Qwen 3.8.

By the end, we’ll give it a single prompt and it will build a full Space Shooter game, with enemy waves, power-ups and a boss fight.

Prefer the terminal? I covered the command-line version in Claude Code For Free: Local Setup with Ollama + Qwen 3.8.

How It Works

Normally the Claude Code extension sends your prompts to Anthropic’s cloud. Here, we point it at Ollama, which runs on your own machine at localhost:11434 and serves the Qwen 3.8 model.

Piece What it does
VS Code + Claude Code extension The editor and the AI coding agent you chat with
Ollama Runs AI models locally and exposes them on port 11434
Qwen 3.8 (27B) The model that actually writes the code

Nothing about how you use Claude Code changes. Only where the model runs does.

What You Need

Requirement
Editor VS Code (any recent version)
Memory About 32 GB total between RAM and GPU
Disk About 20 GB free (the model is ~18 GB)
GPU Optional, but much faster with one. 24 GB VRAM is ideal
OS Windows, macOS or Linux

No big GPU? It still works. Ollama splits the model between your GPU and RAM; it’s just slower.

The Plan: Six Steps

  1. Download Ollama
  2. Download the Qwen 3.8 model
  3. Install the Claude Code extension
  4. Set the environment variables (this skips the login)
  5. Add settings.local.json to your project
  6. Build a Space Shooter with one prompt

Step 1: Download Ollama

Ollama is what runs AI models on your own computer.

Windows: download the installer from ollama.com and run it.

macOS or Linux:

1
curl -fsSL https://ollama.com/install.sh | sh

Then check the version. You need 0.15 or newer:

1
ollama --version

Keep Ollama running in the background. Claude Code talks to it on port 11434.

Step 2: Download the Model

One command:

1
ollama pull qwen3.8:27b

It’s about 18 GB, so this is the slow part. When it says success, do a quick test:

1
2
ollama run qwen3.8:27b
# say hi, then type /bye to exit

If it answers, the model is working locally.

Step 3: Install the Claude Code Extension

  1. Open VS Code and press Ctrl + Shift + X (Cmd + Shift + X on a Mac).
  2. Search for Claude Code.
  3. Check the publisher is Anthropic, then click Install.

Step 4: Set the Environment Variables

This is the step that skips the Claude login and points the extension at Ollama.

  1. Press Ctrl + , to open Settings.
  2. Search for Claude Code: Environment Variables.
  3. Click Edit in settings.json.

Add these four entries:

1
2
3
4
5
6
[
  { "name": "ANTHROPIC_AUTH_TOKEN", "value": "ollama" },
  { "name": "ANTHROPIC_API_KEY",    "value": "ollama" },
  { "name": "ANTHROPIC_BASE_URL",   "value": "http://localhost:11434" },
  { "name": "ANTHROPIC_MODEL",      "value": "qwen3.8:27b" }
]
Variable What it does
ANTHROPIC_AUTH_TOKEN Required, but Ollama ignores it, so any word works. I use ollama
ANTHROPIC_API_KEY Same idea: a placeholder so the extension doesn’t ask you to sign in
ANTHROPIC_BASE_URL Sends requests to Ollama on your own machine instead of the cloud
ANTHROPIC_MODEL The model to use: your local Qwen 3.8

Save the file, then reload VS Code (Ctrl + Shift + P → Developer: Reload Window).

Step 5: Add settings.local.json

The environment variables set up the extension. This file sets up your project, so that every model Claude Code might reach for is your local Qwen.

Create it inside your project folder:

1
2
3
your-project/
└── .claude/
    └── settings.local.json

Paste in:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
  "env": {
    "ANTHROPIC_BASE_URL": "http://127.0.0.1:11434",
    "ANTHROPIC_AUTH_TOKEN": "ollama",
    "ANTHROPIC_API_KEY": "",
    "ANTHROPIC_MODEL": "qwen3.8:27b",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen3.8:27b",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen3.8:27b",
    "ANTHROPIC_DEFAULT_FABLE_MODEL": "qwen3.8:27b",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen3.8:27b",
    "CLAUDE_CODE_SUBAGENT_MODEL": "qwen3.8:27b",
    "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "65536"
  }
}

The important lines are the ANTHROPIC_DEFAULT_*_MODEL ones. They map every built-in model choice (Opus, Sonnet, Fable and Haiku) to Qwen, and CLAUDE_CODE_SUBAGENT_MODEL does the same for sub-agents. Nothing ever reaches for a paid model.

Tip: the max context here is 65536 (64k), so open Ollama’s settings and set its context length to 64k to match. Not sure what that means? See What Is Context Size in Ollama?

settings.local.json is meant for your machine only, so keep it out of Git.

Step 6: Build a Space Shooter with One Prompt

Everything’s ready. Open the Claude Code panel in VS Code and paste this prompt:

1
2
3
4
5
6
7
Build a complete, visually stunning Space Shooter game in a single HTML file
using HTML, CSS, and JavaScript. Use Canvas for smooth gameplay, neon space
visuals, animated stars, player movement, shooting, enemy waves, particle
explosions, power-ups, score, lives, increasing difficulty, a boss fight,
and a game-over/restart screen. Make it responsive, polished, and fun to play
with keyboard controls. Keep all code in one index.html file with no external
libraries. Ensure everything works correctly.

Then let Qwen work. Every bit of it runs on your own PC, with no API calls and no tokens being counted.

The Result

When it finished, I opened index.html in the browser and played it: animated stars, a ship that moves and shoots, waves of enemies, particle explosions, and a boss fight with its own health bar.

The full build and live gameplay are in the video.

Is it as fast or as sharp as paid Claude? No. But for side projects, learning and quick prototypes, getting a complete working game for ₹0 is seriously impressive.

Troubleshooting

Still asks you to log in

Check all four environment variables in Step 4, save settings.json, then reload the VS Code window.

Connection refused

Ollama isn’t running. Start the Ollama app, or run ollama serve in a terminal.

Model not found

Run ollama pull qwen3.8:27b again, and make sure the model name matches exactly in both config files.

Slow, or it forgets your files mid-task

  • Set Ollama’s context length to 64k so it matches CLAUDE_CODE_MAX_CONTEXT_TOKENS.
  • Close other GPU-heavy apps.
  • Check the model fits in your GPU memory. If it spills into RAM, it gets much slower.

FAQ

Is this really free?

Yes. There’s no API bill and no subscription. You only use your own hardware.

Do I need a Claude account?

Not for this setup. The environment variables point the extension at Ollama instead of Anthropic’s servers.

Why set the variables in two places?

The VS Code environment variables configure the extension, which is what skips the login. settings.local.json configures Claude Code for this project, mapping every model option to Qwen.

Can I use a different model?

Yes. Pull any model from the Ollama library and replace qwen3.8:27b with its name in both places. Coding-focused models work best.

Is this the same as the Qwen Code extension?

No. That’s a different extension. If you’re curious, I covered it in How to Use Qwen 3 with VS Code for Free.

Wrapping Up

That’s the whole setup:

  1. Download Ollama
  2. Download qwen3.8:27b
  3. Install the Claude Code extension
  4. Set four environment variables
  5. Add .claude/settings.local.json
  6. Build something

Free Claude Code, right inside your editor. Which game should I build next? Tell me in the video comments.

Happy (free) coding! 🚀

comments powered by Disqus