Skip to content

Improve gemini image model cost calculationΒ #2348

@reynaldichernando

Description

@reynaldichernando

right now for gemini (nano banana and nano banana pro), we only count pricing by the actual output image, however we are missing some more things

in gemini docs, they break down the pricing into input and output tokens:

input tokens:

  • the actual text prompt used to generate image
  • image input (if doing image editing/ img2img)

output tokens:

  • the actual image output (what we have right now)
  • optional reasoning token, although this is specific to gemini 3 pro image only

https://ai.google.dev/gemini-api/docs/pricing#gemini-2.5-flash-image
https://ai.google.dev/gemini-api/docs/pricing#gemini-3-pro-image-preview

note:

  • some more caveat, both these models support text output, so technically it can generate text
  • i'm not sure how our txt2img implementation would allow this, my concern is mostly if it does generate text output, and we aren't counting it towards the output tokens

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions