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
Remove legacy server.py startup shim (#983)
Ali Khokhar58c40cf24e7d
diff --git a/README.md b/README.mdindex 65ae35d3..bb200067 100644--- a/README.md+++ b/README.md@@ -589,7 +589,6 @@ Important pieces:```textfree-claude-code/-├── server.py # ASGI entry point├── api/ # FastAPI routes, service layer, routing, optimizations├── core/ # Shared Anthropic protocol helpers, SSE, OpenAI Responses│ └── openai_responses/ # Responses ↔ Anthropic conversion and SSE mapping@@ -607,7 +606,7 @@ Use this path if you are developing or want to run directly from a checkout:```bashgit clone https://github.com/Alishahryar1/free-claude-code.gitcd free-claude-code-uv run uvicorn server:app --host 0.0.0.0 --port 8082+uv run fcc-server```### 3. Commandsdiff --git a/pyproject.toml b/pyproject.tomlindex b4f50969..664adddd 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "hatchling.build"[project]name = "free-claude-code"-version = "2.5.3"+version = "2.5.4"description = "Middleware between Claude Code CLI (Anthropic API) and NVIDIA NIM"readme = "README.md"requires-python = ">=3.14.0"diff --git a/server.py b/server.pydeleted file mode 100644index ae53cfb9..00000000--- a/server.py+++ /dev/null@@ -1,32 +0,0 @@-"""-Claude Code Proxy - Entry Point--Minimal entry point that builds the ASGI app via :func:`api.app.create_app`.-Run with: uv run uvicorn server:app --host 0.0.0.0 --port 8082 --timeout-graceful-shutdown 5-"""--from api.app import create_app, create_asgi_app--app = create_asgi_app()--__all__ = ["app", "create_app"]--if __name__ == "__main__":- import uvicorn-- from cli.process_registry import kill_all_best_effort- from config.settings import get_settings-- settings = get_settings()- try:- # timeout_graceful_shutdown ensures uvicorn doesn't hang on task cleanup.- uvicorn.run(- app,- host=settings.host,- port=settings.port,- log_level="debug",- timeout_graceful_shutdown=5,- )- finally:- # Safety net: cleanup subprocesses if lifespan shutdown doesn't fully run.- kill_all_best_effort()diff --git a/smoke/lib/child_process.py b/smoke/lib/child_process.pyindex e43549cb..5cb02bf8 100644--- a/smoke/lib/child_process.py+++ b/smoke/lib/child_process.py@@ -20,23 +20,6 @@ def cmd_python_c(script: str) -> list[str]:return [python_exe(), "-c", script]-def cmd_uvicorn_server_app(- host: str, port: int, *, graceful_shutdown_s: int = 5-) -> list[str]:- return [- python_exe(),- "-m",- "uvicorn",- "server:app",- "--host",- host,- "--port",- str(port),- "--timeout-graceful-shutdown",- str(graceful_shutdown_s),- ]--def cmd_fcc_init() -> list[str]:return [python_exe(), "-c", "from cli.entrypoints import init; init()"]diff --git a/smoke/lib/server.py b/smoke/lib/server.pyindex bc07fd0d..81970fe2 100644--- a/smoke/lib/server.py+++ b/smoke/lib/server.py@@ -11,7 +11,7 @@ from pathlib import Pathimport httpx-from .child_process import cmd_uvicorn_server_app+from .child_process import cmd_free_claude_code_servefrom .config import SmokeConfig, redacted@@ -47,6 +47,7 @@ def start_server("HOST": "127.0.0.1","PORT": str(port),"LOG_FILE": str(log_path),+ "FCC_OPEN_BROWSER": "0","MESSAGING_PLATFORM": "none","PYTHONUNBUFFERED": "1",}@@ -54,7 +55,7 @@ def start_server(if env_overrides:env.update(env_overrides)- cmd = command or cmd_uvicorn_server_app("127.0.0.1", port)+ cmd = command or cmd_free_claude_code_serve()with log_path.open("ab") as log_file:process = subprocess.Popen(diff --git a/tests/api/test_server_module.py b/tests/api/test_server_module.pydeleted file mode 100644index 887dfecc..00000000--- a/tests/api/test_server_module.py+++ /dev/null@@ -1,33 +0,0 @@-def test_server_module_exports_app_and_create_app():- import server-- assert server.app is not None- assert callable(server.create_app)---def test_server_main_invokes_uvicorn_run(monkeypatch):- import runpy- from types import SimpleNamespace- from unittest.mock import patch-- import uvicorn as uvicorn_mod-- import config.settings as settings_mod-- # Patch settings used by server.__main__ block.- old_get_settings = settings_mod.get_settings- mock_settings = SimpleNamespace(host="127.0.0.1", port=9999)-- try:- with (- patch.object(settings_mod, "get_settings", lambda: mock_settings),- patch.object(uvicorn_mod, "run") as mock_run,- ):- runpy.run_module("server", run_name="__main__")- mock_run.assert_called_once()- call_kwargs = mock_run.call_args[1]- assert call_kwargs["host"] == "127.0.0.1"- assert call_kwargs["port"] == 9999- assert call_kwargs["log_level"] == "debug"- finally:- settings_mod.get_settings = old_get_settingsdiff --git a/tests/contracts/test_import_boundaries.py b/tests/contracts/test_import_boundaries.pyindex bcfedaa2..b33b2ecb 100644--- a/tests/contracts/test_import_boundaries.py+++ b/tests/contracts/test_import_boundaries.py@@ -32,6 +32,17 @@ def test_python314_native_annotations_do_not_use_legacy_future_import() -> None:assert sorted(offenders) == []+def test_server_startup_is_owned_by_cli_entrypoint() -> None:+ repo_root = Path(__file__).resolve().parents[2]++ assert not (repo_root / "server.py").exists()+ assert _text_occurrences(repo_root, "server" + ":app") == []++ pyproject_text = (repo_root / "pyproject.toml").read_text(encoding="utf-8")+ assert 'fcc-server = "cli.entrypoints:serve"' in pyproject_text+ assert 'free-claude-code = "cli.entrypoints:serve"' in pyproject_text++def test_api_and_messaging_do_not_import_provider_common() -> None:repo_root = Path(__file__).resolve().parents[2]assert not (repo_root / "providers" / "common").exists()diff --git a/tests/contracts/test_smoke_child_process.py b/tests/contracts/test_smoke_child_process.pyindex 4db6c9cc..011d240c 100644--- a/tests/contracts/test_smoke_child_process.py+++ b/tests/contracts/test_smoke_child_process.py@@ -1,8 +1,66 @@import subprocessfrom pathlib import Path+from config.settings import Settingsfrom smoke.lib import child_process-from smoke.lib.child_process import cmd_python_c, run_captured_text+from smoke.lib import server as smoke_server+from smoke.lib.child_process import (+ cmd_free_claude_code_serve,+ cmd_python_c,+ run_captured_text,+)+from smoke.lib.config import SmokeConfig+++def test_free_claude_code_serve_command_uses_cli_entrypoint() -> None:+ assert cmd_free_claude_code_serve() == [+ child_process.python_exe(),+ "-c",+ "from cli.entrypoints import serve; serve()",+ ]+++def test_start_server_disables_cli_admin_browser(monkeypatch, tmp_path: Path) -> None:+ captured: dict[str, object] = {}++ class FakeProcess:+ def __init__(self, command: list[str], **kwargs: object) -> None:+ captured["command"] = command+ captured.update(kwargs)++ def poll(self) -> int | None:+ return None++ config = SmokeConfig(+ root=tmp_path,+ results_dir=tmp_path / "results",+ live=True,+ interactive=False,+ targets=frozenset(),+ provider_matrix=frozenset(),+ timeout_s=1.0,+ prompt="",+ claude_bin="claude",+ worker_id="test",+ settings=Settings(),+ )++ monkeypatch.setattr(smoke_server, "find_free_port", lambda: 4567)+ monkeypatch.setattr(smoke_server.subprocess, "Popen", FakeProcess)+ monkeypatch.setattr(+ smoke_server, "_wait_for_health", lambda _server, *, timeout_s: None+ )+ monkeypatch.setattr(smoke_server, "_stop_process", lambda _process: None)++ with smoke_server.start_server(config):+ pass++ env_obj = captured["env"]+ assert isinstance(env_obj, dict)+ env = {str(key): value for key, value in env_obj.items()}+ assert env["FCC_OPEN_BROWSER"] == "0"+ assert env["HOST"] == "127.0.0.1"+ assert env["PORT"] == "4567"def test_run_captured_text_uses_utf8_replacement(monkeypatch, tmp_path: Path) -> None:diff --git a/uv.lock b/uv.lockindex 30abee02..b7734afa 100644--- a/uv.lock+++ b/uv.lock@@ -561,7 +561,7 @@ wheels = [[[package]]name = "free-claude-code"-version = "2.5.3"+version = "2.5.4"source = { editable = "." }dependencies = [{ name = "aiohttp" },