@ai-sdk/openai 3.0.0-beta.56 → 3.0.0-beta.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.0-beta.57
4
+
5
+ ### Patch Changes
6
+
7
+ - b681d7d: feat: expose usage tokens for 'generateImage' function
8
+ - Updated dependencies [b681d7d]
9
+ - @ai-sdk/provider@3.0.0-beta.16
10
+ - @ai-sdk/provider-utils@4.0.0-beta.33
11
+
3
12
  ## 3.0.0-beta.56
4
13
 
5
14
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1633,7 +1633,16 @@ var openaiImageResponseSchema = (0, import_provider_utils12.lazySchema)(
1633
1633
  b64_json: import_v48.z.string(),
1634
1634
  revised_prompt: import_v48.z.string().nullish()
1635
1635
  })
1636
- )
1636
+ ),
1637
+ usage: import_v48.z.object({
1638
+ input_tokens: import_v48.z.number().nullish(),
1639
+ output_tokens: import_v48.z.number().nullish(),
1640
+ total_tokens: import_v48.z.number().nullish(),
1641
+ input_tokens_details: import_v48.z.object({
1642
+ image_tokens: import_v48.z.number().nullish(),
1643
+ text_tokens: import_v48.z.number().nullish()
1644
+ }).nullish()
1645
+ }).nullish()
1637
1646
  })
1638
1647
  )
1639
1648
  );
@@ -1674,7 +1683,7 @@ var OpenAIImageModel = class {
1674
1683
  headers,
1675
1684
  abortSignal
1676
1685
  }) {
1677
- var _a, _b, _c, _d;
1686
+ var _a, _b, _c, _d, _e, _f, _g;
1678
1687
  const warnings = [];
1679
1688
  if (aspectRatio != null) {
1680
1689
  warnings.push({
@@ -1711,6 +1720,11 @@ var OpenAIImageModel = class {
1711
1720
  return {
1712
1721
  images: response.data.map((item) => item.b64_json),
1713
1722
  warnings,
1723
+ usage: response.usage != null ? {
1724
+ inputTokens: (_e = response.usage.input_tokens) != null ? _e : void 0,
1725
+ outputTokens: (_f = response.usage.output_tokens) != null ? _f : void 0,
1726
+ totalTokens: (_g = response.usage.total_tokens) != null ? _g : void 0
1727
+ } : void 0,
1714
1728
  response: {
1715
1729
  timestamp: currentDate,
1716
1730
  modelId: this.modelId,
@@ -4923,7 +4937,7 @@ var OpenAITranscriptionModel = class {
4923
4937
  };
4924
4938
 
4925
4939
  // src/version.ts
4926
- var VERSION = true ? "3.0.0-beta.56" : "0.0.0-test";
4940
+ var VERSION = true ? "3.0.0-beta.57" : "0.0.0-test";
4927
4941
 
4928
4942
  // src/openai-provider.ts
4929
4943
  function createOpenAI(options = {}) {