Skip to content

Commit 7cfe770

Browse files
committed
fix: update tiered pricing for Gemini 2.5 Pro, Sonnet 4/4.5, and Qwen 3 Max across all providers
1 parent 5e34db1 commit 7cfe770

File tree

5 files changed

+174
-253
lines changed

5 files changed

+174
-253
lines changed

packages/types/src/providers/bedrock.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ export const bedrockModels = {
2626
minTokensPerCachePoint: 1024,
2727
maxCachePoints: 4,
2828
cachableFields: ["system", "messages", "tools"],
29+
tiers: [
30+
{
31+
contextWindow: 1_000_000,
32+
inputPrice: 6.0,
33+
outputPrice: 22.5,
34+
cacheWritesPrice: 7.5,
35+
cacheReadsPrice: 0.6,
36+
},
37+
],
2938
},
3039
"amazon.nova-pro-v1:0": {
3140
maxTokens: 5000,
@@ -90,6 +99,15 @@ export const bedrockModels = {
9099
minTokensPerCachePoint: 1024,
91100
maxCachePoints: 4,
92101
cachableFields: ["system", "messages", "tools"],
102+
tiers: [
103+
{
104+
contextWindow: 1_000_000,
105+
inputPrice: 6.0,
106+
outputPrice: 22.5,
107+
cacheWritesPrice: 7.5,
108+
cacheReadsPrice: 0.6,
109+
},
110+
],
93111
},
94112
"anthropic.claude-opus-4-1-20250805-v1:0": {
95113
maxTokens: 8192,

packages/types/src/providers/gemini.ts

Lines changed: 32 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -138,24 +138,19 @@ export const geminiModels = {
138138
contextWindow: 1_048_576,
139139
supportsImages: true,
140140
supportsPromptCache: true,
141-
inputPrice: 2.5, // This is the pricing for prompts above 200k tokens.
142-
outputPrice: 15,
143-
cacheReadsPrice: 0.625,
144-
cacheWritesPrice: 4.5,
141+
inputPrice: 1.25, // Base price for 200k tokens
142+
outputPrice: 10,
143+
cacheReadsPrice: 0.125,
144+
cacheWritesPrice: 1.625,
145145
maxThinkingTokens: 32_768,
146146
supportsReasoningBudget: true,
147147
tiers: [
148148
{
149-
contextWindow: 200_000,
150-
inputPrice: 1.25,
151-
outputPrice: 10,
152-
cacheReadsPrice: 0.31,
153-
},
154-
{
155-
contextWindow: Infinity,
156-
inputPrice: 2.5,
149+
contextWindow: 1_000_000,
150+
inputPrice: 2.5, // >200k tokens
157151
outputPrice: 15,
158-
cacheReadsPrice: 0.625,
152+
cacheReadsPrice: 0.25,
153+
cacheWritesPrice: 2.875,
159154
},
160155
],
161156
},
@@ -164,22 +159,17 @@ export const geminiModels = {
164159
contextWindow: 1_048_576,
165160
supportsImages: true,
166161
supportsPromptCache: true,
167-
inputPrice: 2.5, // This is the pricing for prompts above 200k tokens.
168-
outputPrice: 15,
169-
cacheReadsPrice: 0.625,
170-
cacheWritesPrice: 4.5,
162+
inputPrice: 1.25, // Base price for 200k tokens
163+
outputPrice: 10,
164+
cacheReadsPrice: 0.125,
165+
cacheWritesPrice: 1.625,
171166
tiers: [
172167
{
173-
contextWindow: 200_000,
174-
inputPrice: 1.25,
175-
outputPrice: 10,
176-
cacheReadsPrice: 0.31,
177-
},
178-
{
179-
contextWindow: Infinity,
180-
inputPrice: 2.5,
168+
contextWindow: 1_000_000,
169+
inputPrice: 2.5, // >200k tokens
181170
outputPrice: 15,
182-
cacheReadsPrice: 0.625,
171+
cacheReadsPrice: 0.25,
172+
cacheWritesPrice: 2.875,
183173
},
184174
],
185175
},
@@ -188,24 +178,19 @@ export const geminiModels = {
188178
contextWindow: 1_048_576,
189179
supportsImages: true,
190180
supportsPromptCache: true,
191-
inputPrice: 2.5, // This is the pricing for prompts above 200k tokens.
192-
outputPrice: 15,
193-
cacheReadsPrice: 0.625,
194-
cacheWritesPrice: 4.5,
181+
inputPrice: 1.25, // Base price for 200k tokens
182+
outputPrice: 10,
183+
cacheReadsPrice: 0.125,
184+
cacheWritesPrice: 1.625,
195185
maxThinkingTokens: 32_768,
196186
supportsReasoningBudget: true,
197187
tiers: [
198188
{
199-
contextWindow: 200_000,
200-
inputPrice: 1.25,
201-
outputPrice: 10,
202-
cacheReadsPrice: 0.31,
203-
},
204-
{
205-
contextWindow: Infinity,
206-
inputPrice: 2.5,
189+
contextWindow: 1_000_000,
190+
inputPrice: 2.5, // >200k tokens
207191
outputPrice: 15,
208-
cacheReadsPrice: 0.625,
192+
cacheReadsPrice: 0.25,
193+
cacheWritesPrice: 2.875,
209194
},
210195
],
211196
},
@@ -222,25 +207,20 @@ export const geminiModels = {
222207
contextWindow: 1_048_576,
223208
supportsImages: true,
224209
supportsPromptCache: true,
225-
inputPrice: 2.5, // This is the pricing for prompts above 200k tokens.
226-
outputPrice: 15,
227-
cacheReadsPrice: 0.625,
228-
cacheWritesPrice: 4.5,
210+
inputPrice: 1.25, // Base price for 200k tokens
211+
outputPrice: 10,
212+
cacheReadsPrice: 0.125,
213+
cacheWritesPrice: 1.625,
229214
maxThinkingTokens: 32_768,
230215
supportsReasoningBudget: true,
231216
requiredReasoningBudget: true,
232217
tiers: [
233218
{
234-
contextWindow: 200_000,
235-
inputPrice: 1.25,
236-
outputPrice: 10,
237-
cacheReadsPrice: 0.31,
238-
},
239-
{
240-
contextWindow: Infinity,
241-
inputPrice: 2.5,
219+
contextWindow: 1_000_000,
220+
inputPrice: 2.5, // >200k tokens
242221
outputPrice: 15,
243-
cacheReadsPrice: 0.625,
222+
cacheReadsPrice: 0.25,
223+
cacheWritesPrice: 2.875,
244224
},
245225
],
246226
},

packages/types/src/providers/vertex.ts

Lines changed: 73 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,49 +61,79 @@ export const vertexModels = {
6161
contextWindow: 1_048_576,
6262
supportsImages: true,
6363
supportsPromptCache: true,
64-
inputPrice: 2.5,
65-
outputPrice: 15,
64+
inputPrice: 1.25,
65+
outputPrice: 10,
66+
cacheReadsPrice: 0.125,
67+
cacheWritesPrice: 1.625,
68+
tiers: [
69+
{
70+
contextWindow: 1_000_000,
71+
inputPrice: 2.5,
72+
outputPrice: 15,
73+
cacheReadsPrice: 0.25,
74+
cacheWritesPrice: 2.875,
75+
},
76+
],
6677
},
6778
"gemini-2.5-pro-preview-05-06": {
6879
maxTokens: 65_535,
6980
contextWindow: 1_048_576,
7081
supportsImages: true,
7182
supportsPromptCache: true,
72-
inputPrice: 2.5,
73-
outputPrice: 15,
83+
inputPrice: 1.25,
84+
outputPrice: 10,
85+
cacheReadsPrice: 0.125,
86+
cacheWritesPrice: 1.625,
87+
tiers: [
88+
{
89+
contextWindow: 1_000_000,
90+
inputPrice: 2.5,
91+
outputPrice: 15,
92+
cacheReadsPrice: 0.25,
93+
cacheWritesPrice: 2.875,
94+
},
95+
],
7496
},
7597
"gemini-2.5-pro-preview-06-05": {
7698
maxTokens: 65_535,
7799
contextWindow: 1_048_576,
78100
supportsImages: true,
79101
supportsPromptCache: true,
80-
inputPrice: 2.5,
81-
outputPrice: 15,
102+
inputPrice: 1.25,
103+
outputPrice: 10,
104+
cacheReadsPrice: 0.125,
105+
cacheWritesPrice: 1.625,
82106
maxThinkingTokens: 32_768,
83107
supportsReasoningBudget: true,
108+
tiers: [
109+
{
110+
contextWindow: 1_000_000,
111+
inputPrice: 2.5,
112+
outputPrice: 15,
113+
cacheReadsPrice: 0.25,
114+
cacheWritesPrice: 2.875,
115+
},
116+
],
84117
},
85118
"gemini-2.5-pro": {
86119
maxTokens: 64_000,
87120
contextWindow: 1_048_576,
88121
supportsImages: true,
89122
supportsPromptCache: true,
90-
inputPrice: 2.5,
91-
outputPrice: 15,
123+
inputPrice: 1.25,
124+
outputPrice: 10,
125+
cacheReadsPrice: 0.125,
126+
cacheWritesPrice: 1.625,
92127
maxThinkingTokens: 32_768,
93128
supportsReasoningBudget: true,
94129
requiredReasoningBudget: true,
95130
tiers: [
96131
{
97-
contextWindow: 200_000,
98-
inputPrice: 1.25,
99-
outputPrice: 10,
100-
cacheReadsPrice: 0.31,
101-
},
102-
{
103-
contextWindow: Infinity,
132+
contextWindow: 1_000_000,
104133
inputPrice: 2.5,
105134
outputPrice: 15,
106-
cacheReadsPrice: 0.625,
135+
cacheReadsPrice: 0.25,
136+
cacheWritesPrice: 2.875,
107137
},
108138
],
109139
},
@@ -173,6 +203,15 @@ export const vertexModels = {
173203
cacheWritesPrice: 3.75,
174204
cacheReadsPrice: 0.3,
175205
supportsReasoningBudget: true,
206+
tiers: [
207+
{
208+
contextWindow: 1_000_000,
209+
inputPrice: 6.0,
210+
outputPrice: 22.5,
211+
cacheWritesPrice: 7.5,
212+
cacheReadsPrice: 0.6,
213+
},
214+
],
176215
},
177216
"claude-sonnet-4-5@20250929": {
178217
maxTokens: 8192,
@@ -184,6 +223,15 @@ export const vertexModels = {
184223
cacheWritesPrice: 3.75,
185224
cacheReadsPrice: 0.3,
186225
supportsReasoningBudget: true,
226+
tiers: [
227+
{
228+
contextWindow: 1_000_000,
229+
inputPrice: 6.0,
230+
outputPrice: 22.5,
231+
cacheWritesPrice: 7.5,
232+
cacheReadsPrice: 0.6,
233+
},
234+
],
187235
},
188236
"claude-haiku-4-5@20251001": {
189237
maxTokens: 8192,
@@ -216,6 +264,15 @@ export const vertexModels = {
216264
outputPrice: 75.0,
217265
cacheWritesPrice: 18.75,
218266
cacheReadsPrice: 1.5,
267+
tiers: [
268+
{
269+
contextWindow: 1_000_000,
270+
inputPrice: 30.0,
271+
outputPrice: 112.5,
272+
cacheWritesPrice: 37.5,
273+
cacheReadsPrice: 3.0,
274+
},
275+
],
219276
},
220277
"claude-3-7-sonnet@20250219:thinking": {
221278
maxTokens: 64_000,

src/api/providers/fetchers/openrouter.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,5 +263,56 @@ export const parseOpenRouterModel = ({
263263
modelInfo.maxTokens = 32768
264264
}
265265

266+
// Add tiered pricing for Gemini 2.5 Pro models on OpenRouter
267+
if (id.includes("gemini-2.5-pro") || id.includes("gemini/2.5-pro")) {
268+
modelInfo.inputPrice = 1.25
269+
modelInfo.outputPrice = 10
270+
modelInfo.cacheReadsPrice = 0.125
271+
modelInfo.cacheWritesPrice = 1.625
272+
modelInfo.tiers = [
273+
{
274+
contextWindow: 1_000_000,
275+
inputPrice: 2.5,
276+
outputPrice: 15,
277+
cacheReadsPrice: 0.25,
278+
cacheWritesPrice: 2.875,
279+
},
280+
]
281+
}
282+
283+
// Add tiered pricing for Claude Sonnet 4 and 4.5 on OpenRouter
284+
if (id === "anthropic/claude-sonnet-4" || id === "anthropic/claude-sonnet-4.5") {
285+
modelInfo.inputPrice = 3.0
286+
modelInfo.outputPrice = 15.0
287+
modelInfo.cacheWritesPrice = 3.75
288+
modelInfo.cacheReadsPrice = 0.3
289+
modelInfo.tiers = [
290+
{
291+
contextWindow: 1_000_000,
292+
inputPrice: 6.0,
293+
outputPrice: 22.5,
294+
cacheWritesPrice: 7.5,
295+
cacheReadsPrice: 0.6,
296+
},
297+
]
298+
}
299+
300+
// Add tiered pricing for Qwen 3 Max on OpenRouter
301+
if (id.toLowerCase().includes("qwen") && id.toLowerCase().includes("max")) {
302+
modelInfo.inputPrice = 1.2
303+
modelInfo.outputPrice = 6
304+
modelInfo.cacheReadsPrice = 0.24
305+
modelInfo.cacheWritesPrice = 0 // Free
306+
modelInfo.tiers = [
307+
{
308+
contextWindow: 1_000_000,
309+
inputPrice: 3,
310+
outputPrice: 15,
311+
cacheReadsPrice: 0.6,
312+
cacheWritesPrice: 0, // Free
313+
},
314+
]
315+
}
316+
266317
return modelInfo
267318
}

0 commit comments

Comments
 (0)