Trying to Run Free Claude Code Proxy on Windows: Facing HTTP 200 Empty Response and 422 API Errors

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:

:white_check_mark: Repository cloned successfully
:white_check_mark: Dependencies installed
:white_check_mark: Proxy server starts
:white_check_mark: Admin UI works
:white_check_mark: Claude Code connects to proxy
:white_check_mark: Requests reach /v1/messages
:cross_mark: Provider response is empty/malformed
:cross_mark: Claude Code cannot complete a request

Questions

I would appreciate help from anyone familiar with this project:

  1. Is the src/free_claude_code version compatible with the latest Claude Code CLI 2.1.205?

  2. Is there a recommended model/provider combination that works reliably?

  3. Does the OpenRouter adapter currently support Claude Code streaming responses correctly?

  4. Should I use NVIDIA NIM instead of OpenRouter for better compatibility?

  5. Is there any required environment variable missing for response streaming?

Any suggestions, logs to collect, or configuration examples would be greatly appreciated.

Thanks!

:fire::hammer_and_wrench: FREE-CLAUDE-CODE PROXY β€” FIXING β€œEMPTY OR MALFORMED RESPONSE” ERRORS :laptop::high_voltage:


:bullseye: Stuck with HTTP 200 but empty responses from your free-claude-code proxy? This exact issue is documented in the project’s own GitHub repo with a known fix. Here’s the diagnosis, the fix, and direct answers to all 5 of your questions. :backhand_index_pointing_down:


:brain: THE ROOT CAUSE β€” CLI VERSION MISMATCH

YOUR EXACT ERROR IS A KNOWN, DOCUMENTED ISSUE:
──────────────────────────────────────────────
GitHub Issue #137 AND #497 on Alishahryar1/free-claude-code
both report the IDENTICAL error you're seeing:

  "API Error: API returned an empty or malformed 
   response (HTTP 200) β€” check for a proxy or 
   gateway intercepting the request"

THE CONFIRMED FIX (from Issue #497):
  β†’ Downgrade Claude Code CLI to version 2.1.142
  β†’ Set DISABLE_AUTOUPDATER=1 globally to stop
    Claude Code from auto-updating back to a
    newer, incompatible version

FIX COMMAND:
  npm install -g @anthropic-ai/[email protected]

  Then set (PowerShell):
  $env:DISABLE_AUTOUPDATER="1"

Your CLI version 2.1.205 is newer than the version the proxy was tested against β€” this is almost certainly your primary problem, matching the documented GitHub issue exactly.


:clipboard: DIRECT ANSWERS TO YOUR 5 QUESTIONS


:red_question_mark: Q1 β€” Is the src/free_claude_code version compatible with CLI 2.1.205?

ANSWER: Not fully confirmed compatible.

  β†’ The project's dev.to writeup and official
    README reference installation via:
    uv tool install --force git+https://github.com/
    Alishahryar1/free-claude-code.git
  β†’ Then launching with `fcc-claude` (NOT plain
    `claude`) β€” this wrapper auto-injects the
    required environment variables correctly
  β†’ Using plain `claude` with manually set env
    vars (as you did) can miss newer protocol
    requirements that 2.1.205 expects

:red_question_mark: Q2 β€” Recommended model/provider combination that works reliably?

ANSWER: NVIDIA NIM is currently the most reliable.

  β†’ NVIDIA NIM free tier includes Kimi K2.5 
    and GLM 4.7 β€” both confirmed working
    with this proxy
  β†’ OpenRouter's free-tier models (including
    Qwen3-coder:free) are known to be LESS
    stable for tool-use/streaming with this
    proxy specifically
  β†’ Multiple community tutorials (KSK Royal,
    other guides) default to NVIDIA NIM or
    Gemini free tier as the primary
    recommendation, not OpenRouter

:red_question_mark: Q3 β€” Does OpenRouter adapter support Claude Code streaming correctly?

