Skip to content

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

Restore FastAPI application delegation (#1433)

Ali Khokhar2f516d36a9b7
diff --git a/AGENTS.md b/AGENTS.md
index cbf4caaf..24969007 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -39,6 +39,7 @@
- **Dead code**: Remove unused code, legacy systems, and hardcoded values. Use settings/config instead of literals (e.g. `settings.provider_type` not `"nvidia_nim"`).
- **Performance**: Use list accumulation for strings (not `+=` in loops), cache env vars at init, prefer iterative over recursive when stack depth matters.
- **Platform-agnostic naming**: Use generic names (e.g. `PLATFORM_EDIT`) not platform-specific ones (e.g. `TELEGRAM_EDIT`) in shared code.
+- **Precise types**: Avoid `typing.Any`. Use owner-defined domain types for known values, `JsonValue`/`JsonObject` for JSON, and `object` only at genuinely opaque boundaries where the value is narrowed before use. Enforce this through design review and type checking, not a mechanical text ban in CI.
- **No type ignores**: Do not add `# type: ignore` or `# ty: ignore`. Fix the underlying type issue.
- **Python 3.14 annotations**: Do not use `from __future__ import annotations`; rely on native lazy annotations and fix circular import boundaries instead of hiding them with annotation stringization.
- **Imports**: Prefer top-level imports. Avoid `TYPE_CHECKING` and local imports for first-party or required dependencies; if a top-level import creates a cycle, move shared types/protocols to a neutral owner.
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index cd4390ac..c5cad3b1 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -141,6 +141,13 @@ facade-only. Package initialization and those leaves must remain import-order sa
The model-list schema stays beside its API-owned construction policy in
`api/model_catalog.py`; there is no generic API model package.
+Type annotations follow the same ownership boundaries. Known values use the
+domain types owned by their package, and JSON wire values use `JsonValue` or
+`JsonObject` from `core.json_types`. `object` is reserved for genuinely opaque
+integration boundaries and is narrowed before use. Explicit `typing.Any` is
+avoided because it disables checking, but this remains a semantic design-review
+rule rather than a mechanical text ban in CI.
+
## Customer-Facing Contract
FCC optimizes for installed user workflows, not internal compatibility. The
diff --git a/CLAUDE.md b/CLAUDE.md
index cbf4caaf..24969007 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -39,6 +39,7 @@
- **Dead code**: Remove unused code, legacy systems, and hardcoded values. Use settings/config instead of literals (e.g. `settings.provider_type` not `"nvidia_nim"`).
- **Performance**: Use list accumulation for strings (not `+=` in loops), cache env vars at init, prefer iterative over recursive when stack depth matters.
- **Platform-agnostic naming**: Use generic names (e.g. `PLATFORM_EDIT`) not platform-specific ones (e.g. `TELEGRAM_EDIT`) in shared code.
+- **Precise types**: Avoid `typing.Any`. Use owner-defined domain types for known values, `JsonValue`/`JsonObject` for JSON, and `object` only at genuinely opaque boundaries where the value is narrowed before use. Enforce this through design review and type checking, not a mechanical text ban in CI.
- **No type ignores**: Do not add `# type: ignore` or `# ty: ignore`. Fix the underlying type issue.
- **Python 3.14 annotations**: Do not use `from __future__ import annotations`; rely on native lazy annotations and fix circular import boundaries instead of hiding them with annotation stringization.
- **Imports**: Prefer top-level imports. Avoid `TYPE_CHECKING` and local imports for first-party or required dependencies; if a top-level import creates a cycle, move shared types/protocols to a neutral owner.
diff --git a/pyproject.toml b/pyproject.toml
index 289b3d19..bed5dc16 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "free-claude-code"
-version = "5.3.3"
+version = "5.3.4"
description = "Local proxy connecting coding agents to OpenAI-compatible AI providers"
readme = "README.md"
requires-python = ">=3.14.0"
diff --git a/src/free_claude_code/runtime/asgi.py b/src/free_claude_code/runtime/asgi.py
index f6f41318..0b32da6a 100644
--- a/src/free_claude_code/runtime/asgi.py
+++ b/src/free_claude_code/runtime/asgi.py
@@ -13,6 +13,10 @@ class RuntimeASGIApp:
self.app = app
self.runtime = runtime
+ def __getattr__(self, name: str) -> object:
+ """Expose the wrapped application's public interface transparently."""
+ return getattr(self.app, name)
+
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
if scope["type"] != "lifespan":
await self.app(scope, receive, send)
diff --git a/tests/api/test_app_lifespan_and_errors.py b/tests/api/test_app_lifespan_and_errors.py
index dca8b2a1..888f36ab 100644
--- a/tests/api/test_app_lifespan_and_errors.py
+++ b/tests/api/test_app_lifespan_and_errors.py
@@ -312,6 +312,17 @@ def test_bootstrap_configures_default_log_and_publishes_only_services(tmp_path):
assert set(api_app.state._state) == {"services"}
+def test_bootstrap_app_transparently_exposes_fastapi_interface() -> None:
+ with patch("free_claude_code.runtime.bootstrap.configure_logging"):
+ asgi_app = build_asgi_app(_settings())
+
+ api_app = cast(FastAPI, asgi_app.app)
+ assert asgi_app.router is api_app.router
+ assert asgi_app.routes is api_app.routes
+ assert asgi_app.state is api_app.state
+ assert asgi_app.openapi == api_app.openapi
+
+
def test_bootstrap_wires_the_codex_catalog_publisher() -> None:
publisher = MagicMock()
diff --git a/uv.lock b/uv.lock
index 7cbc55cb..3b243830 100644
--- a/uv.lock
+++ b/uv.lock
@@ -607,7 +607,7 @@ wheels = [
[[package]]
name = "free-claude-code"
-version = "5.3.3"
+version = "5.3.4"
source = { editable = "." }
dependencies = [
{ name = "aiohttp" },