How To Use Claude Code FREE Forever (Ollama Local Setup)
Claude Code usually needs a paid Anthropic plan, a card on file, and a live internet connection. This setup runs Claude code free, fully local, and offline on a 16 GB laptop using Ollama and Google Gemma4 AI Model. 🎓 Want to learn Claude Code with me, live? Join the Claude Code Builder cohort on Maven → https://maven.com/genaiunplugged/claude-code-builder The trick is simple once you see it. Ollama speaks the same API shape that Claude Code expects, so you can point the CLI at your own machine instead of Anthropic's servers. No pro plan, no max plan, nothing charged. What You'll Learn - How to install Ollama and confirm the server is actually running before you touch Claude Code - Why this video uses the Gemma 4 12B model, which needs about 7.5 GB of RAM, instead of the bigger 26B or 31B builds - How to set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN so Claude Code talks to your local Ollama server - The one line you need to add to your .claude.json file so onboarding stops blocking the CLI - How to run "ollama launch claude" and confirm the status output shows your local model, not a cloud one - How to scope the setup to a single project with a local settings.json, so it does not override your paid Claude Code account everywhere else - How to raise the context window to 192,000 tokens for a safer auto-compaction margin - The 4K trap: Ollama defaults to a 4,096 token context, so Claude Code assumes 200k and silently drops everything past 4k until you move the slider to 64k Prerequisites - A laptop with at least 16 GB of RAM. Gemma 4 12B alone uses about 7.5 GB - A text editor for the config files. Sublime Text in this video, any editor works Cost Comparison - Anthropic Claude Code Pro or Max plan: a recurring monthly fee - This setup: $0. No subscription, no API key, no card on file, and it keeps working with no internet connection Tools Mentioned - Ollama, the local model runner that exposes an Anthropic-compatible API - Gemma, Google's open model, tested here at the 12B size - Claude Code CLI - Sublime Text and Visual Studio Code for editing the config files The payoff is a coding agent that runs entirely on your own hardware. Nothing you type leaves your laptop, which matters if privacy is part of why you wanted a local model in the first place. 📺 CHAPTERS: 0:00 Run Claude Code Free Locally 2:03 How the Free Claude Code Setup Works 4:10 Installing Ollama 7:16 Choosing a Gemma Model Size 9:21 Downloading Gemma 4 12B 13:50 Install Claude Code Free Setup 17:04 Launching Claude Code on Ollama 19:08 Scoping Settings to One Project 23:16 Raising the Context Window 28:09 The 4K Context Trap 29:05 Building a Calculator on Gemma 4 30:50 Where the Free Setup Hits Its Ceiling 🔗 RESOURCES Ollama official site and download → https://ollama.com Ollama model library → https://ollama.com/library Google Gemma official model page → https://ai.google.dev/gemma Claude Code official docs → https://docs.claude.com 📥 Helpful Links: 🛠️ Check my AI Systems store → https://store.genaiunplugged.com/ 🌐 Subscribe to GenAI Unplugged Substack → https://genaiunplugged.substack.com/ 🎓 Learn with me on Maven → https://maven.com/genaiunplugged 🤝 Let's connect on LinkedIn → https://www.linkedin.com/in/dheerajsharma14/ 📚 Browse all my courses → https://genaiunplugged.com/ 🙌 A like is what tells YouTube to show this to the next person looking for the same fix. Subscribe if you want a new AI build every week. Let me know which Gemma size your laptop actually handled and where the setup gave you trouble, I read every comment. ⚠️ DISCLAIMER This video is educational. Every setup I show uses the provider's own documented features. Nothing here bypasses billing, cracks licensing, or works around anyone's terms of service. I am not affiliated with any of the tools or providers shown, and there are no affiliate links in this description. Free tiers, model availability and rate limits change often, so check the official docs before you follow along. Your API keys are yours to protect. Never commit one to a repo or leave one on screen. Do not send confidential or client data through a third party model provider. Follow at your own risk. I accept no liability for any cost or issue that comes out of this tutorial. #claudecode #ollama #localllm




Join the discussion
Sign in to join the discussion
Sign in