From 922ba4a4f58976a51aaa228e6c37b4f8c7522d62 Mon Sep 17 00:00:00 2001 From: yiling Date: Mon, 8 Jun 2026 12:43:41 +0800 Subject: [PATCH] test(api): fix lint error in file upload tests --- packages/api/src/api/file.test.ts | 56 +- packages/api/src/api/file.ts | 32 +- .../core/src/generated/providers.generated.ts | 1275 +++++++++++++---- 3 files changed, 1104 insertions(+), 259 deletions(-) diff --git a/packages/api/src/api/file.test.ts b/packages/api/src/api/file.test.ts index 9106a597..c2f5968b 100644 --- a/packages/api/src/api/file.test.ts +++ b/packages/api/src/api/file.test.ts @@ -6,9 +6,24 @@ import { assetService } from '@shumai/core/src/asset/asset' import { metadataService } from '@shumai/core/src/metadata/metadata' import { notificationService } from '@shumai/core/src/notification/notification' import { s3Service } from '@shumai/core/src/s3/s3' +import { transcodeService } from '@shumai/transcode/src/transcode' import { authMiddleware } from './middleware/auth' import { authzService, ResourceType, Permission } from '@shumai/core/src/authz/authz' +vi.mock('fs', async (importOriginal) => { + const actual = (await importOriginal()) as Record + const actualDefault = actual.default as Record + return { + ...actual, + default: { + ...actualDefault, + readFileSync: vi.fn().mockReturnValue(Buffer.from('transcoded content')), + existsSync: vi.fn().mockReturnValue(true), + unlinkSync: vi.fn().mockReturnValue(undefined), + }, + } +}) + vi.mock('@shumai/core/src/authz/authz', () => ({ authzService: { hasPermission: vi.fn().mockResolvedValue(undefined), @@ -45,6 +60,7 @@ describe('file api', () => { vi.spyOn(metadataService, 'updateAssetMetadata').mockImplementation(vi.fn()) vi.spyOn(notificationService, 'create').mockImplementation(vi.fn()) vi.spyOn(s3Service, 'putObject').mockImplementation(vi.fn()) + vi.spyOn(transcodeService, 'transcodeImage').mockResolvedValue(undefined) vi.mocked(authzService.hasPermission).mockResolvedValue(undefined) }) @@ -294,7 +310,7 @@ describe('file api', () => { }) }) - it('POST /teams/:teamId/files', async () => { + it('POST /teams/:teamId/files - image with compression', async () => { vi.mocked(s3Service.putObject).mockResolvedValue(undefined) const formData = new FormData() @@ -309,7 +325,7 @@ describe('file api', () => { expect(res.status).toBe(200) const json = await res.json() - expect(json.key).toMatch(/^files\//) + expect(json.key).toMatch(/^files\/.*\.webp$/) expect(authzService.hasPermission).toHaveBeenCalledWith({ user: { id: 'user1', name: 'Test User' }, @@ -317,7 +333,41 @@ describe('file api', () => { type: ResourceType.Team, id: 'test-team', }) - expect(s3Service.putObject).toHaveBeenCalled() + expect(transcodeService.transcodeImage).toHaveBeenCalled() + expect(s3Service.putObject).toHaveBeenCalledWith( + expect.any(String), + expect.stringMatching(/\.webp$/), + expect.any(Buffer), + expect.any(Number), + 'image/webp', + ) + }) + + it('POST /teams/:teamId/files - non-image without compression', async () => { + vi.mocked(s3Service.putObject).mockResolvedValue(undefined) + + const formData = new FormData() + const file = new File(['test content'], 'test.txt', { type: 'text/plain' }) + formData.append('file', file) + + const app = new Hono().use('*', authMiddleware).route('/', fileRoute) + const res = await app.request('/teams/test-team/files', { + method: 'POST', + body: formData, + }) + + expect(res.status).toBe(200) + const json = await res.json() + expect(json.key).toMatch(/^files\/[A-Z0-9]+$/) + + expect(transcodeService.transcodeImage).not.toHaveBeenCalled() + expect(s3Service.putObject).toHaveBeenCalledWith( + expect.any(String), + expect.not.stringMatching(/\.webp$/), + expect.any(Buffer), + expect.any(Number), + expect.stringContaining('text/plain'), + ) }) it('PATCH /files/:fileId/metadata', async () => { diff --git a/packages/api/src/api/file.ts b/packages/api/src/api/file.ts index da16b6df..b7c7b00c 100644 --- a/packages/api/src/api/file.ts +++ b/packages/api/src/api/file.ts @@ -1,28 +1,28 @@ -import { Hono } from 'hono' import { zValidator } from '@hono/zod-validator' -import { prisma } from '@shumai/db' -import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz' import { assetService } from '@shumai/core/src/asset/asset' +import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz' import { metadataService } from '@shumai/core/src/metadata/metadata' import { notificationService } from '@shumai/core/src/notification/notification' import { s3Service } from '@shumai/core/src/s3/s3' -import { transcodeService } from '@shumai/transcode/src/transcode' -import path from 'path' -import os from 'os' -import fs from 'fs' +import type { Prisma } from '@shumai/db' +import { prisma } from '@shumai/db' import { - updateFileRequestSchema, - updateAssetOrderRequestSchema, - deleteFilesRequestSchema, - restoreFilesRequestSchema, createCommentRequestSchema, + deleteFilesRequestSchema, + paginationParamsSchema, + restoreFilesRequestSchema, + updateAssetMetadataRequestSchema, + updateAssetOrderRequestSchema, + updateFileRequestSchema, uploadFileRequestSchema, } from '@shumai/dtos' -import { updateAssetMetadataRequestSchema } from '@shumai/dtos' -import { paginationParamsSchema } from '@shumai/dtos' +import { transcodeService } from '@shumai/transcode/src/transcode' +import fs from 'fs' +import { Hono } from 'hono' +import os from 'os' +import path from 'path' import { ulid } from 'ulid' import { z } from 'zod' -import type { Prisma } from '@shumai/db' type User = Prisma.UserGetPayload> @@ -227,8 +227,8 @@ const route = new Hono<{ Variables: { user: User } }>() id: teamId, }) - if (file.size > 10 * 1024 * 1024) { - return c.json('file too large, max 10MB', 400) + if (file.size > 30 * 1024 * 1024) { + return c.json('file too large, max 30MB', 400) } let key = `files/${ulid()}` diff --git a/packages/core/src/generated/providers.generated.ts b/packages/core/src/generated/providers.generated.ts index 2a4bccd5..12abeff5 100644 --- a/packages/core/src/generated/providers.generated.ts +++ b/packages/core/src/generated/providers.generated.ts @@ -2348,8 +2348,8 @@ export const builtinProviders: Record = { contextWindow: 131072, maxTokens: 16000, cost: { - input: 0.2288, - output: 0.9144, + input: 0.20020000000000002, + output: 0.8000999999999999, cacheRead: 0, cacheWrite: 0, }, @@ -2448,11 +2448,11 @@ export const builtinProviders: Record = { reasoning: true, input: ['text'], contextWindow: 131072, - maxTokens: 65536, + maxTokens: 64000, cost: { - input: 0.252, - output: 0.378, - cacheRead: 0.0252, + input: 0.2288, + output: 0.3432, + cacheRead: 0, cacheWrite: 0, }, }, @@ -2525,40 +2525,6 @@ export const builtinProviders: Record = { }, }, }, - { - modelId: 'google/gemini-2.0-flash-001', - name: 'Google: Gemini 2.0 Flash', - config: { - api: 'openai-completions', - reasoning: false, - input: ['text', 'image'], - contextWindow: 1048576, - maxTokens: 8192, - cost: { - input: 0.09999999999999999, - output: 0.39999999999999997, - cacheRead: 0.024999999999999998, - cacheWrite: 0.08333333333333334, - }, - }, - }, - { - modelId: 'google/gemini-2.0-flash-lite-001', - name: 'Google: Gemini 2.0 Flash Lite', - config: { - api: 'openai-completions', - reasoning: false, - input: ['text', 'image'], - contextWindow: 1048576, - maxTokens: 8192, - cost: { - input: 0.075, - output: 0.3, - cacheRead: 0, - cacheWrite: 0, - }, - }, - }, { modelId: 'google/gemini-2.5-flash', name: 'Google: Gemini 2.5 Flash', @@ -2943,9 +2909,9 @@ export const builtinProviders: Record = { contextWindow: 262144, maxTokens: 65536, cost: { - input: 0.3, - output: 2.5, - cacheRead: 0.06, + input: 0.075, + output: 0.625, + cacheRead: 0.015, cacheWrite: 0, }, }, @@ -3145,15 +3111,32 @@ export const builtinProviders: Record = { reasoning: true, input: ['text'], contextWindow: 204800, - maxTokens: 4096, + maxTokens: 131072, cost: { - input: 0.26, + input: 0.27899999999999997, output: 1.2, cacheRead: 0, cacheWrite: 0, }, }, }, + { + modelId: 'minimax/minimax-m3', + name: 'MiniMax: MiniMax M3', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text', 'image'], + contextWindow: 1048576, + maxTokens: 512000, + cost: { + input: 0.3, + output: 1.2, + cacheRead: 0.06, + cacheWrite: 0, + }, + }, + }, { modelId: 'mistralai/codestral-2508', name: 'Mistral: Codestral 2508', @@ -3664,6 +3647,40 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'nvidia/nemotron-3-ultra-550b-a55b', + name: 'NVIDIA: Nemotron 3 Ultra', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 1000000, + maxTokens: 16384, + cost: { + input: 0.5, + output: 2.5, + cacheRead: 0.15, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'nvidia/nemotron-3-ultra-550b-a55b:free', + name: 'NVIDIA: Nemotron 3 Ultra (free)', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 1000000, + maxTokens: 65536, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, { modelId: 'nvidia/nemotron-nano-12b-v2-vl:free', name: 'NVIDIA: Nemotron Nano 12B 2 VL (free)', @@ -3783,23 +3800,6 @@ export const builtinProviders: Record = { }, }, }, - { - modelId: 'openai/gpt-4-0314', - name: 'OpenAI: GPT-4 (older v0314)', - config: { - api: 'openai-completions', - reasoning: false, - input: ['text'], - contextWindow: 8191, - maxTokens: 4096, - cost: { - input: 30, - output: 60, - cacheRead: 0, - cacheWrite: 0, - }, - }, - }, { modelId: 'openai/gpt-4-1106-preview', name: 'OpenAI: GPT-4 Turbo (older v1106)', @@ -4929,11 +4929,11 @@ export const builtinProviders: Record = { api: 'openai-completions', reasoning: false, input: ['text'], - contextWindow: 262144, - maxTokens: 262144, + contextWindow: 131072, + maxTokens: 32000, cost: { - input: 0.09, - output: 0.3, + input: 0.04815, + output: 0.19305, cacheRead: 0, cacheWrite: 0, }, @@ -5534,6 +5534,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'qwen/qwen3.7-plus', + name: 'Qwen: Qwen3.7 Plus', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text', 'image'], + contextWindow: 1000000, + maxTokens: 65536, + cost: { + input: 0.39999999999999997, + output: 1.5999999999999999, + cacheRead: 0.08, + cacheWrite: 0.5, + }, + }, + }, { modelId: 'rekaai/reka-edge', name: 'Reka Edge', @@ -5687,6 +5704,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'upstage/solar-pro-3', + name: 'Upstage: Solar Pro 3', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 128000, + maxTokens: 4096, + cost: { + input: 0.15, + output: 0.6, + cacheRead: 0.015, + cacheWrite: 0, + }, + }, + }, { modelId: 'x-ai/grok-4.20', name: 'xAI: Grok 4.20', @@ -6190,6 +6224,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'devstral-latest', + name: 'Devstral 2', + config: { + api: 'mistral-conversations', + reasoning: false, + input: ['text'], + contextWindow: 262144, + maxTokens: 262144, + cost: { + input: 0.4, + output: 2, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, { modelId: 'devstral-medium-2507', name: 'Devstral Medium', @@ -6564,6 +6615,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'open-mistral-nemo', + name: 'Open Mistral Nemo', + config: { + api: 'mistral-conversations', + reasoning: false, + input: ['text'], + contextWindow: 128000, + maxTokens: 128000, + cost: { + input: 0.15, + output: 0.15, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, { modelId: 'open-mixtral-8x22b', name: 'Mixtral 8x22B', @@ -7026,8 +7094,8 @@ export const builtinProviders: Record = { contextWindow: 1000000, maxTokens: 128000, cost: { - input: 5, - output: 25, + input: 5.5, + output: 27.5, cacheRead: 0.5, cacheWrite: 6.25, }, @@ -7043,10 +7111,10 @@ export const builtinProviders: Record = { contextWindow: 1000000, maxTokens: 128000, cost: { - input: 5, - output: 25, - cacheRead: 0.5, - cacheWrite: 6.25, + input: 5.5, + output: 27.5, + cacheRead: 0.55, + cacheWrite: 6.875, }, }, }, @@ -7060,10 +7128,10 @@ export const builtinProviders: Record = { contextWindow: 1000000, maxTokens: 128000, cost: { - input: 5, - output: 25, - cacheRead: 0.5, - cacheWrite: 6.25, + input: 5.5, + output: 27.5, + cacheRead: 0.55, + cacheWrite: 6.875, }, }, }, @@ -7077,10 +7145,10 @@ export const builtinProviders: Record = { contextWindow: 200000, maxTokens: 64000, cost: { - input: 3, - output: 15, - cacheRead: 0.3, - cacheWrite: 3.75, + input: 3.3, + output: 16.5, + cacheRead: 0.33, + cacheWrite: 4.125, }, }, }, @@ -7094,10 +7162,10 @@ export const builtinProviders: Record = { contextWindow: 1000000, maxTokens: 64000, cost: { - input: 3, - output: 15, - cacheRead: 0.3, - cacheWrite: 3.75, + input: 3.3, + output: 16.5, + cacheRead: 0.33, + cacheWrite: 4.125, }, }, }, @@ -8174,6 +8242,67 @@ export const builtinProviders: Record = { }, ], }, + 'ant-ling': { + name: 'ant-ling', + config: { + api: 'openai-completions', + baseUrl: 'https://api.ant-ling.com/v1', + apiKey: '', + }, + models: [ + { + modelId: 'Ling-2.6-1T', + name: 'Ling 2.6 1T', + config: { + api: 'openai-completions', + reasoning: false, + input: ['text'], + contextWindow: 262144, + maxTokens: 65536, + cost: { + input: 0.06, + output: 0.25, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'Ling-2.6-flash', + name: 'Ling 2.6 Flash', + config: { + api: 'openai-completions', + reasoning: false, + input: ['text'], + contextWindow: 262144, + maxTokens: 65536, + cost: { + input: 0.01, + output: 0.02, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'Ring-2.6-1T', + name: 'Ring 2.6 1T', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 262144, + maxTokens: 65536, + cost: { + input: 0.06, + output: 0.25, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + ], + }, 'azure-openai-responses': { name: 'azure-openai-responses', config: { @@ -9947,8 +10076,8 @@ export const builtinProviders: Record = { api: 'anthropic-messages', reasoning: true, input: ['text', 'image'], - contextWindow: 128000, - maxTokens: 8192, + contextWindow: 262144, + maxTokens: 65536, cost: { input: 0.5, output: 3, @@ -10003,7 +10132,7 @@ export const builtinProviders: Record = { models: [ { modelId: 'claude-haiku-4.5', - name: 'Claude Haiku 4.5', + name: 'Claude Haiku 4.5 (latest)', config: { api: 'anthropic-messages', reasoning: true, @@ -10011,16 +10140,16 @@ export const builtinProviders: Record = { contextWindow: 200000, maxTokens: 64000, cost: { - input: 0, - output: 0, - cacheRead: 0, - cacheWrite: 0, + input: 1, + output: 5, + cacheRead: 0.1, + cacheWrite: 1.25, }, }, }, { modelId: 'claude-opus-4.5', - name: 'Claude Opus 4.5', + name: 'Claude Opus 4.5 (latest)', config: { api: 'anthropic-messages', reasoning: true, @@ -10028,10 +10157,10 @@ export const builtinProviders: Record = { contextWindow: 200000, maxTokens: 32000, cost: { - input: 0, - output: 0, - cacheRead: 0, - cacheWrite: 0, + input: 5, + output: 25, + cacheRead: 0.5, + cacheWrite: 6.25, }, }, }, @@ -10045,10 +10174,10 @@ export const builtinProviders: Record = { contextWindow: 1000000, maxTokens: 32000, cost: { - input: 0, - output: 0, - cacheRead: 0, - cacheWrite: 0, + input: 5, + output: 25, + cacheRead: 0.5, + cacheWrite: 6.25, }, }, }, @@ -10062,10 +10191,10 @@ export const builtinProviders: Record = { contextWindow: 200000, maxTokens: 32000, cost: { - input: 0, - output: 0, - cacheRead: 0, - cacheWrite: 0, + input: 5, + output: 25, + cacheRead: 0.5, + cacheWrite: 6.25, }, }, }, @@ -10079,16 +10208,33 @@ export const builtinProviders: Record = { contextWindow: 200000, maxTokens: 64000, cost: { - input: 0, - output: 0, - cacheRead: 0, - cacheWrite: 0, + input: 5, + output: 25, + cacheRead: 0.5, + cacheWrite: 6.25, + }, + }, + }, + { + modelId: 'claude-sonnet-4', + name: 'Claude Sonnet 4 (latest)', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text', 'image'], + contextWindow: 216000, + maxTokens: 16000, + cost: { + input: 3, + output: 15, + cacheRead: 0.3, + cacheWrite: 3.75, }, }, }, { modelId: 'claude-sonnet-4.5', - name: 'Claude Sonnet 4.5', + name: 'Claude Sonnet 4.5 (latest)', config: { api: 'anthropic-messages', reasoning: true, @@ -10096,10 +10242,10 @@ export const builtinProviders: Record = { contextWindow: 200000, maxTokens: 32000, cost: { - input: 0, - output: 0, - cacheRead: 0, - cacheWrite: 0, + input: 3, + output: 15, + cacheRead: 0.3, + cacheWrite: 3.75, }, }, }, @@ -10113,10 +10259,10 @@ export const builtinProviders: Record = { contextWindow: 1000000, maxTokens: 32000, cost: { - input: 0, - output: 0, - cacheRead: 0, - cacheWrite: 0, + input: 3, + output: 15, + cacheRead: 0.3, + cacheWrite: 3.75, }, }, }, @@ -10125,21 +10271,21 @@ export const builtinProviders: Record = { name: 'Gemini 2.5 Pro', config: { api: 'openai-completions', - reasoning: false, + reasoning: true, input: ['text', 'image'], contextWindow: 128000, maxTokens: 64000, cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 1.25, + output: 10, + cacheRead: 0.125, cacheWrite: 0, }, }, }, { modelId: 'gemini-3-flash-preview', - name: 'Gemini 3 Flash', + name: 'Gemini 3 Flash Preview', config: { api: 'openai-completions', reasoning: true, @@ -10147,9 +10293,9 @@ export const builtinProviders: Record = { contextWindow: 128000, maxTokens: 64000, cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 0.5, + output: 3, + cacheRead: 0.05, cacheWrite: 0, }, }, @@ -10164,9 +10310,9 @@ export const builtinProviders: Record = { contextWindow: 200000, maxTokens: 64000, cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 2, + output: 12, + cacheRead: 0.2, cacheWrite: 0, }, }, @@ -10181,9 +10327,9 @@ export const builtinProviders: Record = { contextWindow: 200000, maxTokens: 64000, cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 1.5, + output: 9, + cacheRead: 0.15, cacheWrite: 0, }, }, @@ -10198,33 +10344,16 @@ export const builtinProviders: Record = { contextWindow: 128000, maxTokens: 16384, cost: { - input: 0, - output: 0, - cacheRead: 0, - cacheWrite: 0, - }, - }, - }, - { - modelId: 'gpt-4o', - name: 'GPT-4o', - config: { - api: 'openai-completions', - reasoning: false, - input: ['text', 'image'], - contextWindow: 128000, - maxTokens: 4096, - cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 2, + output: 8, + cacheRead: 0.5, cacheWrite: 0, }, }, }, { modelId: 'gpt-5-mini', - name: 'GPT-5-mini', + name: 'GPT-5 Mini', config: { api: 'openai-responses', reasoning: true, @@ -10232,9 +10361,9 @@ export const builtinProviders: Record = { contextWindow: 264000, maxTokens: 64000, cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 0.25, + output: 2, + cacheRead: 0.025, cacheWrite: 0, }, }, @@ -10249,16 +10378,16 @@ export const builtinProviders: Record = { contextWindow: 400000, maxTokens: 128000, cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 1.75, + output: 14, + cacheRead: 0.175, cacheWrite: 0, }, }, }, { modelId: 'gpt-5.2-codex', - name: 'GPT-5.2-Codex', + name: 'GPT-5.2 Codex', config: { api: 'openai-responses', reasoning: true, @@ -10266,16 +10395,16 @@ export const builtinProviders: Record = { contextWindow: 400000, maxTokens: 128000, cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 1.75, + output: 14, + cacheRead: 0.175, cacheWrite: 0, }, }, }, { modelId: 'gpt-5.3-codex', - name: 'GPT-5.3-Codex', + name: 'GPT-5.3 Codex', config: { api: 'openai-responses', reasoning: true, @@ -10283,9 +10412,9 @@ export const builtinProviders: Record = { contextWindow: 400000, maxTokens: 128000, cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 1.75, + output: 14, + cacheRead: 0.175, cacheWrite: 0, }, }, @@ -10300,16 +10429,16 @@ export const builtinProviders: Record = { contextWindow: 400000, maxTokens: 128000, cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 2.5, + output: 15, + cacheRead: 0.25, cacheWrite: 0, }, }, }, { modelId: 'gpt-5.4-mini', - name: 'GPT-5.4 Mini', + name: 'GPT-5.4 mini', config: { api: 'openai-responses', reasoning: true, @@ -10317,9 +10446,26 @@ export const builtinProviders: Record = { contextWindow: 400000, maxTokens: 128000, cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 0.75, + output: 4.5, + cacheRead: 0.075, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'gpt-5.4-nano', + name: 'GPT-5.4 nano', + config: { + api: 'openai-responses', + reasoning: true, + input: ['text', 'image'], + contextWindow: 400000, + maxTokens: 128000, + cost: { + input: 0.2, + output: 1.25, + cacheRead: 0.02, cacheWrite: 0, }, }, @@ -10334,26 +10480,26 @@ export const builtinProviders: Record = { contextWindow: 400000, maxTokens: 128000, cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 5, + output: 30, + cacheRead: 0.5, cacheWrite: 0, }, }, }, { - modelId: 'grok-code-fast-1', - name: 'Grok Code Fast 1', + modelId: 'raptor-mini', + name: 'Raptor mini', config: { api: 'openai-completions', reasoning: true, - input: ['text'], - contextWindow: 128000, - maxTokens: 64000, + input: ['text', 'image'], + contextWindow: 400000, + maxTokens: 128000, cost: { - input: 0, - output: 0, - cacheRead: 0, + input: 0.25, + output: 2, + cacheRead: 0.025, cacheWrite: 0, }, }, @@ -11061,6 +11207,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'MiniMax-M3', + name: 'MiniMax-M3', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text', 'image'], + contextWindow: 512000, + maxTokens: 128000, + cost: { + input: 0.6, + output: 2.4, + cacheRead: 0.12, + cacheWrite: 0, + }, + }, + }, ], }, 'minimax-cn': { @@ -11105,6 +11268,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'MiniMax-M3', + name: 'MiniMax-M3', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text', 'image'], + contextWindow: 512000, + maxTokens: 128000, + cost: { + input: 0.6, + output: 2.4, + cacheRead: 0.12, + cacheWrite: 0, + }, + }, + }, ], }, moonshotai: { @@ -11365,6 +11545,356 @@ export const builtinProviders: Record = { }, ], }, + nvidia: { + name: 'nvidia', + config: { + api: 'openai-completions', + baseUrl: 'https://integrate.api.nvidia.com/v1', + apiKey: '', + }, + models: [ + { + modelId: 'meta/llama-3.1-70b-instruct', + name: 'Llama 3.1 70b Instruct', + config: { + api: 'openai-completions', + reasoning: false, + input: ['text'], + contextWindow: 128000, + maxTokens: 4096, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'meta/llama-3.1-8b-instruct', + name: 'Llama 3.1 8B Instruct', + config: { + api: 'openai-completions', + reasoning: false, + input: ['text'], + contextWindow: 16000, + maxTokens: 4096, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'meta/llama-3.2-11b-vision-instruct', + name: 'Llama 3.2 11b Vision Instruct', + config: { + api: 'openai-completions', + reasoning: false, + input: ['text', 'image'], + contextWindow: 128000, + maxTokens: 4096, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'meta/llama-3.2-90b-vision-instruct', + name: 'Llama-3.2-90B-Vision-Instruct', + config: { + api: 'openai-completions', + reasoning: false, + input: ['text', 'image'], + contextWindow: 128000, + maxTokens: 8192, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'meta/llama-3.3-70b-instruct', + name: 'Llama 3.3 70b Instruct', + config: { + api: 'openai-completions', + reasoning: false, + input: ['text'], + contextWindow: 128000, + maxTokens: 4096, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'mistralai/mistral-large-3-675b-instruct-2512', + name: 'Mistral Large 3 675B Instruct 2512', + config: { + api: 'openai-completions', + reasoning: false, + input: ['text', 'image'], + contextWindow: 262144, + maxTokens: 262144, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'mistralai/mistral-small-4-119b-2603', + name: 'mistral-small-4-119b-2603', + config: { + api: 'openai-completions', + reasoning: false, + input: ['text'], + contextWindow: 128000, + maxTokens: 8192, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'moonshotai/kimi-k2.6', + name: 'Kimi K2.6', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text', 'image'], + contextWindow: 262144, + maxTokens: 262144, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'nvidia/llama-3.3-nemotron-super-49b-v1', + name: 'Llama 3.3 Nemotron Super 49B v1', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 131072, + maxTokens: 131072, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'nvidia/llama-3.3-nemotron-super-49b-v1.5', + name: 'Llama 3.3 Nemotron Super 49B v1.5', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 131072, + maxTokens: 131072, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'nvidia/nemotron-3-nano-30b-a3b', + name: 'nemotron-3-nano-30b-a3b', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 131072, + maxTokens: 131072, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'nvidia/nemotron-3-nano-omni-30b-a3b-reasoning', + name: 'Nemotron 3 Nano Omni', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text', 'image'], + contextWindow: 256000, + maxTokens: 65536, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'nvidia/nemotron-3-super-120b-a12b', + name: 'Nemotron 3 Super', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 262144, + maxTokens: 262144, + cost: { + input: 0.2, + output: 0.8, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'nvidia/nvidia-nemotron-nano-9b-v2', + name: 'nvidia-nemotron-nano-9b-v2', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 131072, + maxTokens: 131072, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'openai/gpt-oss-20b', + name: 'GPT OSS 20B', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 131072, + maxTokens: 32768, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'qwen/qwen3-coder-480b-a35b-instruct', + name: 'Qwen3 Coder 480B A35B Instruct', + config: { + api: 'openai-completions', + reasoning: false, + input: ['text'], + contextWindow: 262144, + maxTokens: 66536, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'qwen/qwen3.5-122b-a10b', + name: 'Qwen3.5 122B-A10B', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text', 'image'], + contextWindow: 262144, + maxTokens: 65536, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'stepfun-ai/step-3.5-flash', + name: 'Step 3.5 Flash', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 256000, + maxTokens: 16384, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'stepfun-ai/step-3.7-flash', + name: 'Step 3.7 Flash', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text', 'image'], + contextWindow: 256000, + maxTokens: 16384, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'z-ai/glm-5.1', + name: 'GLM-5.1', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 131072, + maxTokens: 131072, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + ], + }, 'openai-codex': { name: 'openai-codex', config: { @@ -11373,40 +11903,6 @@ export const builtinProviders: Record = { apiKey: '', }, models: [ - { - modelId: 'gpt-5.2', - name: 'GPT-5.2', - config: { - api: 'openai-codex-responses', - reasoning: true, - input: ['text', 'image'], - contextWindow: 272000, - maxTokens: 128000, - cost: { - input: 1.75, - output: 14, - cacheRead: 0.175, - cacheWrite: 0, - }, - }, - }, - { - modelId: 'gpt-5.3-codex', - name: 'GPT-5.3 Codex', - config: { - api: 'openai-codex-responses', - reasoning: true, - input: ['text', 'image'], - contextWindow: 272000, - maxTokens: 128000, - cost: { - input: 1.75, - output: 14, - cacheRead: 0.175, - cacheWrite: 0, - }, - }, - }, { modelId: 'gpt-5.3-codex-spark', name: 'GPT-5.3 Codex Spark', @@ -12149,13 +12645,30 @@ export const builtinProviders: Record = { }, }, { - modelId: 'nemotron-3-super-free', - name: 'Nemotron 3 Super Free', + modelId: 'minimax-m3-free', + name: 'MiniMax M3 Free', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text', 'image'], + contextWindow: 200000, + maxTokens: 32000, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'nemotron-3-ultra-free', + name: 'Nemotron 3 Ultra Free', config: { api: 'openai-completions', reasoning: true, input: ['text'], - contextWindow: 204800, + contextWindow: 1000000, maxTokens: 128000, cost: { input: 0, @@ -12379,6 +12892,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'minimax-m3', + name: 'MiniMax M3', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text', 'image'], + contextWindow: 512000, + maxTokens: 131072, + cost: { + input: 0.6, + output: 2.4, + cacheRead: 0.12, + cacheWrite: 0, + }, + }, + }, { modelId: 'qwen3.6-plus', name: 'Qwen3.6 Plus', @@ -12413,6 +12943,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'qwen3.7-plus', + name: 'Qwen3.7 Plus', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text', 'image'], + contextWindow: 262144, + maxTokens: 65536, + cost: { + input: 0.4, + output: 1.6, + cacheRead: 0.04, + cacheWrite: 0.5, + }, + }, + }, ], }, together: { @@ -12761,7 +13308,7 @@ export const builtinProviders: Record = { name: 'Qwen3 235B A22B', config: { api: 'anthropic-messages', - reasoning: false, + reasoning: true, input: ['text'], contextWindow: 262144, maxTokens: 16384, @@ -12813,7 +13360,7 @@ export const builtinProviders: Record = { config: { api: 'anthropic-messages', reasoning: true, - input: ['text', 'image'], + input: ['text'], contextWindow: 240000, maxTokens: 64000, cost: { @@ -12846,7 +13393,7 @@ export const builtinProviders: Record = { name: 'Qwen3 Coder 480B A35B Instruct', config: { api: 'anthropic-messages', - reasoning: false, + reasoning: true, input: ['text'], contextWindow: 262144, maxTokens: 65536, @@ -12880,7 +13427,7 @@ export const builtinProviders: Record = { name: 'Qwen3 Coder Next', config: { api: 'anthropic-messages', - reasoning: false, + reasoning: true, input: ['text'], contextWindow: 256000, maxTokens: 256000, @@ -12960,6 +13507,40 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'alibaba/qwen3-next-80b-a3b-instruct', + name: 'Qwen3 Next 80B A3B Instruct', + config: { + api: 'anthropic-messages', + reasoning: false, + input: ['text'], + contextWindow: 131072, + maxTokens: 32768, + cost: { + input: 0.15, + output: 1.2, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'alibaba/qwen3-next-80b-a3b-thinking', + name: 'Qwen3 Next 80B A3B Thinking', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text'], + contextWindow: 131072, + maxTokens: 32768, + cost: { + input: 0.15, + output: 1.2, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, { modelId: 'alibaba/qwen3-vl-thinking', name: 'Qwen3 VL 235B A22B Thinking', @@ -13051,7 +13632,7 @@ export const builtinProviders: Record = { config: { api: 'anthropic-messages', reasoning: true, - input: ['text', 'image'], + input: ['text'], contextWindow: 991000, maxTokens: 64000, cost: { @@ -13062,6 +13643,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'alibaba/qwen3.7-plus', + name: 'Qwen 3.7 Plus', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text', 'image'], + contextWindow: 1000000, + maxTokens: 64000, + cost: { + input: 0.39999999999999997, + output: 1.5999999999999999, + cacheRead: 0.08, + cacheWrite: 0.5, + }, + }, + }, { modelId: 'anthropic/claude-3-haiku', name: 'Claude 3 Haiku', @@ -13407,8 +14005,8 @@ export const builtinProviders: Record = { name: 'DeepSeek V3.2', config: { api: 'anthropic-messages', - reasoning: false, - input: ['text'], + reasoning: true, + input: ['text', 'image'], contextWindow: 128000, maxTokens: 8000, cost: { @@ -13424,8 +14022,8 @@ export const builtinProviders: Record = { name: 'DeepSeek V3.2 Thinking', config: { api: 'anthropic-messages', - reasoning: false, - input: ['text'], + reasoning: true, + input: ['text', 'image'], contextWindow: 128000, maxTokens: 8000, cost: { @@ -13442,7 +14040,7 @@ export const builtinProviders: Record = { config: { api: 'anthropic-messages', reasoning: true, - input: ['text'], + input: ['text', 'image'], contextWindow: 1000000, maxTokens: 384000, cost: { @@ -13662,14 +14260,14 @@ export const builtinProviders: Record = { name: 'Gemma 4 26B A4B IT', config: { api: 'anthropic-messages', - reasoning: false, + reasoning: true, input: ['text', 'image'], contextWindow: 262144, maxTokens: 131072, cost: { - input: 0.13, - output: 0.39999999999999997, - cacheRead: 0, + input: 0.15, + output: 0.6, + cacheRead: 0.015, cacheWrite: 0, }, }, @@ -13969,7 +14567,7 @@ export const builtinProviders: Record = { config: { api: 'anthropic-messages', reasoning: true, - input: ['text', 'image'], + input: ['text'], contextWindow: 204800, maxTokens: 131000, cost: { @@ -13986,7 +14584,7 @@ export const builtinProviders: Record = { config: { api: 'anthropic-messages', reasoning: true, - input: ['text', 'image'], + input: ['text'], contextWindow: 204800, maxTokens: 131100, cost: { @@ -13997,6 +14595,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'minimax/minimax-m3', + name: 'MiniMax M3', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text', 'image'], + contextWindow: 1000000, + maxTokens: 1000000, + cost: { + input: 0.3, + output: 1.2, + cacheRead: 0.06, + cacheWrite: 0, + }, + }, + }, { modelId: 'mistral/codestral', name: 'Mistral Codestral', @@ -14133,6 +14748,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'mistral/mistral-nemo', + name: 'Mistral Nemo 12B', + config: { + api: 'anthropic-messages', + reasoning: false, + input: ['text'], + contextWindow: 131072, + maxTokens: 131072, + cost: { + input: 0.02, + output: 0.04, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, { modelId: 'mistral/mistral-small', name: 'Mistral Small', @@ -14286,6 +14918,40 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'nvidia/nemotron-3-super-120b-a12b', + name: 'NVIDIA Nemotron 3 Super 120B A12B', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text'], + contextWindow: 256000, + maxTokens: 32000, + cost: { + input: 0.15, + output: 0.65, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'nvidia/nemotron-3-ultra-550b-a55b', + name: 'Nemotron 3 Ultra', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text'], + contextWindow: 262144, + maxTokens: 65000, + cost: { + input: 0.5, + output: 2.5, + cacheRead: 0.15, + cacheWrite: 0, + }, + }, + }, { modelId: 'nvidia/nemotron-nano-12b-v2-vl', name: 'Nvidia Nemotron Nano 12B V2 VL', @@ -14462,7 +15128,7 @@ export const builtinProviders: Record = { config: { api: 'anthropic-messages', reasoning: true, - input: ['text'], + input: ['text', 'image'], contextWindow: 400000, maxTokens: 128000, cost: { @@ -14813,6 +15479,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'openai/gpt-oss-120b', + name: 'GPT OSS 120B', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text'], + contextWindow: 131072, + maxTokens: 131000, + cost: { + input: 0.35, + output: 0.75, + cacheRead: 0.25, + cacheWrite: 0, + }, + }, + }, { modelId: 'openai/gpt-oss-20b', name: 'GPT OSS 20B', @@ -14983,6 +15666,23 @@ export const builtinProviders: Record = { }, }, }, + { + modelId: 'stepfun/step-3.5-flash', + name: 'StepFun 3.5 Flash', + config: { + api: 'anthropic-messages', + reasoning: true, + input: ['text'], + contextWindow: 262114, + maxTokens: 262114, + cost: { + input: 0.09, + output: 0.3, + cacheRead: 0, + cacheWrite: 0.02, + }, + }, + }, { modelId: 'stepfun/step-3.7-flash', name: 'Step 3.7 Flash', @@ -15277,7 +15977,7 @@ export const builtinProviders: Record = { name: 'GLM 4.5V', config: { api: 'anthropic-messages', - reasoning: false, + reasoning: true, input: ['text', 'image'], contextWindow: 66000, maxTokens: 16000, @@ -15431,7 +16131,7 @@ export const builtinProviders: Record = { config: { api: 'anthropic-messages', reasoning: true, - input: ['text'], + input: ['text', 'image'], contextWindow: 202800, maxTokens: 64000, cost: { @@ -16014,4 +16714,99 @@ export const builtinProviders: Record = { }, ], }, + 'zai-coding-cn': { + name: 'zai-coding-cn', + config: { + api: 'openai-completions', + baseUrl: 'https://open.bigmodel.cn/api/coding/paas/v4', + apiKey: '', + }, + models: [ + { + modelId: 'glm-4.5-air', + name: 'GLM-4.5-Air', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 131072, + maxTokens: 98304, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'glm-4.7', + name: 'GLM-4.7', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 204800, + maxTokens: 131072, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'glm-5-turbo', + name: 'GLM-5-Turbo', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 200000, + maxTokens: 131072, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'glm-5.1', + name: 'GLM-5.1', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text'], + contextWindow: 200000, + maxTokens: 131072, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + { + modelId: 'glm-5v-turbo', + name: 'GLM-5V-Turbo', + config: { + api: 'openai-completions', + reasoning: true, + input: ['text', 'image'], + contextWindow: 200000, + maxTokens: 131072, + cost: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + }, + }, + }, + ], + }, } as unknown as Record