The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(image_gen): default new paid subscribers to Krea 2 Medium Turbo so Krea is the image lane without a config edit
Mariano Nicolini257849838f8e
diff --git a/hermes_cli/nous_subscription.py b/hermes_cli/nous_subscription.pyindex f3a9aed3861..f1ad85b6ebf 100644--- a/hermes_cli/nous_subscription.py+++ b/hermes_cli/nous_subscription.py@@ -75,6 +75,7 @@ _ALL_GATEWAY_KEYS = tuple(_GATEWAY_SECTION_FIELDS)_GATEWAY_TOOL_LABELS = {k: _FEATURES[k].offer_label for k in _ALL_GATEWAY_KEYS}# Sections apply_*_defaults always materialise before writing selections._DEFAULT_SECTIONS = ("web", "tts", "stt", "browser")+MANAGED_IMAGE_DEFAULT_KREA_MODEL = "krea-2-medium-turbo"def _uses_gateway(section: object) -> bool:@@ -138,12 +139,14 @@ def _ensure_section(config: dict[str, object], key: str) -> dict[str, object]:return value-def _select_nous(config: dict[str, object], key: str) -> None:+def _select_nous(config: dict[str, object], key: str, model: Optional[str] = None) -> None:"""Store the managed ``nous`` selection in the ``key`` section (field per _GATEWAY_SECTION_FIELDS)."""section_key, field = _GATEWAY_SECTION_FIELDS[key]section = _ensure_section(config, section_key)section[field] = "nous"section.pop("use_gateway", None)+ if model:+ section["model"] = modeldef _norm(value: object, default: str = "") -> str:@@ -501,7 +504,12 @@ def apply_nous_managed_defaults(config: dict[str, object], *, enabled_toolsets:# Video gen is not funded by the free tool pool: only wire managed video for entitled (paid) users.for key, category in (("image_gen", None), ("video_gen", "fal-video")):if key in selected_toolsets and not fal_key_is_configured() and (category is None or account_info.tool_gateway_entitled_for(category)):- _select_nous(config, key)+ # Paid accounts default to Krea; the free pool is not entitled to it and keeps the FAL default.+ model = None+ if (key == "image_gen" and not features.features[key].explicit_configured+ and not _section(config, key).get("model") and account_info.tool_gateway_entitled_for("krea")):+ model = MANAGED_IMAGE_DEFAULT_KREA_MODEL+ _select_nous(config, key, model=model)changed.add(key)return changeddiff --git a/tests/hermes_cli/test_nous_subscription.py b/tests/hermes_cli/test_nous_subscription.pyindex 605132fb731..4d4ba610e6c 100644--- a/tests/hermes_cli/test_nous_subscription.py+++ b/tests/hermes_cli/test_nous_subscription.py@@ -424,6 +424,32 @@ def test_apply_nous_managed_defaults_writes_video_gen_config(monkeypatch):assert "use_gateway" not in config["video_gen"]+def _defaults_for(monkeypatch, account, config):+ monkeypatch.setattr(tool_backend_helpers, "managed_nous_tools_enabled", lambda **kw: True)+ monkeypatch.delenv("FAL_KEY", raising=False)+ monkeypatch.setattr(ns, "fal_key_is_configured", lambda: False)+ monkeypatch.setattr(ns, "get_nous_portal_account_info", lambda **kw: account)+ ns.apply_nous_managed_defaults(config, enabled_toolsets=["image_gen"])+ return config["image_gen"]+++def test_paid_account_defaults_to_the_krea_image_model(monkeypatch):+ section = _defaults_for(monkeypatch, _account(logged_in=True, paid=True), {"model": {"provider": "nous"}})+ assert section == {"provider": "nous", "model": ns.MANAGED_IMAGE_DEFAULT_KREA_MODEL}+++def test_pool_account_keeps_the_fal_image_default(monkeypatch):+ section = _defaults_for(monkeypatch, _pool_account(), {"model": {"provider": "nous"}})+ assert section["provider"] == "nous"+ assert "model" not in section+++def test_configured_image_section_is_left_alone(monkeypatch):+ config = {"model": {"provider": "nous"}, "image_gen": {"provider": "nous", "model": FAL_DEFAULT_MODEL}}+ section = _defaults_for(monkeypatch, _account(logged_in=True, paid=True), config)+ assert section["model"] == FAL_DEFAULT_MODEL++# ---------------------------------------------------------------------------# ensure_nous_portal_access — inline login gate for `hermes tools`# ---------------------------------------------------------------------------diff --git a/website/docs/user-guide/features/tool-gateway.md b/website/docs/user-guide/features/tool-gateway.mdindex 08b88881e7d..9fff184c107 100644--- a/website/docs/user-guide/features/tool-gateway.md+++ b/website/docs/user-guide/features/tool-gateway.md@@ -111,7 +111,7 @@ Select the tool, pick **Nous Subscription** as the provider (or any direct provi## Using individual image models-The model is chosen once, in `hermes tools` → Image Generation, and stored in `config.yaml` as `image_gen.model`. Every `image_generate` call uses that stored model — the tool has no model parameter, so there is no per-call override. Leave it unset and Hermes uses FLUX 2 Klein 9B.+The model is chosen once, in `hermes tools` → Image Generation, and stored in `config.yaml` as `image_gen.model`. Every `image_generate` call uses that stored model — the tool has no model parameter, so there is no per-call override. Leave it unset and a paid subscription gets Krea 2 Medium Turbo; the free tool pool gets FLUX 2 Klein 9B.The **Nous Subscription** row has one model picker that lists every model once. The stored id decides which gateway serves the request: a native Krea id (`krea-2-medium`, `krea-2-large`, `krea-2-medium-turbo`) goes to the Krea gateway, a FAL catalog id goes to FAL, and any other id goes to Nous Portal. The selection is still just `image_gen.provider: nous` plus the model id.