From 65477e4bf34f6bfbca81096db203bfa3f90dc9a9 Mon Sep 17 00:00:00 2001 From: Re-bin Date: Thu, 26 Feb 2026 02:15:42 +0000 Subject: [PATCH] feat: support explicit provider selection in config --- nanobot/config/schema.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nanobot/config/schema.py b/nanobot/config/schema.py index 32b85cf..b030dac 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 ""