If you want to use Claude Code with a free locally running NVIDIA NIM backend, follow these steps carefully.
This setup works by running a local API server that Claude Code connects to instead of the default Anthropic API.
Step 1 — Install UV
First, install UV from the official documentation:
https://docs.astral.sh/uv/getting-started/installation/
After installing UV, install Python 3.14:
uv python install 3.14
Step 2 — Clone the Repository
Clone the repository and move into the project directory:
git clone https://github.com/Alishahryar1/free-claude-code.git nvidia-nim
cd nvidia-nim
Step 3 — Create the Environment File
Copy the example environment file to .env.
macOS/Linux
cp .env.example .env
PowerShell
Copy-Item .env.example .env
Step 4 — Configure NVIDIA NIM
To get your API key, visit https://build.nvidia.com/models, verify your mobile number, and generate your API key.
Open the .env file and add your NVIDIA NIM API key and model name.
Example:
NVIDIA_API_KEY=your_api_key_here
MODEL_NAME=your_model_name_here
Save the file after editing.
Step 5 — Start the NVIDIA NIM API Server
Run the following command to start the API server:
uv run uvicorn server:app --host 0.0.0.0 --port 8082
The API server must stay running in the background while using Claude Code.
Step 6 — Install Claude Code
Install Claude Code using:
curl -fsSL https://claude.ai/install.sh | bash
Step 7 — Run Claude Code with NVIDIA NIM
PowerShell
$env:ANTHROPIC_AUTH_TOKEN="freecc";
$env:ANTHROPIC_BASE_URL="http://localhost:8082";
claude
Bash
ANTHROPIC_AUTH_TOKEN="freecc" ANTHROPIC_BASE_URL="http://localhost:8082" claude
Claude Code will now use the locally running NVIDIA NIM API server.
Optional — Create a Single Startup Script
Instead of manually running both commands every time, you can automate the process using a startup script.
Linux/macOS Startup Script
Create a file named start.sh:
#!/bin/bash
echo "[+] Starting NVIDIA NIM API Server..."
uv run uvicorn server:app --host 0.0.0.0 --port 8082 &
sleep 5
echo "[+] Launching Claude Code..."
ANTHROPIC_AUTH_TOKEN="freecc" \
ANTHROPIC_BASE_URL="http://localhost:8082" \
claude
Make it executable:
chmod +x start.sh
Run it using:
./start.sh
Windows PowerShell Startup Script
Create a file named start.ps1:
Write-Host "[+] Starting NVIDIA NIM API Server..."
Start-Process powershell -ArgumentList "uv run uvicorn server:app --host 0.0.0.0 --port 8082"
Start-Sleep -Seconds 5
Write-Host "[+] Launching Claude Code..."
$env:ANTHROPIC_AUTH_TOKEN="freecc"
$env:ANTHROPIC_BASE_URL="http://localhost:8082"
claude
Run it using:
.\start.ps1
This allows you to start both the API server and Claude Code with a single command.
Important Note
Each time you want to use Claude Code with NVIDIA NIM, make sure:
- The API server is running
- The environment variables are set correctly
- Claude Code is launched using the commands above
If the API server stops, Claude Code will not be able to connect.