feat(adapters): 接入 CloudCone/Zeabur/Dynadot/新网/Agnes 五个平台

线上平台列表里 cloudcone、zeabur、xinwang、dynadot、agnes 的 sdk_type 仍为空,
平台卡片只能显示「未对接」,用户无法同步。按各自真实 API 能力补齐:

- CloudCone:实例清单 + 开机/关机/重启;无公开账单接口,不声明余额与续费
- Zeabur:服务器清单 + 重启;毫核/MB 归一化为核/GB,未采集时不伪造规格
- Dynadot:域名清单(含到期日)+ 账户余额;set_dns2 位置参数无法安全 CRUD
- 新网:代理 API 按域名逐个查到期日;无列表接口,需在账号里填 domains 清单
- Agnes:/models 校验 Key;无余额接口,如实标记不支持

配套改动:
- _align_preset_providers 为库中为空的 sdk_type 回填种子值(启动即生效),
  避免新适配器上线后线上仍停留在「未对接」
- 适配器可声明 plain_config,代理号/域名等非密钥字段前端按明文输入
- PRESET_PROVIDERS 五条记录填上对应 sdk_type

测试:445 passed(新增 tests/test_platform_adapters.py),vitest 62 passed。
This commit is contained in:
gouki
2026-10-26 09:16:45 +00:00
parent 9aa1ca431e
commit 103f48e38b
14 changed files with 892 additions and 32 deletions
+25
View File
@@ -103,6 +103,31 @@ class OpenAIAdapter(_AIBase):
# get_account 为 False,刷新余额时会如实提示「暂不支持余额查询」。
@register("agnes-api")
class AgnesAdapter(_AIBase):
"""Agnes 适配器(OpenAI 兼容接口,Bearer Key)
官方 Base URL:https://api.agnes-ai.cn/v1(国际站为 api.agnes-ai.com)
只做 Key 有效性验证与可用模型查询;官方没有公开余额接口,
因此不实现 get_account——否则余额刷新会显示「已更新」但数值永远不变。
"""
BASE = "https://api.agnes-ai.cn/v1"
def _base_url(self) -> str:
return (self.config.get("base_url") or self.BASE).rstrip("/")
def test_connection(self) -> dict:
try:
data = self._get(self._base_url() + "/models")
count = len(data.get("data", []))
return {"ok": True, "message": f"连接成功,可用模型 {count} 个"}
except httpx.HTTPStatusError as e:
return self._http_error(e)
except Exception as e: # noqa: BLE001
return {"ok": False, "message": str(e)}
@register("minimax-api")
class MinimaxAdapter(_AIBase):
"""Minimax 适配器(余额查询)