mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-07 16:42:38 +01:00
🤖 feat: GPT-5.4 and GPT-5.4-pro Context + Pricing (#12099)
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run
Docker Dev Images Build / build (Dockerfile, librechat-dev, node) (push) Waiting to run
Docker Dev Images Build / build (Dockerfile.multi, librechat-dev-api, api-build) (push) Waiting to run
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run
Docker Dev Images Build / build (Dockerfile, librechat-dev, node) (push) Waiting to run
Docker Dev Images Build / build (Dockerfile.multi, librechat-dev-api, api-build) (push) Waiting to run
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
* ✨ feat: Add support for new GPT-5.4 and GPT-5.4-pro models - Introduced new token values and cache settings for 'gpt-5.4' and 'gpt-5.4-pro' in the API model configurations. - Updated maximum output limits for the new models in the tokens utility. - Included 'gpt-5.4' and 'gpt-5.4-pro' in the shared OpenAI models list for consistent access across the application. * 🔧 update: Enhance GPT-5.4 and GPT-5.4-pro model configurations - Refined token pricing and cache settings for 'gpt-5.4' and 'gpt-5.4-pro' in the API model configurations. - Added tests for cache multipliers and maximum token limits for the new models. - Updated shared OpenAI models list to include 'gpt-5.4-thinking' and added a note for verifying pricing before release. * 🔧 update: Add clarification to token pricing for 'gpt-5.4-pro' - Added a comment to the 'gpt-5.4-pro' model configuration in tokens.ts to specify that it shares the same token window as 'gpt-5.4', enhancing clarity for future reference.
This commit is contained in:
parent
3b84cc048a
commit
a79f7cebd5
5 changed files with 100 additions and 24 deletions
|
|
@ -59,6 +59,17 @@ describe('getValueKey', () => {
|
|||
expect(getValueKey('openai/gpt-5.3')).toBe('gpt-5.3');
|
||||
});
|
||||
|
||||
it('should return "gpt-5.4" for model name containing "gpt-5.4"', () => {
|
||||
expect(getValueKey('gpt-5.4')).toBe('gpt-5.4');
|
||||
expect(getValueKey('gpt-5.4-thinking')).toBe('gpt-5.4');
|
||||
expect(getValueKey('openai/gpt-5.4')).toBe('gpt-5.4');
|
||||
});
|
||||
|
||||
it('should return "gpt-5.4-pro" for model name containing "gpt-5.4-pro"', () => {
|
||||
expect(getValueKey('gpt-5.4-pro')).toBe('gpt-5.4-pro');
|
||||
expect(getValueKey('openai/gpt-5.4-pro')).toBe('gpt-5.4-pro');
|
||||
});
|
||||
|
||||
it('should return "gpt-3.5-turbo-1106" for model name containing "gpt-3.5-turbo-1106"', () => {
|
||||
expect(getValueKey('gpt-3.5-turbo-1106-some-other-info')).toBe('gpt-3.5-turbo-1106');
|
||||
expect(getValueKey('openai/gpt-3.5-turbo-1106')).toBe('gpt-3.5-turbo-1106');
|
||||
|
|
@ -400,6 +411,33 @@ describe('getMultiplier', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('should return the correct multiplier for gpt-5.4', () => {
|
||||
expect(getMultiplier({ model: 'gpt-5.4', tokenType: 'prompt' })).toBe(
|
||||
tokenValues['gpt-5.4'].prompt,
|
||||
);
|
||||
expect(getMultiplier({ model: 'gpt-5.4', tokenType: 'completion' })).toBe(
|
||||
tokenValues['gpt-5.4'].completion,
|
||||
);
|
||||
expect(getMultiplier({ model: 'gpt-5.4-thinking', tokenType: 'prompt' })).toBe(
|
||||
tokenValues['gpt-5.4'].prompt,
|
||||
);
|
||||
expect(getMultiplier({ model: 'openai/gpt-5.4', tokenType: 'completion' })).toBe(
|
||||
tokenValues['gpt-5.4'].completion,
|
||||
);
|
||||
});
|
||||
|
||||
it('should return the correct multiplier for gpt-5.4-pro', () => {
|
||||
expect(getMultiplier({ model: 'gpt-5.4-pro', tokenType: 'prompt' })).toBe(
|
||||
tokenValues['gpt-5.4-pro'].prompt,
|
||||
);
|
||||
expect(getMultiplier({ model: 'gpt-5.4-pro', tokenType: 'completion' })).toBe(
|
||||
tokenValues['gpt-5.4-pro'].completion,
|
||||
);
|
||||
expect(getMultiplier({ model: 'openai/gpt-5.4-pro', tokenType: 'prompt' })).toBe(
|
||||
tokenValues['gpt-5.4-pro'].prompt,
|
||||
);
|
||||
});
|
||||
|
||||
it('should return the correct multiplier for gpt-4o', () => {
|
||||
const valueKey = getValueKey('gpt-4o-2024-08-06');
|
||||
expect(getMultiplier({ valueKey, tokenType: 'prompt' })).toBe(tokenValues['gpt-4o'].prompt);
|
||||
|
|
@ -1377,6 +1415,7 @@ describe('getCacheMultiplier', () => {
|
|||
'gpt-5.1',
|
||||
'gpt-5.2',
|
||||
'gpt-5.3',
|
||||
'gpt-5.4',
|
||||
'gpt-5-mini',
|
||||
'gpt-5-nano',
|
||||
'o1',
|
||||
|
|
@ -1413,10 +1452,20 @@ describe('getCacheMultiplier', () => {
|
|||
expect(getCacheMultiplier({ model: 'gpt-5-pro', cacheType: 'write' })).toBeNull();
|
||||
expect(getCacheMultiplier({ model: 'gpt-5.2-pro', cacheType: 'read' })).toBeNull();
|
||||
expect(getCacheMultiplier({ model: 'gpt-5.2-pro', cacheType: 'write' })).toBeNull();
|
||||
expect(getCacheMultiplier({ model: 'gpt-5.4-pro', cacheType: 'read' })).toBeNull();
|
||||
expect(getCacheMultiplier({ model: 'gpt-5.4-pro', cacheType: 'write' })).toBeNull();
|
||||
});
|
||||
|
||||
it('should have consistent 10% cache read pricing for gpt-5.x models', () => {
|
||||
const gpt5CacheModels = ['gpt-5', 'gpt-5.1', 'gpt-5.2', 'gpt-5.3', 'gpt-5-mini', 'gpt-5-nano'];
|
||||
const gpt5CacheModels = [
|
||||
'gpt-5',
|
||||
'gpt-5.1',
|
||||
'gpt-5.2',
|
||||
'gpt-5.3',
|
||||
'gpt-5.4',
|
||||
'gpt-5-mini',
|
||||
'gpt-5-nano',
|
||||
];
|
||||
for (const model of gpt5CacheModels) {
|
||||
expect(cacheTokenValues[model].read).toBeCloseTo(cacheTokenValues[model].write * 0.1, 10);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue