How to Run Claude Code for Free with Ollama and Gemma 4 on Any PC

17 May 2026 11:37 50,478 views
You can now run a Claude-style AI coding assistant on your own Windows PC for free using Ollama and Google’s Gemma 4 model. This step-by-step guide walks you through the full setup and shows how to build real browser games with zero manual coding.

Imagine having a powerful AI coding assistant like Claude Code running on your own PC – with no subscription, no GPU, and no credit card required. Thanks to Ollama and Google’s Gemma 4 model, you can do exactly that, even on a low-end Windows machine.

In this guide, you’ll set everything up from scratch and then use your new AI assistant to build real, working browser games – all in a few prompts.

What You’re Setting Up

This setup combines three key pieces:

Visual Studio Code (VS Code) – Your main code editor and terminal where everything runs.

Claude Code – A command-line coding assistant that can understand your project, generate files, and modify code.

Ollama + Gemma 4 – Ollama connects Claude Code to Google’s Gemma 4 model. You’ll use the cloud version of Gemma 4, so you don’t need a powerful GPU or a high-end PC.

The result: a free, local-style coding assistant that feels similar to Claude’s paid coding experience, but powered by Gemma 4 through Ollama.

If you want a deeper dive into Gemma itself, check out this overview of why Gemma 4 is such a big deal.

Step 1: Install Visual Studio Code

VS Code will be your main workspace.

To install it:

1. Go to the official Visual Studio Code website and download the Windows installer.

2. Run the installer and accept the license agreement.

3. On the options screen, make sure you check:

- “Add to PATH”
- “Open with Code”

These options make it easier to launch and integrate tools later.

4. Click Install, then Finish. VS Code is now ready.

Step 2: Install Git (Required for Claude Code)

Claude Code relies on Git behind the scenes to manage and track your files. If Git isn’t installed, Claude Code simply won’t work, so don’t skip this step.

1. Visit git-scm.com and download Git for Windows.

2. Run the installer and keep the default options, except for one important screen:

- When asked which editor Git should use, choose Visual Studio Code as the default editor.

3. Finish the installation.

4. Open VS Code, go to Terminal > New Terminal.

5. Type:

git --version

If you see a version number (for example, git version 2.x.x), Git is installed correctly.

Step 3: Install Claude Code on Windows

Now you’ll install Claude Code itself.

1. Open your browser and go to code.claude.com/docs/overview.

2. Scroll down to the installation section. There are different commands for macOS, Linux, WSL, and Windows.

3. For Windows, copy the PowerShell installation command.

4. Open Windows PowerShell (search for “PowerShell” from the Start menu).

5. Paste the command into PowerShell and press Enter.

Windows will download and install Claude Code automatically. After a minute or two, you should see a version number confirming the installation.

Add Claude Code to Your PATH

After installation, you may see a message saying the installation exists, but the location is not in your PATH. You need to add it manually so you can run claude from any terminal.

1. Copy the installation path shown in PowerShell (the folder where Claude Code was installed).

2. Open the Start menu and search for Environment Variables.

3. Click Edit the system environment variables.

4. In the window that opens, click the Environment Variables… button.

5. Under User variables, select Path and click Edit.

6. Click New and paste the Claude installation path.

7. Click OK on all open dialogs to save and close.

8. Completely close PowerShell and VS Code, then reopen them so the new PATH is recognized.

To test it, open a new terminal (PowerShell or VS Code) and type:

claude

Claude Code should launch and show its interface. If it asks you to log in, just exit for now by pressing Ctrl + C twice. You’ll be connecting it through Ollama instead of logging in directly.

Step 4: Install Ollama on Windows

Ollama is the bridge between Claude Code and the Gemma 4 model. It can run models locally or via the cloud. In this setup, you’ll use the cloud option, which means no heavy downloads and no GPU required.

1. Go to ollama.com and sign in (this is important for using the cloud features).

2. Download Ollama for Windows.

