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
15 changes: 11 additions & 4 deletions apps/web/src/lib/ai-gateway/models.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ describe('isFreeModel', () => {
internalId: 'minimax/minimax-m3-free',
contextLength: 1_048_576,
vision: true,
isAutoFree: true,
},
{
name: 'MiniMax M2.7',
Expand All @@ -122,10 +123,11 @@ describe('isFreeModel', () => {
internalId: 'minimax/minimax-m2.7-free',
contextLength: 196_608,
vision: false,
isAutoFree: false,
},
])(
'registers $name as a free Vercel GMI Cloud model',
async ({ model, publicId, internalId, contextLength, vision }) => {
async ({ model, publicId, internalId, contextLength, vision, isAutoFree }) => {
expect(findKiloExclusiveModel(model.public_id)).toBe(model);
expect(await isFreeModel(model.public_id)).toBe(true);
expect(model).toMatchObject({
Expand All @@ -140,7 +142,10 @@ describe('isFreeModel', () => {
expect(model.flags.includes('reasoning')).toBe(true);
expect(model.flags.includes('vision')).toBe(vision);
expect(getInferenceProvider(model)?.slug).toBe('gmicloud');
expect(preferredModels).not.toContain(model.public_id);
expect(autoFreeModels.some(({ model: modelId }) => modelId === model.public_id)).toBe(
isAutoFree
);
expect(preferredModels.includes(model.public_id)).toBe(isAutoFree);
}
);

Expand Down Expand Up @@ -235,16 +240,18 @@ describe('isFreeModel', () => {
'stepfun/step-3.7-flash:free': { enabled: true, effort: 'high' },
'poolside/laguna-s-2.1:free': { enabled: true, effort: 'high' },
'meituan/longcat-2.0-free': { enabled: true, effort: 'high' },
'minimax/minimax-m3:free': { enabled: true, effort: 'high' },
});
});

test('weights Auto Free models at 7:1:1 for StepFun, Laguna, and LongCat', () => {
test('weights every Auto Free model equally', () => {
expect(
Object.fromEntries(autoFreeModels.map(({ model, weight }) => [model, weight]))
).toEqual({
'stepfun/step-3.7-flash:free': 7,
'stepfun/step-3.7-flash:free': 1,
'poolside/laguna-s-2.1:free': 1,
'meituan/longcat-2.0-free': 1,
'minimax/minimax-m3:free': 1,
});
});

Expand Down
11 changes: 10 additions & 1 deletion apps/web/src/lib/ai-gateway/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const autoFreeModels: ReadonlyArray<AutoFreeModel> = [
? [
{
model: stepfun_37_flash_free_model.public_id,
weight: 7,
weight: 1,
reasoning: { enabled: true, effort: 'high' },
} satisfies AutoFreeModel,
]
Expand Down Expand Up @@ -79,6 +79,15 @@ export const autoFreeModels: ReadonlyArray<AutoFreeModel> = [
} satisfies AutoFreeModel,
]
: []),
...(minimax_m3_free_model.status === 'public'
? [
{
model: minimax_m3_free_model.public_id,
weight: 1,
reasoning: { enabled: true, effort: 'high' },
} satisfies AutoFreeModel,
]
: []),
];

export function selectAutoFreeCandidate(
Expand Down