Skip to content

[Feature]: 加固 Provider / Gateway 兼容性与外部 API 接入 / Harden provider-gateway compatibility and external API integration #214

@Sun-sunshine06

Description

@Sun-sunshine06

[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 / developer role 行为不一致
  • 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 only chat/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.md and this proposal does not conflict with them.

Child issues / 子 issue

Suggested order / 建议顺序

  1. Capability profile
  2. Diagnostics and capability detection
  3. Connection-test and runtime parity
  4. Model discovery modes
  5. LiteLLM gateway preset
  6. Wire-role-reasoning policy
  7. External provider adapter framework
  8. OpenCode-Codex-CCS follow-up
  9. Error normalization and recovery hints

Current code references / 现有代码参考

  • packages/providers/src/index.ts
  • packages/providers/src/errors.ts
  • packages/providers/src/gateway-compat.ts
  • apps/desktop/src/main/provider-settings.ts
  • apps/desktop/src/main/resolve-api-key.ts
  • apps/desktop/src/main/connection-ipc.ts
  • apps/desktop/src/main/imports/opencode-config.ts
  • apps/desktop/src/main/onboarding-ipc.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttriageAwaiting maintainer review

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions