Skip to content

Gemini 2.5 Flash ▶

Overview

This repository uses the record name gemini-2.5-flash for image generation, while Google’s current official documentation presents the image-capable product as Gemini 2.5 Flash Image, also called Nano Banana. Google positions it as the fast, high-throughput option for conversational image generation and editing, with native multimodal handling of text and reference images. For portal documentation, the important point is that it behaves less like a narrow image endpoint and more like a creative multimodal model that can iteratively refine results.

Status

▶ Active

API base URL

https://generativelanguage.googleapis.com/v1beta

Example payload

{
  "model": "gemini-2.5-flash",
  "contents": [
    {
      "text": "Generate a polished product visual with soft studio lighting"
    }
  ],
  "config": {
    "imageConfig": {
      "aspectRatio": "1:1",
      "imageSize": "1K",
      "enhancePrompt": false
    }
  }
}

Our Current Pricing

Gemini image billing is hybrid. The preferred path is token-based when the provider returns token counts, but the code also carries fallback per-image amounts for cases where output token data is missing.

Implemented pricing key for this model family: gemini-2.5-flash-image.

input_price_per_1m_tokens  = 0.30 USD
output_price_per_1m_tokens = 30.00 USD

Preferred formula:

cost_usd =
  (tokens_out * output_price_per_1m_tokens / 1_000_000) +
  (tokens_in  * input_price_per_1m_tokens  / 1_000_000)

Fallback behavior applies only when tokensOut is absent or zero. No explicit size-specific fallback rows are listed beyond the default fallback. If the pricing key itself is unknown, the final defensive fallback is 0.0025 USD. Final rounding is to 6 decimal places.

The practical billing rule is straightforward. First try to read the usage object and compute cost from tokensIn and tokensOut. If usage is missing, look up the output size you requested or inferred and charge the fallback image amount. That dual strategy is useful because Gemini image responses can be metered precisely when usage is present, but your product still needs a deterministic amount when it is not.

Sources