Skip to content

feat: multi-provider API support with per-provider keys & model name mapping (closes #2329)#2333

Open
LaiyanB wants to merge 2 commits into
esengine:v1from
LaiyanB:main
Open

feat: multi-provider API support with per-provider keys & model name mapping (closes #2329)#2333
LaiyanB wants to merge 2 commits into
esengine:v1from
LaiyanB:main

Conversation

@LaiyanB
Copy link
Copy Markdown

@LaiyanB LaiyanB commented May 30, 2026

Closes #2329

概述

实现多 API 供应商支持,内置 10 家常用 DeepSeek 供应商,支持用户添加自定义供应商。每个供应商独立管理 API Key,切换时自动加载对应的 Key 和模型名映射。

内置供应商

ID 名称 Base URL
deepseek DeepSeek 官方 https://api.deepseek.com
siliconflow 硅基流动 https://api.siliconflow.cn/v1
aliyun 阿里云百炼 https://dashscope.aliyuncs.com/compatible-mode/v1
volcengine 火山引擎 https://ark.cn-beijing.volces.com/api/v3
tencent 腾讯云 https://api.lkeap.cloud.tencent.com/v1
baidu 百度千帆 https://qianfan.baidubce.com/v2
openrouter OpenRouter https://openrouter.ai/api/v1
fireworks Fireworks AI https://api.fireworks.ai/inference/v1
together Together AI https://api.together.xyz/v1
replicate Replicate https://api.replicate.com/v1

变更内容

后端

  • config.ts: 新增 API_PROVIDER_PRESETS、resolveModelForProvider()、saveApiKeyForProvider() / saveCustomProvider() 等
  • loop.ts: 新增 providerId 选项,API 调用时映射模型名
  • context-manager.ts: fold-summary 改为注入 summaryModel
  • 所有 CLI 入口传入 providerId 确保模型名正确映射
  • Subagent 继承父代理的 providerId

CLI

  • 新增 reasonix provider 命令 (list/set/show/key/add/remove)

桌面端 UI

  • 供应商选择 + API Key 移至 Settings -> Models 页面
  • Per-provider Key: 每个供应商独立存储,切换自动加载
  • 切换供应商时自动清空输入框
  • 模型卡片始终显示 canonical 名

配置持久化

存储在 ~/.reasonix/config.json,apiProvider + apiKeys + customProviders

LaiyanB added 2 commits May 30, 2026 10:33
… name mapping

Backend:
- Add 10 built-in API providers (DeepSeek official, SiliconFlow, Aliyun, Volcengine, Tencent, Baidu, OpenRouter, Fireworks, Together, Replicate)
- Add resolveModelForProvider() to map canonical model names to provider-specific names at API call time
- Add loadResolvedModel() convenience function
- Wire providerId through CacheFirstLoop, ContextManager, subagents, and all CLI entry points
- Auto-escalation and fold-summary calls now use provider-resolved model names
- emitSettings sends masked key prefixes for ALL providers, not just the current one

CLI:
- Add reasonix provider command (list, set, show, key, add, remove)

Desktop UI:
- Move provider/key section from General to Models settings page
- Provider dropdown, API key input per provider, custom provider management
- Key input resets when switching providers, no fallback leak between providers
- UI always shows canonical model names (deepseek-v4-flash / deepseek-v4-pro)
@esengine esengine added the v1 Legacy TypeScript line (0.x) — v1 branch, maintenance only label May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1 Legacy TypeScript line (0.x) — v1 branch, maintenance only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

支持自定义 DeepSeek 模型提供商(硅基流动、阿里云百炼、OpenRouter 等)

2 participants