ANSWER: This is likely your SECOND problem.

  β†’ Your earlier 422 error:
    "Input should be 'user' or 'assistant', 
     input: 'system'"
    β†’ This means the OpenRouter adapter is NOT
      correctly translating Anthropic's "system"
      role into the format your chosen Qwen3-coder
      model expects
  β†’ Free-tier models on OpenRouter often have
    incomplete or inconsistent system-role support
  β†’ This is a known translation-layer gap between
    Anthropic Messages API format and OpenRouter's
    OpenAI-compatible format for free models
    specifically

:red_question_mark: Q4 β€” Should you use NVIDIA NIM instead of OpenRouter?

ANSWER: Yes, switch to NVIDIA NIM.

  β†’ NVIDIA NIM's free tier (build.nvidia.com) is
    explicitly listed as the PRIMARY supported
    backend in the project documentation
  β†’ It's designed to closely mirror Anthropic's
    message structure, reducing translation errors
  β†’ Kimi K2.5 and GLM 4.7 are the two models
    confirmed to work reliably through this proxy
  β†’ This should resolve BOTH your 422 role error
    AND likely your empty response issue

:red_question_mark: Q5 β€” Missing environment variable for streaming?

ANSWER: Yes β€” add gateway model discovery flag.

  β†’ Add this environment variable:
    CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1

  β†’ This is explicitly required in the VS Code
    integration example from the official docs:
    {
      "claude.env": {
        "ANTHROPIC_BASE_URL": "http://localhost:8082",
        "ANTHROPIC_AUTH_TOKEN": "freecc",
        "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
      }
    }

  β†’ Without this flag, Claude Code CLI may not
    correctly negotiate the /v1/models endpoint,
    which can result in malformed/empty response
    handling on newer CLI versions like yours

:wrench: COMPLETE FIX SEQUENCE β€” TRY IN THIS ORDER

STEP 1: Downgrade Claude Code CLI
  npm install -g @anthropic-ai/[email protected]

STEP 2: Disable auto-updater
  $env:DISABLE_AUTOUPDATER="1"

STEP 3: Switch provider to NVIDIA NIM
  β†’ Get free key at: build.nvidia.com
  β†’ Configure via Admin UI at 
    http://127.0.0.1:8082/admin
  β†’ Select model: Kimi K2.5 or GLM 4.7

STEP 4: Add the missing env variable
  $env:CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY="1"

STEP 5: Use the wrapper launcher, not plain claude
  uv tool install --force git+https://github.com/
    Alishahryar1/free-claude-code.git
  fcc-server
  fcc-claude   ← use this instead of "claude"

STEP 6: Re-test
  β†’ Send a simple prompt
  β†’ Check server console for the actual JSON
    response body, not just the HTTP status code

:bar_chart: PROVIDER COMPATIBILITY SNAPSHOT

:hammer_and_wrench: PROVIDER :high_voltage: RELIABILITY :wrench: ROLE MAPPING :ocean: STREAMING
NVIDIA NIM (Kimi K2.5/GLM 4.7) :star::star::star::star::star: :white_check_mark: Stable :white_check_mark: Confirmed
OpenRouter (free tier models) :star::star: :warning: Inconsistent :warning: Known issues
Gemini (via AI Studio) :star::star::star::star: :white_check_mark: Stable :white_check_mark: Confirmed
LM Studio (local) :star::star::star: :white_check_mark: Stable :warning: Depends on model

:light_bulb: PRO TIPS

  • :fire: Always check the raw JSON response in the proxy’s console logs, not just Claude Code’s error message β€” β€œHTTP 200 empty” often hides a malformed JSON body that the terminal log will show clearly
  • :pushpin: The fcc-claude wrapper exists specifically to avoid manual env var mistakes β€” skip manual $env: exports entirely once you install the wrapper via uv tool install
  • :bullseye: NVIDIA NIM’s free tier requires zero credit card β€” just a build.nvidia.com account, making it the lowest-friction fix to test first
  • :warning: Free-tier OpenRouter models are the least stable link in this entire chain β€” even the project’s own docs flag them as β€œsome with free tiers” rather than fully guaranteed
  • :counterclockwise_arrows_button: Pin your CLI version going forward β€” add DISABLE_AUTOUPDATER=1 to your permanent PowerShell profile so future npm auto-updates don’t silently break compatibility again

