Links:
Free Claude Code Repo: https://github.com/Alishahryar1/free-claude-code
Nvidia Nim API Key: https://build.nvidia.com/settings/api-keys
Open Router API Key: https://openrouter.ai/keys
DeepSeek API Key: https://platform.deepseek.com/api_keys
If you’re looking for a way to use Claude Code for free, you’ve probably stumbled across tutorials telling you to run local models through Ollama or LM Studio. But let’s be real—99% of people don’t have the high-end PCs required to run those smoothly.
Even on a $4,000 Mac with 64GB of RAM and an M-series chip, running smart local models can be agonizingly slow. If you switch to a fast model, you sacrifice the intelligence needed for complex coding tasks.
Furthermore, while Claude Code’s official pricing starts at $20/month, the usage limits are surprisingly low, leaving even those on the $100/month plan wanting more.
So, how can you get around this? The answer is using a free API via NVIDIA NIM and a clever proxy server. In this guide, we’ll walk you through the complete A to Z process of setting up Claude Code absolutely free.
Step 1: Install Claude Code
First, you need the official Claude Code CLI.
- Visit the official Claude Code website to get the install command.
- Open your Terminal (Command Prompt on Windows, or default Terminal/iTerm on Mac/Linux).
- Paste the command and press Enter.
(Note: Do not run Claude Code just yet; we have some configuration to do first.)
Step 2: Install uv and Python
Next, we need to install uv to manage our environment.
For Mac/Linux: Copy the install command for Mac/Linux from the GitHub repository and run it in your terminal.
For Windows: Run the three specified Windows commands from the repo.
After installation, update uv by running the self-update command, and then install Python using the third command provided in the repository instructions.
Step 3: Clone the Proxy Server Repository
Instead of relying on slow local models, we are going to use a proxy server that connects to powerful, free APIs.
- Create a directory where you want to store the proxy server (e.g., a
Playgroundfolder). - Open your terminal, navigate to that folder using the
cdcommand, and clone the repository provided in the video description. - Navigate into the cloned folder (
cd free-claude-code). - Copy the environment example file to create your own
.envfile by running the setup command. - Open this directory in your favorite code editor (like VS Code using
code .).
Step 4: Get Your Free API Keys
We’ll primarily use NVIDIA NIM, which generously offers around 40 requests per minute for free—more than enough for general coding.
1. NVIDIA NIM (Recommended)
- Go to the NVIDIA NIM website and create an account.
- Verify your account using your phone number (this is required to generate a key).
- Click Generate API Key, name it (e.g., “CC”), and set an expiration date.
- Copy the key and paste it into the
NVIDIA_API_KEYfield in your.envfile.
2. OpenRouter (Optional)
- Create an account on OpenRouter.
- Generate a new key and paste it into the
OPENROUTER_API_KEYfield. (Note: Free OpenRouter models can occasionally be unreliable without account credit).
3. DeepSeek (Optional)
- Create an account on the DeepSeek platform.
- Click Create New API Key, name it, copy it, and paste it into the
DEEPSEEK_API_KEYfield.
Save your .env file!
Step 5: Configure the Models
Claude Code expects three model slots: Opus, Sonnet, and Haiku. We will map our free models to these slots within the config file.
- For Opus (NVIDIA GLM): On the NVIDIA NIM site, filter by “Free Endpoint” and select your preferred model (e.g., GLM 4.7). Click “View Code”, copy the model string, and format it as
nvidia/[model-name]. - For Sonnet (OpenRouter Gemma 2): Search for top-context free models on OpenRouter, copy the model name, and format it as
openrouter/[model-name]. - For Haiku (DeepSeek Reasoner): Use the DeepSeek Direct API and format it as
deepseek/deepseek-reasoner.
Step 6: Run the Proxy Server and Start Coding!
- In your terminal (inside the
free-claude-codefolder), run the command to start the proxy server. This server mimics Anthropic’s API while routing requests to your free NVIDIA/OpenRouter models. - Open a new terminal window and navigate to your actual project folder (where you want to write code).
- Run the specific startup command for your OS (Bash for Mac/Linux, PowerShell for Windows) provided in the repo.
- Claude Code will launch. Select your mapped model (e.g., Opus/GLM).
You can now start prompting Claude Code! For example: “Create a tic-tac-toe game in HTML, CSS, and JS.” You will see the API hits going to your free server, and Claude will generate the files for you.
Pro Tip: Automate with Sandbox Mode
By default, Claude Code asks for permission before modifying any file, which gets tedious on large projects.
You can bypass this by setting up a shell alias with the --dangerously-skip-permissions flag. However, for security, you should always run this in Sandbox Mode:
- In Claude Code, type
/sandbox. - Select Sandbox with auto-allow.
This runs Claude Code in a virtual environment restricted only to your project folder. It will edit your project files automatically but will ask for permission if it tries to touch anything outside that folder. Always use version control (Git) so you can safely commit or revert changes!
Conclusion
By leveraging NVIDIA NIM and a lightweight proxy server, you can unlock the full power of Claude Code for free, without melting your laptop’s CPU. Give this setup a try, and happy coding!
Don’t forget to use Git to keep your code secure while using automated sandbox features!