Skip to content

Conversation

@shaper
Copy link
Collaborator

@shaper shaper commented Nov 28, 2025

Background

The OpenAI Images API returns useful metadata about each request in the response. Callers may want to use this data for purposes like cost computation.

Reference: https://platform.openai.com/docs/pricing#image-generation

To compute the cost for an image generation a caller has to know:

  • model
  • image quality
  • image dimensions

Summary

Parse additional detail from OpenAI API response and include in provider response metadata.

Manual Verification

Ran example scripts for openai.

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Copy link
Collaborator Author

shaper commented Nov 28, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@shaper shaper force-pushed the 11-28-feat_provider_openai_include_more_image_generation_response_metadata branch from c8a3892 to 0941ebd Compare November 28, 2025 23:31
@shaper shaper force-pushed the 11-28-feat_provider_openai_include_more_image_generation_response_metadata branch from 0941ebd to d5c2e46 Compare November 28, 2025 23:50
@shaper shaper marked this pull request as ready for review November 29, 2025 00:06
Copy link
Contributor

@aayush-kapoor aayush-kapoor left a comment

Choose a reason for hiding this comment

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

verified the changes 👍 thanks

@shaper shaper force-pushed the 11-28-feat_provider_openai_include_more_image_generation_response_metadata branch from 88e0a71 to ce4eaeb Compare December 2, 2025 04:18
@shaper shaper force-pushed the 11-28-feat_provider_openai_include_more_image_generation_response_metadata branch from ce4eaeb to bc9187a Compare December 2, 2025 04:44
@shaper shaper merged commit 88edc28 into main Dec 2, 2025
19 checks passed
@shaper shaper deleted the 11-28-feat_provider_openai_include_more_image_generation_response_metadata branch December 2, 2025 04:56
@shaper shaper added the backport label Dec 2, 2025
vercel-ai-sdk bot pushed a commit that referenced this pull request Dec 2, 2025
@vercel-ai-sdk vercel-ai-sdk bot removed the backport label Dec 2, 2025
@vercel-ai-sdk
Copy link
Contributor

vercel-ai-sdk bot commented Dec 2, 2025

⚠️ Backport to release-v5.0 created but has conflicts: #10783

shaper added a commit that referenced this pull request Dec 2, 2025
…nse metadata (#10783)

This is an automated backport of #10698 to the release-v5.0 branch. FYI
@shaper

---------

Co-authored-by: Walter Korman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants