Hi 1HACKERS,
I am trying to set up a free Claude Code environment using the open-source free-claude-code project, but I am currently stuck with API response errors. I am sharing my complete setup details and troubleshooting steps here in the hope that someone can point me in the right direction.
Goal
My goal is to use Claude Code CLI with a free/low-cost backend provider by routing Anthropic API requests through the free-claude-code proxy.
The project description mentions support for:
-
NVIDIA NIM
-
OpenRouter
-
LM Studio
-
Multiple model routing (Opus / Sonnet / Haiku mapping)
-
Claude Code CLI compatibility
Environment
Operating System:
-
Windows 11
-
PowerShell
Installed versions:
Claude Code:
2.1.205
Project directory:
C:\Users\SARASWATHI\free-claude-code
Repository Used
Initially, I looked at:
Rishurajgautam24/free-claude-code
However, the README structure I was following appeared to match another fork:
Alishahryar1/free-claude-code
The version I finally downloaded uses a newer src based Python structure:
free-claude-code
│
├── src
│ └── free_claude_code
│ ├── api
│ ├── cli
│ ├── config
│ ├── core
│ ├── messaging
│ └── providers
│
├── pyproject.toml
├── uv.lock
└── README.md
Because of this, the older command:
uv run uvicorn server:app --host 0.0.0.0 --port 8082
did not work because there is no server.py file in this version.
The correct startup command appears to be:
uv run fcc-server --host 127.0.0.1 --port 8082
Installation Steps Followed
Installed dependencies:
uv sync
Started the server successfully:
uv run fcc-server --host 127.0.0.1 --port 8082
Server output:
INFO: Started server process [9176]
INFO: Waiting for application startup.
INFO: Admin UI: http://127.0.0.1:8082/admin
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8082
The admin panel also loads successfully:
http://127.0.0.1:8082/admin
Claude Code Configuration
I configured Claude Code using:
$env:ANTHROPIC_AUTH_TOKEN="freecc"
$env:ANTHROPIC_BASE_URL="http://127.0.0.1:8082"
claude
The proxy receives requests:
POST /v1/messages?beta=true HTTP/1.1" 200 OK
However, Claude Code fails with:
API Error: API returned an empty or malformed response (HTTP 200)
— check for a proxy or gateway intercepting the request
Earlier Error Encountered
Before changing the repository and configuration, I also received:
API Error: 422
{
"detail": [
{
"type": "literal_error",
"loc": [
"body",
"messages",
1,
"role"
],
"msg": "Input should be 'user' or 'assistant'",
"input": "system"
}
]
}
This appeared to be a provider/model compatibility issue.
Configuration Tested
I tested with OpenRouter:
MODEL="open_router/qwen/qwen3-coder:free"
MODEL_OPUS="open_router/qwen/qwen3-coder:free"
MODEL_SONNET="open_router/qwen/qwen3-coder:free"
MODEL_HAIKU="open_router/qwen/qwen3-coder:free"
The API key loads correctly:
Test:
uv run python -c "import os; from dotenv import load_dotenv; load_dotenv(); print('Key loaded:', bool(os.getenv('OPENROUTER_API_KEY')))"
Output:
Key loaded: True
Current Situation
At this point:
Repository cloned successfully
Dependencies installed
Proxy server starts
Admin UI works
Claude Code connects to proxy
Requests reach /v1/messages
Provider response is empty/malformed
Claude Code cannot complete a request
Questions
I would appreciate help from anyone familiar with this project:
-
Is the
src/free_claude_codeversion compatible with the latest Claude Code CLI2.1.205? -
Is there a recommended model/provider combination that works reliably?
-
Does the OpenRouter adapter currently support Claude Code streaming responses correctly?
-
Should I use NVIDIA NIM instead of OpenRouter for better compatibility?
-
Is there any required environment variable missing for response streaming?
Any suggestions, logs to collect, or configuration examples would be greatly appreciated.
Thanks!
!