@ai-sdk/google 4.0.85 → 4.0.87

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.
@@ -727,7 +727,7 @@ With the URL context tool, you will also get the `groundingMetadata`.
727
727
  "groundingChunkIndices": [
728
728
  0
729
729
  ]
730
- },
730
+ }
731
731
  ]
732
732
  }
733
733
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google",
3
- "version": "4.0.85",
3
+ "version": "4.0.87",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -35,14 +35,14 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@ai-sdk/provider": "4.0.19",
39
- "@ai-sdk/provider-utils": "5.0.51"
38
+ "@ai-sdk/provider": "4.0.21",
39
+ "@ai-sdk/provider-utils": "5.0.53"
40
40
  },
41
41
  "devDependencies": {
42
- "@ai-sdk/test-server": "2.0.2",
42
+ "@ai-sdk/test-server": "2.0.3",
43
43
  "@types/node": "22.19.19",
44
44
  "@vercel/ai-tsconfig": "0.0.0",
45
- "tsup": "^8.5.1",
45
+ "tsdown": "^0.23.0",
46
46
  "typescript": "5.8.3",
47
47
  "zod": "3.25.76"
48
48
  },
@@ -69,9 +69,9 @@
69
69
  "ai"
70
70
  ],
71
71
  "scripts": {
72
- "build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
73
- "build:watch": "pnpm clean && tsup --watch",
74
- "clean": "del-cli dist docs *.tsbuildinfo",
72
+ "build": "pnpm clean && tsdown",
73
+ "build:watch": "pnpm clean && tsdown --watch",
74
+ "clean": "del-cli docs *.tsbuildinfo",
75
75
  "type-check": "tsc --build",
76
76
  "test": "pnpm test:node && pnpm test:edge",
77
77
  "test:update": "pnpm test:node -u",
@@ -32,6 +32,7 @@ export const googleSpeechResponseSchema = lazySchema(() =>
32
32
  }),
33
33
  )
34
34
  .nullish(),
35
+ usageMetadata: z.record(z.string(), z.json()).nullish(),
35
36
  }),
36
37
  ),
37
38
  );
@@ -353,6 +353,9 @@ export class GoogleSpeechModel implements SpeechModelV4 {
353
353
  return {
354
354
  audio,
355
355
  warnings,
356
+ ...(response.usageMetadata != null && {
357
+ usage: response.usageMetadata,
358
+ }),
356
359
  request: {
357
360
  body: JSON.stringify(requestBody),
358
361
  },
@@ -217,6 +217,7 @@ export class GoogleTranscriptionModel implements TranscriptionModelV4 {
217
217
  language: undefined,
218
218
  durationInSeconds: undefined,
219
219
  warnings,
220
+ ...(response.usage != null && { usage: response.usage }),
220
221
  response: {
221
222
  timestamp: currentDate,
222
223
  modelId: this.modelId,
@@ -226,7 +227,7 @@ export class GoogleTranscriptionModel implements TranscriptionModelV4 {
226
227
  ...(response.usage != null
227
228
  ? {
228
229
  providerMetadata: {
229
- google: { usage: response.usage as JSONObject },
230
+ google: { usage: response.usage },
230
231
  },
231
232
  }
232
233
  : {}),
@@ -434,6 +435,7 @@ function createGoogleLiveTranscriptionStream({
434
435
  segments: [],
435
436
  language,
436
437
  durationInSeconds: undefined,
438
+ usage: usageMetadata,
437
439
  ...(usageMetadata != null
438
440
  ? { providerMetadata: { google: { usageMetadata } } }
439
441
  : {}),
@@ -710,5 +712,5 @@ const googleInteractionsTranscriptionResponseSchema = z.object({
710
712
  }),
711
713
  )
712
714
  .nullish(),
713
- usage: z.record(z.string(), z.unknown()).nullish(),
715
+ usage: z.record(z.string(), z.json()).nullish(),
714
716
  });