🐉 feat: Add Claude Mythos 5.2 Support (#18017)

* 🐉 feat: Add Claude Mythos 5.2 Support

* test: Track Numeric Matcher Search Performance

* test: Distinguish Mythos Version Boundary Regressions

---------

Co-authored-by: Lia <lia@librechat.ai>
This commit is contained in:
lia-by-librechat[bot] 2026-11-10 15:01:49 -05:00 • committed by GitHub
parent c380c9e5d5
commit eb71fd3c23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 109 additions and 0 deletions

View file

@ -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']);
});

View file

@ -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');
},
);
});

View file

@ -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;

View file

@ -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);
},
);
});

View file

@ -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 });
});
});

View file

@ -215,6 +215,7 @@ export const tokenValues: Record<string, { prompt: number; completion: number }>
'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<string, { write: number; read: number }> =
'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 },