makecindy / makecindy/cindy

[Feature] 支持 tapsvc 自定义网关中 Codex 多模型工具协议适配

Open
#213 1 comment 0 reactions 0 assignees View on GitHub
feature
Dominant language
TypeScript
Stars
2.7k
Forks
401
Avg merge
21h 48m
Merged PRs (30d)
776

Description

## 问题描述

在自定义 tapsvc 网关中使用 Codex Agent 时,GPT、Codex 相关模型及 Gemini 3.5 Flash 可正常调用;部分其他模型因请求中的工具定义或 Codex 专用字段与下游模型协议不兼容而失败。

当前自定义 Provider 的 Codex runtime 按 OpenAI Responses 请求透传。客户端只对少数内置/已知模型做专门转换,未提供可配置或可扩展的多模型兼容策略。

## 环境

- Cindy 版本或 commit:待补充
- 平台与版本:待补充
- 安装方式:待补充
- 自定义供应商:tapsvc
- Agent:Codex

## 复现步骤

1. 在「设置 - 模型供应商」添加 tapsvc 自定义供应商,并为 Codex runtime 配置下述模型。
2. 创建 Codex 会话,选择 tapsvc 供应商及目标模型。
3. 发送包含默认工具集的请求。

## 期望行为

对于 tapsvc 已支持的模型,Cindy 能按目标模型或网关能力转换 Codex Responses 请求中的工具定义和专用字段,使基础对话及工具调用可正常执行。

对于暂未支持的模型,应在发送前或错误提示中明确说明不兼容的协议字段与可用替代方案。

## 实际行为

| 模型类别或示例 | 结果 | 脱敏错误 |
| --- | --- | --- |
| GPT 与 Codex 相关模型 | 可用 | - |
| gemini-3.5-flush | 可用 | - |
| qwen3.7-max | 不可用 | `DashscopeException - 'function' is a required property, expected an object - 'tools.9'` |
| glm-5.2 | 不可用 | `DashscopeException - 'function' is a required property, expected an object - 'tools.9'` |
| claude-haiku-4.5-20251001 | 不可用 | `tools: Tool names must be unique.` |
| claude-opus-4-6 | 不可用 | `BedrockException - client_metadata: Extra inputs are not permitted` |

- GPT、Codex 相关模型及 Gemini 3.5 Flash 可正常处理同类请求,说明 tapsvc 连接、鉴权和基础路由正常。
- Qwen3.7-Max、GLM-5.2 在 `tools.9` 处拒绝当前工具结构,提示缺少 `function` 对象。
- Claude Haiku 4.5 拒绝重复工具名。
- Claude Opus 4.6 的 Bedrock 路由拒绝 `client_metadata` 字段。
- Cindy 仅展示笼统的端点/协议不兼容提示,无法识别具体模型和失败字段。

## 初步定位

- 自定义 Provider 的 Codex runtime 被定义为 OpenAI Responses 兼容端点,请求会经本地 Codex 代理转发至配置的 `baseUrl`。
- 当前请求转换链对自定义模型大多保持透传,仅为少数已知模型执行专门适配。
- 因此 Codex 请求内的工具定义、重复工具名和 `client_metadata` 等字段会直接进入 tapsvc 的多模型转发链,并由不同下游模型或适配器拒绝。

## 实现建议

1. 新增自定义 Codex Provider 的协议能力描述,覆盖工具格式、重复工具名规则和 `client_metadata` 支持情况;保持默认透传,避免对全部网关无差别删字段。
2. 在 Codex 请求转换链按 Provider/模型能力实施最小化转换:为 Dashscope 适配工具的 `function` 结构,为 Claude 路由处理重复工具名,为 Bedrock 路由移除不支持的 `client_metadata`。
3. 为 GPT/Codex、Gemini、Qwen、GLM、Claude 分别增加基础对话和工具调用回归测试,并在无法兼容时输出模型及字段级错误提示。

Contributor guide

Open the contributing guide

Research direction

Start by locating the custom Provider Codex runtime and its request-conversion chain, then reproduce the listed tool-call failures through the tapsvc configuration. Review existing model-specific adapters and add focused regression coverage for the named model groups; done means supported models handle basic and tool calls, while incompatible fields produce model- and field-specific errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ai, backend-api-design, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.