Skip to content
Merged
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
8 changes: 0 additions & 8 deletions apps/web/src/lib/ai-gateway/providers/anthropic.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,6 @@ export function isClaudeModel(requestedModel: string) {
return requestedModel.includes('claude');
}

export function isHaikuModel(requestedModel: string) {
return requestedModel.includes('haiku');
}

export function isOpusModel(requestedModel: string) {
return requestedModel.includes('opus');
}

export function isFableModel(requestedModel: string) {
return requestedModel.includes('claude-fable');
}
8 changes: 2 additions & 6 deletions apps/web/src/lib/ai-gateway/providers/model-prefix.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isClaudeModel, isHaikuModel, isOpusModel } from './anthropic.constants';
import { isClaudeModel } from './anthropic.constants';
import { isOpenAiModel, isGptOssModel } from './openai';
import { isGemmaModel, isGemini3Model } from './google';
import { isKimiModel } from './moonshotai';
Expand All @@ -10,15 +10,11 @@ import { isCodestralModel, isMistralModel } from './mistral';
import { inferVercelFirstPartyInferenceProviderForModel } from './openrouter/inference-provider-id';

describe('provider predicates match substrings, regardless of prefix', () => {
test('isClaudeModel / isHaikuModel / isOpusModel', () => {
test('isClaudeModel', () => {
expect(isClaudeModel('~anthropic/claude-sonnet-4.5')).toBe(true);
expect(isClaudeModel('anthropic/claude-sonnet-4.5')).toBe(true);
expect(isClaudeModel('claude-sonnet-4-6')).toBe(true);
expect(isClaudeModel('openai/gpt-5')).toBe(false);
expect(isHaikuModel('~anthropic/claude-haiku-4.5')).toBe(true);
expect(isHaikuModel('claude-haiku-4-6')).toBe(true);
expect(isOpusModel('~anthropic/claude-opus-4.7')).toBe(true);
expect(isOpusModel('claude-opus-4-7')).toBe(true);
});

test('isOpenAiModel / isGptOssModel', () => {
Expand Down
20 changes: 2 additions & 18 deletions apps/web/src/lib/ai-gateway/providers/model-settings.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
isClaudeModel,
isFableModel,
isOpusModel,
} from '@/lib/ai-gateway/providers/anthropic.constants';
import { isClaudeModel } from '@/lib/ai-gateway/providers/anthropic.constants';
import { isGemini3Model, isGemmaModel } from '@/lib/ai-gateway/providers/google';
import { isKimiModel } from '@/lib/ai-gateway/providers/moonshotai';
import { isOpenAiModel } from '@/lib/ai-gateway/providers/openai';
Expand Down Expand Up @@ -52,20 +48,11 @@ export const REASONING_VARIANTS_NONE_HIGH_XHIGH = {
xhigh: { reasoning: { enabled: true, effort: 'xhigh' } },
} as const;

const REASONING_VARIANTS_CLAUDE_BASE = {
const REASONING_VARIANTS_CLAUDE = {
none: { reasoning: { enabled: false, effort: 'none' } },
low: { reasoning: { enabled: true, effort: 'low' }, verbosity: 'low' },
medium: { reasoning: { enabled: true, effort: 'medium' }, verbosity: 'medium' },
high: { reasoning: { enabled: true, effort: 'high' }, verbosity: 'high' },
} as const;

export const REASONING_VARIANTS_CLAUDE = {
...REASONING_VARIANTS_CLAUDE_BASE,
max: { reasoning: { enabled: true, effort: 'xhigh' }, verbosity: 'max' },
} as const;

export const REASONING_VARIANTS_OPUS = {
...REASONING_VARIANTS_CLAUDE_BASE,
xhigh: { reasoning: { enabled: true, effort: 'xhigh' }, verbosity: 'xhigh' },
max: { reasoning: { enabled: true, effort: 'xhigh' }, verbosity: 'max' },
} as const;
Expand All @@ -81,9 +68,6 @@ export const REASONING_VARIANTS_INSTANT_LOW_MEDIUM_HIGH = {
} as const;

export function getModelVariants(model: string): OpenCodeSettings['variants'] {
if (isOpusModel(model) || isFableModel(model)) {
return REASONING_VARIANTS_OPUS;
}
if (isClaudeModel(model)) {
return REASONING_VARIANTS_CLAUDE;
}
Expand Down