Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/types/src/providers/bedrock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ export const bedrockModels = {
minTokensPerCachePoint: 1024,
maxCachePoints: 4,
cachableFields: ["system", "messages", "tools"],
tiers: [
{
contextWindow: 1_000_000,
inputPrice: 6.0,
outputPrice: 22.5,
cacheWritesPrice: 7.5,
cacheReadsPrice: 0.6,
},
],
},
"amazon.nova-pro-v1:0": {
maxTokens: 5000,
Expand Down Expand Up @@ -90,6 +99,15 @@ export const bedrockModels = {
minTokensPerCachePoint: 1024,
maxCachePoints: 4,
cachableFields: ["system", "messages", "tools"],
tiers: [
{
contextWindow: 1_000_000,
inputPrice: 6.0,
outputPrice: 22.5,
cacheWritesPrice: 7.5,
cacheReadsPrice: 0.6,
},
],
},
"anthropic.claude-opus-4-1-20250805-v1:0": {
maxTokens: 8192,
Expand Down
84 changes: 32 additions & 52 deletions packages/types/src/providers/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,19 @@ export const geminiModels = {
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 2.5, // This is the pricing for prompts above 200k tokens.
outputPrice: 15,
cacheReadsPrice: 0.625,
cacheWritesPrice: 4.5,
inputPrice: 1.25, // Base price for 200k tokens
outputPrice: 10,
cacheReadsPrice: 0.125,
cacheWritesPrice: 1.625,
maxThinkingTokens: 32_768,
supportsReasoningBudget: true,
tiers: [
{
contextWindow: 200_000,
inputPrice: 1.25,
outputPrice: 10,
cacheReadsPrice: 0.31,
},
{
contextWindow: Infinity,
inputPrice: 2.5,
contextWindow: 1_000_000,
inputPrice: 2.5, // >200k tokens
outputPrice: 15,
cacheReadsPrice: 0.625,
cacheReadsPrice: 0.25,
cacheWritesPrice: 2.875,
},
],
},
Expand All @@ -164,22 +159,17 @@ export const geminiModels = {
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 2.5, // This is the pricing for prompts above 200k tokens.
outputPrice: 15,
cacheReadsPrice: 0.625,
cacheWritesPrice: 4.5,
inputPrice: 1.25, // Base price for 200k tokens
outputPrice: 10,
cacheReadsPrice: 0.125,
cacheWritesPrice: 1.625,
tiers: [
{
contextWindow: 200_000,
inputPrice: 1.25,
outputPrice: 10,
cacheReadsPrice: 0.31,
},
{
contextWindow: Infinity,
inputPrice: 2.5,
contextWindow: 1_000_000,
inputPrice: 2.5, // >200k tokens
outputPrice: 15,
cacheReadsPrice: 0.625,
cacheReadsPrice: 0.25,
cacheWritesPrice: 2.875,
},
],
},
Expand All @@ -188,24 +178,19 @@ export const geminiModels = {
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 2.5, // This is the pricing for prompts above 200k tokens.
outputPrice: 15,
cacheReadsPrice: 0.625,
cacheWritesPrice: 4.5,
inputPrice: 1.25, // Base price for 200k tokens
outputPrice: 10,
cacheReadsPrice: 0.125,
cacheWritesPrice: 1.625,
maxThinkingTokens: 32_768,
supportsReasoningBudget: true,
tiers: [
{
contextWindow: 200_000,
inputPrice: 1.25,
outputPrice: 10,
cacheReadsPrice: 0.31,
},
{
contextWindow: Infinity,
inputPrice: 2.5,
contextWindow: 1_000_000,
inputPrice: 2.5, // >200k tokens
outputPrice: 15,
cacheReadsPrice: 0.625,
cacheReadsPrice: 0.25,
cacheWritesPrice: 2.875,
},
],
},
Expand All @@ -222,25 +207,20 @@ export const geminiModels = {
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 2.5, // This is the pricing for prompts above 200k tokens.
outputPrice: 15,
cacheReadsPrice: 0.625,
cacheWritesPrice: 4.5,
inputPrice: 1.25, // Base price for 200k tokens
outputPrice: 10,
cacheReadsPrice: 0.125,
cacheWritesPrice: 1.625,
maxThinkingTokens: 32_768,
supportsReasoningBudget: true,
requiredReasoningBudget: true,
tiers: [
{
contextWindow: 200_000,
inputPrice: 1.25,
outputPrice: 10,
cacheReadsPrice: 0.31,
},
{
contextWindow: Infinity,
inputPrice: 2.5,
contextWindow: 1_000_000,
inputPrice: 2.5, // >200k tokens
outputPrice: 15,
cacheReadsPrice: 0.625,
cacheReadsPrice: 0.25,
cacheWritesPrice: 2.875,
},
],
},
Expand Down
89 changes: 73 additions & 16 deletions packages/types/src/providers/vertex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,49 +61,79 @@ export const vertexModels = {
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 2.5,
outputPrice: 15,
inputPrice: 1.25,
outputPrice: 10,
cacheReadsPrice: 0.125,
cacheWritesPrice: 1.625,
tiers: [
{
contextWindow: 1_000_000,
inputPrice: 2.5,
outputPrice: 15,
cacheReadsPrice: 0.25,
cacheWritesPrice: 2.875,
},
],
},
"gemini-2.5-pro-preview-05-06": {
maxTokens: 65_535,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 2.5,
outputPrice: 15,
inputPrice: 1.25,
outputPrice: 10,
cacheReadsPrice: 0.125,
cacheWritesPrice: 1.625,
tiers: [
{
contextWindow: 1_000_000,
inputPrice: 2.5,
outputPrice: 15,
cacheReadsPrice: 0.25,
cacheWritesPrice: 2.875,
},
],
},
"gemini-2.5-pro-preview-06-05": {
maxTokens: 65_535,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 2.5,
outputPrice: 15,
inputPrice: 1.25,
outputPrice: 10,
cacheReadsPrice: 0.125,
cacheWritesPrice: 1.625,
maxThinkingTokens: 32_768,
supportsReasoningBudget: true,
tiers: [
{
contextWindow: 1_000_000,
inputPrice: 2.5,
outputPrice: 15,
cacheReadsPrice: 0.25,
cacheWritesPrice: 2.875,
},
],
},
"gemini-2.5-pro": {
maxTokens: 64_000,
contextWindow: 1_048_576,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 2.5,
outputPrice: 15,
inputPrice: 1.25,
outputPrice: 10,
cacheReadsPrice: 0.125,
cacheWritesPrice: 1.625,
maxThinkingTokens: 32_768,
supportsReasoningBudget: true,
requiredReasoningBudget: true,
tiers: [
{
contextWindow: 200_000,
inputPrice: 1.25,
outputPrice: 10,
cacheReadsPrice: 0.31,
},
{
contextWindow: Infinity,
contextWindow: 1_000_000,
inputPrice: 2.5,
outputPrice: 15,
cacheReadsPrice: 0.625,
cacheReadsPrice: 0.25,
cacheWritesPrice: 2.875,
},
],
},
Expand Down Expand Up @@ -173,6 +203,15 @@ export const vertexModels = {
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
supportsReasoningBudget: true,
tiers: [
{
contextWindow: 1_000_000,
inputPrice: 6.0,
outputPrice: 22.5,
cacheWritesPrice: 7.5,
cacheReadsPrice: 0.6,
},
],
},
"claude-sonnet-4-5@20250929": {
maxTokens: 8192,
Expand All @@ -184,6 +223,15 @@ export const vertexModels = {
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
supportsReasoningBudget: true,
tiers: [
{
contextWindow: 1_000_000,
inputPrice: 6.0,
outputPrice: 22.5,
cacheWritesPrice: 7.5,
cacheReadsPrice: 0.6,
},
],
},
"claude-haiku-4-5@20251001": {
maxTokens: 8192,
Expand Down Expand Up @@ -216,6 +264,15 @@ export const vertexModels = {
outputPrice: 75.0,
cacheWritesPrice: 18.75,
cacheReadsPrice: 1.5,
tiers: [
{
contextWindow: 1_000_000,
inputPrice: 30.0,
outputPrice: 112.5,
cacheWritesPrice: 37.5,
cacheReadsPrice: 3.0,
},
],
},
"claude-3-7-sonnet@20250219:thinking": {
maxTokens: 64_000,
Expand Down
51 changes: 51 additions & 0 deletions src/api/providers/fetchers/openrouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,5 +263,56 @@ export const parseOpenRouterModel = ({
modelInfo.maxTokens = 32768
}

// Add tiered pricing for Gemini 2.5 Pro models on OpenRouter
if (id.includes("gemini-2.5-pro") || id.includes("gemini/2.5-pro")) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When matching model IDs to apply tiered pricing (e.g. for Gemini 2.5 Pro), consider using a consistent case-insensitive check (e.g. id.toLowerCase()) to avoid mismatches.

modelInfo.inputPrice = 1.25
modelInfo.outputPrice = 10
modelInfo.cacheReadsPrice = 0.125
modelInfo.cacheWritesPrice = 1.625
modelInfo.tiers = [
{
contextWindow: 1_000_000,
inputPrice: 2.5,
outputPrice: 15,
cacheReadsPrice: 0.25,
cacheWritesPrice: 2.875,
},
]
}

// Add tiered pricing for Claude Sonnet 4 and 4.5 on OpenRouter
if (id === "anthropic/claude-sonnet-4" || id === "anthropic/claude-sonnet-4.5") {
modelInfo.inputPrice = 3.0
modelInfo.outputPrice = 15.0
modelInfo.cacheWritesPrice = 3.75
modelInfo.cacheReadsPrice = 0.3
modelInfo.tiers = [
{
contextWindow: 1_000_000,
inputPrice: 6.0,
outputPrice: 22.5,
cacheWritesPrice: 7.5,
cacheReadsPrice: 0.6,
},
]
}

// Add tiered pricing for Qwen 3 Max on OpenRouter
if (id.toLowerCase().includes("qwen") && id.toLowerCase().includes("max")) {
modelInfo.inputPrice = 1.2
modelInfo.outputPrice = 6
modelInfo.cacheReadsPrice = 0.24
modelInfo.cacheWritesPrice = 0 // Free
modelInfo.tiers = [
{
contextWindow: 1_000_000,
inputPrice: 3,
outputPrice: 15,
cacheReadsPrice: 0.6,
cacheWritesPrice: 0, // Free
},
]
}

return modelInfo
}
Loading
Loading