Skip to content

Commit 8772988

Browse files
feat: add gemini-3-flash-preview to cost registry (#5424)
* feat: add gemini-3-flash-preview to cost registry Add pricing for gemini-3-flash-preview model with support for Google AI Studio, Vertex AI, and OpenRouter providers. Pricing: - Input: $0.50/1M tokens - Cached input: $0.05/1M tokens (10% of input) - Output: $3/1M tokens - Audio input: $1/1M tokens - Cached audio input: $0.10/1M tokens (10% of audio input) * feat: add gemini-3-flash-preview to legacy cost registry - Add model pricing to legacy providers/google/index.ts - Update test snapshots to include new model - Fix jest config to work without preset - Add jest dependencies to root package.json Pricing: - Input: $0.50/1M tokens - Cached input: $0.05/1M tokens - Output: $3/1M tokens * chore: revert changes to yarn.lock, package.json, and jest.config.ts * fix --------- Co-authored-by: replicas-connector[bot] <replicas-connector[bot]@users.noreply.github.com> Co-authored-by: connortbot <loiconnor8@gmail.com>
1 parent c174403 commit 8772988

File tree

5 files changed

+281
-6
lines changed

5 files changed

+281
-6
lines changed

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

Lines changed: 128 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,6 +2323,77 @@ exports[`Registry Snapshots endpoint configurations snapshot 1`] = `
23232323
],
23242324
},
23252325
},
2326+
"google/gemini-3-flash-preview": {
2327+
"gemini-3-flash-preview:google-ai-studio": {
2328+
"context": 1048576,
2329+
"crossRegion": false,
2330+
"maxTokens": 65536,
2331+
"modelId": "gemini-3-flash-preview",
2332+
"parameters": [
2333+
"include_reasoning",
2334+
"max_tokens",
2335+
"reasoning",
2336+
"response_format",
2337+
"seed",
2338+
"stop",
2339+
"structured_outputs",
2340+
"temperature",
2341+
"tool_choice",
2342+
"tools",
2343+
"top_p",
2344+
],
2345+
"provider": "google-ai-studio",
2346+
"ptbEnabled": true,
2347+
"regions": [
2348+
"*",
2349+
],
2350+
},
2351+
"gemini-3-flash-preview:openrouter": {
2352+
"context": 1048576,
2353+
"crossRegion": false,
2354+
"maxTokens": 65536,
2355+
"modelId": "google/gemini-3-flash-preview",
2356+
"parameters": [
2357+
"max_tokens",
2358+
"response_format",
2359+
"seed",
2360+
"stop",
2361+
"temperature",
2362+
"tool_choice",
2363+
"tools",
2364+
"top_p",
2365+
],
2366+
"provider": "openrouter",
2367+
"ptbEnabled": true,
2368+
"regions": [
2369+
"*",
2370+
],
2371+
},
2372+
"gemini-3-flash-preview:vertex": {
2373+
"context": 1048576,
2374+
"crossRegion": true,
2375+
"maxTokens": 65536,
2376+
"modelId": "gemini-3-flash-preview",
2377+
"parameters": [
2378+
"include_reasoning",
2379+
"max_tokens",
2380+
"reasoning",
2381+
"response_format",
2382+
"seed",
2383+
"stop",
2384+
"structured_outputs",
2385+
"temperature",
2386+
"tool_choice",
2387+
"tools",
2388+
"top_p",
2389+
],
2390+
"provider": "vertex",
2391+
"ptbEnabled": true,
2392+
"regions": [
2393+
"global",
2394+
],
2395+
},
2396+
},
23262397
"google/gemini-3-pro-image": {
23272398
"gemini-3-pro-image-preview:google-ai-studio": {
23282399
"context": 65536,
@@ -5934,6 +6005,11 @@ exports[`Registry Snapshots model coverage snapshot 1`] = `
59346005
"openrouter",
59356006
"vertex",
59366007
],
6008+
"google/gemini-3-flash-preview": [
6009+
"google-ai-studio",
6010+
"openrouter",
6011+
"vertex",
6012+
],
59376013
"google/gemini-3-pro-image": [
59386014
"google-ai-studio",
59396015
"openrouter",
@@ -7286,6 +7362,43 @@ exports[`Registry Snapshots pricing snapshot 1`] = `
72867362
},
72877363
],
72887364
},
7365+
"google/gemini-3-flash-preview": {
7366+
"google-ai-studio": [
7367+
{
7368+
"audio": {
7369+
"cachedInputMultiplier": 0.1,
7370+
"input": 0.000001,
7371+
},
7372+
"cacheMultipliers": {
7373+
"cachedInput": 0.1,
7374+
},
7375+
"input": 5e-7,
7376+
"output": 0.000003,
7377+
"threshold": 0,
7378+
},
7379+
],
7380+
"openrouter": [
7381+
{
7382+
"input": 5.2775e-7,
7383+
"output": 0.000003165,
7384+
"threshold": 0,
7385+
},
7386+
],
7387+
"vertex": [
7388+
{
7389+
"audio": {
7390+
"cachedInputMultiplier": 0.1,
7391+
"input": 0.000001,
7392+
},
7393+
"cacheMultipliers": {
7394+
"cachedInput": 0.1,
7395+
},
7396+
"input": 5e-7,
7397+
"output": 0.000003,
7398+
"threshold": 0,
7399+
},
7400+
],
7401+
},
72897402
"google/gemini-3-pro-image": {
72907403
"google-ai-studio": [
72917404
{
@@ -8075,6 +8188,14 @@ exports[`Registry Snapshots verify registry state 1`] = `
80758188
"vertex",
80768189
],
80778190
},
8191+
{
8192+
"model": "gemini-3-flash-preview",
8193+
"providers": [
8194+
"google-ai-studio",
8195+
"openrouter",
8196+
"vertex",
8197+
],
8198+
},
80788199
{
80798200
"model": "gemini-3-pro-image-preview",
80808201
"providers": [
@@ -8632,7 +8753,7 @@ exports[`Registry Snapshots verify registry state 1`] = `
86328753
"provider": "fireworks",
86338754
},
86348755
{
8635-
"modelCount": 5,
8756+
"modelCount": 6,
86368757
"provider": "google-ai-studio",
86378758
},
86388759
{
@@ -8660,15 +8781,15 @@ exports[`Registry Snapshots verify registry state 1`] = `
86608781
"provider": "openai",
86618782
},
86628783
{
8663-
"modelCount": 59,
8784+
"modelCount": 60,
86648785
"provider": "openrouter",
86658786
},
86668787
{
86678788
"modelCount": 5,
86688789
"provider": "perplexity",
86698790
},
86708791
{
8671-
"modelCount": 17,
8792+
"modelCount": 18,
86728793
"provider": "vertex",
86738794
},
86748795
{
@@ -8702,6 +8823,7 @@ exports[`Registry Snapshots verify registry state 1`] = `
87028823
"gemini-2.5-flash",
87038824
"gemini-2.5-flash-lite",
87048825
"gemini-2.5-pro",
8826+
"gemini-3-flash-preview",
87058827
"gemini-3-pro-image-preview",
87068828
"gemini-3-pro-preview",
87078829
"gemma-3-12b-it",
@@ -8782,9 +8904,9 @@ exports[`Registry Snapshots verify registry state 1`] = `
87828904
"claude-3.5-haiku:anthropic:*",
87838905
],
87848906
"totalArchivedConfigs": 0,
8785-
"totalEndpoints": 257,
8786-
"totalModelProviderConfigs": 257,
8787-
"totalModelsWithPtb": 95,
8907+
"totalEndpoints": 259,
8908+
"totalModelProviderConfigs": 259,
8909+
"totalModelsWithPtb": 96,
87888910
"totalProviders": 21,
87898911
}
87908912
`;
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import { ModelProviderName } from "../../../providers";
2+
import type { ModelProviderConfig } from "../../../types";
3+
import { Gemini3FlashPreviewModelName } from "./model";
4+
5+
export const endpoints = {
6+
"gemini-3-flash-preview:google-ai-studio": {
7+
providerModelId: "gemini-3-flash-preview",
8+
provider: "google-ai-studio",
9+
author: "google",
10+
pricing: [
11+
{
12+
threshold: 0,
13+
input: 0.0000005, // $0.50/1M tokens
14+
output: 0.000003, // $3/1M tokens
15+
cacheMultipliers: {
16+
cachedInput: 0.1, // $0.05/1M = 10% of input
17+
},
18+
audio: {
19+
input: 0.000001, // $1/1M audio tokens
20+
cachedInputMultiplier: 0.1, // $0.10/1M = 10% of audio input
21+
},
22+
},
23+
],
24+
contextLength: 1_048_576,
25+
maxCompletionTokens: 65_536,
26+
supportedParameters: [
27+
"include_reasoning",
28+
"max_tokens",
29+
"reasoning",
30+
"response_format",
31+
"seed",
32+
"stop",
33+
"structured_outputs",
34+
"temperature",
35+
"tool_choice",
36+
"tools",
37+
"top_p",
38+
],
39+
rateLimits: {
40+
rpm: 2_000,
41+
tpm: 8_000_000,
42+
},
43+
ptbEnabled: true,
44+
responseFormat: "GOOGLE",
45+
endpointConfigs: {
46+
"*": {},
47+
},
48+
},
49+
"gemini-3-flash-preview:vertex": {
50+
providerModelId: "gemini-3-flash-preview",
51+
provider: "vertex",
52+
author: "google",
53+
crossRegion: true,
54+
pricing: [
55+
{
56+
threshold: 0,
57+
input: 0.0000005, // $0.50/1M tokens
58+
output: 0.000003, // $3/1M tokens
59+
cacheMultipliers: {
60+
cachedInput: 0.1, // $0.05/1M = 10% of input
61+
},
62+
audio: {
63+
input: 0.000001, // $1/1M audio tokens
64+
cachedInputMultiplier: 0.1, // $0.10/1M = 10% of audio input
65+
},
66+
},
67+
],
68+
contextLength: 1_048_576,
69+
maxCompletionTokens: 65_536,
70+
supportedParameters: [
71+
"include_reasoning",
72+
"max_tokens",
73+
"reasoning",
74+
"response_format",
75+
"seed",
76+
"stop",
77+
"structured_outputs",
78+
"temperature",
79+
"tool_choice",
80+
"tools",
81+
"top_p",
82+
],
83+
responseFormat: "GOOGLE",
84+
ptbEnabled: true,
85+
endpointConfigs: {
86+
global: {
87+
providerModelId: "gemini-3-flash-preview",
88+
},
89+
},
90+
},
91+
"gemini-3-flash-preview:openrouter": {
92+
provider: "openrouter",
93+
author: "google",
94+
providerModelId: "google/gemini-3-flash-preview",
95+
pricing: [
96+
{
97+
threshold: 0,
98+
input: 0.0000005275, // $0.5275/1M - $0.50/1M * 1.055
99+
output: 0.000003165, // $3.165/1M - $3.00/1M * 1.055
100+
},
101+
],
102+
contextLength: 1_048_576,
103+
maxCompletionTokens: 65_536,
104+
supportedParameters: [
105+
"max_tokens",
106+
"response_format",
107+
"seed",
108+
"stop",
109+
"temperature",
110+
"tool_choice",
111+
"tools",
112+
"top_p",
113+
],
114+
ptbEnabled: true,
115+
endpointConfigs: {
116+
"*": {},
117+
},
118+
},
119+
} satisfies Partial<
120+
Record<`${Gemini3FlashPreviewModelName}:${ModelProviderName}`, ModelProviderConfig>
121+
>;
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-flash-preview": {
5+
name: "Google Gemini 3 Flash Preview",
6+
author: "google",
7+
description:
8+
"Gemini 3 Flash Preview is Google's latest fast and efficient AI model optimized for quick response times while maintaining high quality. This preview version offers excellent performance for everyday tasks including text generation, code assistance, and multimodal understanding at a lower cost than Pro variants.",
9+
contextLength: 1_048_576,
10+
maxOutputTokens: 65_536,
11+
created: "2025-12-17T00:00:00",
12+
modality: { inputs: ["text", "image", "audio", "video"], outputs: ["text"] },
13+
tokenizer: "Gemini",
14+
},
15+
} satisfies Record<string, ModelConfig>;
16+
17+
export type Gemini3FlashPreviewModelName = keyof typeof model;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { model as gemini25FlashLiteModel } from "./gemini-2.5-flash-lite/model";
1111
import { endpoints as gemini25FlashLiteEndpoints } from "./gemini-2.5-flash-lite/endpoints";
1212
import { model as gemini3ProPreviewModel } from "./gemini-3/model";
1313
import { endpoints as gemini3ProPreviewEndpoints } from "./gemini-3/endpoints";
14+
import { model as gemini3FlashPreviewModel } from "./gemini-3-flash-preview/model";
15+
import { endpoints as gemini3FlashPreviewEndpoints } from "./gemini-3-flash-preview/endpoints";
1416
import { model as gemini3ProImagePreviewModel } from "./gemini-3-pro-image/model";
1517
import { endpoints as gemini3ProImagePreviewEndpoints } from "./gemini-3-pro-image/endpoints";
1618
import { model as gemma29bModel } from "./gemma/model";
@@ -24,6 +26,7 @@ export const googleModels = {
2426
...gemini25FlashModel,
2527
...gemini25FlashLiteModel,
2628
...gemini3ProPreviewModel,
29+
...gemini3FlashPreviewModel,
2730
...gemini3ProImagePreviewModel,
2831
...gemma29bModel,
2932
...gemma3Model,
@@ -34,6 +37,7 @@ export const googleEndpointConfig = {
3437
...gemini25FlashEndpoints,
3538
...gemini25FlashLiteEndpoints,
3639
...gemini3ProPreviewEndpoints,
40+
...gemini3FlashPreviewEndpoints,
3741
...gemini3ProImagePreviewEndpoints,
3842
...gemma29bEndpoints,
3943
...gemma3Endpoints,

packages/cost/providers/google/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,17 @@ export const costs: ModelRow[] = [
219219
prompt_cache_read_token: 0.0000002,
220220
},
221221
},
222+
{
223+
model: {
224+
operator: "includes",
225+
value: "gemini-3-flash-preview",
226+
},
227+
cost: {
228+
prompt_token: 0.0000005,
229+
completion_token: 0.000003,
230+
prompt_cache_read_token: 0.00000005,
231+
},
232+
},
222233
];
223234

224235
export const modelDetails: ModelDetailsMap = {

0 commit comments

Comments
 (0)