feat: 新增阿里云百炼 Token Plan 渠道类型#5777
Conversation
Add dedicated channel type for Alibaba Cloud Bailian Token Plan service,
enabling proper /v1/responses endpoint support (required for Codex tools).
Problem:
- Token Plan uses compatible-mode API at token-plan.cn-beijing.maas.aliyuncs.com
- Using the existing 'Ali Qianwen' channel type routes responses requests to
DashScope-specific paths (/api/v2/apps/protocols/...) which Token Plan doesn't support
- This causes 500 errors on /v1/responses while /v1/chat/completions works
Solution:
- New channel type 59 (ChannelTypeAliTokenPlan) with dedicated adaptor
- Adaptor inherits from ali.Adaptor but overrides:
- GetRequestURL: routes to /compatible-mode/v1/{responses,chat/completions,...}
- SetupRequestHeader: removes DashScope-specific headers (X-DashScope-SSE)
- DoRequest: ensures Go embedding method dispatch calls overridden methods
- Registered in both classic and default frontends with model fetch support
- Default base URL: https://token-plan.cn-beijing.maas.aliyuncs.com
Closes QuantumNous#5763
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
WalkthroughAdds a new AliTokenPlan Channel Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
原issue已回复过,不会考虑支持 |
Important
📝 变更描述 / Description
新增阿里云百炼 Token Plan 专用渠道类型(type=59),解决使用"阿里千问"渠道类型时
/v1/responses返回 500 的问题。Token Plan 服务使用标准 OpenAI 兼容协议(
/compatible-mode/v1/...),但现有 Ali 适配器会将 responses 请求路由到 DashScope 专有路径并注入不兼容的头部。本 PR 新建ali_token_plan适配器包,嵌入ali.Adaptor并覆写路由和头部逻辑,使 Token Plan 的/v1/responses端点正常工作。🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
📸 运行证明 / Proof of Work
已部署至生产环境验证,responses 和 chat/completions 均正常:
渠道配置界面:
curl 验证 responses 可用:
Summary by CodeRabbit
New Features
Bug Fixes