diff --git a/packages/cost/models/authors/google/gemini-3.1-flash-image-preview/endpoints.ts b/packages/cost/models/authors/google/gemini-3.1-flash-image-preview/endpoints.ts new file mode 100644 index 0000000000..3eab5e2185 --- /dev/null +++ b/packages/cost/models/authors/google/gemini-3.1-flash-image-preview/endpoints.ts @@ -0,0 +1,110 @@ +import { ModelProviderName } from "../../../providers"; +import type { ModelProviderConfig } from "../../../types"; +import { Gemini31FlashImagePreviewModelName } from "./model"; + +export const endpoints = { + "gemini-3.1-flash-image-preview:google-ai-studio": { + providerModelId: "gemini-3.1-flash-image-preview", + provider: "google-ai-studio", + author: "google", + pricing: [ + { + threshold: 0, + input: 0.00000025, // $0.25/1M tokens + output: 0.0000015, // $1.50/1M tokens (text output) + image: { + input: 0.00000025, // $0.25/1M tokens for image input (same as text) + output: 0.00006, // $60/1M tokens for image output ($0.067 per 1K image) + }, + }, + ], + contextLength: 65_536, + maxCompletionTokens: 32_768, + supportedParameters: [ + "max_tokens", + "response_format", + "seed", + "stop", + "temperature", + "top_p", + ], + rateLimits: { + rpm: 100, + tpm: 1_000_000, + }, + ptbEnabled: true, + responseFormat: "GOOGLE", + endpointConfigs: { + "*": {}, + }, + }, + "gemini-3.1-flash-image-preview:vertex": { + providerModelId: "gemini-3.1-flash-image-preview", + provider: "vertex", + author: "google", + crossRegion: true, + pricing: [ + { + threshold: 0, + input: 0.00000025, // $0.25/1M tokens + output: 0.0000015, // $1.50/1M tokens (text output) + image: { + input: 0.00000025, // $0.25/1M tokens for image input (same as text) + output: 0.00006, // $60/1M tokens for image output + }, + }, + ], + contextLength: 65_536, + maxCompletionTokens: 32_768, + supportedParameters: [ + "max_tokens", + "response_format", + "seed", + "stop", + "temperature", + "top_p", + ], + responseFormat: "GOOGLE", + ptbEnabled: true, + endpointConfigs: { + global: { + providerModelId: "gemini-3.1-flash-image-preview", + }, + }, + }, + "gemini-3.1-flash-image-preview:openrouter": { + provider: "openrouter", + author: "google", + providerModelId: "google/gemini-3.1-flash-image-preview", + pricing: [ + { + threshold: 0, + input: 0.000000264, // $0.264/1M - $0.25/1M * 1.055 (OpenRouter 5.5% markup) + output: 0.000001583, // $1.583/1M - $1.50/1M * 1.055 + image: { + input: 0.000000264, // $0.264/1M for image input (with markup) + output: 0.0000633, // $63.30/1M - $60/1M * 1.055 for image output + }, + }, + ], + contextLength: 65_536, + maxCompletionTokens: 32_768, + supportedParameters: [ + "max_tokens", + "response_format", + "seed", + "stop", + "temperature", + "top_p", + ], + ptbEnabled: true, + endpointConfigs: { + "*": {}, + }, + }, +} satisfies Partial< + Record< + `${Gemini31FlashImagePreviewModelName}:${ModelProviderName}`, + ModelProviderConfig + > +>; diff --git a/packages/cost/models/authors/google/gemini-3.1-flash-image-preview/model.ts b/packages/cost/models/authors/google/gemini-3.1-flash-image-preview/model.ts new file mode 100644 index 0000000000..518f495c27 --- /dev/null +++ b/packages/cost/models/authors/google/gemini-3.1-flash-image-preview/model.ts @@ -0,0 +1,17 @@ +import { ModelConfig } from "../../../types"; + +export const model = { + "gemini-3.1-flash-image-preview": { + name: "Google Gemini 3.1 Flash Image Preview", + author: "google", + description: + "Gemini 3.1 Flash Image is Google's fast and cost-effective image generation model. It supports text and image inputs with text and image outputs, optimized for high-throughput image generation at lower cost than Gemini 3 Pro Image. This preview version supports native image generation with token-based pricing.", + contextLength: 65_536, + maxOutputTokens: 32_768, + created: "2026-01-15T00:00:00", + modality: { inputs: ["text", "image"], outputs: ["text", "image"] }, + tokenizer: "Gemini", + }, +} satisfies Record; + +export type Gemini31FlashImagePreviewModelName = keyof typeof model; diff --git a/packages/cost/models/authors/google/index.ts b/packages/cost/models/authors/google/index.ts index a929f641b2..c009ff2506 100644 --- a/packages/cost/models/authors/google/index.ts +++ b/packages/cost/models/authors/google/index.ts @@ -19,6 +19,8 @@ import { model as gemini3FlashPreviewModel } from "./gemini-3-flash-preview/mode import { endpoints as gemini3FlashPreviewEndpoints } from "./gemini-3-flash-preview/endpoints"; import { model as gemini3ProImagePreviewModel } from "./gemini-3-pro-image/model"; import { endpoints as gemini3ProImagePreviewEndpoints } from "./gemini-3-pro-image/endpoints"; +import { model as gemini31FlashImagePreviewModel } from "./gemini-3.1-flash-image-preview/model"; +import { endpoints as gemini31FlashImagePreviewEndpoints } from "./gemini-3.1-flash-image-preview/endpoints"; import { model as gemma29bModel } from "./gemma/model"; import { endpoints as gemma29bEndpoints } from "./gemma/endpoints"; import { model as gemma3Model } from "./gemma-3/model"; @@ -34,6 +36,7 @@ export const googleModels = { ...gemini31ProPreviewModel, ...gemini3FlashPreviewModel, ...gemini3ProImagePreviewModel, + ...gemini31FlashImagePreviewModel, ...gemma29bModel, ...gemma3Model, } satisfies Record; @@ -47,6 +50,7 @@ export const googleEndpointConfig = { ...gemini31ProPreviewEndpoints, ...gemini3FlashPreviewEndpoints, ...gemini3ProImagePreviewEndpoints, + ...gemini31FlashImagePreviewEndpoints, ...gemma29bEndpoints, ...gemma3Endpoints, } satisfies Record; diff --git a/packages/cost/providers/google/index.ts b/packages/cost/providers/google/index.ts index 9be2b5a81b..40e89760ef 100644 --- a/packages/cost/providers/google/index.ts +++ b/packages/cost/providers/google/index.ts @@ -263,6 +263,16 @@ export const costs: ModelRow[] = [ prompt_cache_read_token: 0.0000002, // $0.20/1M = 10% of input }, }, + { + model: { + operator: "includes", + value: "gemini-3.1-flash-image-preview", + }, + cost: { + prompt_token: 0.00000025, // $0.25/1M tokens + completion_token: 0.0000015, // $1.50/1M tokens (text output) + }, + }, ]; export const modelDetails: ModelDetailsMap = {