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

Fix Codex App authentication for signed-in users (#1366)

Ali Khokhar111ff43a0b07
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 346aaf88..5b1d5b32 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -1117,6 +1117,12 @@ instead of stopping at its login gate.
- It stores the proxy auth token in `FCC_CODEX_API_KEY` for Codex's provider
`env_key` to read. This process-local variable is a client credential carrier,
not a second FCC setting.
+- Persistent Codex App and IDE configuration uses Codex's command-backed provider
+ authentication. Codex invokes `fcc-codex --print-proxy-auth-token`, which reads
+ the canonical FCC settings, prints only the shared proxy-auth token (or the
+ no-auth sentinel), and exits without a proxy preflight, model request, or client
+ process. This makes the FCC provider own its bearer credential instead of
+ competing with Codex's signed-in OpenAI authorization.
[cli/launchers/pi.py](src/free_claude_code/cli/launchers/pi.py) owns the installed
`fcc-pi` launcher and [cli/launchers/pi_extension.ts](src/free_claude_code/cli/launchers/pi_extension.ts)
diff --git a/README.md b/README.md
index 3febe280..15ede56f 100644
--- a/README.md
+++ b/README.md
@@ -322,12 +322,16 @@ model = "nvidia_nim/nvidia/nemotron-3-super-120b-a12b"
[model_providers.fcc]
name = "Free Claude Code"
base_url = "http://127.0.0.1:8082/v1"
-http_headers = { Authorization = "Bearer freecc" }
wire_api = "responses"
+
+[model_providers.fcc.auth]
+command = "fcc-codex"
+args = ["--print-proxy-auth-token"]
```
-Match the model, port, and bearer token to the Admin UI. Restart the Codex App
-after setup or model changes, then select an FCC model from its model picker.
+Match the model and port to the Admin UI. The auth command reads FCC's current
+proxy token automatically. Restart the Codex App after setup or model changes,
+then select an FCC model from its model picker.
</details>
@@ -343,11 +347,16 @@ model = "nvidia_nim/nvidia/nemotron-3-super-120b-a12b"
[model_providers.fcc]
name = "Free Claude Code"
base_url = "http://127.0.0.1:8082/v1"
-http_headers = { Authorization = "Bearer freecc" }
wire_api = "responses"
+
+[model_providers.fcc.auth]
+command = "fcc-codex"
+args = ["--print-proxy-auth-token"]
```
-Match `model`, the port, and bearer token to the Admin UI, then restart VS Code. For WSL-backed Codex, edit the file inside WSL.
+Match `model` and the port to the Admin UI. The auth command reads FCC's current
+proxy token automatically. Restart VS Code after setup or model changes. For
+WSL-backed Codex, edit the file inside WSL.
</details>
diff --git a/pyproject.toml b/pyproject.toml
index 4c7e9b86..00756b58 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "free-claude-code"
-version = "4.17.4"
+version = "4.17.5"
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/cli/launchers/codex.py b/src/free_claude_code/cli/launchers/codex.py
index d911468e..c307177b 100644
--- a/src/free_claude_code/cli/launchers/codex.py
+++ b/src/free_claude_code/cli/launchers/codex.py
@@ -24,6 +24,7 @@ from .common import (
)
_CODEX_AUTH_ENV_KEY = "FCC_CODEX_API_KEY"
+_PRINT_PROXY_AUTH_TOKEN_FLAG = "--print-proxy-auth-token"
_DISPLAY_NAME = "Codex CLI"
_DEFAULT_BINARY = "codex"
_INSTALL_HINT = "Install Codex with: npm install -g @openai/codex"
@@ -48,7 +49,12 @@ _STRIPPED_CODEX_ENV_KEYS = frozenset(
def launch(argv: Sequence[str] | None = None) -> None:
"""Launch Codex CLI with Free Claude Code proxy configuration."""
+ args = list(sys.argv[1:] if argv is None else argv)
settings = get_settings()
+ if args == [_PRINT_PROXY_AUTH_TOKEN_FLAG]:
+ print(proxy_auth_token(settings.anthropic_auth_token))
+ return
+
proxy_root_url = local_proxy_root_url(settings)
if error := preflight_proxy(proxy_root_url):
print(
@@ -65,7 +71,6 @@ def launch(argv: Sequence[str] | None = None) -> None:
install_hint=_INSTALL_HINT,
)
catalog_args = codex_model_catalog_config_args(proxy_root_url, settings)
- args = list(sys.argv[1:] if argv is None else argv)
run_client_process(
command=build_codex_launcher_command(
binary_path=binary_path,
diff --git a/tests/cli/test_codex_model_catalog.py b/tests/cli/test_codex_model_catalog.py
index c8918e21..25ef1172 100644
--- a/tests/cli/test_codex_model_catalog.py
+++ b/tests/cli/test_codex_model_catalog.py
@@ -163,9 +163,12 @@ def test_generated_catalog_schema_is_accepted_by_installed_codex(
"[model_providers.fcc]",
'name = "Free Claude Code"',
'base_url = "http://127.0.0.1:8082/v1"',
- 'http_headers = { Authorization = "Bearer freecc" }',
'wire_api = "responses"',
"",
+ "[model_providers.fcc.auth]",
+ 'command = "fcc-codex"',
+ 'args = ["--print-proxy-auth-token"]',
+ "",
)
),
encoding="utf-8",
diff --git a/tests/cli/test_entrypoints.py b/tests/cli/test_entrypoints.py
index 98d2b166..4dc218e2 100644
--- a/tests/cli/test_entrypoints.py
+++ b/tests/cli/test_entrypoints.py
@@ -623,6 +623,38 @@ def test_launch_codex_passes_responses_config_and_child_env(
unregister_pid.assert_called_once_with(12345)
+ ("configured_token", "expected_token"),
+ [
+ (" proxy-token ", "proxy-token"),
+ ("", "fcc-no-auth"),
+ ],
+)
+def test_codex_proxy_auth_command_prints_only_current_token(
+ configured_token: str,
+ expected_token: str,
+ capsys: pytest.CaptureFixture[str],
+) -> None:
+ from free_claude_code.cli.launchers import codex
+
+ settings = _launcher_settings(token=configured_token)
+ with (
+ patch.object(codex, "get_settings", return_value=settings) as get_settings,
+ patch.object(codex, "preflight_proxy") as preflight_proxy,
+ patch.object(codex, "resolve_client_binary") as resolve_client_binary,
+ patch.object(codex, "open_local_request") as open_local_request,
+ patch.object(codex, "run_client_process") as run_client_process,
+ ):
+ codex.launch(["--print-proxy-auth-token"])
+
+ assert capsys.readouterr() == (f"{expected_token}\n", "")
+ get_settings.assert_called_once_with()
+ preflight_proxy.assert_not_called()
+ resolve_client_binary.assert_not_called()
+ open_local_request.assert_not_called()
+ run_client_process.assert_not_called()
+
+
def test_launch_codex_catalog_failure_warns_and_continues(
capsys: pytest.CaptureFixture[str],
tmp_path: Path,
diff --git a/uv.lock b/uv.lock
index 3f6ccdeb..f3fadff8 100644
--- a/uv.lock
+++ b/uv.lock
@@ -620,7 +620,7 @@ wheels = [
[[package]]
name = "free-claude-code"
-version = "4.17.4"
+version = "4.17.5"
source = { editable = "." }
dependencies = [
{ name = "aiohttp" },