Local Claude Code setup
How to Run Claude Code Free and Offline With Ollama

- You need decent hardware, since even a small model needs memory
- Ollama installs and runs local AI models on your computer
- Pick a model that fits your machine, such as GPT-OSS 20B or a Qwen coder model
- Install Node.js and Claude Code with npm
- The model name in the launch command must match the model you pulled
What this setup gives you
In this video I run Claude Code without paying API charges and without an internet connection. The language model runs on my own computer, which also means the work is native and private.
This is a quick tutorial. All of the terminal commands are in a document linked in the video description, so you can copy each one. The steps below follow the order in the video.
There is also a short list of what you need: Ollama, a local model, Node.js, Claude Code through npm and a computer with decent memory. Sixteen gigabytes of RAM is what I use and what the description recommends.
The video also covers a quick demo at the start so you can see the result before you follow the steps. The description lists the timeline: hardware, Windows versus Mac, installing Ollama, pulling the model, choosing a model, installing Node.js, installing Claude Code, launching with the local model, a to-do app demo, switching models and using it in VS Code.
Check your hardware
You need a decent computer to run a local AI model, even a small one. I am using a MacBook with an M5 chip, 16 GB of RAM and a 512 GB SSD, and I run the GPT-OSS 20 billion parameter model.
One thing I say for the first time in the video is that for this use case a Windows machine may be better than a Mac. The commands differ between Windows and Mac, so use the right set from the document.
I want to be clear about expectations. In the video I say you can keep the computer running as long as you want and that medium-size generations come out pretty fast, native and private. Speed will depend on your hardware.
Keep your expectations realistic: this is a way to use Claude Code at no API cost, on your own hardware, and results depend on the model you can run.
Step 1: install Ollama
Ollama is software that lets you install and run local AI models on your computer, offline. Open a terminal and run the first command in the document, which on a Mac uses Homebrew to install Ollama.
To check that it worked, run the version command. If it prints a version number, Ollama is installed.
On a Mac, the Homebrew command installs Ollama. If you are on Windows, use the Windows command in the document. Either way, check the version afterwards, which takes a second and tells you the install is fine.
I also mention in the video that I am showing Mac commands and that the Windows commands are different. Always follow the set that matches your own system.
Step 2: pull a local model
Next, download a model. I prefer GPT-OSS 20B because it is big enough to handle complex tasks while small enough to run on my laptop without overheating it.
If your computer can handle them, you can use a Qwen coder model. If none of those fit, there is a smaller Qwen 2.5 coder option. Choose the biggest model your machine can run comfortably. Run the pull command for your model and wait for it to download. If it is already installed, it will not download again.
I choose a 20 billion parameter model because it is big enough for complex tasks and small enough to run locally on my Mac. Pick the option from the document that suits your own computer.
Step 3: install Node.js and Claude Code
Claude Code needs Node.js. If you do not have it, use the Node install command from the document. Then install Claude Code globally with the npm install command, which uses Anthropic's package name in the document.
Both of these were already installed on my machine, so the terminal simply confirmed them.
Both installs are quick. Node.js comes first because Claude Code is installed with npm. On my machine both were already present, so the terminal only confirmed them.
Step 4: launch Claude Code with the local model
Now copy the launch command from the document, which starts Claude Code but points it at your local model instead of the cloud. Paste it, press enter and trust the folder when asked.
To test, I asked it to make a to-do app in simple JavaScript. It builds using the local model. Because nothing is sent to the cloud, you can disconnect from the internet and it still works. Medium-size generations are fairly quick, and you can keep your computer running as long as you like.
The launch step is the heart of the tutorial. The command sets Claude Code to talk to your local Ollama model instead of a cloud service, which is why no API key is needed. After launching, I accept the trust prompt for the folder, then give it a simple task as a test.
Switching models and using VS Code
The catch is that the model name inside the launch command must match the model you installed. If you installed a Qwen coder model, change the name in the command to that model.
You can also run the same command in the VS Code terminal, either in a new window or after opening a project folder, and Claude Code will work there too.
That is the whole setup: one command per step, in order. Keep the document open, switch the model name when you change models, and you will have a private, free coding assistant on your machine.
To summarize in order: install Ollama, pull a model, install Node.js, install Claude Code with npm, and launch it pointed at your local model. Then test it with a small task, such as a to-do app, before relying on it for bigger work.
Watch the full video to see each command run and the offline to-do app build.
Watch the full video See EducateXAIResults vary and depend on your effort. Read the results disclaimer.
Questions people ask
Do I need an API key or internet?
Not for this setup. The model runs locally through Ollama, so there is no API key and no cloud usage charge. You need internet only to install the tools and download the model first.
Which local model should I choose?
I use GPT-OSS 20B on a 16 GB Mac. If your machine cannot run that, try a Qwen coder model, and for weaker hardware use the smaller Qwen 2.5 coder. Match the model to your memory.
Why does Claude Code say the model is missing?
Check that the model name in the launch command matches what you pulled with Ollama. If you installed a different model, such as a Qwen coder size, you must change the name in the command.
Does it work on Windows?
Yes. In the video I say it works on both Mac and Windows, with different commands for each, and that a Windows machine may actually suit this setup better. Use the Windows commands from the document.
More from the channel
- How to Build a Premium Website With AI, Starting From Zero
- How to Sell AI Websites With a Value-First Cold Email System
- How to Recreate a Premium Website From a Mockup Using AI
- How to Make Motion Graphics Videos With Remotion and AI
- How to Build an Immersive Scroll-Based Website With AI Images and Video
- How to Build an Animated Crypto Landing Page With AI