Skip to content

feat(cost): add gemini-3.1-flash-image-preview pricing#5617

Open
nspady wants to merge 2 commits intoHelicone:mainfrom
nspady:feat/add-gemini-3.1-flash-image-preview-cost
Open

feat(cost): add gemini-3.1-flash-image-preview pricing#5617
nspady wants to merge 2 commits intoHelicone:mainfrom
nspady:feat/add-gemini-3.1-flash-image-preview-cost

Conversation

@nspady
Copy link
Copy Markdown

@nspady nspady commented Mar 2, 2026

Summary

Adds cost tracking for Google's Gemini 3.1 Flash Image Preview model (gemini-3.1-flash-image-preview) across both the legacy cost system and the new model registry.

Pricing per Google AI Developer docs:

Token Type Price per 1M Tokens
Input (text/image) $0.25
Text output $1.50
Image output $60.00

Changes

1. Legacy cost entry (providers/google/index.ts)

Added ModelRow with text token rates (consistent with existing image models like gemini-2.5-flash-image).

2. New model registry (models/authors/google/gemini-3.1-flash-image-preview/)

  • model.ts — Model config with text+image input/output modality
  • endpoints.ts — Three provider endpoints (google-ai-studio, vertex, openrouter) with proper image.output pricing using the ModalityPricing interface
  • index.ts — Registered in the Google author aggregation

The new registry correctly captures the $60/1M image output rate via the image.output field, matching the pattern established by gemini-3-pro-image in #5496.

Pricing Details

Endpoint Text Input Text Output Image Output Notes
google-ai-studio $0.25/1M $1.50/1M $60/1M Direct Google pricing
vertex $0.25/1M $1.50/1M $60/1M Same pricing, cross-region enabled
openrouter $0.264/1M $1.583/1M $63.30/1M 5.5% markup applied

Add cost entry for Google's Gemini 3.1 Flash Image Preview model.

Pricing per Google AI Developer docs (https://ai.google.dev/gemini-api/docs/pricing):
- Input: $0.25/1M tokens
- Text output: $1.50/1M tokens
- Image output: $60.00/1M tokens (not representable in current cost model)

Note: The completion_token rate uses the text output price ($1.50/1M).
Image output tokens are priced at $60/1M by Google, but the current
ModelRow interface has a single completion_token rate. This means image
generation costs will be underestimated. A future enhancement to support
separate image_output_token pricing would improve accuracy for image
generation models.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 2, 2026

@nspady is attempting to deploy a commit to the Helicone Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Add full model registry entry with proper image output pricing:

- model.ts: Model config with text+image input/output modality
- endpoints.ts: google-ai-studio, vertex, and openrouter endpoints
  with separate image pricing using the ModalityPricing interface

Pricing per Google AI Developer docs:
- Input: $0.25/1M tokens
- Text output: $1.50/1M tokens
- Image output: $60.00/1M tokens ($0.067 per 1K image at 1120 tokens)

The new registry's image.output field correctly captures the $60/1M
image output rate, unlike the legacy providers/ entry which can only
use a single completion_token rate.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant