Skip to content

Commit d9ec248

Browse files
committed
fix: update OpenAI provider to use tiers array format for service tier pricing
1 parent 27e0526 commit d9ec248

File tree

1 file changed

+32
-44
lines changed

1 file changed

+32
-44
lines changed

packages/types/src/providers/openai.ts

Lines changed: 32 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ export const openAiNativeModels = {
3232
// supportsVerbosity is a new capability; ensure ModelInfo includes it
3333
supportsVerbosity: true,
3434
supportsTemperature: false,
35-
allowedServiceTiers: ["flex", "priority"],
36-
serviceTierPricing: {
37-
flex: { inputPrice: 0.625, outputPrice: 5.0, cacheReadsPrice: 0.0625 },
38-
priority: { inputPrice: 2.5, outputPrice: 20.0, cacheReadsPrice: 0.25 },
39-
},
35+
tiers: [
36+
{ name: "flex", contextWindow: 400000, inputPrice: 0.625, outputPrice: 5.0, cacheReadsPrice: 0.0625 },
37+
{ name: "priority", contextWindow: 400000, inputPrice: 2.5, outputPrice: 20.0, cacheReadsPrice: 0.25 },
38+
],
4039
},
4140
"gpt-5-mini-2025-08-07": {
4241
maxTokens: 128000,
@@ -51,11 +50,10 @@ export const openAiNativeModels = {
5150
description: "GPT-5 Mini: A faster, more cost-efficient version of GPT-5 for well-defined tasks",
5251
supportsVerbosity: true,
5352
supportsTemperature: false,
54-
allowedServiceTiers: ["flex", "priority"],
55-
serviceTierPricing: {
56-
flex: { inputPrice: 0.125, outputPrice: 1.0, cacheReadsPrice: 0.0125 },
57-
priority: { inputPrice: 0.45, outputPrice: 3.6, cacheReadsPrice: 0.045 },
58-
},
53+
tiers: [
54+
{ name: "flex", contextWindow: 400000, inputPrice: 0.125, outputPrice: 1.0, cacheReadsPrice: 0.0125 },
55+
{ name: "priority", contextWindow: 400000, inputPrice: 0.45, outputPrice: 3.6, cacheReadsPrice: 0.045 },
56+
],
5957
},
6058
"gpt-5-nano-2025-08-07": {
6159
maxTokens: 128000,
@@ -70,10 +68,7 @@ export const openAiNativeModels = {
7068
description: "GPT-5 Nano: Fastest, most cost-efficient version of GPT-5",
7169
supportsVerbosity: true,
7270
supportsTemperature: false,
73-
allowedServiceTiers: ["flex"],
74-
serviceTierPricing: {
75-
flex: { inputPrice: 0.025, outputPrice: 0.2, cacheReadsPrice: 0.0025 },
76-
},
71+
tiers: [{ name: "flex", contextWindow: 400000, inputPrice: 0.025, outputPrice: 0.2, cacheReadsPrice: 0.0025 }],
7772
},
7873
"gpt-4.1": {
7974
maxTokens: 32_768,
@@ -84,10 +79,9 @@ export const openAiNativeModels = {
8479
outputPrice: 8,
8580
cacheReadsPrice: 0.5,
8681
supportsTemperature: true,
87-
allowedServiceTiers: ["priority"],
88-
serviceTierPricing: {
89-
priority: { inputPrice: 3.5, outputPrice: 14.0, cacheReadsPrice: 0.875 },
90-
},
82+
tiers: [
83+
{ name: "priority", contextWindow: 1_047_576, inputPrice: 3.5, outputPrice: 14.0, cacheReadsPrice: 0.875 },
84+
],
9185
},
9286
"gpt-4.1-mini": {
9387
maxTokens: 32_768,
@@ -98,10 +92,9 @@ export const openAiNativeModels = {
9892
outputPrice: 1.6,
9993
cacheReadsPrice: 0.1,
10094
supportsTemperature: true,
101-
allowedServiceTiers: ["priority"],
102-
serviceTierPricing: {
103-
priority: { inputPrice: 0.7, outputPrice: 2.8, cacheReadsPrice: 0.175 },
104-
},
95+
tiers: [
96+
{ name: "priority", contextWindow: 1_047_576, inputPrice: 0.7, outputPrice: 2.8, cacheReadsPrice: 0.175 },
97+
],
10598
},
10699
"gpt-4.1-nano": {
107100
maxTokens: 32_768,
@@ -112,10 +105,9 @@ export const openAiNativeModels = {
112105
outputPrice: 0.4,
113106
cacheReadsPrice: 0.025,
114107
supportsTemperature: true,
115-
allowedServiceTiers: ["priority"],
116-
serviceTierPricing: {
117-
priority: { inputPrice: 0.2, outputPrice: 0.8, cacheReadsPrice: 0.05 },
118-
},
108+
tiers: [
109+
{ name: "priority", contextWindow: 1_047_576, inputPrice: 0.2, outputPrice: 0.8, cacheReadsPrice: 0.05 },
110+
],
119111
},
120112
o3: {
121113
maxTokens: 100_000,
@@ -128,11 +120,10 @@ export const openAiNativeModels = {
128120
supportsReasoningEffort: true,
129121
reasoningEffort: "medium",
130122
supportsTemperature: false,
131-
allowedServiceTiers: ["flex", "priority"],
132-
serviceTierPricing: {
133-
flex: { inputPrice: 1.0, outputPrice: 4.0, cacheReadsPrice: 0.25 },
134-
priority: { inputPrice: 3.5, outputPrice: 14.0, cacheReadsPrice: 0.875 },
135-
},
123+
tiers: [
124+
{ name: "flex", contextWindow: 200_000, inputPrice: 1.0, outputPrice: 4.0, cacheReadsPrice: 0.25 },
125+
{ name: "priority", contextWindow: 200_000, inputPrice: 3.5, outputPrice: 14.0, cacheReadsPrice: 0.875 },
126+
],
136127
},
137128
"o3-high": {
138129
maxTokens: 100_000,
@@ -167,11 +158,10 @@ export const openAiNativeModels = {
167158
supportsReasoningEffort: true,
168159
reasoningEffort: "medium",
169160
supportsTemperature: false,
170-
allowedServiceTiers: ["flex", "priority"],
171-
serviceTierPricing: {
172-
flex: { inputPrice: 0.55, outputPrice: 2.2, cacheReadsPrice: 0.138 },
173-
priority: { inputPrice: 2.0, outputPrice: 8.0, cacheReadsPrice: 0.5 },
174-
},
161+
tiers: [
162+
{ name: "flex", contextWindow: 200_000, inputPrice: 0.55, outputPrice: 2.2, cacheReadsPrice: 0.138 },
163+
{ name: "priority", contextWindow: 200_000, inputPrice: 2.0, outputPrice: 8.0, cacheReadsPrice: 0.5 },
164+
],
175165
},
176166
"o4-mini-high": {
177167
maxTokens: 100_000,
@@ -268,10 +258,9 @@ export const openAiNativeModels = {
268258
outputPrice: 10,
269259
cacheReadsPrice: 1.25,
270260
supportsTemperature: true,
271-
allowedServiceTiers: ["priority"],
272-
serviceTierPricing: {
273-
priority: { inputPrice: 4.25, outputPrice: 17.0, cacheReadsPrice: 2.125 },
274-
},
261+
tiers: [
262+
{ name: "priority", contextWindow: 128_000, inputPrice: 4.25, outputPrice: 17.0, cacheReadsPrice: 2.125 },
263+
],
275264
},
276265
"gpt-4o-mini": {
277266
maxTokens: 16_384,
@@ -282,10 +271,9 @@ export const openAiNativeModels = {
282271
outputPrice: 0.6,
283272
cacheReadsPrice: 0.075,
284273
supportsTemperature: true,
285-
allowedServiceTiers: ["priority"],
286-
serviceTierPricing: {
287-
priority: { inputPrice: 0.25, outputPrice: 1.0, cacheReadsPrice: 0.125 },
288-
},
274+
tiers: [
275+
{ name: "priority", contextWindow: 128_000, inputPrice: 0.25, outputPrice: 1.0, cacheReadsPrice: 0.125 },
276+
],
289277
},
290278
"codex-mini-latest": {
291279
maxTokens: 16_384,

0 commit comments

Comments
 (0)