Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -123,6 +125,10 @@ export function applyProviderSpecificLogic(
}
}

if (isAlibabaDirectModel(requestedModel)) {
addCacheBreakpoints(requestToMutate);
}

if (isClaudeModel(requestedModel)) {
applyAnthropicModelSettings(requestToMutate, extraHeaders);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const OpenRouterInferenceProviderIdSchema = z.enum([
]);

export const VercelUserByokInferenceProviderIdSchema = z.enum([
'alibaba',
'anthropic',
'bedrock',
'fireworks',
Expand Down Expand Up @@ -113,6 +114,7 @@ export const UserByokProviderIdSchema = VercelUserByokInferenceProviderIdSchema.
export type UserByokProviderId = z.infer<typeof UserByokProviderIdSchema>;

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',
Expand All @@ -135,7 +137,6 @@ export const UserByokTestModels = {
} satisfies Record<UserByokProviderId, string>;

export const VercelNonUserByokInferenceProviderIdSchema = z.enum([
'alibaba',
'arcee-ai',
'azure',
'baseten',
Expand Down Expand Up @@ -201,7 +202,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<string, VercelInferenceProviderId | undefined>;
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -22,7 +19,6 @@ export default {
supportedChatApis: ['chat_completions' /*, 'responses'*/],
transformRequest(context) {
context.request.body.enable_thinking = !isReasoningExplicitlyDisabled(context.request);
addCacheBreakpoints(context.request);
},
},
SEED: {
Expand Down