Skip to content
Open
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
6 changes: 3 additions & 3 deletions src/lib/providers/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export function isHaikuModel(requestedModel: string) {
}

function appendAnthropicBetaHeader(extraHeaders: Record<string, string>, betaFlag: string) {
extraHeaders['x-anthropic-beta'] = [extraHeaders['x-anthropic-beta'], betaFlag]
.filter(Boolean)
.join(',');
for (const header of ['anthropic-beta', 'x-anthropic-beta']) {
extraHeaders[header] = [extraHeaders[header], betaFlag].filter(Boolean).join(',');
}
}

function hasCacheControl(message: OpenAI.ChatCompletionMessageParam) {
Expand Down
23 changes: 0 additions & 23 deletions src/lib/providers/vercel/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { BYOKResult } from '@/lib/byok';
import { kiloFreeModels, preferredModels } from '@/lib/models';
import { isAnthropicModel } from '@/lib/providers/anthropic';
import { getGatewayErrorRate } from '@/lib/providers/gateway-error-rate';
import { isOpenAiModel } from '@/lib/providers/openai';
import type { VercelUserByokInferenceProviderId } from '@/lib/providers/openrouter/inference-provider-id';
import {
AutocompleteUserByokProviderIdSchema,
Expand Down Expand Up @@ -73,19 +71,6 @@ export async function shouldRouteToVercel(
return true;
}

if (isAnthropicModel(requestedModel)) {
console.debug(
`[shouldRouteToVercel] Anthropic models are not routed to Vercel pending fine-grained tool streaming support`
);
return false;
}

if (isOpenAiModel(requestedModel)) {
// 2026-03-03 Vercel returns this error: The model `gpt-5.3-codex-api-preview` does not exist or you do not have access to it.
console.debug(`[shouldRouteToVercel] OpenAI models are not routed to Vercel`);
return false;
}

if (!preferredModels.includes(requestedModel)) {
console.debug(`[shouldRouteToVercel] only recommended models are tested for Vercel routing`);
return false;
Expand Down Expand Up @@ -151,14 +136,6 @@ export function applyVercelSettings(
) {
requestToMutate.model = mapModelIdToVercel(requestedModel);

if (isAnthropicModel(requestedModel)) {
// https://vercel.com/docs/ai-gateway/model-variants#anthropic-claude-sonnet-4:-1m-token-context-beta
extraHeaders['anthropic-beta'] = [extraHeaders['x-anthropic-beta'], 'context-1m-2025-08-07']
.filter(Boolean)
.join(',');
delete extraHeaders['x-anthropic-beta'];
}

if (userByok) {
if (userByok.length === 0) {
throw new Error('Invalid state: userByok should be null or not empty');
Expand Down