Skip to content

The agent that grows with you

feat: keyless providers count as authenticated everywhere — opencode-free appears in /model and desktop pickers with zero setup

Teknium2a2307e68f10
diff --git a/hermes_cli/auth.py b/hermes_cli/auth.py
index fcfc602788c..ae807b9bfee 100644
--- a/hermes_cli/auth.py
+++ b/hermes_cli/auth.py
@@ -7096,6 +7096,25 @@ def get_api_key_provider_status(provider_id: str) -> Dict[str, Any]:
if not pconfig or pconfig.auth_type != "api_key":
return {"configured": False}
+ # Keyless providers (opencode-free) are served anonymously: no credential
+ # exists, so every install counts as configured/logged in. Derived from
+ # the HermesOverlay keyless flag — the same source the provider catalog
+ # and GUI contract tests use.
+ try:
+ from hermes_cli.providers import HERMES_OVERLAYS
+ _overlay = HERMES_OVERLAYS.get(provider_id)
+ except Exception:
+ _overlay = None
+ if _overlay is not None and getattr(_overlay, "keyless", False):
+ return {
+ "configured": True,
+ "provider": provider_id,
+ "name": pconfig.name,
+ "key_source": "keyless",
+ "base_url": pconfig.inference_base_url,
+ "logged_in": True,
+ }
+
api_key = ""
key_source = ""
api_key, key_source = _resolve_api_key_provider_secret(provider_id, pconfig)
diff --git a/hermes_cli/inventory.py b/hermes_cli/inventory.py
index d122213be65..3ef41d65867 100644
--- a/hermes_cli/inventory.py
+++ b/hermes_cli/inventory.py
@@ -691,11 +691,27 @@ def _filter_explicit_provider_rows(rows: list[dict], ctx: ConfigContext) -> list
if _raw_config_has_enabled_moa_preset():
kept.append(row)
continue
+ if _provider_is_keyless(slug):
+ # Keyless providers (opencode-free) require no configuration at
+ # all — there is nothing to "explicitly configure", and hiding
+ # them would defeat their purpose (zero-setup discoverability).
+ kept.append(row)
+ continue
if is_provider_explicitly_configured(slug):
kept.append(row)
return kept
+def _provider_is_keyless(slug: str) -> bool:
+ """True when the provider's Hermes overlay declares it keyless."""
+ try:
+ from hermes_cli.providers import HERMES_OVERLAYS
+ overlay = HERMES_OVERLAYS.get(slug)
+ return bool(overlay is not None and getattr(overlay, "keyless", False))
+ except Exception:
+ return False
+
+
def _raw_config_has_enabled_moa_preset() -> bool:
"""Return True when the user's raw config explicitly enables MoA.
diff --git a/hermes_cli/model_switch.py b/hermes_cli/model_switch.py
index d8d1f476ba6..959e0ce8cd7 100644
--- a/hermes_cli/model_switch.py
+++ b/hermes_cli/model_switch.py
@@ -2948,7 +2948,11 @@ def list_authenticated_providers(
# Check if credentials exist
has_creds = False
- if overlay.auth_type == "aws_sdk":
+ if getattr(overlay, "keyless", False):
+ # Keyless providers (opencode-free) are served anonymously —
+ # there is no credential to check, so everyone is authenticated.
+ has_creds = True
+ elif overlay.auth_type == "aws_sdk":
has_creds = _has_aws_sdk_creds_for_listing(hermes_slug)
elif overlay.auth_type == "vertex":
# Vertex authenticates via OAuth2 (service-account JSON / ADC),
diff --git a/tests/hermes_cli/test_opencode_zen_free_keyless.py b/tests/hermes_cli/test_opencode_zen_free_keyless.py
index a518018709c..1d83d78d7d4 100644
--- a/tests/hermes_cli/test_opencode_zen_free_keyless.py
+++ b/tests/hermes_cli/test_opencode_zen_free_keyless.py
@@ -122,3 +122,47 @@ class TestRuntimeProviderKeylessRouting:
with pytest.raises(AuthError):
self._resolve("opencode-zen", "claude-sonnet-5")
+
+
+class TestKeylessProviderAlwaysAuthenticated:
+ """opencode-free counts as authenticated everywhere, with zero keys.
+
+ The provider is keyless: there is no credential to configure, so every
+ surface that gates on auth (get_auth_status, provider:model listing,
+ the /model picker source, the desktop explicit-only filter) must treat
+ every install as logged in.
+ """
+
+ @pytest.fixture(autouse=True)
+ def _no_creds(self, monkeypatch):
+ for var in ("OPENCODE_ZEN_API_KEY", "OPENCODE_GO_API_KEY"):
+ monkeypatch.delenv(var, raising=False)
+
+ def test_auth_status_logged_in(self):
+ from hermes_cli.auth import get_auth_status
+
+ st = get_auth_status("opencode-free")
+ assert st["logged_in"] is True
+ assert st["configured"] is True
+ assert st["key_source"] == "keyless"
+
+ def test_list_available_providers_authenticated(self):
+ from hermes_cli.models import list_available_providers
+
+ rows = {r["id"]: r["authenticated"] for r in list_available_providers()}
+ assert rows.get("opencode-free") is True
+
+ def test_picker_source_includes_provider_with_models(self):
+ import model_tools # noqa: F401 — plugin discovery
+ from hermes_cli.model_switch import list_authenticated_providers
+
+ provs = list_authenticated_providers(for_picker=True)
+ free = [p for p in provs if p["slug"] == "opencode-free"]
+ assert free, "opencode-free must appear in the picker with zero keys"
+ assert free[0]["models"], "picker row must carry the curated models"
+
+ def test_explicit_only_filter_keeps_keyless(self):
+ from hermes_cli.inventory import _provider_is_keyless
+
+ assert _provider_is_keyless("opencode-free") is True
+ assert _provider_is_keyless("opencode-zen") is False