From eb71fd3c23dbd77bea1b7dde4a1a3dcc19951be5 Mon Sep 17 00:00:00 2001 From: "lia-by-librechat[bot]" <328778573+lia-by-librechat[bot]@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:01:49 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=89=20feat:=20Add=20Claude=20Mythos=20?= =?UTF-8?q?5.2=20Support=20(#18017)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐉 feat: Add Claude Mythos 5.2 Support * test: Track Numeric Matcher Search Performance * test: Distinguish Mythos Version Boundary Regressions --------- Co-authored-by: Lia --- .../api/src/endpoints/anthropic/llm.spec.ts | 23 +++++++++++++ packages/api/src/utils/tokens.spec.ts | 29 +++++++++++++++++ packages/api/src/utils/tokens.ts | 1 + packages/data-provider/specs/mythos.spec.ts | 32 +++++++++++++++++++ packages/data-schemas/src/methods/tx.spec.ts | 22 +++++++++++++ packages/data-schemas/src/methods/tx.ts | 2 ++ 6 files changed, 109 insertions(+) create mode 100644 packages/data-provider/specs/mythos.spec.ts diff --git a/packages/api/src/endpoints/anthropic/llm.spec.ts b/packages/api/src/endpoints/anthropic/llm.spec.ts index d4ee91133a..df43d73c57 100644 --- a/packages/api/src/endpoints/anthropic/llm.spec.ts +++ b/packages/api/src/endpoints/anthropic/llm.spec.ts @@ -1226,6 +1226,28 @@ describe('getLLMConfig', () => { expect(result.llmConfig).not.toHaveProperty('topK'); }); + it('keeps Mythos 5.2 thinking adaptive when a saved preset disables it', () => { + const result = getLLMConfig('test-key', { + modelOptions: { + model: 'claude-mythos-5-2', + thinking: false, + temperature: 0.7, + topP: 0.9, + topK: 40, + }, + }); + + expect(result.llmConfig.thinking).toMatchObject({ + type: 'adaptive', + display: 'summarized', + block_binding: { prefix_mismatch_behavior: 'drop_block' }, + }); + expect(result.llmConfig.maxTokens).toBe(128000); + expect(result.llmConfig).not.toHaveProperty('temperature'); + expect(result.llmConfig).not.toHaveProperty('topP'); + expect(result.llmConfig).not.toHaveProperty('topK'); + }); + it('keeps Fable 5.2 thinking adaptive when a saved preset disables it', () => { const result = getLLMConfig('test-key', { modelOptions: { @@ -2597,6 +2619,7 @@ describe('assistant prefill', () => { 'claude-opus-5-5', 'claude-fable-5-1', 'claude-fable-5-2', + 'claude-mythos-5-2', ])('drops the trailing assistant turn for %s', async (model) => { expect(await sendAndCaptureMessages(model)).toEqual(['user']); }); diff --git a/packages/api/src/utils/tokens.spec.ts b/packages/api/src/utils/tokens.spec.ts index 61c7500985..3dc4b37dfa 100644 --- a/packages/api/src/utils/tokens.spec.ts +++ b/packages/api/src/utils/tokens.spec.ts @@ -470,3 +470,32 @@ describe('Claude version boundaries', () => { }, ); }); + +describe('Claude Mythos 5.2 context window', () => { + it.each(['claude-mythos-5-2', 'anthropic/claude-mythos-5-2'])( + 'resolves the 1M context window for %s', + (model) => { + expect(getModelMaxTokens(model, EModelEndpoint.anthropic)).toBe(1000000); + expect(getModelMaxTokens(model, EModelEndpoint.custom)).toBe(1000000); + }, + ); +}); + +describe('Claude Mythos version boundaries', () => { + const rates = { 'claude-mythos-5': 10, 'claude-mythos-5-1': 10, 'claude-mythos-5-2': 8 }; + + it.each([ + 'claude-mythos-5-20260609', + 'anthropic/claude-mythos-5-20260609', + 'anthropic.claude-mythos-5-20260609', + ])('does not mistake the date in %s for a minor version', (model) => { + expect(findMatchingPattern(model, rates)).toBe('claude-mythos-5'); + }); + + it.each(['claude-mythos-5-2', 'claude-mythos-5-2-20261109'])( + 'still resolves a complete minor version in %s', + (model) => { + expect(findMatchingPattern(model, rates)).toBe('claude-mythos-5-2'); + }, + ); +}); diff --git a/packages/api/src/utils/tokens.ts b/packages/api/src/utils/tokens.ts index c4c0b372fa..aa6921c0d8 100644 --- a/packages/api/src/utils/tokens.ts +++ b/packages/api/src/utils/tokens.ts @@ -200,6 +200,7 @@ const anthropicModels = { 'claude-fable-5-1': 1000000, 'claude-fable-5-2': 1000000, 'claude-mythos-5-1': 1000000, + 'claude-mythos-5-2': 1000000, }; const ANTHROPIC_CONTEXT_1M = 1000000; diff --git a/packages/data-provider/specs/mythos.spec.ts b/packages/data-provider/specs/mythos.spec.ts new file mode 100644 index 0000000000..c46f56d862 --- /dev/null +++ b/packages/data-provider/specs/mythos.spec.ts @@ -0,0 +1,32 @@ +import { defaultModels } from '../src/config'; +import { EModelEndpoint, anthropicSettings } from '../src/schemas'; +import { + supportsContext1m, + supportsPromptCache, + hasAlwaysOnThinking, + bindsThinkingBlocks, + omitsSamplingParameters, + supportsAdaptiveThinking, + resolveThinkingDisplay, +} from '../src/bedrock'; + +describe('Claude Mythos 5.2', () => { + it('does not offer a verification-restricted model in the default catalog', () => { + expect(defaultModels[EModelEndpoint.anthropic]).not.toContain('claude-mythos-5-2'); + }); + + it.each(['claude-mythos-5-2', 'anthropic/claude-mythos-5-2'])( + 'uses the modern Claude capability profile for %s', + (model) => { + expect(supportsContext1m(model)).toBe(true); + expect(supportsPromptCache(model)).toBe(true); + expect(hasAlwaysOnThinking(model)).toBe(true); + expect(bindsThinkingBlocks(model)).toBe(true); + expect(supportsAdaptiveThinking(model)).toBe(true); + expect(omitsSamplingParameters(model)).toBe(true); + expect(resolveThinkingDisplay(model)).toBe('summarized'); + expect(anthropicSettings.maxOutputTokens.reset(model)).toBe(128000); + expect(anthropicSettings.maxOutputTokens.set(200000, model)).toBe(128000); + }, + ); +}); diff --git a/packages/data-schemas/src/methods/tx.spec.ts b/packages/data-schemas/src/methods/tx.spec.ts index 30769e2b6e..ea3cb1e549 100644 --- a/packages/data-schemas/src/methods/tx.spec.ts +++ b/packages/data-schemas/src/methods/tx.spec.ts @@ -3555,3 +3555,25 @@ describe('Claude Fable 5.2 pricing', () => { expect(cacheTokenValues['claude-fable-5-1']).toEqual({ write: 12.5, read: 0.25 }); }); }); + +describe('Claude Mythos 5.2 pricing', () => { + it.each(['claude-mythos-5-2', 'anthropic/claude-mythos-5-2', 'anthropic.claude-mythos-5-2'])( + 'uses the release-specific rates for %s at every context length', + (model) => { + expect(getValueKey(model)).toBe('claude-mythos-5-2'); + for (const inputTokenCount of [1000, 200001, 999999]) { + expect(getMultiplier({ model, tokenType: 'prompt', inputTokenCount })).toBe(8); + expect(getMultiplier({ model, tokenType: 'completion', inputTokenCount })).toBe(40); + expect(getCacheMultiplier({ model, cacheType: 'read', inputTokenCount })).toBe(0.2); + expect(getCacheMultiplier({ model, cacheType: 'write', inputTokenCount })).toBe(10); + expect(getCacheMultiplier({ model, cacheType: 'write1h', inputTokenCount })).toBe(16); + } + }, + ); + + it('preserves the prices of previous Mythos releases', () => { + expect(tokenValues['claude-mythos-5']).toEqual({ prompt: 10, completion: 50 }); + expect(tokenValues['claude-mythos-5-1']).toEqual({ prompt: 10, completion: 50 }); + expect(cacheTokenValues['claude-mythos-5-1']).toEqual({ write: 12.5, read: 0.25 }); + }); +}); diff --git a/packages/data-schemas/src/methods/tx.ts b/packages/data-schemas/src/methods/tx.ts index 34e95eab27..626eb4fc13 100644 --- a/packages/data-schemas/src/methods/tx.ts +++ b/packages/data-schemas/src/methods/tx.ts @@ -215,6 +215,7 @@ export const tokenValues: Record 'claude-fable-5-1': { prompt: 10, completion: 50 }, 'claude-fable-5-2': { prompt: 8, completion: 40 }, 'claude-mythos-5-1': { prompt: 10, completion: 50 }, + 'claude-mythos-5-2': { prompt: 8, completion: 40 }, 'claude-sonnet-4': { prompt: 3, completion: 15 }, 'claude-sonnet-4-5': { prompt: 3, completion: 15 }, 'claude-sonnet-4-6': { prompt: 3, completion: 15 }, @@ -415,6 +416,7 @@ export const cacheTokenValues: Record = 'claude-fable-5-1': { write: 12.5, read: 0.25 }, 'claude-fable-5-2': { write: 10, read: 0.2 }, 'claude-mythos-5-1': { write: 12.5, read: 0.25 }, + 'claude-mythos-5-2': { write: 10, read: 0.2 }, 'gpt-4o': { write: 2.5, read: 1.25 }, 'gpt-4o-mini': { write: 0.15, read: 0.075 }, 'gpt-4.1': { write: 2, read: 0.5 },