Your setup is 95% correct β€” the empty response error is a documented, known issue tied to CLI version 2.1.205 outpacing the proxy’s tested compatibility. Downgrade to 2.1.142, switch to NVIDIA NIM, and add the gateway model discovery flag, and this should resolve cleanly. :fire::laptop::high_voltage:

:firecracker: Claude Code, Minus the Anthropic Bill



Claude Code = Anthropic’s terminal AI coder (reads files, writes code, runs commands from your command line). It never checks who answers β€” swap the address, run it on a free model, it can’t tell.

Two settings. Everything below is how deep it goes. :backhand_index_pointing_down:


πŸ”Œ Two settings + a free key β†’ Claude Code stops charging you

Claude Code reads two things on boot:

  • ANTHROPIC_BASE_URL β†’ where it sends requests
  • ANTHROPIC_AUTH_TOKEN β†’ your key (password to a model)

Point them at a free backend, done. Nothing cracked β€” you just changed the return address.

Free keys, email only, no card:

Pre-wired proxy that does the plumbing: free-claude-code

πŸͺ€ The 422 wall (not your bug) β†’ the one-line kill

The error everyone hits and blames themselves for:

API Error: 422 "Input should be 'user' or 'assistant'", "input":"system"

Cause: Claude Code 2.1.15x jams a system message into a slot that only allows user/assistant. Strict proxies reject it before it reaches a model. It’s Claude Code’s bug β†’ official thread.

Kill it 3 ways:

Why it happens (Anthropic vs OpenAI message shape) β†’ teardown

πŸ”€ Translators: bolt Claude Code onto any cheap model

A proxy = a middleman that flips Anthropic ↔ OpenAI format both ways. Pick one:

:warning: LiteLLM 1.82.7 / 1.82.8 shipped key-stealing malware β€” pin around them β†’ receipts

🌊 One door, 200+ free providers, auto-dodge every limit

Stack providers behind one endpoint β€” one caps out, it slides to the next.

Self-host hubs:

Free-tier stackers (auto-failover across dozens of free plans):

Set-and-forget switchers (UI):

πŸ”‘ Where the free keys actually live (refreshed daily)
πŸ‰ China's native stack β€” ~1/7 the price, no proxy, no 422

GLM / Kimi / Qwen / MiniMax speak Claude’s dialect natively and sell flat monthly coding plans. Just change the base URL:

  • cc-compatible-models β€” master cheat-sheet (endpoints, prices, plans)
  • GLM setup β†’ docs.z.ai Β· URL https://open.bigmodel.cn/api/anthropic
  • Kimi https://api.moonshot.cn/anthropic Β· Qwen https://dashscope-intl.aliyuncs.com/apps/anthropic Β· Volcengine https://ark.cn-beijing.volces.com/api/coding
  • glm-claude β€” one command, launches on GLM
  • Windows 11 + PowerShell β†’ step-by-step
🎭 Turn a login into a free API (no card, no key)

The β€œSign in with Google/GitHub” flow gives model access β€” these borrow that session and hand you a local API:

  • CLIProxyAPI β€” Gemini/Codex/Claude/Grok logins β†’ one API
  • gemini-proxy β€” free Gemini off a Google login
  • Hermes proxy β€” Claude/ChatGPT/Grok logins β†’ local endpoint
  • sub2api β€” pool/share subscriptions behind one door
πŸ“± Run the whole rig from an Android phone

Termux = a full Linux terminal as an Android app. Runs all of the above:

πŸ’‘ 5 spots this quietly saves your ass
  • 3am mega-refactor, no usage meter ticking in the back of your head.
  • Old $100 Android in Termux on a train β€” full AI coder, no laptop.
  • One cheap coding plan covers a whole team instead of five separate Anthropic bills.
  • Point it at a local model β†’ company’s private code never leaves the machine.
  • Anthropic rate-limits you mid-task β†’ auto-failover to a free model finishes it instead of losing the work.

Same tool, same terminal, cheaper (or free) engine underneath. Cheap models nail routine work; keep one paid escape hatch for the giant multi-file jobs. Full living index: awesome-claude-code.

Nothing here is cracked. The lock was just a URL you were always allowed to change.