Free Open-Source Proxy Unlocks Unlimited Claude Code Usage
Claude Code offers powerful AI‑assisted coding but its official API is costly and hard to access; the open‑source free‑claude‑code proxy intercepts Claude’s requests, forwards them to free or low‑cost LLM providers, provides multi‑model routing, zero‑cost usage, detailed setup steps, advanced bot and voice features, and troubleshooting guidance.
Background
Claude Code is Anthropic’s terminal‑level AI programming assistant that can understand whole codebases, perform Git operations and multi‑file refactoring. Its official API is expensive, difficult to access from China, and locked to Anthropic‑provided models.
free‑claude‑code
The open‑source project free‑claude‑code (GitHub https://github.com/Alishahryar1/free-claude-code) gained >20 000 stars within a week and provides a lightweight proxy that forwards Claude Code requests to free or low‑cost LLM providers while preserving the Anthropic API contract.
Core principle
Implemented in Python/FastAPI, the proxy intercepts Claude Code’s HTTP calls, routes them to a selected back‑end (NVIDIA NIM, OpenRouter, DeepSeek, LM Studio, llama.cpp, Ollama), converts the provider’s response to the Anthropic format and returns it unchanged to Claude Code. No modification of Claude Code’s CLI, VS Code or JetBrains extensions is required.
┌─────────────────┐ ┌──────────────────────┐ ┌──────────────────┐
│ Claude Code │──►│ Free Claude Code │──►│ Real LLM vendor │
│ CLI / VSCode │◄──│ Local proxy (:8082)│◄──│ NIM / OR / local│
└─────────────────┘ └──────────────────────┘ └──────────────────┘
Anthropic API format OpenAI‑compatible format (SSE)Key features
Support for six back‑ends covering free, paid and self‑hosted models.
Intelligent model routing: Opus, Sonnet and Haiku requests can be directed to different providers.
Native /model endpoint compatibility – Claude Code can switch models without extra configuration.
Full feature compatibility: streaming, tool calls, reasoning blocks, with latency optimisations.
Optional Discord or Telegram bot, voice‑note transcription via Whisper or NVIDIA NIM.
Provider overview
NVIDIA NIM – free, 40 req/min, suitable for daily use; requires an nvapi‑… key.
OpenRouter – free or paid, rate limits vary by model.
DeepSeek – pay‑as‑you‑go, Anthropic‑compatible API.
LM Studio – free local, unlimited rate, privacy‑focused.
llama.cpp – free local, unlimited rate, lightweight inference.
Ollama – free local, unlimited rate, easiest to start.
Technical highlights
Thought‑chain preservation – parses reasoning_content tags so models such as DeepSeek R1 or GLM display their reasoning in Claude Code.
Automatic tool‑call repair – heuristics fix non‑standard tool‑call outputs from open models.
Smart rate‑limit and anti‑ban – concurrency control and 429 back‑off reduce latency and prevent bans.
Advanced usage
Discord or Telegram bots can turn Claude Code into a remote‑controllable agent with threaded conversations, persistent sessions and voice transcription. The project also ships a claude‑pick script that uses fzf for interactive model selection, and a voice‑note feature configurable via VOICE_NOTE_ENABLED and Whisper or NVIDIA NIM models.
Quick start
Install the base dependencies:
# macOS/Linux (bash)
curl -LsSf https://astral.sh/uv/install.sh | sh
uv self update
uv python install 3.14or
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
uv self update
uv python install 3.14Clone the repository and copy the example env file:
git clone https://github.com/Alishahryar1/free-claude-code.git
cd free-claude-code
cp .env.example .env # or Copy-Item on WindowsEdit .env to add the API key of the chosen provider (example for NVIDIA NIM) and model mappings:
# NVIDIA NIM key (required)
NVIDIA_NIM_API_KEY="nvapi-YOUR_KEY"
# Model routing
MODEL_OPUS="nvidia_nim/moonshotai/kimi-k2.5"
MODEL_SONNET="nvidia_nim/z-ai/glm-5.1"
MODEL_HAIKU="nvidia_nim/z-ai/glm4.7"
MODEL="nvidia_nim/z-ai/glm4.7"
# Optional features
ENABLE_MODEL_THINKING=true
ANTHROPIC_AUTH_TOKEN="freecc"
PROVIDER_RATE_LIMIT=1
PROVIDER_RATE_WINDOW=3
PROVIDER_MAX_CONCURRENCY=5Start the local proxy:
uv run uvicorn server:app --host 0.0.0.0 --port 8082Configure Claude Code to point to the proxy (CLI, VS Code or JetBrains): set ANTHROPIC_BASE_URL=http://localhost:8082 and ANTHROPIC_AUTH_TOKEN=freecc. Example for the CLI:
ANTHROPIC_AUTH_TOKEN="freecc" ANTHROPIC_BASE_URL="http://localhost:8082" claudeand for VS Code add the same variables to settings.json.
{
"claudeCode.environmentVariables": [
{"name": "ANTHROPIC_BASE_URL", "value": "http://localhost:8082"},
{"name": "ANTHROPIC_AUTH_TOKEN", "value": "freecc"}
]
}Troubleshooting
Incorrect response format – ensure ANTHROPIC_BASE_URL has no /v1 suffix and the proxy returns streaming data.
Local model returns 400 – verify the local service is running, supports /v1/messages, and increase context size if needed.
Streaming interruptions – lower concurrency, increase timeout parameters, or switch to a more stable provider.
VS Code shows login screen – check settings.json environment variables and that the proxy is running.
Limitations
Because the back‑end model is swapped, tasks that require very long context, multi‑step tool calls or deep code refactoring may perform worse than the original Anthropic models. For everyday coding, single‑file edits and code explanations the free models are sufficient and cost‑effective.
Project structure
free-claude-code/
├── server.py # ASGI entry point
├── api/ # FastAPI routes and logic
├── core/ # Protocol utilities and streaming
├── providers/ # Provider adapters and rate limiting
├── messaging/ # Chat platform adapters and voice
├── cli/ # Command‑line entry
├── config/ # Configuration and logging
└── tests/ # Test suiteDevelopment commands
uv run ruff format # code formatting
uv run ruff check # linting
uv run ty check # type checking
uv run pytest # test suiteRepository
https://github.com/Alishahryar1/free-claude-code
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
AI Architecture Path
Focused on AI open-source practice, sharing AI news, tools, technologies, learning resources, and GitHub projects.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