3. Run the installer and click Install.

Ollama will set itself up and run in the background. You should see its icon in the system tray (bottom-right corner of the screen).

To confirm it’s working, open a VS Code terminal and type:

ollama --version

If you see a version number, Ollama is installed correctly.

Step 5: Connect Claude Code to Gemma 4 via Ollama

Now it’s time to plug everything together and use Gemma 4 as the brain behind Claude Code.

1. On the Ollama website, search for Gemma 4 and open its model page.

2. Scroll down to see the available versions. The most powerful one is:

gemma4:31b (about 20 GB if downloaded locally).

If you have a strong GPU and lots of RAM, you could pull this model locally using:

ollama pull gemma4:31b

But for most people, the cloud version is easier and works great, especially on low-end PCs.

Use the Gemma 4 Cloud Model with Claude Code

1. On the Gemma 4 model page, scroll to the section showing supported applications (like Code X, Open Code, and Claude Code).

2. Copy the command shown for Claude Code.

3. Go back to your terminal in VS Code.

4. Paste the command, but change the model name to the cloud version:

gemma4:31b-cloud

5. Press Enter.

Ollama will now launch Claude Code, but this time it will be powered by the Gemma 4 31B cloud model. At the bottom of the Claude Code interface, you should see the model name showing something like Gemma 4 31B. That confirms everything is wired up correctly.

Type hi and press Enter. If you get a friendly response like “Hello, how can I help you with your project?”, your free AI coding assistant is live.

For a more general walkthrough of using Gemma 4 with Ollama and VS Code, you may also like this detailed Gemma 4 + Ollama coding guide.

Step 6: Test Your Setup with Real Projects

With everything connected, it’s time to see what your new AI assistant can actually build. You’ll start simple and then move to full games.

Project 1: Simple “Hello World” Page

In the Claude Code terminal, type:

Create a simple HTML page that says "Hello World" with a black background.

Claude Code will:

- Create an HTML file
- Add the basic structure
- Style the page with a black background and “Hello World” text

When it’s done, open the file by typing:

start index.html

Your browser should show a clean “Hello World” page. This confirms your setup is working end-to-end.

Project 2: Snake Game in a Single HTML File

Next, build a simple browser game with one prompt. In Claude Code, type:

Create a simple single-file HTML snake game using Canvas API.

Claude Code will generate:

- The HTML structure
- A <canvas> element
- JavaScript for snake movement, food spawning, scoring, and game over logic

Once it finishes:

1. Right-click the created file in VS Code and choose Reveal in File Explorer.

2. Double-click the HTML file to open it in your browser.

You should see a fully working Snake game you can play immediately – built entirely by AI from a single prompt.

Project 3: Brick Breaker Game with Score and Lives

For a slightly more advanced test, build a Brick Breaker game. Use a more detailed prompt so the assistant includes everything you want:

Create a single-file HTML brick breaker game using Canvas API with score, lives, and restart.

Claude Code will generate:

- A paddle, ball, and brick layout
- Collision detection between ball, paddle, walls, and bricks
- A score system and lives counter
- Logic to restart the game after losing

Open the resulting HTML file in your browser, and you’ll have a complete Brick Breaker game running locally – again, with zero manual coding.

What You Can Build Next

With Claude Code, Ollama, and Gemma 4 connected, you now have a powerful, free coding assistant on your Windows PC. You can:

- Prototype web apps and tools
- Generate full front-end projects from prompts
- Experiment with small games and interactive demos
- Let the AI refactor or explain code you already have

And because Gemma 4 is available via Ollama’s cloud, you don’t need expensive hardware to get started. Just keep experimenting with prompts, ask for improvements, and iterate on your projects directly inside VS Code.

This combination of free tools gives you a near “pro” AI coding experience without subscriptions, GPUs, or API keys – just your laptop and a bit of curiosity.

Share:

Comments

No comments yet. Be the first to share your thoughts!

More in Code Assistants