Skip to content

Commit bf5b87e

Browse files
authored
🪙 feat: Update token value for gpt-4o (danny-avila#4387)
1 parent bab0152 commit bf5b87e

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

api/models/tx.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ const tokenValues = Object.assign(
4040
'o1-preview': { prompt: 15, completion: 60 },
4141
'o1-mini': { prompt: 3, completion: 12 },
4242
o1: { prompt: 15, completion: 60 },
43-
'gpt-4o-2024-08-06': { prompt: 2.5, completion: 10 },
4443
'gpt-4o-mini': { prompt: 0.15, completion: 0.6 },
45-
'gpt-4o': { prompt: 5, completion: 15 },
44+
'gpt-4o': { prompt: 2.5, completion: 10 },
45+
'gpt-4o-2024-05-13': { prompt: 5, completion: 15 },
4646
'gpt-4-1106': { prompt: 10, completion: 30 },
4747
'gpt-3.5-turbo-0125': { prompt: 0.5, completion: 1.5 },
4848
'claude-3-opus': { prompt: 15, completion: 75 },
@@ -104,8 +104,8 @@ const getValueKey = (model, endpoint) => {
104104
return 'o1-mini';
105105
} else if (modelName.includes('o1')) {
106106
return 'o1';
107-
} else if (modelName.includes('gpt-4o-2024-08-06')) {
108-
return 'gpt-4o-2024-08-06';
107+
} else if (modelName.includes('gpt-4o-2024-05-13')) {
108+
return 'gpt-4o-2024-05-13';
109109
} else if (modelName.includes('gpt-4o-mini')) {
110110
return 'gpt-4o-mini';
111111
} else if (modelName.includes('gpt-4o')) {

api/models/tx.spec.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ describe('getValueKey', () => {
5050
});
5151

5252
it('should return "gpt-4o" for model type of "gpt-4o"', () => {
53-
expect(getValueKey('gpt-4o-2024-05-13')).toBe('gpt-4o');
53+
expect(getValueKey('gpt-4o-2024-08-06')).toBe('gpt-4o');
54+
expect(getValueKey('gpt-4o-2024-08-06-0718')).toBe('gpt-4o');
5455
expect(getValueKey('openai/gpt-4o')).toBe('gpt-4o');
56+
expect(getValueKey('openai/gpt-4o-2024-08-06')).toBe('gpt-4o');
5557
expect(getValueKey('gpt-4o-turbo')).toBe('gpt-4o');
5658
expect(getValueKey('gpt-4o-0125')).toBe('gpt-4o');
5759
});
@@ -60,14 +62,14 @@ describe('getValueKey', () => {
6062
expect(getValueKey('gpt-4o-mini-2024-07-18')).toBe('gpt-4o-mini');
6163
expect(getValueKey('openai/gpt-4o-mini')).toBe('gpt-4o-mini');
6264
expect(getValueKey('gpt-4o-mini-0718')).toBe('gpt-4o-mini');
63-
expect(getValueKey('gpt-4o-2024-08-06-0718')).not.toBe('gpt-4o');
65+
expect(getValueKey('gpt-4o-2024-08-06-0718')).not.toBe('gpt-4o-mini');
6466
});
6567

66-
it('should return "gpt-4o-2024-08-06" for model type of "gpt-4o-2024-08-06"', () => {
67-
expect(getValueKey('gpt-4o-2024-08-06-2024-07-18')).toBe('gpt-4o-2024-08-06');
68-
expect(getValueKey('openai/gpt-4o-2024-08-06')).toBe('gpt-4o-2024-08-06');
69-
expect(getValueKey('gpt-4o-2024-08-06-0718')).toBe('gpt-4o-2024-08-06');
70-
expect(getValueKey('gpt-4o-2024-08-06-0718')).not.toBe('gpt-4o');
68+
it('should return "gpt-4o-2024-05-13" for model type of "gpt-4o-2024-05-13"', () => {
69+
expect(getValueKey('gpt-4o-2024-05-13')).toBe('gpt-4o-2024-05-13');
70+
expect(getValueKey('openai/gpt-4o-2024-05-13')).toBe('gpt-4o-2024-05-13');
71+
expect(getValueKey('gpt-4o-2024-05-13-0718')).toBe('gpt-4o-2024-05-13');
72+
expect(getValueKey('gpt-4o-2024-05-13-0718')).not.toBe('gpt-4o');
7173
});
7274

7375
it('should return "gpt-4o" for model type of "chatgpt-4o"', () => {
@@ -134,7 +136,7 @@ describe('getMultiplier', () => {
134136
});
135137

136138
it('should return the correct multiplier for gpt-4o', () => {
137-
const valueKey = getValueKey('gpt-4o-2024-05-13');
139+
const valueKey = getValueKey('gpt-4o-2024-08-06');
138140
expect(getMultiplier({ valueKey, tokenType: 'prompt' })).toBe(tokenValues['gpt-4o'].prompt);
139141
expect(getMultiplier({ valueKey, tokenType: 'completion' })).toBe(
140142
tokenValues['gpt-4o'].completion,

api/utils/tokens.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const openAIModels = {
1414
'gpt-4-0125': 127500, // -500 from max
1515
'gpt-4o': 127500, // -500 from max
1616
'gpt-4o-mini': 127500, // -500 from max
17+
'gpt-4o-2024-05-13': 127500, // -500 from max
1718
'gpt-4o-2024-08-06': 127500, // -500 from max
1819
'gpt-4-turbo': 127500, // -500 from max
1920
'gpt-4-vision': 127500, // -500 from max

0 commit comments

Comments
 (0)