Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)
Python
Fix Claude launcher no-auth login gate
Alishahryar1492860cc3d6c
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex 8823b4f2..e29c15ff 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -392,7 +392,9 @@ adapter:- `fcc-claude` strips inherited `ANTHROPIC_*` variables, sets`ANTHROPIC_BASE_URL`, enables gateway model discovery, configures the- auto-compact window, and forwards `ANTHROPIC_AUTH_TOKEN` when configured.+ auto-compact window, and always sets `ANTHROPIC_AUTH_TOKEN`. Blank proxy auth+ becomes the local-only `fcc-no-auth` sentinel so Claude Code reaches the proxy+ instead of stopping at its login gate.- Managed task invocations set `ANTHROPIC_API_URL`, `ANTHROPIC_BASE_URL`,gateway model discovery, non-interactive terminal settings, optional`--resume`, optional `--fork-session`, and `--output-format stream-json`.diff --git a/README.md b/README.mdindex 30370cbe..9d22d988 100644--- a/README.md+++ b/README.md@@ -140,7 +140,7 @@ Keep `fcc-server` running while you work.fcc-claude```-`fcc-claude` reads the current configured port and auth token each time it starts, sets the Claude Code environment variables (including a 190k-token `CLAUDE_CODE_AUTO_COMPACT_WINDOW` for auto-compaction), and then launches the real `claude` command.+`fcc-claude` reads the current configured port and auth token each time it starts, sets the Claude Code environment variables (including a 190k-token `CLAUDE_CODE_AUTO_COMPACT_WINDOW` for auto-compaction), and then launches the real `claude` command. When proxy auth is disabled, it still passes `ANTHROPIC_AUTH_TOKEN=fcc-no-auth` so newer Claude Code versions do not stop at their local login gate before contacting the proxy.**Codex**@@ -366,7 +366,7 @@ For terminal use, prefer the installed launcher:fcc-claude```-The Admin UI manages proxy config, restarts the server when runtime settings change, and `fcc-claude` reads the current Admin UI-managed port and auth token every time it starts. It also sets `CLAUDE_CODE_AUTO_COMPACT_WINDOW` to `190000` for auto-compaction.+The Admin UI manages proxy config, restarts the server when runtime settings change, and `fcc-claude` reads the current Admin UI-managed port and auth token every time it starts. It also sets `CLAUDE_CODE_AUTO_COMPACT_WINDOW` to `190000` for auto-compaction. When proxy auth is blank, `fcc-claude` injects `ANTHROPIC_AUTH_TOKEN=fcc-no-auth` only to satisfy Claude Code's local login check; the proxy still treats blank auth as disabled.### 2. Codex CLI@@ -625,7 +625,7 @@ CI also enforces a ban on `# type: ignore` / `# ty: ignore` suppressions; `scrip- `fcc-server`: starts the proxy with configured host and port.- `fcc-init`: optional advanced scaffold for `~/.fcc/.env`; prefer the **Admin UI** for normal configuration.-- `fcc-claude`: launches Claude Code with the configured local proxy URL, auth token, model discovery flag, and a 190k `CLAUDE_CODE_AUTO_COMPACT_WINDOW` for auto-compaction.+- `fcc-claude`: launches Claude Code with the configured local proxy URL, an auth-token env var or `fcc-no-auth` sentinel, model discovery flag, and a 190k `CLAUDE_CODE_AUTO_COMPACT_WINDOW` for auto-compaction.- `fcc-codex`: launches Codex with ephemeral `fcc` provider config pointing at the local proxy's `/v1/responses` endpoint, a generated native `/model` picker catalog, and `FCC_CODEX_API_KEY` from the Admin UI auth token.- `free-claude-code`: compatibility alias for `fcc-server`.diff --git a/cli/adapters/claude.py b/cli/adapters/claude.pyindex f4402079..213a59d5 100644--- a/cli/adapters/claude.py+++ b/cli/adapters/claude.py@@ -11,6 +11,7 @@ from loguru import loggerfrom .base import CliInvocation, CliParseState, CliTaskRequest_AUTO_COMPACT_WINDOW = "190000"+_NO_AUTH_SENTINEL = "fcc-no-auth"class ClaudeCliAdapter:@@ -150,8 +151,7 @@ class ClaudeCliAdapter:env["ANTHROPIC_BASE_URL"] = proxy_root_urlenv["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] = "1"env["CLAUDE_CODE_AUTO_COMPACT_WINDOW"] = _AUTO_COMPACT_WINDOW- if token := auth_token.strip():- env["ANTHROPIC_AUTH_TOKEN"] = token+ env["ANTHROPIC_AUTH_TOKEN"] = _claude_auth_token(auth_token)return envdef _task_env(@@ -170,10 +170,7 @@ class ClaudeCliAdapter:env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] = "1"env["CLAUDE_CODE_AUTO_COMPACT_WINDOW"] = _AUTO_COMPACT_WINDOWenv.pop("ANTHROPIC_API_KEY", None)- if token := auth_token.strip():- env["ANTHROPIC_AUTH_TOKEN"] = token- else:- env.pop("ANTHROPIC_AUTH_TOKEN", None)+ env["ANTHROPIC_AUTH_TOKEN"] = _claude_auth_token(auth_token)env["TERM"] = "dumb"env["PYTHONIOENCODING"] = "utf-8"@@ -230,4 +227,8 @@ def _string_value(value: Any) -> str | None:return value if isinstance(value, str) else None+def _claude_auth_token(auth_token: str) -> str:+ return auth_token.strip() or _NO_AUTH_SENTINEL++CLAUDE_CLI_ADAPTER = ClaudeCliAdapter()diff --git a/pyproject.toml b/pyproject.tomlindex bcd730a2..9a353923 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "hatchling.build"[project]name = "free-claude-code"-version = "2.3.0"+version = "2.3.1"description = "Middleware between Claude Code CLI (Anthropic API) and NVIDIA NIM"readme = "README.md"requires-python = ">=3.14.0"diff --git a/tests/cli/test_adapters.py b/tests/cli/test_adapters.pyindex ad2205b2..31094442 100644--- a/tests/cli/test_adapters.py+++ b/tests/cli/test_adapters.py@@ -131,6 +131,32 @@ def test_claude_adapter_launcher_env_targets_proxy() -> None:assert "ANTHROPIC_API_KEY" not in env+def test_claude_adapter_uses_sentinel_auth_when_proxy_auth_blank() -> None:+ invocation = CLAUDE_CLI_ADAPTER.build_task_invocation(+ config=_config(auth_token=""),+ request=CliTaskRequest(prompt="hello"),+ base_env={+ "ANTHROPIC_API_KEY": "official-key",+ "ANTHROPIC_AUTH_TOKEN": "stale-token",+ },+ )++ assert invocation.env["ANTHROPIC_AUTH_TOKEN"] == "fcc-no-auth"+ assert "ANTHROPIC_API_KEY" not in invocation.env++ env = CLAUDE_CLI_ADAPTER.build_launcher_env(+ proxy_root_url="http://127.0.0.1:9191",+ auth_token="",+ base_env={+ "ANTHROPIC_API_KEY": "official-key",+ "ANTHROPIC_AUTH_TOKEN": "stale-token",+ },+ )++ assert env["ANTHROPIC_AUTH_TOKEN"] == "fcc-no-auth"+ assert "ANTHROPIC_API_KEY" not in env++def test_claude_adapter_launcher_command_preserves_args() -> None:command = CLAUDE_CLI_ADAPTER.build_launcher_command(binary_path="claude.cmd",diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.pyindex 0ee10b1e..03ab929c 100644--- a/tests/cli/test_cli.py+++ b/tests/cli/test_cli.py@@ -538,7 +538,7 @@ class TestCLISession:assert "ANTHROPIC_API_KEY" not in env@pytest.mark.asyncio- async def test_start_task_removes_stale_auth_token_when_proxy_auth_blank(self):+ async def test_start_task_uses_sentinel_when_proxy_auth_blank(self):"""Test start_task does not leak inherited Claude auth into proxy calls."""from cli.session import CLISession@@ -560,7 +560,7 @@ class TestCLISession:passenv = mock_exec.call_args.kwargs["env"]- assert "ANTHROPIC_AUTH_TOKEN" not in env+ assert env["ANTHROPIC_AUTH_TOKEN"] == "fcc-no-auth"@pytest.mark.asyncioasync def test_start_task_allowed_dirs(self):diff --git a/tests/cli/test_entrypoints.py b/tests/cli/test_entrypoints.pyindex 383d99cb..7f27d90e 100644--- a/tests/cli/test_entrypoints.py+++ b/tests/cli/test_entrypoints.py@@ -329,7 +329,7 @@ def test_claude_child_env_targets_current_proxy_config() -> None:assert "ANTHROPIC_API_KEY" not in env-def test_claude_child_env_removes_blank_configured_auth_token() -> None:+def test_claude_child_env_uses_sentinel_for_blank_configured_auth_token() -> None:from cli.entrypoints import _claude_child_envenv = _claude_child_env(@@ -340,7 +340,7 @@ def test_claude_child_env_removes_blank_configured_auth_token() -> None:},)- assert "ANTHROPIC_AUTH_TOKEN" not in env+ assert env["ANTHROPIC_AUTH_TOKEN"] == "fcc-no-auth"assert "ANTHROPIC_API_KEY" not in envdiff --git a/uv.lock b/uv.lockindex b36fb2cd..912a6514 100644--- a/uv.lock+++ b/uv.lock@@ -561,7 +561,7 @@ wheels = [[[package]]name = "free-claude-code"-version = "2.3.0"+version = "2.3.1"source = { editable = "." }dependencies = [{ name = "aiohttp" },