Repository navigation
[Feature]: 加固 Provider / Gateway 兼容性与外部 API 接入 / Harden provider-gateway compatibility and external API integration #214
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requesttriageAwaiting maintainer reviewAwaiting maintainer review
Description
[Feature]: 加固 Provider / Gateway 兼容性与外部 API 接入 / Harden provider-gateway compatibility and external API integration
Problem / pain point / 问题
Open CoDesign 已经支持多 provider、自定义 OpenAI-compatible endpoint、keyless provider、以及外部配置导入,但 API 兼容性仍然偏“隐式”:
- 不同 gateway 只实现了部分 OpenAI-compatible 接口
- 有些 endpoint 有
/models,有些没有 - 有些支持
responses,有些只支持chat/completions system/developerrole 行为不一致- reasoning 支持依赖 provider 和 model
- 外部配置导入正在增多,但每个来源仍然有独立逻辑
Open CoDesign already supports multiple providers, custom OpenAI-compatible endpoints, keyless providers, and external config import. The remaining pain is compatibility hardening:
- different gateways partially implement OpenAI-compatible APIs
- some endpoints expose
/models, some do not - some providers support
responses, others onlychat/completions - role handling differs across gateways
- reasoning support depends on provider/model
- external imports are growing, but each source still has bespoke logic
Proposed solution / 方案
把 provider compatibility 当成一等产品能力,而不只是零散补丁。
Treat provider compatibility as a first-class product surface rather than a collection of one-off fixes.
本 epic 追踪以下工作:
- provider capability profile
- capability-aware diagnostics
- connection-test and runtime parity
- LiteLLM first-class preset
- formal model discovery modes
- explicit wire / role / reasoning policy
- unified external-provider adapter framework
- OpenCode / Codex / CCS-style import follow-up
- actionable provider error normalization
Alternatives considered / 备选方案
-
继续按案例追加兼容补丁
- 缺点:可扩展性差,后续维护成本高
-
为每个 provider 单独做一套 bespoke integration
- 缺点:会绕开现有
wire + baseUrl + headers + model抽象
- 缺点:会绕开现有
-
Keep shipping incremental compatibility patches
- Rejected because it scales poorly
-
Build bespoke integration paths for every provider
- Rejected because it fights the existing abstraction
Scope / 范围
Provider / model
Hard-constraints check / 约束检查
- I have read the hard constraints in
CLAUDE.mdand this proposal does not conflict with them.
Child issues / 子 issue
- [Feature]: 引入显式 Provider Capability Profile / Add explicit provider capability profiles #206 Capability profile / 能力画像
- [Feature]: 升级连接诊断为 capability-aware / Improve connection diagnostics with capability-aware detection #213 Diagnostics and capability detection / 诊断与能力探测
- [Feature]: 对齐“测试连接”和“实际调用”链路 / Ensure connection-test and actual-invocation parity #216 Connection-test and runtime parity / 测试连接与实际调用链路对齐
- [Feature]: 增加 LiteLLM Gateway 一等预设 / Add a first-class LiteLLM gateway preset #208 LiteLLM gateway preset / LiteLLM 网关预设
- [Feature]: 正式建模模型发现模式 / Formalize provider model discovery modes #210 Model discovery modes / 模型发现模式
- [Feature]: 显式化 wire / role / reasoning 兼容策略 / Make wire-role-reasoning compatibility policy explicit #207 Wire-role-reasoning policy / wire、role、reasoning 兼容策略
- [Feature]: 统一外部 Provider 导入为共享 Adapter 框架 / Unify external provider imports under a shared adapter framework #211 External provider adapter framework / 外部 provider adapter 框架
- [Feature]: 跟进 OpenCode / Codex / CCS 风格配置导入路线 / Follow up OpenCode-Codex-CCS style import roadmap #209 OpenCode-Codex-CCS import follow-up / OpenCode、Codex、CCS 导入后续
- [Feature]: 增强 Provider 错误归一化与恢复提示 / Improve provider error normalization and recovery actions #212 Error normalization and recovery hints / 错误归一化与恢复提示
Suggested order / 建议顺序
- Capability profile
- Diagnostics and capability detection
- Connection-test and runtime parity
- Model discovery modes
- LiteLLM gateway preset
- Wire-role-reasoning policy
- External provider adapter framework
- OpenCode-Codex-CCS follow-up
- Error normalization and recovery hints
Current code references / 现有代码参考
packages/providers/src/index.tspackages/providers/src/errors.tspackages/providers/src/gateway-compat.tsapps/desktop/src/main/provider-settings.tsapps/desktop/src/main/resolve-api-key.tsapps/desktop/src/main/connection-ipc.tsapps/desktop/src/main/imports/opencode-config.tsapps/desktop/src/main/onboarding-ipc.ts
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesttriageAwaiting maintainer reviewAwaiting maintainer review
Activity
github-actions commentedon Apr 23, 2026
感谢提这个 epic。基于当前仓库实现,我确认这个方向和现状是对齐的:现在已经有一批 provider / gateway compatibility 的基础设施,但还没有独立的 capability profile / unified adapter framework 落地,所以把这类工作集中追踪在一个 umbrella issue 里是合理的。
目前能从代码里直接验证到的,是“兼容性增强”已经分散存在于 provider 层、连接诊断、错误归一化和导入链路里;但还没有找到单独的 capability profile schema、formal model discovery modes、LiteLLM first-class preset 或统一 external-provider adapter framework 实现。项目当前也还在
v0.1.xpre-alpha 阶段,README 里把 “Provider & API config polish” 明确列为正在进行中的工作。Relevant code:
packages/providers/src/gateway-compat.ts:1— 已有 gateway 兼容检测,专门识别/models可用但/messages未实现的 Anthropic-compatible relay。apps/desktop/src/main/connection-ipc.ts:40— 连接测试已区分models、chat_completion_degraded、responses_degraded三种探测结果。apps/desktop/src/main/connection-ipc.ts:471— 当/models返回 404 时,会 fallback probe 到真实 inference endpoint,而不是直接判定 endpoint 不可用。packages/providers/src/index.ts:175— 已有 wire / role / reasoning 兼容逻辑,避免把developerrole 发给不兼容的 OpenAI-compatible gateway。packages/providers/src/index.ts:341— 对 strictopenai-responsesgateway,已显式把 system prompt 转成 top-levelinstructions,并移除system/developerentries。packages/providers/src/errors.ts:1— 已有 provider error normalization,保留 upstream status/code/request-id,并对 body 做脱敏。apps/desktop/src/main/provider-settings.ts:72— 已支持 keyless provider / IP-whitelisted gateway 配置。apps/desktop/src/main/provider-settings.ts:215— 当前 provider entry 解析已经覆盖wire、httpHeaders、queryParams、reasoningLevel等字段。apps/desktop/src/main/imports/opencode-config.ts:273— 已有 OpenCode import 基础,但未知 auth type / 不支持 provider 仍然是按来源分别处理和 warning。README.md:250— 当前仍是v0.1.x,README 也把 Provider / API config polish 列为当前阶段重点。open-codesign Bot
hqhq1025 commentedon Apr 23, 2026
补充一点, "测试链接"链路 和 "实际调用" 链路应该确保是统一的 之前遇到包括现在也存在很多误判
JeremyP42 commentedon Apr 23, 2026
Hello.
I propose an implementation option for adding providers and models. The main settings window (01) contains a list of added providers and an "Add Provider" button.
The "Add and Edit Providers" window (02) contains provider connection settings and a list of available models.
The basic provider URL is filled in from a pop-up window (03) or manually. The list of providers with links is available here: https://models.dev/api.json .
Models can be selected from the menu (04) or entered manually (05).
hqhq1025 commentedon Apr 23, 2026
looks good! thank you.
@Sun-sunshine06
Sun-sunshine06 commentedon Apr 23, 2026
根据 @hqhq1025 提到的反馈,我补了一个单独子 issue:#216。
之所以单独拆,是因为这里的核心问题不是单纯 diagnostics 做得不够,而是“测试连接”和“实际调用”目前仍可能走不同的有效 provider contract,导致 test-pass/runtime-fail 或 test-fail/runtime-pass 的误判。
和 #213 的边界:#213 更偏 capability-aware diagnostics;#216 更偏 connection-test / runtime parity,本质上是在要求两条链路共享同一套 provider 解析、auth、wire、baseUrl、keyless 语义。
Sun-sunshine06 commentedon Apr 23, 2026
@hqhq1025 这个点我同意,而且我觉得是需要单独跟踪的结构性问题,不只是提示文案问题。
我已经补了子 issue #216,专门跟踪“测试连接”和“实际调用”链路对齐这件事。后续会重点看这几件事:
/modelsprobe 和真实 inference fallback 的关系是否被明确建模目前 #215 先落了 capability profile 这层基础,后面做 #216 时就可以少一些硬编码判断。
Sun-sunshine06 commentedon Apr 23, 2026
@JeremyP42 Thank you, this is very helpful.
Your proposal lines up well with two tracks we are already splitting out under this epic:
A few parts of your suggestion feel especially useful:
I do think we should treat external provider lists like
models.dev/api.jsonas a helpful seed rather than the sole source of truth, because auth shape, supported wire, and runtime compatibility can still differ by gateway.We will keep this UI direction in mind as we work through the provider/API issues. Thanks again for taking the time to mock it up.
feat(shared,desktop): add provider capability profiles (#215)
feat(desktop): align connection test credential resolution with runti…
github-actions commentedon May 1, 2026
This is a well-structured epic that accurately reflects the current state of provider compatibility in the codebase. The code references you listed align with what's present:
packages/providers/src/gateway-compat.ts— already detects gateway-specific behavior (e.g., Anthropic relay with/modelsbut no/messages)apps/desktop/src/main/connection-ipc.ts— connection test already distinguishesmodels,chat_completion_degraded,responses_degraded, and fallback probespackages/providers/src/index.ts— handles wire/role/reasoning adaptation for OpenAI-compatible gatewaysapps/desktop/src/main/provider-settings.ts— supports keyless providers,wire,httpHeaders,queryParams,reasoningLevelfieldsAll nine child issues are now tracked, and #216 (connection-test/runtime parity) has been added based on @hqhq1025's feedback, which is a good call. The existing infrastructure provides a solid base for this work.
If you'd like deeper code-level analysis for any specific child issue (e.g., how model discovery could reuse the existing probe flow, or how the provider adapter framework might build on
synthesizeWireModel), feel free to tag this bot or open a follow-up.Open-CoDesign Bot