Skip to content

Conversation

@Trynax
Copy link
Contributor

@Trynax Trynax commented Nov 4, 2025

fixes #661

Changes:

  • Check tool.model field in calculateToolCost() to detect Gemini models
  • Apply flat $0.039 per image pricing for Gemini models (gemini-2.5-flash-image, gemini-2.0-flash, etc.) per Google's pricing
  • Added GeminiImageGenerationPricing type and pricing constant to SDK

@vercel
Copy link
Contributor

vercel bot commented Nov 4, 2025

@Trynax is attempting to deploy a commit to the Merit Systems Team on Vercel.

A member of the Team first needs to authorize it.


switch (tool.type) {
case 'image_generation': {
const model = (tool as any).model;
Copy link
Contributor

Choose a reason for hiding this comment

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

pretty sure this does not exist here.

const toolPricing = SupportedOpenAIResponseToolPricing;

switch (tool.type) {
case 'image_generation': {
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't think that gemini returns the same types for tools image_generation tool is an open ai specific concept. we need to split out the Tool processing for each provider (just openai + gemini for now)

Copy link
Contributor

Have you been able to verify this? What has been your testing strategy?

@Trynax
Copy link
Contributor Author

Trynax commented Nov 13, 2025

Have you been able to verify this? What has been your testing strategy?

Yoo @rsproule just added a test that i ran locally.

strategy is:
Integration test (gemini-generate-image.test.ts) that prove image generation and pricing
Tested it locally against Echo server with logs to confirm the pricing ($0.039) per image is correctly charged

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.

Gemini-Flash-Image Toolcall Pricing

2 participants