Skip to content

feat(ai-gateway): prefer alibaba for DeepSeek V4 Pro and V4 Flash on OpenRouter#3433

Open
kilo-code-bot[bot] wants to merge 1 commit into
mainfrom
feat/deepseek-v4-alibaba-preferred-provider
Open

feat(ai-gateway): prefer alibaba for DeepSeek V4 Pro and V4 Flash on OpenRouter#3433
kilo-code-bot[bot] wants to merge 1 commit into
mainfrom
feat/deepseek-v4-alibaba-preferred-provider

Conversation

@kilo-code-bot
Copy link
Copy Markdown
Contributor

@kilo-code-bot kilo-code-bot Bot commented May 22, 2026

Summary

  • Adds isDeepseekV4Model helper to deepseek.ts that identifies deepseek/deepseek-v4-pro and deepseek/deepseek-v4-flash.
  • Updates getPreferredProviderOrder in apply-provider-specific-logic.ts to 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.
  • Non-V4 DeepSeek models retain the existing [deepseek, novita] preference order.

Verification

  • Test a request to deepseek/deepseek-v4-pro or deepseek/deepseek-v4-flash via the OpenRouter gateway and confirm the provider.order in the upstream request body begins with alibaba.

Visual Changes

N/A

Reviewer Notes

The isDeepseekV4Model check is placed before the broader isDeepseekModel check in getPreferredProviderOrder to ensure V4 models get the more specific routing. alibaba is already a valid entry in OpenRouterInferenceProviderIdSchema.


Built for Ari Messer by Kilo for Slack

@arimesser arimesser requested review from Copilot and lambertjosh May 22, 2026 20:26
@arimesser arimesser marked this pull request as ready for review May 22, 2026 20:26
@kilo-code-bot
Copy link
Copy Markdown
Contributor Author

kilo-code-bot Bot commented May 22, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Small, well-structured routing change that adds isDeepseekV4Model and places it correctly before the broader isDeepseekModel guard — alibaba is a valid OpenRouterInferenceProviderIdSchema enum entry and the fallback order mirrors the existing Qwen/Kimi pattern.

Files Reviewed (2 files)
  • apps/web/src/lib/ai-gateway/providers/deepseek.ts
  • apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts

Reviewed by claude-4.6-sonnet-20260217 · 303,912 tokens

Review guidance: REVIEW.md from base branch main

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 isDeepseekV4Model helper to identify DeepSeek V4 Pro/Flash model IDs.
  • Updated getPreferredProviderOrder to 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';
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