feat(ai-gateway): prefer alibaba for DeepSeek V4 Pro and V4 Flash on OpenRouter#3433
feat(ai-gateway): prefer alibaba for DeepSeek V4 Pro and V4 Flash on OpenRouter#3433kilo-code-bot[bot] wants to merge 1 commit into
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummarySmall, well-structured routing change that adds Files Reviewed (2 files)
Reviewed by claude-4.6-sonnet-20260217 · 303,912 tokens Review guidance: REVIEW.md from base branch |
There was a problem hiding this comment.
Pull request overview
This PR adjusts OpenRouter provider routing so that DeepSeek V4 Pro/Flash models prefer Alibaba as the first upstream inference provider, while keeping the existing provider preference order for other DeepSeek models.
Changes:
- Added an
isDeepseekV4Modelhelper to identify DeepSeek V4 Pro/Flash model IDs. - Updated
getPreferredProviderOrderto route DeepSeek V4 Pro/Flash through[alibaba, deepseek, novita], while keeping non‑V4 DeepSeek as[deepseek, novita].
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/web/src/lib/ai-gateway/providers/deepseek.ts | Adds a V4-specific model identification helper. |
| apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts | Uses the new helper to prefer Alibaba first for DeepSeek V4 provider routing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| export function isDeepseekV4Model(model: string) { | ||
| return model === 'deepseek/deepseek-v4-pro' || model === 'deepseek/deepseek-v4-flash'; |
Summary
isDeepseekV4Modelhelper todeepseek.tsthat identifiesdeepseek/deepseek-v4-proanddeepseek/deepseek-v4-flash.getPreferredProviderOrderinapply-provider-specific-logic.tsto route DeepSeek V4 Pro and V4 Flash through Alibaba first (order = 1), followed by DeepSeek and Novita as fallbacks — matching the same pattern used for Qwen models.[deepseek, novita]preference order.Verification
deepseek/deepseek-v4-proordeepseek/deepseek-v4-flashvia the OpenRouter gateway and confirm theprovider.orderin the upstream request body begins withalibaba.Visual Changes
N/A
Reviewer Notes
The
isDeepseekV4Modelcheck is placed before the broaderisDeepseekModelcheck ingetPreferredProviderOrderto ensure V4 models get the more specific routing.alibabais already a valid entry inOpenRouterInferenceProviderIdSchema.Built for Ari Messer by Kilo for Slack