Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
add dashscope support
ZJUCQR8499dbf13233
diff --git a/nanobot/config/schema.py b/nanobot/config/schema.pyindex 71e336175..695d76920 100644--- a/nanobot/config/schema.py+++ b/nanobot/config/schema.py@@ -52,6 +52,7 @@ class ProvidersConfig(BaseModel):openrouter: ProviderConfig = Field(default_factory=ProviderConfig)groq: ProviderConfig = Field(default_factory=ProviderConfig)zhipu: ProviderConfig = Field(default_factory=ProviderConfig)+ dashscope: ProviderConfig = Field(default_factory=ProviderConfig) # 阿里云通义千问vllm: ProviderConfig = Field(default_factory=ProviderConfig)gemini: ProviderConfig = Field(default_factory=ProviderConfig)@@ -92,13 +93,14 @@ class Config(BaseSettings):return Path(self.agents.defaults.workspace).expanduser()def get_api_key(self) -> str | None:- """Get API key in priority order: OpenRouter > Anthropic > OpenAI > Gemini > Zhipu > Groq > vLLM."""+ """Get API key in priority order: OpenRouter > Anthropic > OpenAI > Gemini > Zhipu > DashScope > Groq > vLLM."""return (self.providers.openrouter.api_key orself.providers.anthropic.api_key orself.providers.openai.api_key orself.providers.gemini.api_key orself.providers.zhipu.api_key or+ self.providers.dashscope.api_key orself.providers.groq.api_key orself.providers.vllm.api_key orNonediff --git a/nanobot/providers/litellm_provider.py b/nanobot/providers/litellm_provider.pyindex 547626d44..18e19ff94 100644--- a/nanobot/providers/litellm_provider.py+++ b/nanobot/providers/litellm_provider.py@@ -51,6 +51,8 @@ class LiteLLMProvider(LLMProvider):os.environ.setdefault("GEMINI_API_KEY", api_key)elif "zhipu" in default_model or "glm" in default_model or "zai" in default_model:os.environ.setdefault("ZHIPUAI_API_KEY", api_key)+ elif "dashscope" in default_model or "qwen" in default_model.lower():+ os.environ.setdefault("DASHSCOPE_API_KEY", api_key)elif "groq" in default_model:os.environ.setdefault("GROQ_API_KEY", api_key)@@ -95,6 +97,13 @@ class LiteLLMProvider(LLMProvider):model.startswith("openrouter/")):model = f"zhipu/{model}"++ # For DashScope/Qwen, ensure prefix is present+ if ("qwen" in model.lower() or "dashscope" in model.lower()) and not (+ model.startswith("dashscope/") or+ model.startswith("openrouter/")+ ):+ model = f"dashscope/{model}"# For vLLM, use hosted_vllm/ prefix per LiteLLM docs# Convert openai/ prefix to hosted_vllm/ if user specified it