From d05eb2e4dc1ac6a4a46bc0d8a63298ea5a851e29 Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Fri, 1 May 2026 09:56:55 +0000 Subject: [PATCH 1/2] feat(inference-providers): graduate alibaba to user BYOK --- .../src/components/organizations/byok/BYOKKeysManager.tsx | 1 + .../ai-gateway/providers/openrouter/inference-provider-id.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/organizations/byok/BYOKKeysManager.tsx b/apps/web/src/components/organizations/byok/BYOKKeysManager.tsx index d3943fbd9..4f4139564 100644 --- a/apps/web/src/components/organizations/byok/BYOKKeysManager.tsx +++ b/apps/web/src/components/organizations/byok/BYOKKeysManager.tsx @@ -51,6 +51,7 @@ import * as z from 'zod'; // clause forces new entries here whenever a provider is added to // VercelUserByokInferenceProviderIdSchema. const VERCEL_BYOK_PROVIDER_NAMES = { + alibaba: 'Alibaba', anthropic: 'Anthropic', bedrock: 'AWS Bedrock', openai: 'OpenAI', diff --git a/apps/web/src/lib/ai-gateway/providers/openrouter/inference-provider-id.ts b/apps/web/src/lib/ai-gateway/providers/openrouter/inference-provider-id.ts index 855f156cf..bae7fb7b5 100644 --- a/apps/web/src/lib/ai-gateway/providers/openrouter/inference-provider-id.ts +++ b/apps/web/src/lib/ai-gateway/providers/openrouter/inference-provider-id.ts @@ -74,6 +74,7 @@ export const OpenRouterInferenceProviderIdSchema = z.enum([ ]); export const VercelUserByokInferenceProviderIdSchema = z.enum([ + 'alibaba', 'anthropic', 'bedrock', 'fireworks', @@ -112,6 +113,7 @@ export const UserByokProviderIdSchema = VercelUserByokInferenceProviderIdSchema. export type UserByokProviderId = z.infer; export const UserByokTestModels = { + [VercelUserByokInferenceProviderIdSchema.enum.alibaba]: 'alibaba/qwen3-coder-plus', [VercelUserByokInferenceProviderIdSchema.enum.anthropic]: 'anthropic/claude-haiku-4.5', [VercelUserByokInferenceProviderIdSchema.enum.bedrock]: 'anthropic/claude-haiku-4.5', [VercelUserByokInferenceProviderIdSchema.enum.fireworks]: 'openai/gpt-oss-20b', @@ -133,7 +135,6 @@ export const UserByokTestModels = { } satisfies Record; export const VercelNonUserByokInferenceProviderIdSchema = z.enum([ - 'alibaba', 'arcee-ai', 'azure', 'baseten', @@ -200,7 +201,7 @@ const modelPrefixToVercelInferenceProviderMapping = { openai: VercelUserByokInferenceProviderIdSchema.enum.openai, minimax: VercelUserByokInferenceProviderIdSchema.enum.minimax, mistralai: VercelUserByokInferenceProviderIdSchema.enum.mistral, - qwen: VercelNonUserByokInferenceProviderIdSchema.enum.alibaba, + qwen: VercelUserByokInferenceProviderIdSchema.enum.alibaba, 'x-ai': VercelUserByokInferenceProviderIdSchema.enum.xai, 'z-ai': VercelUserByokInferenceProviderIdSchema.enum.zai, } as Record; From 267f3f92414362b427d99efc4aff5c549bb5ea90 Mon Sep 17 00:00:00 2001 From: Christiaan Arnoldus Date: Fri, 1 May 2026 16:21:38 +0200 Subject: [PATCH 2/2] Add cache breakpoints when using BYOK --- .../ai-gateway/providers/apply-provider-specific-logic.ts | 6 ++++++ .../src/lib/ai-gateway/providers/provider-definitions.ts | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts b/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts index e347a8038..07a58d5cf 100644 --- a/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts +++ b/apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts @@ -21,6 +21,8 @@ import type { BYOKResult, Provider } from '@/lib/ai-gateway/providers/types'; import { isStepModel } from '@/lib/ai-gateway/providers/stepfun'; import { isDeepseekModel } from '@/lib/ai-gateway/providers/deepseek'; import type { FraudDetectionHeaders } from '@/lib/utils'; +import { isAlibabaDirectModel } from '@/lib/ai-gateway/providers/qwen'; +import { addCacheBreakpoints } from '@/lib/ai-gateway/providers/openrouter/request-helpers'; function applyToolChoiceSetting( requestedModel: string, @@ -123,6 +125,10 @@ export function applyProviderSpecificLogic( } } + if (isAlibabaDirectModel(requestedModel)) { + addCacheBreakpoints(requestToMutate); + } + if (isClaudeModel(requestedModel)) { applyAnthropicModelSettings(requestToMutate, extraHeaders); } diff --git a/apps/web/src/lib/ai-gateway/providers/provider-definitions.ts b/apps/web/src/lib/ai-gateway/providers/provider-definitions.ts index 01e803d0a..e2803b1c2 100644 --- a/apps/web/src/lib/ai-gateway/providers/provider-definitions.ts +++ b/apps/web/src/lib/ai-gateway/providers/provider-definitions.ts @@ -1,8 +1,5 @@ import { getEnvVariable } from '@/lib/dotenvx'; -import { - addCacheBreakpoints, - isReasoningExplicitlyDisabled, -} from '@/lib/ai-gateway/providers/openrouter/request-helpers'; +import { isReasoningExplicitlyDisabled } from '@/lib/ai-gateway/providers/openrouter/request-helpers'; import type { Provider } from '@/lib/ai-gateway/providers/types'; import { applyVercelSettings } from '@/lib/ai-gateway/providers/vercel'; @@ -22,7 +19,6 @@ export default { supportedChatApis: ['chat_completions' /*, 'responses'*/], transformRequest(context) { context.request.body.enable_thinking = !isReasoningExplicitlyDisabled(context.request); - addCacheBreakpoints(context.request); }, }, SEED: {