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

log urls at startup

Alishahryar1b9bad70771b0
diff --git a/api/admin_urls.py b/api/admin_urls.py
index b75771e0..e37ea117 100644
--- a/api/admin_urls.py
+++ b/api/admin_urls.py
@@ -5,15 +5,27 @@ from __future__ import annotations
from config.settings import Settings
-def local_admin_url(settings: Settings) -> str:
- """Return a browser-friendly URL for the localhost-only admin UI."""
+def _browser_host_for_local_urls(settings: Settings) -> str:
+ """Host fragment for URLs shown to humans on the same machine as the server."""
host = settings.host.strip() if settings.host else "127.0.0.1"
if host in {"0.0.0.0", "::", "[::]"}:
host = "127.0.0.1"
if ":" in host and not host.startswith("["):
host = f"[{host}]"
- return f"http://{host}:{settings.port}/admin"
+ return host
+
+
+def local_proxy_root_url(settings: Settings) -> str:
+ """Return the proxy root URL (no path) for clients on the same machine."""
+
+ return f"http://{_browser_host_for_local_urls(settings)}:{settings.port}"
+
+
+def local_admin_url(settings: Settings) -> str:
+ """Return a browser-friendly URL for the localhost-only admin UI."""
+
+ return f"{local_proxy_root_url(settings)}/admin"
def admin_launch_message(settings: Settings) -> str:
diff --git a/api/runtime.py b/api/runtime.py
index d504bee6..99f52880 100644
--- a/api/runtime.py
+++ b/api/runtime.py
@@ -4,13 +4,14 @@ from __future__ import annotations
import asyncio
import os
+import sys
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any
from fastapi import FastAPI
from loguru import logger
-from api.admin_urls import local_admin_url
+from api.admin_urls import local_admin_url, local_proxy_root_url
from config.settings import Settings, get_settings
from providers.exceptions import ServiceUnavailableError
from providers.registry import ProviderRegistry
@@ -101,7 +102,8 @@ class AppRuntime:
async def startup(self) -> None:
logger.info("Starting Claude Code Proxy...")
- logger.info("Admin UI: {} (local-only)", local_admin_url(self.settings))
+ root_url = local_proxy_root_url(self.settings)
+ admin_url = local_admin_url(self.settings)
self._provider_registry = ProviderRegistry()
self.app.state.provider_registry = self._provider_registry
try:
@@ -110,6 +112,13 @@ class AppRuntime:
self._provider_registry.start_model_list_refresh(self.settings)
await self._start_messaging_if_configured()
self._publish_state()
+ logger.info("Server URL: {}", root_url)
+ logger.info("Admin UI: {} (local-only)", admin_url)
+ print(
+ f"Server URL: {root_url}\nAdmin UI: {admin_url} (local-only)",
+ file=sys.stderr,
+ flush=True,
+ )
except Exception as exc:
log_startup_failure(self.settings, exc)
await best_effort(