Skip to content

Commit 23f8419

Browse files
authored
feat(cost): add Gemini 3.1 Pro Preview model support (#5595)
1 parent c53dbd3 commit 23f8419

File tree

6 files changed

+290
-0
lines changed

6 files changed

+290
-0
lines changed

packages/__tests__/cost/__snapshots__/registrySnapshots.test.ts.snap

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2847,6 +2847,77 @@ exports[`Registry Snapshots endpoint configurations snapshot 1`] = `
28472847
],
28482848
},
28492849
},
2850+
"google/gemini-3.1-pro-preview": {
2851+
"gemini-3.1-pro-preview:helicone": {
2852+
"context": 1048576,
2853+
"crossRegion": false,
2854+
"maxTokens": 65536,
2855+
"modelId": "pa/gemini-3.1-pro-preview",
2856+
"parameters": [
2857+
"include_reasoning",
2858+
"max_tokens",
2859+
"reasoning",
2860+
"response_format",
2861+
"seed",
2862+
"stop",
2863+
"structured_outputs",
2864+
"temperature",
2865+
"tool_choice",
2866+
"tools",
2867+
"top_p",
2868+
],
2869+
"provider": "helicone",
2870+
"ptbEnabled": true,
2871+
"regions": [
2872+
"*",
2873+
],
2874+
},
2875+
"gemini-3.1-pro-preview:openrouter": {
2876+
"context": 1048576,
2877+
"crossRegion": false,
2878+
"maxTokens": 65536,
2879+
"modelId": "google/gemini-3.1-pro-preview",
2880+
"parameters": [
2881+
"max_tokens",
2882+
"response_format",
2883+
"seed",
2884+
"stop",
2885+
"temperature",
2886+
"tool_choice",
2887+
"tools",
2888+
"top_p",
2889+
],
2890+
"provider": "openrouter",
2891+
"ptbEnabled": true,
2892+
"regions": [
2893+
"*",
2894+
],
2895+
},
2896+
"gemini-3.1-pro-preview:vertex": {
2897+
"context": 1048576,
2898+
"crossRegion": true,
2899+
"maxTokens": 65536,
2900+
"modelId": "gemini-3.1-pro-preview",
2901+
"parameters": [
2902+
"include_reasoning",
2903+
"max_tokens",
2904+
"reasoning",
2905+
"response_format",
2906+
"seed",
2907+
"stop",
2908+
"structured_outputs",
2909+
"temperature",
2910+
"tool_choice",
2911+
"tools",
2912+
"top_p",
2913+
],
2914+
"provider": "vertex",
2915+
"ptbEnabled": true,
2916+
"regions": [
2917+
"global",
2918+
],
2919+
},
2920+
},
28502921
"google/gemma": {
28512922
"gemma2-9b-it:chutes": {
28522923
"context": 8192,
@@ -7230,6 +7301,11 @@ exports[`Registry Snapshots model coverage snapshot 1`] = `
72307301
"openrouter",
72317302
"vertex",
72327303
],
7304+
"google/gemini-3.1-pro-preview": [
7305+
"helicone",
7306+
"openrouter",
7307+
"vertex",
7308+
],
72337309
"google/gemma": [
72347310
"chutes",
72357311
"openrouter",
@@ -8957,6 +9033,51 @@ exports[`Registry Snapshots pricing snapshot 1`] = `
89579033
},
89589034
],
89599035
},
9036+
"google/gemini-3.1-pro-preview": {
9037+
"helicone": [
9038+
{
9039+
"input": 0.000002,
9040+
"output": 0.000012,
9041+
"threshold": 0,
9042+
},
9043+
{
9044+
"input": 0.000004,
9045+
"output": 0.000018,
9046+
"threshold": 200000,
9047+
},
9048+
],
9049+
"openrouter": [
9050+
{
9051+
"input": 0.00000211,
9052+
"output": 0.00001266,
9053+
"threshold": 0,
9054+
},
9055+
{
9056+
"input": 0.00000422,
9057+
"output": 0.00001899,
9058+
"threshold": 200000,
9059+
},
9060+
],
9061+
"vertex": [
9062+
{
9063+
"cacheMultipliers": {
9064+
"cachedInput": 0.1,
9065+
},
9066+
"cacheStoragePerHour": 0.0000045,
9067+
"input": 0.000002,
9068+
"output": 0.000012,
9069+
"threshold": 0,
9070+
},
9071+
{
9072+
"cacheMultipliers": {
9073+
"cachedInput": 0.1,
9074+
},
9075+
"input": 0.000004,
9076+
"output": 0.000018,
9077+
"threshold": 200000,
9078+
},
9079+
],
9080+
},
89609081
"google/gemma": {
89619082
"chutes": [
89629083
{
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
import { ModelProviderName } from "../../../providers";
2+
import type { ModelProviderConfig } from "../../../types";
3+
import { Gemini31ProPreviewModelName } from "./model";
4+
5+
export const endpoints = {
6+
"gemini-3.1-pro-preview:vertex": {
7+
providerModelId: "gemini-3.1-pro-preview",
8+
provider: "vertex",
9+
author: "google",
10+
crossRegion: true,
11+
pricing: [
12+
{
13+
threshold: 0,
14+
input: 0.000002, // $2/1M tokens
15+
output: 0.000012, // $12/1M tokens (including thinking tokens)
16+
cacheMultipliers: {
17+
cachedInput: 0.1, // $0.20/1M = 10% of input
18+
},
19+
cacheStoragePerHour: 0.0000045, // $4.50/1M tokens per hour
20+
},
21+
{
22+
threshold: 200000,
23+
input: 0.000004, // $4/1M tokens (over 200K context)
24+
output: 0.000018, // $18/1M tokens (over 200K context)
25+
cacheMultipliers: {
26+
cachedInput: 0.1, // $0.40/1M = 10% of $4
27+
},
28+
},
29+
],
30+
contextLength: 1_048_576,
31+
maxCompletionTokens: 65_536,
32+
supportedParameters: [
33+
"include_reasoning",
34+
"max_tokens",
35+
"reasoning",
36+
"response_format",
37+
"seed",
38+
"stop",
39+
"structured_outputs",
40+
"temperature",
41+
"tool_choice",
42+
"tools",
43+
"top_p",
44+
],
45+
responseFormat: "GOOGLE",
46+
ptbEnabled: true,
47+
endpointConfigs: {
48+
global: {
49+
providerModelId: "gemini-3.1-pro-preview",
50+
},
51+
},
52+
},
53+
54+
"gemini-3.1-pro-preview:openrouter": {
55+
provider: "openrouter",
56+
author: "google",
57+
providerModelId: "google/gemini-3.1-pro-preview",
58+
pricing: [
59+
{
60+
threshold: 0,
61+
input: 0.00000211, // $2.11/1M - $2.00/1M * 1.055 (OpenRouter markup)
62+
output: 0.00001266, // $12.66/1M - $12.00/1M * 1.055
63+
},
64+
{
65+
threshold: 200000,
66+
input: 0.00000422, // $4.22/1M - $4.00/1M * 1.055 (over 200K context)
67+
output: 0.00001899, // $18.99/1M - $18.00/1M * 1.055 (over 200K context)
68+
},
69+
],
70+
contextLength: 1_048_576,
71+
maxCompletionTokens: 65_536,
72+
supportedParameters: [
73+
"max_tokens",
74+
"response_format",
75+
"seed",
76+
"stop",
77+
"temperature",
78+
"tool_choice",
79+
"tools",
80+
"top_p",
81+
],
82+
ptbEnabled: true,
83+
endpointConfigs: {
84+
"*": {},
85+
},
86+
},
87+
88+
"gemini-3.1-pro-preview:helicone": {
89+
provider: "helicone",
90+
author: "google",
91+
providerModelId: "pa/gemini-3.1-pro-preview",
92+
pricing: [
93+
{
94+
threshold: 0,
95+
input: 0.000002, // $2/1M tokens (Google's standard pricing)
96+
output: 0.000012, // $12/1M tokens (Google's standard pricing)
97+
},
98+
{
99+
threshold: 200000,
100+
input: 0.000004, // $4/1M tokens (over 200K context)
101+
output: 0.000018, // $18/1M tokens (over 200K context)
102+
},
103+
],
104+
contextLength: 1_048_576,
105+
maxCompletionTokens: 65_536,
106+
supportedParameters: [
107+
"include_reasoning",
108+
"max_tokens",
109+
"reasoning",
110+
"response_format",
111+
"seed",
112+
"stop",
113+
"structured_outputs",
114+
"temperature",
115+
"tool_choice",
116+
"tools",
117+
"top_p",
118+
],
119+
ptbEnabled: true,
120+
endpointConfigs: {
121+
"*": {},
122+
},
123+
},
124+
} satisfies Partial<
125+
Record<`${Gemini31ProPreviewModelName}:${ModelProviderName}`, ModelProviderConfig>
126+
>;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { ModelConfig } from "../../../types";
2+
3+
export const model = {
4+
"gemini-3.1-pro-preview": {
5+
name: "Google Gemini 3.1 Pro Preview",
6+
author: "google",
7+
description:
8+
"Gemini 3.1 Pro Preview is Google's most advanced reasoning model, released February 2026. It uses extended thinking/chain-of-thought reasoning to work through complex problems. Scores 77.1% on ARC-AGI-2 (more than doubling Gemini 3 Pro's 31.1%), and tops the Artificial Analysis Intelligence Index v4.0 at half the cost of competitors. Features enhanced accuracy for ambitious agentic workflows, complex problem-solving, and scientific reasoning.",
9+
contextLength: 1_048_576,
10+
maxOutputTokens: 65_536,
11+
created: "2026-02-09T00:00:00",
12+
modality: { inputs: ["text", "image", "audio", "video"], outputs: ["text"] },
13+
tokenizer: "Gemini",
14+
},
15+
} satisfies Record<string, ModelConfig>;
16+
17+
export type Gemini31ProPreviewModelName = keyof typeof model;

packages/cost/models/authors/google/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import { model as gemini25FlashLiteModel } from "./gemini-2.5-flash-lite/model";
1313
import { endpoints as gemini25FlashLiteEndpoints } from "./gemini-2.5-flash-lite/endpoints";
1414
import { model as gemini3ProPreviewModel } from "./gemini-3/model";
1515
import { endpoints as gemini3ProPreviewEndpoints } from "./gemini-3/endpoints";
16+
import { model as gemini31ProPreviewModel } from "./gemini-3.1-pro-preview/model";
17+
import { endpoints as gemini31ProPreviewEndpoints } from "./gemini-3.1-pro-preview/endpoints";
1618
import { model as gemini3FlashPreviewModel } from "./gemini-3-flash-preview/model";
1719
import { endpoints as gemini3FlashPreviewEndpoints } from "./gemini-3-flash-preview/endpoints";
1820
import { model as gemini3ProImagePreviewModel } from "./gemini-3-pro-image/model";
@@ -31,6 +33,7 @@ export const googleModels = {
3133
...gemini25FlashModel,
3234
...gemini25FlashLiteModel,
3335
...gemini3ProPreviewModel,
36+
...gemini31ProPreviewModel,
3437
...gemini3FlashPreviewModel,
3538
...gemini3ProImagePreviewModel,
3639
...gemini31ProPreviewModel,
@@ -44,6 +47,7 @@ export const googleEndpointConfig = {
4447
...gemini25FlashEndpoints,
4548
...gemini25FlashLiteEndpoints,
4649
...gemini3ProPreviewEndpoints,
50+
...gemini31ProPreviewEndpoints,
4751
...gemini3FlashPreviewEndpoints,
4852
...gemini3ProImagePreviewEndpoints,
4953
...gemini31ProPreviewEndpoints,

packages/cost/providers/google/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,17 @@ export const costs: ModelRow[] = [
263263
prompt_cache_read_token: 0.00000005,
264264
},
265265
},
266+
{
267+
model: {
268+
operator: "includes",
269+
value: "gemini-3.1-pro-preview",
270+
},
271+
cost: {
272+
prompt_token: 0.000002, // $2/1M tokens
273+
completion_token: 0.000012, // $12/1M tokens (including thinking)
274+
prompt_cache_read_token: 0.0000002, // $0.20/1M = 10% of input
275+
},
276+
},
266277
];
267278

268279
export const modelDetails: ModelDetailsMap = {

packages/cost/providers/openrouter/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,17 @@ export const costs: ModelRow[] = [
11571157
prompt_cache_read_token: 2e-7, // $0.2/1M tokens
11581158
},
11591159
},
1160+
{
1161+
model: {
1162+
operator: "equals",
1163+
value: "google/gemini-3.1-pro-preview",
1164+
},
1165+
cost: {
1166+
prompt_token: 2.11e-6, // $2.11/1M tokens (OpenRouter markup)
1167+
completion_token: 1.266e-5, // $12.66/1M tokens
1168+
prompt_cache_read_token: 2.11e-7, // $0.211/1M tokens
1169+
},
1170+
},
11601171
{
11611172
model: {
11621173
operator: "equals",

0 commit comments

Comments
 (0)