Skip to content

fix(ali): route Responses to compatible-mode endpoint - #7013

Closed
jerzygao wants to merge 1 commit into
QuantumNous:mainfrom
jerzygao:fix/ali-responses-endpoint
Closed

jerzygao wants to merge 1 commit into
QuantumNous:mainfrom
jerzygao:fix/ali-responses-endpoint

Conversation

@jerzygao

@jerzygao jerzygao commented Aug 25, 2026 •

Copy link
Copy Markdown

本 PR 由 AI 协助(Claude Code)生成,描述经人工整理核实。

📝 变更描述 / Description

阿里云(type 17)适配器把 /v1/responses 路由到 /api/v2/apps/protocols/compatible-mode/v1/responses(commit 5b3c8e84 引入)。该路径在直连 MaaS host(如阿里云 Token Plan)上不被服务,阿里云对所有模型返回 {"code":"InternalError","message":"No gRPC response received"}(HTTP 500),而同一渠道的 /v1/chat/completions、/v1/messages 正常工作。

改为 %s/compatible-mode/v1/responses,与同文件 chat 端点 %s/compatible-mode/v1/chat/completions 对齐——这是阿里云文档(https://help.aliyun.com/zh/model-studio/base-url)所列 Token Plan OpenAI-compatible base 下的 responses 端点。

实测验证(Token Plan host + 真实渠道 key)

路径 模型 结果
旧 apps/protocols/.../responses deepseek-v4-pro-0813 HTTP 500 No gRPC response received
新 compatible-mode/v1/responses deepseek-v4-pro-0813 HTTP 200(正常 Responses 对象)
新 compatible-mode/v1/responses qwen3.8-max HTTP 200(qwen 不回归,原 5b3c8e84 针对的 qwen3-max 不会受影响)

go build / go vet / go test ./relay/channel/ali/ 通过。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix)

🔗 关联任务 / Related Issue

  • 暂无对应 Issue(如维护者需要我可另开一个并在此关联)

✅ 提交前检查项 / Checklist

  • 人工确认: 本 PR 为 AI 协助生成,已在顶部 Notice 声明,描述经人工整理核实
  • 非重复提交: 已搜索 upstream Issues/PRs,未见相同修复
  • Bug fix 说明: 暂无关联 Issue,可按维护者要求补开;本 issue 系路径错配致上游 500,非设计取舍/理解偏差
  • 变更理解: 路径错配致 500,改走 compatible-mode responses 端点
  • 范围聚焦: 仅改 relay/channel/ali/adaptor.go 一行 + 注释
  • 本地验证: build/vet/test 通过 + curl 实测见上
  • 安全合规: 无敏感凭据

📸 运行证明 / Proof of Work

见上方实测表格:旧路径复现 500 No gRPC response received,新路径返回 200 正常 Responses 对象。

Summary by CodeRabbit

  • Bug Fixes
    • Corrected Responses API requests to use the OpenAI-compatible endpoint on the channel’s base URL.
    • Improved compatibility and routing for Responses requests.

The Ali (type 17) adapter sent /v1/responses to
/api/v2/apps/protocols/compatible-mode/v1/responses, a path not served by
direct MaaS hosts (e.g. Aliyun Token Plan). Upstream returns
{"code":"InternalError","message":"No gRPC response received"} (HTTP 500)
for every model on that path, while /v1/chat/completions and /v1/messages
on the same channel work fine.

Route Responses to /compatible-mode/v1/responses, parallel to the existing
chat endpoint /compatible-mode/v1/chat/completions — the OpenAI-compatible
base documented at https://help.aliyun.com/zh/model-studio/base-url.

Verified on a Token Plan host: deepseek-v4-pro-0813 and qwen3.8-max both
return HTTP 200 on the new path (qwen not regressed).

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 413a3551-748c-4cd0-bbff-140cb9bcbf85

📥 Commits

Reviewing files that changed from the base of the PR and between 2d8e50b and 101acd5.

📒 Files selected for processing (1)
  • relay/channel/ali/adaptor.go

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The relay adapter changes the RelayModeResponses request URL from the Bailian apps protocol path to the OpenAI-compatible endpoint on the channel base URL.

Changes

Responses endpoint routing

Layer / File(s) Summary
Update Responses request path
relay/channel/ali/adaptor.go
GetRequestURL now uses <base>/compatible-mode/v1/responses for RelayModeResponses.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 101ac

This change routes Alibaba Responses requests to the compatible endpoint that returns successful Responses objects instead of the failing path. No actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: calcium-ion, wxwwt

Poem

A rabbit checks the route at dawn
The old path hops away
The compatible path comes on
Responses find their way
Ears up, the change is done

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: routing Aliyun Responses requests to the compatible-mode endpoint.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seefs001

Copy link
Copy Markdown
Collaborator

不支持token plan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants