From 4e04d42098fdf8f7427534e877e296ee76188eb4 Mon Sep 17 00:00:00 2001 From: Konstantin Sivakov Date: Thu, 23 Apr 2026 19:47:03 +0200 Subject: [PATCH 1/6] Keep byok when using minds --- anton/chat.py | 56 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/anton/chat.py b/anton/chat.py index ca87349c..c4a77171 100644 --- a/anton/chat.py +++ b/anton/chat.py @@ -262,27 +262,61 @@ async def _handle_connect( # (silenced: was printing "Testing LLM endpoints..." and "not available" messages) llm_ok = test_llm(minds_url, api_key, verify=ssl_verify) - if llm_ok: - console.print( - "[anton.success]LLM endpoints available — using Minds server as LLM provider.[/]" - ) + def _has_configured_byok() -> bool: + if settings.planning_provider == "anthropic": + return bool( + settings.anthropic_api_key + or os.environ.get("ANTHROPIC_API_KEY") + or os.environ.get("ANTON_ANTHROPIC_API_KEY") + ) + if settings.planning_provider == "openai": + return True + if settings.planning_provider == "openai-compatible": + # ANTON_OPENAI_API_KEY is only persisted by explicit BYOK setup; Minds-as-LLM + # derives openai_api_key at runtime in model_post_init without persisting it. + return bool(os.environ.get("ANTON_OPENAI_API_KEY")) + return False + + def _switch_to_minds_as_llm() -> None: settings.planning_provider = "openai-compatible" settings.coding_provider = "openai-compatible" settings.planning_model = "_reason_" settings.coding_model = "_code_" - # openai_api_key and openai_base_url are derived at runtime from - # minds_api_key and minds_url via model_post_init — no need to persist them. settings.model_post_init(None) global_ws.set_secret("ANTON_PLANNING_PROVIDER", "openai-compatible") global_ws.set_secret("ANTON_CODING_PROVIDER", "openai-compatible") global_ws.set_secret("ANTON_PLANNING_MODEL", "_reason_") global_ws.set_secret("ANTON_CODING_MODEL", "_code_") + + if llm_ok: + use_minds_as_llm = True + if _has_configured_byok(): + current_label = f"{settings.planning_provider} / {settings.planning_model}" + console.print() + console.print("[anton.cyan]Minds server also supports LLM endpoints.[/]") + console.print(" [bold]1[/] Use Minds server as LLM provider") + console.print( + f" [bold]2[/] Keep current LLM provider ([anton.muted]{current_label}[/])" + ) + console.print() + choice = await prompt_or_cancel( + "(anton) Select LLM provider", + choices=["1", "2"], + default="2", + ) + use_minds_as_llm = choice == "1" + + if use_minds_as_llm: + console.print( + "[anton.success]Using Minds server as LLM provider.[/]" + ) + _switch_to_minds_as_llm() + else: + console.print( + f"[anton.muted]Keeping current LLM provider: {settings.planning_provider} / {settings.planning_model}[/]" + ) else: - # Check if Anthropic key is already configured - has_anthropic = settings.anthropic_api_key or os.environ.get( - "ANTHROPIC_API_KEY" - ) - if not has_anthropic: + if not _has_configured_byok(): anthropic_key = Prompt.ask("Anthropic API key (for LLM)", console=console) if anthropic_key.strip(): anthropic_key = anthropic_key.strip() From 8925ed279f382a37fa9860f4c10e946885ea3254 Mon Sep 17 00:00:00 2001 From: Konstantin Sivakov Date: Thu, 23 Apr 2026 20:06:02 +0200 Subject: [PATCH 2/6] Prevent errors when switching between BYOK keys --- anton/cli.py | 2 +- anton/minds_client.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/anton/cli.py b/anton/cli.py index 74b9cfc2..80b9eb99 100644 --- a/anton/cli.py +++ b/anton/cli.py @@ -759,7 +759,7 @@ def _setup_other_provider(settings, ws) -> None: ) _setup_anthropic(settings, ws) - settings.minds_url = None + settings.minds_url = "https://mdb.ai" settings.minds_api_key = None ws.set_secret("ANTON_MINDS_URL", "") ws.set_secret("ANTON_MINDS_API_KEY", "") diff --git a/anton/minds_client.py b/anton/minds_client.py index a960f3b4..7cc199bf 100644 --- a/anton/minds_client.py +++ b/anton/minds_client.py @@ -59,10 +59,12 @@ def minds_request( return resp.read() -def normalize_minds_url(url: str) -> str: - """Add https:// if no scheme present, strip trailing slash.""" +def normalize_minds_url(url: str | None) -> str: + """Add https:// if no scheme present, strip trailing slash. Falls back to the default when empty.""" + if not url or not url.strip(): + return "https://mdb.ai" url = url.strip() - if url and not url.startswith("http://") and not url.startswith("https://"): + if not url.startswith("http://") and not url.startswith("https://"): url = "https://" + url return url.rstrip("/") From 3d7161e392880777f98cbfc38e0c8bfbaca93400 Mon Sep 17 00:00:00 2001 From: Konstantin Sivakov Date: Sat, 25 Apr 2026 17:44:37 +0200 Subject: [PATCH 3/6] Fix openai detection --- anton/chat.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/anton/chat.py b/anton/chat.py index c4a77171..6be89350 100644 --- a/anton/chat.py +++ b/anton/chat.py @@ -270,7 +270,11 @@ def _has_configured_byok() -> bool: or os.environ.get("ANTON_ANTHROPIC_API_KEY") ) if settings.planning_provider == "openai": - return True + return bool( + settings.openai_api_key + or os.environ.get("OPENAI_API_KEY") + or os.environ.get("ANTON_OPENAI_API_KEY") + ) if settings.planning_provider == "openai-compatible": # ANTON_OPENAI_API_KEY is only persisted by explicit BYOK setup; Minds-as-LLM # derives openai_api_key at runtime in model_post_init without persisting it. From 947a84550545ac76def69c53867fa741409e79bb Mon Sep 17 00:00:00 2001 From: Konstantin Sivakov Date: Sat, 25 Apr 2026 18:02:15 +0200 Subject: [PATCH 4/6] Fix issue with setting of the mdb ai url --- anton/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anton/cli.py b/anton/cli.py index 80b9eb99..800500d8 100644 --- a/anton/cli.py +++ b/anton/cli.py @@ -761,7 +761,7 @@ def _setup_other_provider(settings, ws) -> None: settings.minds_url = "https://mdb.ai" settings.minds_api_key = None - ws.set_secret("ANTON_MINDS_URL", "") + ws.set_secret("ANTON_MINDS_URL", "https://mdb.ai") ws.set_secret("ANTON_MINDS_API_KEY", "") From a810f63e92ef13bc67bb75924776f5289d9b3286 Mon Sep 17 00:00:00 2001 From: Konstantin Sivakov Date: Tue, 28 Apr 2026 12:21:06 +0200 Subject: [PATCH 5/6] Delist minds command --- anton/commands/ui.py | 1 - 1 file changed, 1 deletion(-) diff --git a/anton/commands/ui.py b/anton/commands/ui.py index 27543e59..936dd92e 100644 --- a/anton/commands/ui.py +++ b/anton/commands/ui.py @@ -20,7 +20,6 @@ class Command: COMMANDS = [ "LLM Provider", Command("/llm", "Change LLM provider or API key"), - Command("/minds", "Connect to Minds server"), None, "Data Connections", Command("/connect", "Connect a database or API to your Local Vault"), From 7e880d7be1b32678608b321e6f81e4c06695854f Mon Sep 17 00:00:00 2001 From: Konstantin Sivakov Date: Tue, 28 Apr 2026 13:07:47 +0200 Subject: [PATCH 6/6] Bump version --- anton/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anton/__init__.py b/anton/__init__.py index f6bb6f4d..34c5111c 100644 --- a/anton/__init__.py +++ b/anton/__init__.py @@ -1 +1 @@ -__version__ = "2.0.4" +__version__ = "2.0.5"