Skip to content

Your lightweight open-source personal agent.

feat: support explicit provider selection in config

Re-bin65477e4bf34f
diff --git a/nanobot/config/schema.py b/nanobot/config/schema.py
index 32b85cf03..b030dac82 100644
--- a/nanobot/config/schema.py
+++ b/nanobot/config/schema.py
@@ -186,6 +186,7 @@ class AgentDefaults(Base):
workspace: str = "~/.nanobot/workspace"
model: str = "anthropic/claude-opus-4-5"
+ provider: str = "auto" # Provider name (e.g. "anthropic", "openrouter") or "auto" for auto-detection
max_tokens: int = 8192
temperature: float = 0.1
max_tool_iterations: int = 40
@@ -301,6 +302,11 @@ class Config(BaseSettings):
"""Match provider config and its registry name. Returns (config, spec_name)."""
from nanobot.providers.registry import PROVIDERS
+ forced = self.agents.defaults.provider
+ if forced != "auto":
+ p = getattr(self.providers, forced, None)
+ return (p, forced) if p else (None, None)
+
model_lower = (model or self.agents.defaults.model).lower()
model_normalized = model_lower.replace("-", "_")
model_prefix = model_lower.split("/", 1)[0] if "/" in model_lower else ""