Skip to content

[Feature]: 建议支持仅兼容 Responses API 的 OpenAI-compatible 提供商 #944

@zshs000

Description

@zshs000

Summary

希望 CoPaw 能支持 OpenAI-compatible 提供商使用 responses API,或至少支持为不同提供商切换/自定义请求适配方式。
目前 CoPaw 的 OpenAI 路线最终依赖 AgentScope,而 AgentScope 实际走的是 /v1/chat/completions,这会导致部分仅支持 responses 的兼容网关无法正常对话。

Component(s) Affected

  • Core / Backend (app, agents, config, providers, utils, local_models)
  • Console (frontend web UI)
  • Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
  • Skills
  • CLI
  • Documentation (website)
  • Tests
  • CI/CD
  • Scripts / Deploy

Problem / Motivation

当前接入自定义 OpenAI-compatible 提供商时,CoPaw 的实际请求链路依赖 AgentScope 的 OpenAIChatModel。
但 AgentScope 当前实际调用的是:

  • self.client.chat.completions.create(**kwargs)

相关代码:

这意味着当前 OpenAI-compatible 提供商实际上要求兼容 /v1/chat/completions。
但现实中有些兼容站点/网关只支持 responses API,或优先支持 responses,对 /v1/chat/completions 支持不完整甚至不支持。

因此会出现下面的问题:

  • 用户在 CoPaw 中可以按 OpenAI-compatible 提供商完成配置
  • “测试连接”可能显示正常
  • 但实际聊天请求仍然失败

其中一个容易造成误解的点是:CoPaw 当前“测试连接”优先验证的是 /models,而不是实际对话时使用的 /chat/completions:

所以会出现:

  • /models 可访问,因此测试连接通过
  • 但实际聊天走 /v1/chat/completions 时失败

对于只支持 responses、不支持 chat/completions 的 OpenAI-compatible 提供商,这会让用户误以为是自己配置有问题。

另外,类似需求已在 agentscope-java 的 #784 中提出:

根据该 issue 中的讨论,maintainer 认可 Responses API 是更长期的方向,并表示后续会支持。
因此也建议 Python 侧(agentscope 与 CoPaw)同步跟进。

Proposed Solution

希望考虑以下方向之一:

  1. 在 AgentScope Python 侧支持 responses API 后,CoPaw 同步跟进对这类 OpenAI-compatible 提供商的支持。
  2. 如果短期内暂不支持,至少在文档或相关说明中明确指出:
    • 当前 OpenAI-compatible 提供商实际上需要兼容 /v1/chat/completions

Alternatives Considered

目前能想到的替代方式主要有:

  • 用户自行寻找同时兼容 /v1/chat/completions 的提供商或网关
  • 用户自行搭一层中转,把 responses 风格转换成 chat/completions 风格

Additional Context

相关调用链代码:

CoPaw 测试连接相关代码:

类似讨论:

Willing to Contribute

  • I am willing to open a PR for this feature (after discussion).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmodel configureIssue related to the model API.

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions