chore: simplify Alibaba Coding Plan to apiBase hint, remove dedicated provider
This commit is contained in:
@@ -662,9 +662,9 @@ Config file: `~/.nanobot/config.json`
|
||||
> [!TIP]
|
||||
> - **Groq** provides free voice transcription via Whisper. If configured, Telegram voice messages will be automatically transcribed.
|
||||
> - **Zhipu Coding Plan**: If you're on Zhipu's coding plan, set `"apiBase": "https://open.bigmodel.cn/api/coding/paas/v4"` in your zhipu provider config.
|
||||
> - **Alibaba Cloud Coding Plan**: If you're on the Alibaba Cloud Coding Plan (BaiLian coding assistance), add configuration for `dashscope_coding_plan` provider with an API key starting with `sk-sp-` in your config. This provider uses OpenAI-compatible endpoint `https://coding.dashscope.aliyuncs.com/v1`.
|
||||
> - **MiniMax (Mainland China)**: If your API key is from MiniMax's mainland China platform (minimaxi.com), set `"apiBase": "https://api.minimaxi.com/v1"` in your minimax provider config.
|
||||
> - **VolcEngine Coding Plan**: If you're on VolcEngine's coding plan, set `"apiBase": "https://ark.cn-beijing.volces.com/api/coding/v3"` in your volcengine provider config.
|
||||
> - **Alibaba Cloud Coding Plan**: If you're on the Alibaba Cloud Coding Plan (BaiLian), set `"apiBase": "https://coding.dashscope.aliyuncs.com/v1"` in your dashscope provider config.
|
||||
|
||||
| Provider | Purpose | Get API Key |
|
||||
|----------|---------|-------------|
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from pydantic.alias_generators import to_camel
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
class Base(BaseModel):
|
||||
@@ -258,20 +258,13 @@ class ProvidersConfig(Base):
|
||||
groq: ProviderConfig = Field(default_factory=ProviderConfig)
|
||||
zhipu: ProviderConfig = Field(default_factory=ProviderConfig)
|
||||
dashscope: ProviderConfig = Field(default_factory=ProviderConfig) # 阿里云通义千问
|
||||
dashscope_coding_plan: ProviderConfig = Field(
|
||||
default_factory=ProviderConfig
|
||||
) # 阿里云百炼Coding Plan
|
||||
vllm: ProviderConfig = Field(default_factory=ProviderConfig)
|
||||
gemini: ProviderConfig = Field(default_factory=ProviderConfig)
|
||||
moonshot: ProviderConfig = Field(default_factory=ProviderConfig)
|
||||
minimax: ProviderConfig = Field(default_factory=ProviderConfig)
|
||||
aihubmix: ProviderConfig = Field(default_factory=ProviderConfig) # AiHubMix API gateway
|
||||
siliconflow: ProviderConfig = Field(
|
||||
default_factory=ProviderConfig
|
||||
) # SiliconFlow (硅基流动) API gateway
|
||||
volcengine: ProviderConfig = Field(
|
||||
default_factory=ProviderConfig
|
||||
) # VolcEngine (火山引擎) API gateway
|
||||
siliconflow: ProviderConfig = Field(default_factory=ProviderConfig) # SiliconFlow (硅基流动)
|
||||
volcengine: ProviderConfig = Field(default_factory=ProviderConfig) # VolcEngine (火山引擎)
|
||||
openai_codex: ProviderConfig = Field(default_factory=ProviderConfig) # OpenAI Codex (OAuth)
|
||||
github_copilot: ProviderConfig = Field(default_factory=ProviderConfig) # Github Copilot (OAuth)
|
||||
|
||||
@@ -326,20 +319,6 @@ class MCPServerConfig(Base):
|
||||
tool_timeout: int = 30 # seconds before a tool call is cancelled
|
||||
|
||||
|
||||
class TTSConfig(Base):
|
||||
"""Text-to-Speech configuration."""
|
||||
|
||||
provider: str = "edge_tts" # Default TTS provider
|
||||
voice: str = "en-US-ChristopherNeural" # Default voice
|
||||
speed: float = 1.0 # Voice speed multiplier
|
||||
|
||||
|
||||
class AudioConfig(Base):
|
||||
"""Audio configuration."""
|
||||
|
||||
tts: TTSConfig = Field(default_factory=TTSConfig)
|
||||
|
||||
|
||||
class ToolsConfig(Base):
|
||||
"""Tools configuration."""
|
||||
|
||||
@@ -357,7 +336,6 @@ class Config(BaseSettings):
|
||||
providers: ProvidersConfig = Field(default_factory=ProvidersConfig)
|
||||
gateway: GatewayConfig = Field(default_factory=GatewayConfig)
|
||||
tools: ToolsConfig = Field(default_factory=ToolsConfig)
|
||||
audio: AudioConfig = Field(default_factory=AudioConfig)
|
||||
|
||||
@property
|
||||
def workspace_path(self) -> Path:
|
||||
|
||||
@@ -350,26 +350,6 @@ PROVIDERS: tuple[ProviderSpec, ...] = (
|
||||
strip_model_prefix=False,
|
||||
model_overrides=(),
|
||||
),
|
||||
# === Coding Plan Gateway Providers =====================================
|
||||
# Alibaba Cloud Coding Plan: OpenAI-compatible gateway for coding assistance.
|
||||
# Uses special API key format starting with "sk-sp-" to distinguish it
|
||||
# from regular dashscope keys. Uses the OpenAI-compatible endpoint.
|
||||
ProviderSpec(
|
||||
name="dashscope_coding_plan",
|
||||
keywords=("dashscope-coding-plan", "coding-plan", "aliyun-coding", "bailian-coding"),
|
||||
env_key="DASHSCOPE_CODING_PLAN_API_KEY",
|
||||
display_name="Alibaba Cloud Coding Plan",
|
||||
litellm_prefix="openai", # → openai/{model} (uses OpenAI-compatible endpoint)
|
||||
skip_prefixes=("openai/", "dashscope/", "openrouter/"),
|
||||
env_extras=(),
|
||||
is_gateway=True,
|
||||
is_local=False,
|
||||
detect_by_key_prefix="sk-sp-", # coding plan API keys start with "sk-sp-"
|
||||
detect_by_base_keyword="coding.dashscope",
|
||||
default_api_base="https://coding.dashscope.aliyuncs.com/v1",
|
||||
strip_model_prefix=True, # Strip "dashscope_coding_plan/" prefix
|
||||
model_overrides=(),
|
||||
),
|
||||
# === Auxiliary (not a primary LLM provider) ============================
|
||||
# Groq: mainly used for Whisper voice transcription, also usable for LLM.
|
||||
# Needs "groq/" prefix for LiteLLM routing. Placed last — it rarely wins fallback.
|
||||
|
||||
Reference in New Issue
Block a user