You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(ai, openai): expose usage tokens for 'generateImage' function (#10128)
## Background
`experimental_generateImage` doesn't expose the token usage information
returned by providers. this PR introduces token usage for OpenAI
provider
We also update the ImageProvider spec so as to allow for usage tokens
See #8358
## Summary
- create new type `ImageModelUsage`
- update openai image api response schema
- map responses to appropriate vars [`inputTokens`, `outputTokens`,
`totalTokens`]
## Manual Verification
- updated unit tests
- updated example in `examples/ai-core/generate-image/openai.ts`
- [ ] test with e2e UI example
## Checklist
- [x] 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)
## Future Work
Will need support for other providers for which we support image
generation
#10150
## Related Issues
Fixes#8358
0 commit comments