feat(vendors): 新增 minimax/kimi/doubao/xiaomi/alibaba 五个原生 Anthropic 兼容供应商#136
Merged
Merged
Conversation
…容供应商; 提取 NativeAnthropicVendor 公共基类,将 zhipu 及 5 个新供应商统一为薄透传代理子类, 仅做模型名映射和 x-api-key 认证头替换,其余请求体/响应原样透传。 - 配置层:VendorType 扩展、5 个 Config 类、schema re-export - 供应商层:native_anthropic.py 基类 + zhipu 重构 + 5 个新子类 - 工厂/路由:factory.py match 分支、model_mapper/executor/session_manager 注册 - 默认配置:config.default.yaml 新增 vendor 定义、模型映射和定价条目(默认禁用) - 测试:test_native_vendors.py 参数化测试 (65 cases) + 既有测试断言更新 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
参考 zhipu 的薄透传代理实现模式,新增接入 minimax、kimi、doubao、xiaomi、alibaba 五个原生 Anthropic 兼容端点供应商。所有新供应商仅做模型名映射和
x-api-key认证头替换,其余 Claude Code 请求体/响应原样透传,保持 N-tier 架构链路的降级与兜底完整能力。变更内容
架构优化:提取
NativeAnthropicVendor公共基类ZhipuVendor(~267 行)提取公共逻辑至native_anthropic.py(~271 行),所有 6 个供应商统一继承配置层(4 files)
config/routing.pyVendorTypeLiteral 扩展 5 个新成员;提取_NATIVE_ANTHROPIC_FIELDS公共字段集config/vendors.pyMinimaxConfig、KimiConfig、DoubaoConfig、XiaomiConfig、AlibabaConfigconfig/schema.py_NATIVE_ANTHROPIC_FIELDSconfig/config.default.yamlenabled: false)、15 条模型映射规则、8 条定价条目供应商层(7 files)
vendors/native_anthropic.pyvendors/zhipu.py_vendor_name/_display_namevendors/minimax.pyvendors/kimi.pyvendors/doubao.pyvendors/xiaomi.pyvendors/alibaba.py工厂 + 路由注册(4 files)
server/factory.pymatch语句新增 5 个 vendor case 分支routing/model_mapper.py_VENDOR_ALIASES新增 5 条映射routing/executor.py_VENDOR_PROTOCOL_LABEL_MAP新增 5 条 →"Anthropic"routing/session_manager.pyprovider_protocol新增 5 条 →"anthropic_messages"测试(3 files)
tests/test_native_vendors.pytests/test_router_executor.py_VENDOR_PROTOCOL_LABEL_MAP键集断言tests/test_schema.py_VENDOR_EXCLUSIVE_FIELDS键集断言及api_key描述匹配供应商接入配置
https://api.minimaxi.com/anthropichttps://api.kimi.com/coding/https://ark.cn-beijing.volces.com/api/codinghttps://token-plan-cn.xiaomimimo.com/anthropichttps://coding-intl.dashscope.aliyuncs.com/apps/anthropic测试验证
🤖 Generated with Claude Code, CodeX, Gemini
Co-Authored-By: Aurelius Huangthreefish.ai@gmail.com