From d6258c1b568ab4a19a623f7ee8892c66df2f5b56 Mon Sep 17 00:00:00 2001 From: Anil Kulkarni Date: Mon, 28 Sep 2026 08:49:52 -0700 Subject: [PATCH] Update the kilo enkrypt integration for new models --- .../api/cron/sync-model-stats/route.test.ts | 2 +- .../lib/model-stats/enkrypt-identity.test.ts | 28 +++---- .../src/lib/model-stats/enkrypt-identity.ts | 80 +++++++++++++++++++ apps/web/src/tests/fixtures/enkrypt-scores.ts | 24 ++++++ 4 files changed, 119 insertions(+), 15 deletions(-) diff --git a/apps/web/src/app/api/cron/sync-model-stats/route.test.ts b/apps/web/src/app/api/cron/sync-model-stats/route.test.ts index e15e2b8db9..859abbd057 100644 --- a/apps/web/src/app/api/cron/sync-model-stats/route.test.ts +++ b/apps/web/src/app/api/cron/sync-model-stats/route.test.ts @@ -323,7 +323,7 @@ describe('GET /api/cron/sync-model-stats', () => { jest.mocked(getEnhancedOpenRouterModels).mockResolvedValue({ data: [...models, ...models] }); expect((await GET(request())).status).toBe(200); - expect(ids).toHaveLength(70); + expect(ids).toHaveLength(89); expect(syncOpenRouterModels).toHaveBeenCalledWith( [monitoredModel, ...models], [monitoredModel.id], diff --git a/apps/web/src/lib/model-stats/enkrypt-identity.test.ts b/apps/web/src/lib/model-stats/enkrypt-identity.test.ts index 6fb3c7232a..a64c199e4a 100644 --- a/apps/web/src/lib/model-stats/enkrypt-identity.test.ts +++ b/apps/web/src/lib/model-stats/enkrypt-identity.test.ts @@ -511,11 +511,11 @@ describe('expanded reviewed Enkrypt identities', () => { }) ); - it('contains exactly all 70 independently enumerated identities and canonical targets', () => { - expect(ENKRYPT_REVIEWED_CASES).toHaveLength(70); + it('contains exactly all 89 independently enumerated identities and canonical targets', () => { + expect(ENKRYPT_REVIEWED_CASES).toHaveLength(89); expect(ENKRYPT_MODEL_MAPPINGS).toStrictEqual(expectedMappings); - expect(new Set(expectedMappings.map(({ identity }) => JSON.stringify(identity))).size).toBe(70); - expect(new Set(expectedMappings.map(({ modelId }) => modelId)).size).toBe(70); + expect(new Set(expectedMappings.map(({ identity }) => JSON.stringify(identity))).size).toBe(89); + expect(new Set(expectedMappings.map(({ modelId }) => modelId)).size).toBe(89); expect(records.every(record => record.risk_score === 0 && record.safety_score === null)).toBe( true ); @@ -616,7 +616,7 @@ describe('expanded reviewed Enkrypt identities', () => { [false, true], [true, true], ])( - 'matches all 70 without collisions with reversed scores %s and catalog %s', + 'matches all 89 without collisions with reversed scores %s and catalog %s', (scores, models) => { const result = matchEnkryptScores( scores ? records.toReversed() : records, @@ -674,7 +674,7 @@ describe('expanded reviewed Enkrypt identities', () => { } ); - it('rejects all 70 canonical targets if they share a storage ID', () => { + it('rejects all 89 canonical targets if they share a storage ID', () => { const result = matchEnkryptScores( records, catalog.map(record => ({ ...record, id: 'same-storage-id' })) @@ -687,21 +687,21 @@ describe('expanded reviewed Enkrypt identities', () => { identity, modelIds: [modelId], })), - ambiguousCount: 70, + ambiguousCount: 89, missingRequiredModelIds: ENKRYPT_REQUIRED_MODEL_IDS, }); }); - it('reports all 70 exact identities without exposing synthetic metrics or expanding the required gate', () => { + it('reports all 89 exact identities without exposing synthetic metrics or expanding the required gate', () => { const report = buildEnkryptCoverageReport( parseEnkryptScores(envelope(records)), catalog, 'fullinput' ); expect(report.counters).toStrictEqual({ - fetchedCount: 70, - acceptedCount: 70, - matchedCount: 70, + fetchedCount: 89, + acceptedCount: 89, + matchedCount: 89, unmatchedCount: 0, ambiguousCount: 0, rejectedCount: 0, @@ -720,7 +720,7 @@ describe('expanded reviewed Enkrypt identities', () => { }); it.each(['scores', 'catalog'] as const)( - 'does not require the 67 optional mappings when their %s are absent', + 'does not require the 86 optional mappings when their %s are absent', absent => { const result = matchEnkryptScores( absent === 'scores' ? records.slice(0, 3) : records, @@ -741,7 +741,7 @@ describe('expanded reviewed Enkrypt identities', () => { ); it.each(reviewedMappings)( - 'still fails the required $modelId gate with all 67 optional identities present', + 'still fails the required $modelId gate with all 86 optional identities present', ({ modelId }) => { const result = matchEnkryptScores( ENKRYPT_REVIEWED_CASES.filter(record => record.modelId !== modelId).map( @@ -749,7 +749,7 @@ describe('expanded reviewed Enkrypt identities', () => { ), catalog ); - expect(result.matches).toHaveLength(69); + expect(result.matches).toHaveLength(88); expect(result.missingRequiredModelIds).toEqual([modelId]); expect(result.ambiguousCount).toBe(0); } diff --git a/apps/web/src/lib/model-stats/enkrypt-identity.ts b/apps/web/src/lib/model-stats/enkrypt-identity.ts index c8683c944a..38ed3abbe5 100644 --- a/apps/web/src/lib/model-stats/enkrypt-identity.ts +++ b/apps/web/src/lib/model-stats/enkrypt-identity.ts @@ -316,6 +316,86 @@ export const ENKRYPT_MODEL_MAPPINGS: readonly EnkryptModelMapping[] = [ }, modelId: 'mistralai/mistral-small-24b-instruct-2501', }, + { + identity: { model_name: 'claude-opus-4-8', provider: 'anthropic', source: 'anthropic' }, + modelId: 'anthropic/claude-opus-4.8', + }, + { + identity: { model_name: 'claude-opus-4-7', provider: 'anthropic', source: 'anthropic' }, + modelId: 'anthropic/claude-opus-4.7', + }, + { + identity: { model_name: 'claude-sonnet-4-6', provider: 'anthropic', source: 'anthropic' }, + modelId: 'anthropic/claude-sonnet-4.6', + }, + { + identity: { model_name: 'claude-opus-5', provider: 'openai_compatible', source: 'Anthropic' }, + modelId: 'anthropic/claude-opus-5', + }, + { + identity: { model_name: 'glm-5.2', provider: 'openai_compatible', source: 'z-ai' }, + modelId: 'z-ai/glm-5.2', + }, + { + identity: { model_name: 'minimax-m3', provider: 'openai_compatible', source: 'minimax' }, + modelId: 'minimax/minimax-m3', + }, + { + identity: { model_name: 'mimo-v2.5-pro', provider: 'openai_compatible', source: 'xiaomi' }, + modelId: 'xiaomi/mimo-v2.5-pro', + }, + { + identity: { model_name: 'gemini-3.6-flash', provider: 'openai_compatible', source: 'google' }, + modelId: 'google/gemini-3.6-flash', + }, + { + identity: { model_name: 'gemini-3.5-flash', provider: 'openai_compatible', source: 'google' }, + modelId: 'google/gemini-3.5-flash', + }, + { + identity: { + model_name: 'nemotron-3-ultra-550b-a55b', + provider: 'openai_compatible', + source: 'nvidia', + }, + modelId: 'nvidia/nemotron-3-ultra-550b-a55b', + }, + { + identity: { model_name: 'kimi-k2.6', provider: 'openai_compatible', source: 'moonshotai' }, + modelId: 'moonshotai/kimi-k2.6', + }, + { + identity: { model_name: 'kimi-k2.7-code', provider: 'openai_compatible', source: 'moonshotai' }, + modelId: 'moonshotai/kimi-k2.7-code', + }, + { + identity: { model_name: 'qwen3.8-max', provider: 'openai_compatible', source: 'qwen' }, + modelId: 'qwen/qwen3.8-max', + }, + { + identity: { model_name: 'qwen3.7-max', provider: 'openai_compatible', source: 'qwen' }, + modelId: 'qwen/qwen3.7-max', + }, + { + identity: { model_name: 'grok-build-0.1', provider: 'openai_compatible', source: 'xAI' }, + modelId: 'x-ai/grok-build-0.1', + }, + { + identity: { model_name: 'grok-4.5', provider: 'openai_compatible', source: 'xAI' }, + modelId: 'x-ai/grok-4.5', + }, + { + identity: { model_name: 'grok-4.6', provider: 'openai_compatible', source: 'xAI' }, + modelId: 'x-ai/grok-4.6', + }, + { + identity: { model_name: 'laguna-s-2.1', provider: 'openai_compatible', source: 'xAI' }, + modelId: 'poolside/laguna-s-2.1', + }, + { + identity: { model_name: 'laguna-xs-2.1', provider: 'openai_compatible', source: 'poolside' }, + modelId: 'poolside/laguna-xs-2.1', + }, ]; export const ENKRYPT_REQUIRED_MODEL_IDS: readonly string[] = [ diff --git a/apps/web/src/tests/fixtures/enkrypt-scores.ts b/apps/web/src/tests/fixtures/enkrypt-scores.ts index 85dac08de5..880b9a626e 100644 --- a/apps/web/src/tests/fixtures/enkrypt-scores.ts +++ b/apps/web/src/tests/fixtures/enkrypt-scores.ts @@ -129,6 +129,30 @@ const reviewedIdentities: [string, string, string, string][] = [ 'Mistral', 'mistralai/mistral-small-24b-instruct-2501', ], + ['claude-opus-4-8', 'anthropic', 'anthropic', 'anthropic/claude-opus-4.8'], + ['claude-opus-4-7', 'anthropic', 'anthropic', 'anthropic/claude-opus-4.7'], + ['claude-sonnet-4-6', 'anthropic', 'anthropic', 'anthropic/claude-sonnet-4.6'], + ['claude-opus-5', 'openai_compatible', 'Anthropic', 'anthropic/claude-opus-5'], + ['glm-5.2', 'openai_compatible', 'z-ai', 'z-ai/glm-5.2'], + ['minimax-m3', 'openai_compatible', 'minimax', 'minimax/minimax-m3'], + ['mimo-v2.5-pro', 'openai_compatible', 'xiaomi', 'xiaomi/mimo-v2.5-pro'], + ['gemini-3.6-flash', 'openai_compatible', 'google', 'google/gemini-3.6-flash'], + ['gemini-3.5-flash', 'openai_compatible', 'google', 'google/gemini-3.5-flash'], + [ + 'nemotron-3-ultra-550b-a55b', + 'openai_compatible', + 'nvidia', + 'nvidia/nemotron-3-ultra-550b-a55b', + ], + ['kimi-k2.6', 'openai_compatible', 'moonshotai', 'moonshotai/kimi-k2.6'], + ['kimi-k2.7-code', 'openai_compatible', 'moonshotai', 'moonshotai/kimi-k2.7-code'], + ['qwen3.8-max', 'openai_compatible', 'qwen', 'qwen/qwen3.8-max'], + ['qwen3.7-max', 'openai_compatible', 'qwen', 'qwen/qwen3.7-max'], + ['grok-build-0.1', 'openai_compatible', 'xAI', 'x-ai/grok-build-0.1'], + ['grok-4.5', 'openai_compatible', 'xAI', 'x-ai/grok-4.5'], + ['grok-4.6', 'openai_compatible', 'xAI', 'x-ai/grok-4.6'], + ['laguna-s-2.1', 'openai_compatible', 'xAI', 'poolside/laguna-s-2.1'], + ['laguna-xs-2.1', 'openai_compatible', 'poolside', 'poolside/laguna-xs-2.1'], ]; export const ENKRYPT_REVIEWED_CASES = reviewedIdentities.map(