[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-2391":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},2391,"free-claude-code","Alishahryar1\u002Ffree-claude-code","Alishahryar1","Use claude-code for free in the terminal, VSCode extension or discord like OpenClaw (voice supported)","",null,"Python",33809,5172,185,176,0,237,1507,9958,1116,120,"MIT License",false,"main",true,[],"2026-06-12 04:00:14","\u003Cdiv align=\"center\">\n\n# 🤖 Free Claude Code\n\nUse Claude Code CLI, VS Code, JetBrains ACP, or chat bots through your own Anthropic-compatible proxy.\n\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg?style=for-the-badge)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n[![Python 3.14](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.14-3776ab.svg?style=for-the-badge&logo=python&logoColor=white)](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002F)\n[![uv](https:\u002F\u002Fimg.shields.io\u002Fendpoint?url=https:\u002F\u002Fraw.githubusercontent.com\u002Fastral-sh\u002Fuv\u002Fmain\u002Fassets\u002Fbadge\u002Fv0.json&style=for-the-badge)](https:\u002F\u002Fgithub.com\u002Fastral-sh\u002Fuv)\n[![Tested with Pytest](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Ftesting-Pytest-00c0ff.svg?style=for-the-badge)](https:\u002F\u002Fgithub.com\u002FAlishahryar1\u002Ffree-claude-code\u002Factions\u002Fworkflows\u002Ftests.yml)\n[![Type checking: Ty](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Ftype%20checking-ty-ffcc00.svg?style=for-the-badge)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fty\u002F)\n[![Code style: Ruff](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcode%20formatting-ruff-f5a623.svg?style=for-the-badge)](https:\u002F\u002Fgithub.com\u002Fastral-sh\u002Fruff)\n[![Logging: Loguru](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flogging-loguru-4ecdc4.svg?style=for-the-badge)](https:\u002F\u002Fgithub.com\u002FDelgan\u002Floguru)\n\nFree Claude Code routes Anthropic Messages API traffic from Claude Code to NVIDIA NIM, OpenRouter, DeepSeek, LM Studio, llama.cpp, or Ollama. It keeps Claude Code's client-side protocol stable while letting you choose free, paid, or local models.\n\n[Quick Start](#quick-start) · [Providers](#choose-a-provider) · [Clients](#connect-claude-code) · [Troubleshooting](#troubleshooting) · [Development](#development)\n\n\u003C\u002Fdiv>\n\n\u003Cdiv align=\"center\">\n  \u003Cimg src=\"pic.png\" alt=\"Free Claude Code in action\" width=\"700\">\n\u003C\u002Fdiv>\n\n## Star History\n\n\u003Cdiv align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fstar-history.com\u002F#Alishahryar1\u002Ffree-claude-code&Date\">\n    \u003Cpicture>\n      \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=Alishahryar1\u002Ffree-claude-code&type=Date&theme=dark\">\n      \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=Alishahryar1\u002Ffree-claude-code&type=Date\">\n      \u003Cimg alt=\"Star History Chart\" src=\"https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=Alishahryar1\u002Ffree-claude-code&type=Date\" width=\"700\">\n    \u003C\u002Fpicture>\n  \u003C\u002Fa>\n\u003C\u002Fdiv>\n\n## What You Get\n\n- Drop-in proxy for Claude Code's Anthropic API calls.\n- Six provider backends: NVIDIA NIM, OpenRouter, DeepSeek, LM Studio, llama.cpp, and Ollama.\n- Per-model routing: send Opus, Sonnet, Haiku, and fallback traffic to different providers.\n- Native Claude Code `\u002Fmodel` picker support through the proxy's `\u002Fv1\u002Fmodels` endpoint (Claude Code must opt in to Gateway model discovery; see [Model Picker](#model-picker)).\n- Streaming, tool use, reasoning\u002Fthinking block handling, and local request optimizations.\n- Optional Discord or Telegram bot wrapper for remote coding sessions.\n- Optional voice-note transcription through local Whisper or NVIDIA NIM.\n\n## Quick Start\n\n### 1. Install Requirements\n\nInstall [Claude Code](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code), then install `uv` and Python 3.14.\n\nmacOS\u002FLinux:\n\n```bash\ncurl -LsSf https:\u002F\u002Fastral.sh\u002Fuv\u002Finstall.sh | sh\nuv self update\nuv python install 3.14\n```\n\nWindows PowerShell:\n\n```powershell\npowershell -ExecutionPolicy ByPass -c \"irm https:\u002F\u002Fastral.sh\u002Fuv\u002Finstall.ps1 | iex\"\nuv self update\nuv python install 3.14\n```\n\n### 2. Clone And Configure\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FAlishahryar1\u002Ffree-claude-code.git\ncd free-claude-code\ncp .env.example .env\n```\n\nEdit `.env` and choose one provider. For the default NVIDIA NIM path:\n\n```dotenv\nNVIDIA_NIM_API_KEY=\"nvapi-your-key\"\nMODEL=\"nvidia_nim\u002Fz-ai\u002Fglm4.7\"\nANTHROPIC_AUTH_TOKEN=\"freecc\"\n```\n\nUse any local secret for `ANTHROPIC_AUTH_TOKEN`; Claude Code will send the same value back to this proxy. Leave it empty only for local\u002Fprivate testing.\n\n### 3. Start The Proxy\n\n```bash\nuv run uvicorn server:app --host 0.0.0.0 --port 8082\n```\n\nPackage install alternative:\n\n```bash\nuv tool install git+https:\u002F\u002Fgithub.com\u002FAlishahryar1\u002Ffree-claude-code.git\nfcc-init\nfree-claude-code\n```\n\n`fcc-init` creates `~\u002F.config\u002Ffree-claude-code\u002F.env` from the bundled template.\n\n### 4. Run Claude Code\n\nPoint `ANTHROPIC_BASE_URL` at the proxy root. Do not append `\u002Fv1`. Set `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1` if you use `\u002Fmodel` to list models from this proxy (see [Model Picker](#model-picker)).\n\nPowerShell:\n\n```powershell\n$env:ANTHROPIC_AUTH_TOKEN=\"freecc\"; $env:ANTHROPIC_BASE_URL=\"http:\u002F\u002Flocalhost:8082\"; $env:CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=\"1\"; claude\n```\n\nBash:\n\n```bash\nANTHROPIC_AUTH_TOKEN=\"freecc\" ANTHROPIC_BASE_URL=\"http:\u002F\u002Flocalhost:8082\" CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 claude\n```\n\n## Choose A Provider\n\nModel values use this format:\n\n```text\nprovider_id\u002Fmodel\u002Fname\n```\n\n`MODEL` is the fallback. `MODEL_OPUS`, `MODEL_SONNET`, and `MODEL_HAIKU` override routing for requests that Claude Code sends for those tiers.\n\n| Provider | Prefix | Transport | Key | Default base URL |\n| --- | --- | --- | --- | --- |\n| \u003Cimg src=\"https:\u002F\u002Fcdn.simpleicons.org\u002Fnvidia\u002F76B900\" alt=\"\" width=\"18\" height=\"18\"> NVIDIA NIM | `nvidia_nim\u002F...` | OpenAI chat translation | `NVIDIA_NIM_API_KEY` | `https:\u002F\u002Fintegrate.api.nvidia.com\u002Fv1` |\n| \u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Flobehub\u002Flobe-icons\u002Frefs\u002Fheads\u002Fmaster\u002Fpackages\u002Fstatic-avatar\u002Favatars\u002Fkimi.webp\" alt=\"\" width=\"18\" height=\"18\"> Kimi | `kimi\u002F...` | OpenAI chat translation | `KIMI_API_KEY` | `https:\u002F\u002Fapi.moonshot.ai\u002Fv1` |\n| \u003Cimg src=\"https:\u002F\u002Fcdn.simpleicons.org\u002Fopenrouter\u002F6C47FF\" alt=\"\" width=\"18\" height=\"18\"> OpenRouter | `open_router\u002F...` | Anthropic Messages | `OPENROUTER_API_KEY` | `https:\u002F\u002Fopenrouter.ai\u002Fapi\u002Fv1` |\n| \u003Cimg src=\"https:\u002F\u002Fcdn.simpleicons.org\u002Fdeepseek\u002F4D6BFF\" alt=\"\" width=\"18\" height=\"18\"> DeepSeek | `deepseek\u002F...` | Anthropic Messages | `DEEPSEEK_API_KEY` | `https:\u002F\u002Fapi.deepseek.com\u002Fanthropic` |\n| \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Flmstudio-ai.png?size=64\" alt=\"\" width=\"18\" height=\"18\"> LM Studio | `lmstudio\u002F...` | Anthropic Messages | none | `http:\u002F\u002Flocalhost:1234\u002Fv1` |\n| \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fggml-org.png?size=64\" alt=\"\" width=\"18\" height=\"18\"> llama.cpp | `llamacpp\u002F...` | Anthropic Messages | none | `http:\u002F\u002Flocalhost:8080\u002Fv1` |\n| \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Follama.png?size=64\" alt=\"\" width=\"18\" height=\"18\"> Ollama | `ollama\u002F...` | Anthropic Messages | none | `http:\u002F\u002Flocalhost:11434` |\n\n\n\u003Cdetails>\n\u003Csummary>\u003Cimg src=\"https:\u002F\u002Fcdn.simpleicons.org\u002Fnvidia\u002F76B900\" alt=\"\" width=\"18\" height=\"18\"> \u003Cb>NVIDIA NIM\u003C\u002Fb>\u003C\u002Fsummary>\n\nGet a key at [build.nvidia.com\u002Fsettings\u002Fapi-keys](https:\u002F\u002Fbuild.nvidia.com\u002Fsettings\u002Fapi-keys).\n\n```dotenv\nNVIDIA_NIM_API_KEY=\"nvapi-your-key\"\nMODEL=\"nvidia_nim\u002Fz-ai\u002Fglm4.7\"\n```\n\nPopular examples:\n\n- `nvidia_nim\u002Fz-ai\u002Fglm4.7`\n- `nvidia_nim\u002Fz-ai\u002Fglm5`\n- `nvidia_nim\u002Fmoonshotai\u002Fkimi-k2.5`\n- `nvidia_nim\u002Fminimaxai\u002Fminimax-m2.5`\n\nBrowse models at [build.nvidia.com](https:\u002F\u002Fbuild.nvidia.com\u002Fexplore\u002Fdiscover).\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cimg src=\"https:\u002F\u002Fcdn.simpleicons.org\u002Fopenrouter\u002F6C47FF\" alt=\"\" width=\"18\" height=\"18\"> \u003Cb>OpenRouter\u003C\u002Fb>\u003C\u002Fsummary>\n\nGet a key at [openrouter.ai\u002Fkeys](https:\u002F\u002Fopenrouter.ai\u002Fkeys).\n\n```dotenv\nOPENROUTER_API_KEY=\"sk-or-your-key\"\nMODEL=\"open_router\u002Fstepfun\u002Fstep-3.5-flash:free\"\n```\n\nBrowse [all models](https:\u002F\u002Fopenrouter.ai\u002Fmodels) or [free models](https:\u002F\u002Fopenrouter.ai\u002Fcollections\u002Ffree-models).\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cimg src=\"https:\u002F\u002Fcdn.simpleicons.org\u002Fdeepseek\u002F4D6BFF\" alt=\"\" width=\"18\" height=\"18\"> \u003Cb>DeepSeek\u003C\u002Fb>\u003C\u002Fsummary>\n\nGet a key at [platform.deepseek.com\u002Fapi_keys](https:\u002F\u002Fplatform.deepseek.com\u002Fapi_keys).\n\n```dotenv\nDEEPSEEK_API_KEY=\"your-deepseek-key\"\nMODEL=\"deepseek\u002Fdeepseek-chat\"\n```\n\nThis provider uses DeepSeek's Anthropic-compatible endpoint, not the OpenAI chat-completions endpoint.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Flmstudio-ai.png?size=64\" alt=\"\" width=\"18\" height=\"18\"> \u003Cb>LM Studio\u003C\u002Fb>\u003C\u002Fsummary>\n\nStart LM Studio's local server, load a model, then configure:\n\n```dotenv\nLM_STUDIO_BASE_URL=\"http:\u002F\u002Flocalhost:1234\u002Fv1\"\nMODEL=\"lmstudio\u002Fyour-loaded-model\"\n```\n\nUse the model identifier shown by LM Studio. Prefer models with tool-use support for Claude Code workflows.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fggml-org.png?size=64\" alt=\"\" width=\"18\" height=\"18\"> \u003Cb>llama.cpp\u003C\u002Fb>\u003C\u002Fsummary>\n\nStart `llama-server` with an Anthropic-compatible `\u002Fv1\u002Fmessages` endpoint and enough context for Claude Code requests.\n\n```dotenv\nLLAMACPP_BASE_URL=\"http:\u002F\u002Flocalhost:8080\u002Fv1\"\nMODEL=\"llamacpp\u002Flocal-model\"\n```\n\nFor local coding models, context size matters. If llama.cpp returns HTTP 400 for normal Claude Code requests, increase `--ctx-size` and verify the model\u002Fserver build supports the requested features.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Follama.png?size=64\" alt=\"\" width=\"18\" height=\"18\"> \u003Cb>Ollama\u003C\u002Fb>\u003C\u002Fsummary>\n\nRun Ollama and pull a model:\n\n```bash\nollama pull llama3.1\nollama serve\n```\n\nThen configure the proxy. `OLLAMA_BASE_URL` is the Ollama server root; do not append `\u002Fv1`.\n\n```dotenv\nOLLAMA_BASE_URL=\"http:\u002F\u002Flocalhost:11434\"\nMODEL=\"ollama\u002Fllama3.1\"\n```\n\nUse the same tag shown by `ollama list`, for example `ollama\u002Fllama3.1:8b`.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Mix providers by model tier\u003C\u002Fb>\u003C\u002Fsummary>\n\nEach tier can use a different provider:\n\n```dotenv\nNVIDIA_NIM_API_KEY=\"nvapi-your-key\"\nOPENROUTER_API_KEY=\"sk-or-your-key\"\n\nMODEL_OPUS=\"nvidia_nim\u002Fmoonshotai\u002Fkimi-k2.5\"\nMODEL_SONNET=\"open_router\u002Fdeepseek\u002Fdeepseek-r1-0528:free\"\nMODEL_HAIKU=\"lmstudio\u002Funsloth\u002FGLM-4.7-Flash-GGUF\"\nMODEL=\"nvidia_nim\u002Fz-ai\u002Fglm4.7\"\n```\n\n\u003C\u002Fdetails>\n\n## Connect Claude Code\n\n### Claude Code CLI\n\n```bash\nANTHROPIC_AUTH_TOKEN=\"freecc\" ANTHROPIC_BASE_URL=\"http:\u002F\u002Flocalhost:8082\" CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 claude\n```\n\n### VS Code Extension\n\nOpen Settings, search for `claude-code.environmentVariables`, choose **Edit in settings.json**, and add:\n\n```json\n\"claudeCode.environmentVariables\": [\n  { \"name\": \"ANTHROPIC_BASE_URL\", \"value\": \"http:\u002F\u002Flocalhost:8082\" },\n  { \"name\": \"ANTHROPIC_AUTH_TOKEN\", \"value\": \"freecc\" },\n  { \"name\": \"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY\", \"value\": \"1\" }\n]\n```\n\nReload the extension. If the extension shows a login screen, choose the Anthropic Console path once; the local proxy still handles model traffic after the environment variables are active.\n\n### JetBrains ACP\n\nEdit the installed Claude ACP config:\n\n- Windows: `C:\\Users\\%USERNAME%\\AppData\\Roaming\\JetBrains\\acp-agents\\installed.json`\n- Linux\u002FmacOS: `~\u002F.jetbrains\u002Facp.json`\n\nSet the environment for `acp.registry.claude-acp`:\n\n```json\n\"env\": {\n  \"ANTHROPIC_BASE_URL\": \"http:\u002F\u002Flocalhost:8082\",\n  \"ANTHROPIC_AUTH_TOKEN\": \"freecc\",\n  \"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY\": \"1\"\n}\n```\n\nRestart the IDE after changing the file.\n\n### Model Picker\n\nClaude Code 2.1.126 or later can populate `\u002Fmodel` from this proxy's Gateway `\u002Fv1\u002Fmodels` response when `ANTHROPIC_BASE_URL` points here. In **2.1.126–2.1.128** that discovery was automatic; **newer releases** require **`CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1`** in the same environment as `ANTHROPIC_*`. Omit the flag if you only set models via proxy config and never use `\u002Fmodel` discovery.\n\nStart Claude Code with that variable set (see [Quick Start](#4-run-claude-code)), run `\u002Fmodel`, and choose any discovered provider model.\n\n\u003Cdiv align=\"center\">\n  \u003Cimg src=\"cc-model-picker.png\" alt=\"Claude Code model picker showing gateway models\" width=\"700\">\n\u003C\u002Fdiv>\n\nThe proxy lists models for configured provider keys and referenced local providers. Picker-safe IDs are routed back to the real provider\u002Fmodel automatically, so no `.env` edit or separate launcher script is needed after startup.\n\nEach provider model also has a `(no thinking)` picker variant. Use it when a model does not support Claude Code thinking or fails with adaptive-thinking requests. It routes to the same upstream model while asking Claude Code to send a non-thinking request.\n\n## Optional Integrations\n\n### Discord And Telegram Bots\n\nThe bot wrapper runs Claude Code sessions remotely, streams progress, supports reply-based conversation branches, and can stop or clear tasks.\n\nDiscord minimum config:\n\n```dotenv\nMESSAGING_PLATFORM=\"discord\"\nDISCORD_BOT_TOKEN=\"your-discord-bot-token\"\nALLOWED_DISCORD_CHANNELS=\"123456789\"\nCLAUDE_WORKSPACE=\".\u002Fagent_workspace\"\nALLOWED_DIR=\"C:\u002FUsers\u002Fyourname\u002Fprojects\"\n```\n\nCreate the bot in the [Discord Developer Portal](https:\u002F\u002Fdiscord.com\u002Fdevelopers\u002Fapplications), enable Message Content Intent, and invite it with read\u002Fsend\u002Fhistory permissions.\n\nTelegram minimum config:\n\n```dotenv\nMESSAGING_PLATFORM=\"telegram\"\nTELEGRAM_BOT_TOKEN=\"123456789:ABC...\"\nALLOWED_TELEGRAM_USER_ID=\"your-user-id\"\nCLAUDE_WORKSPACE=\".\u002Fagent_workspace\"\nALLOWED_DIR=\"C:\u002FUsers\u002Fyourname\u002Fprojects\"\n```\n\nGet a token from [@BotFather](https:\u002F\u002Ft.me\u002FBotFather) and your user ID from [@userinfobot](https:\u002F\u002Ft.me\u002Fuserinfobot).\n\nUseful commands:\n\n- `\u002Fstop` cancels a task; reply to a task message to stop only that branch.\n- `\u002Fclear` resets sessions; reply to clear one branch.\n- `\u002Fstats` shows session state.\n\n### Voice Notes\n\nVoice notes work on Discord and Telegram. Choose one backend:\n\n```bash\nuv sync --extra voice_local\nuv sync --extra voice\nuv sync --extra voice --extra voice_local\n```\n\n```dotenv\nVOICE_NOTE_ENABLED=true\nWHISPER_DEVICE=\"cpu\"          # cpu | cuda | nvidia_nim\nWHISPER_MODEL=\"base\"\nHF_TOKEN=\"\"\n```\n\nUse `WHISPER_DEVICE=\"nvidia_nim\"` with the `voice` extra and `NVIDIA_NIM_API_KEY` for NVIDIA-hosted transcription.\n\n## Configuration Reference\n\n[`.env.example`](.env.example) is the canonical list of variables. The sections below are the ones most users change.\n\n### Model Routing\n\n```dotenv\nMODEL=\"nvidia_nim\u002Fz-ai\u002Fglm4.7\"\nMODEL_OPUS=\nMODEL_SONNET=\nMODEL_HAIKU=\nENABLE_MODEL_THINKING=true\nENABLE_OPUS_THINKING=\nENABLE_SONNET_THINKING=\nENABLE_HAIKU_THINKING=\n```\n\nBlank per-tier values inherit the fallback. Blank thinking overrides inherit `ENABLE_MODEL_THINKING`.\n\n### Provider Keys And URLs\n\n```dotenv\nNVIDIA_NIM_API_KEY=\"\"\nOPENROUTER_API_KEY=\"\"\nDEEPSEEK_API_KEY=\"\"\nLM_STUDIO_BASE_URL=\"http:\u002F\u002Flocalhost:1234\u002Fv1\"\nLLAMACPP_BASE_URL=\"http:\u002F\u002Flocalhost:8080\u002Fv1\"\nOLLAMA_BASE_URL=\"http:\u002F\u002Flocalhost:11434\"\n```\n\nProxy settings are per provider:\n\n```dotenv\nNVIDIA_NIM_PROXY=\"\"\nOPENROUTER_PROXY=\"\"\nLMSTUDIO_PROXY=\"\"\nLLAMACPP_PROXY=\"\"\n```\n\n### Rate Limits And Timeouts\n\n```dotenv\nPROVIDER_RATE_LIMIT=1\nPROVIDER_RATE_WINDOW=3\nPROVIDER_MAX_CONCURRENCY=5\nHTTP_READ_TIMEOUT=120\nHTTP_WRITE_TIMEOUT=10\nHTTP_CONNECT_TIMEOUT=10\n```\n\nUse lower limits for free hosted providers; local providers can usually tolerate higher concurrency if the machine can handle it.\n\n### Security And Diagnostics\n\n```dotenv\nANTHROPIC_AUTH_TOKEN=\nLOG_RAW_API_PAYLOADS=false\nLOG_RAW_SSE_EVENTS=false\nLOG_API_ERROR_TRACEBACKS=false\nLOG_RAW_MESSAGING_CONTENT=false\nLOG_RAW_CLI_DIAGNOSTICS=false\nLOG_MESSAGING_ERROR_DETAILS=false\n```\n\nRaw logging flags can expose prompts, tool arguments, paths, and model output. Keep them off unless you are debugging locally.\n\n### Local Web Tools\n\n```dotenv\nENABLE_WEB_SERVER_TOOLS=true\nWEB_FETCH_ALLOWED_SCHEMES=http,https\nWEB_FETCH_ALLOW_PRIVATE_NETWORKS=false\n```\n\nThese tools perform outbound HTTP from the proxy. Keep private-network access disabled unless you are in a controlled lab environment.\n\n## Troubleshooting\n\n### Claude Code says `undefined ... input_tokens`, `$.speed`, or malformed response\n\nUpdate to the latest commit first. Older versions could emit invalid usage metadata in streaming responses. Then check:\n\n- `ANTHROPIC_BASE_URL` is `http:\u002F\u002Flocalhost:8082`, not `http:\u002F\u002Flocalhost:8082\u002Fv1`.\n- The proxy is returning Server-Sent Events for `\u002Fv1\u002Fmessages`.\n- `server.log` contains no upstream 400\u002F500 response before the malformed-response error.\n\n### llama.cpp or LM Studio returns HTTP 400\n\nThis usually means the local runtime rejected the Anthropic Messages request before the proxy could stream a model answer.\n\nCheck:\n\n- The local server supports `POST \u002Fv1\u002Fmessages`.\n- The model and runtime support the requested context length and tools.\n- llama.cpp was started with enough `--ctx-size` for Claude Code prompts.\n- The configured base URL includes `\u002Fv1` for LM Studio and llama.cpp.\n\n### Provider disconnects during streaming\n\nErrors like `incomplete chunked read`, `server disconnected`, or a peer closing the body usually come from the upstream provider or gateway. Reduce concurrency, raise timeouts, or retry later.\n\n### Tool calls work on one model but not another\n\nTool support is model and provider dependent. Some OpenAI-compatible models emit malformed tool-call deltas, omit tool names, or return tool calls as plain text. Try another model or provider before assuming the proxy is broken.\n\n### The VS Code extension still shows a login screen\n\nConfirm the extension environment variables are set, then reload the extension or restart VS Code. The browser login flow may still appear once; the local proxy is used when `ANTHROPIC_BASE_URL` is active in the extension process.\n\n## How It Works\n\n```text\nClaude Code CLI \u002F IDE\n        |\n        | Anthropic Messages API\n        v\nFree Claude Code proxy (:8082)\n        |\n        | provider-specific request\u002Fstream adapter\n        v\nNIM \u002F OpenRouter \u002F DeepSeek \u002F LM Studio \u002F llama.cpp \u002F Ollama\n```\n\nImportant pieces:\n\n- FastAPI exposes Anthropic-compatible routes such as `\u002Fv1\u002Fmessages`, `\u002Fv1\u002Fmessages\u002Fcount_tokens`, and `\u002Fv1\u002Fmodels`.\n- Model routing resolves the Claude model name to `MODEL_OPUS`, `MODEL_SONNET`, `MODEL_HAIKU`, or `MODEL`.\n- NIM uses OpenAI chat streaming translated into Anthropic SSE.\n- OpenRouter, DeepSeek, LM Studio, llama.cpp, and Ollama use Anthropic Messages style transports.\n- The proxy normalizes thinking blocks, tool calls, token usage metadata, and provider errors into the shape Claude Code expects.\n- Request optimizations answer trivial Claude Code probes locally to save latency and quota.\n\n## Development\n\n### Project Structure\n\n```text\nfree-claude-code\u002F\n├── server.py              # ASGI entry point\n├── api\u002F                   # FastAPI routes, service layer, routing, optimizations\n├── core\u002F                  # Shared Anthropic protocol helpers and SSE utilities\n├── providers\u002F             # Provider transports, registry, rate limiting\n├── messaging\u002F             # Discord\u002FTelegram adapters, sessions, voice\n├── cli\u002F                   # Package entry points and Claude process management\n├── config\u002F                # Settings, provider catalog, logging\n└── tests\u002F                 # Unit and contract tests\n```\n\n### Commands\n\n```bash\nuv run ruff format\nuv run ruff check\nuv run ty check\nuv run pytest\n```\n\nRun them in that order before pushing. CI enforces the same checks.\n\n### Package Scripts\n\n`pyproject.toml` installs:\n\n- `free-claude-code`: starts the proxy with configured host and port.\n- `fcc-init`: creates the user config template at `~\u002F.config\u002Ffree-claude-code\u002F.env`.\n\n### Extending\n\n- Add OpenAI-compatible providers by extending `OpenAIChatTransport`.\n- Add Anthropic Messages providers by extending `AnthropicMessagesTransport`.\n- Register provider metadata in `config.provider_catalog` and factory wiring in `providers.registry`.\n- Add messaging platforms by implementing the `MessagingPlatform` interface in `messaging\u002F`.\n\n## Contributing\n\n- Report bugs and feature requests in [Issues](https:\u002F\u002Fgithub.com\u002FAlishahryar1\u002Ffree-claude-code\u002Fissues).\n- Keep changes small and covered by focused tests.\n- Do not open Docker integration PRs.\n- Do not open README change PRs just open an issue for it.\n- Run the full check sequence before opening a pull request.\n- The syntax Except X, Y is brought back in python 3.14 final version (not in 3.14 alpha). Keep in mind before opening PRs.\n\n## License\n\nMIT License. See [LICENSE](LICENSE) for details.\n","Free Claude Code 是一个允许用户在终端、VSCode 扩展或 Discord 中免费使用 Claude 代码的项目。该项目通过将 Anthropic Messages API 流量路由到 NVIDIA NIM、OpenRouter、DeepSeek、LM Studio、llama.cpp 或 Ollama 等后端，实现了对 Claude 代码客户端协议的支持，并允许用户选择免费、付费或本地模型。其核心功能包括支持多种模型路由、原生 Claude Code 模型选择器集成以及流式处理和工具使用等高级特性。此外，还提供了可选的 Discord 或 Telegram 机器人封装，以支持远程编码会话及语音笔记转录功能。Free Claude Code 适用于需要灵活接入不同 AI 模型进行开发或研究的场景，特别适合希望在本地或云端利用开源模型替代 Anthropic 服务的开发者。",2,"2026-06-11 02:49:44","top_language"]