@ai-sdk/google 3.0.75 → 3.0.78

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,30 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.78
4
+
5
+ ### Patch Changes
6
+
7
+ - cf63828: fix(google): read `serviceTier` from `usageMetadata.serviceTier` in both generate and stream paths
8
+
9
+ The previous implementation read `serviceTier` from the `x-gemini-service-tier`
10
+ response header, which is only populated on non-streaming responses. Gemini
11
+ streaming includes the value in `usageMetadata.serviceTier` on every chunk, so
12
+ `providerMetadata.google.serviceTier` was always `null` for streams. Read from
13
+ `usageMetadata` for both paths instead.
14
+
15
+ ## 3.0.77
16
+
17
+ ### Patch Changes
18
+
19
+ - 0f9f9bf: feat(google): read `serviceTier` from `x-gemini-service-tier` response header in Gemini API and use PayGo for Vertex
20
+
21
+ ## 3.0.76
22
+
23
+ ### Patch Changes
24
+
25
+ - f259bd1: fix(google): fix streaming tool call args
26
+ - 756fec1: feat(provider/google): add `gemini-3.5-flash`
27
+
3
28
  ## 3.0.75
4
29
 
5
30
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -11,7 +11,7 @@ declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
11
11
  }>;
12
12
  type GoogleErrorData = InferSchema<typeof googleErrorDataSchema>;
13
13
 
14
- type GoogleGenerativeAIModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
14
+ type GoogleGenerativeAIModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
15
15
  declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
16
16
  responseModalities?: ("TEXT" | "IMAGE")[] | undefined;
17
17
  thinkingConfig?: {
@@ -41,6 +41,8 @@ declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
41
41
  } | undefined;
42
42
  streamFunctionCallArguments?: boolean | undefined;
43
43
  serviceTier?: "standard" | "flex" | "priority" | undefined;
44
+ sharedRequestType?: "standard" | "flex" | "priority" | undefined;
45
+ requestType?: "shared" | undefined;
44
46
  }>;
45
47
  type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
46
48
 
@@ -169,6 +171,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
169
171
  candidatesTokenCount?: number | null | undefined;
170
172
  totalTokenCount?: number | null | undefined;
171
173
  trafficType?: string | null | undefined;
174
+ serviceTier?: string | null | undefined;
172
175
  promptTokensDetails?: {
173
176
  modality: string;
174
177
  tokenCount: number;
@@ -189,7 +192,6 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
189
192
  blocked?: boolean | null | undefined;
190
193
  }[] | null | undefined;
191
194
  } | null | undefined;
192
- serviceTier?: string | null | undefined;
193
195
  }>;
194
196
  type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
195
197
  type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
@@ -269,7 +271,7 @@ type GoogleVideoModelOptions = {
269
271
  * the two surfaces (`:generateContent` vs `/interactions`) are independent and
270
272
  * may diverge over time.
271
273
  */
272
- type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
274
+ type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
273
275
  /**
274
276
  * Provider-options schema for `google.interactions(...)` calls. Read from the
275
277
  * shared `providerOptions.google.*` namespace (per PRD); per-call options that
@@ -319,6 +321,29 @@ declare const googleInteractionsLanguageModelOptions: _ai_sdk_provider_utils.Laz
319
321
  signature?: string | null | undefined;
320
322
  interactionId?: string | null | undefined;
321
323
  pollingTimeoutMs?: number | null | undefined;
324
+ background?: boolean | null | undefined;
325
+ environment?: string | {
326
+ type: "remote";
327
+ sources?: ({
328
+ type: "gcs";
329
+ source: string;
330
+ target?: string | null | undefined;
331
+ } | {
332
+ type: "repository";
333
+ source: string;
334
+ target?: string | null | undefined;
335
+ } | {
336
+ type: "inline";
337
+ content: string;
338
+ target: string;
339
+ })[] | null | undefined;
340
+ network?: "disabled" | {
341
+ allowlist: {
342
+ domain: string;
343
+ transform?: Record<string, string>[] | null | undefined;
344
+ }[];
345
+ } | null | undefined;
346
+ } | null | undefined;
322
347
  }>;
323
348
  type GoogleLanguageModelInteractionsOptions = InferSchema<typeof googleInteractionsLanguageModelOptions>;
324
349
 
@@ -348,14 +373,12 @@ type GoogleInteractionsProviderMetadata = {
348
373
  * Type-only module: declares the union of supported Gemini Interactions agent
349
374
  * names. Used by the `google.interactions({ agent })` factory branch.
350
375
  *
351
- * Sourced from `googleapis/js-genai` `src/interactions/resources/interactions.ts`
352
- * (`Interaction.agent` enum). Subject to expansion as Google adds new agents.
353
- *
354
- * This is a strict string-literal union (no `string` escape hatch) so that
355
- * passing an unknown agent name is a compile-time error. Add new agents here
356
- * as Google publishes them.
376
+ * Strict string-literal union: unknown agent names are a compile-time error.
377
+ * User-defined agents (created via the `/agents` endpoint) are addressed by
378
+ * a separate `{ managedAgent: string }` factory shape — see
379
+ * `GoogleInteractionsModelInput`.
357
380
  */
358
- type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026';
381
+ type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026' | 'antigravity-preview-05-2026';
359
382
 
360
383
  declare const googleTools: {
361
384
  /**
@@ -478,11 +501,16 @@ interface GoogleGenerativeAIProvider extends ProviderV3 {
478
501
  videoModel(modelId: GoogleGenerativeAIVideoModelId): Experimental_VideoModelV3;
479
502
  /**
480
503
  * Creates a language model targeting the Gemini Interactions API
481
- * (`POST /v1beta/interactions`). Pass either a model ID (string) or
482
- * `{ agent: <name> }` to use a Gemini agent preset.
504
+ * (`POST /v1beta/interactions`). Pass:
505
+ * - a model ID (string),
506
+ * - `{ agent: <name> }` to use a known Gemini agent preset, or
507
+ * - `{ managedAgent: <name> }` to use a user-defined agent created via
508
+ * the `/v1beta/agents` endpoint.
483
509
  */
484
510
  interactions(modelIdOrAgent: GoogleInteractionsModelId | {
485
511
  agent: GoogleInteractionsAgentName;
512
+ } | {
513
+ managedAgent: string;
486
514
  }): LanguageModelV3;
487
515
  tools: typeof googleTools;
488
516
  }
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
11
11
  }>;
12
12
  type GoogleErrorData = InferSchema<typeof googleErrorDataSchema>;
13
13
 
14
- type GoogleGenerativeAIModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
14
+ type GoogleGenerativeAIModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
15
15
  declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
16
16
  responseModalities?: ("TEXT" | "IMAGE")[] | undefined;
17
17
  thinkingConfig?: {
@@ -41,6 +41,8 @@ declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
41
41
  } | undefined;
42
42
  streamFunctionCallArguments?: boolean | undefined;
43
43
  serviceTier?: "standard" | "flex" | "priority" | undefined;
44
+ sharedRequestType?: "standard" | "flex" | "priority" | undefined;
45
+ requestType?: "shared" | undefined;
44
46
  }>;
45
47
  type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
46
48
 
@@ -169,6 +171,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
169
171
  candidatesTokenCount?: number | null | undefined;
170
172
  totalTokenCount?: number | null | undefined;
171
173
  trafficType?: string | null | undefined;
174
+ serviceTier?: string | null | undefined;
172
175
  promptTokensDetails?: {
173
176
  modality: string;
174
177
  tokenCount: number;
@@ -189,7 +192,6 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
189
192
  blocked?: boolean | null | undefined;
190
193
  }[] | null | undefined;
191
194
  } | null | undefined;
192
- serviceTier?: string | null | undefined;
193
195
  }>;
194
196
  type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
195
197
  type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
@@ -269,7 +271,7 @@ type GoogleVideoModelOptions = {
269
271
  * the two surfaces (`:generateContent` vs `/interactions`) are independent and
270
272
  * may diverge over time.
271
273
  */
272
- type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
274
+ type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
273
275
  /**
274
276
  * Provider-options schema for `google.interactions(...)` calls. Read from the
275
277
  * shared `providerOptions.google.*` namespace (per PRD); per-call options that
@@ -319,6 +321,29 @@ declare const googleInteractionsLanguageModelOptions: _ai_sdk_provider_utils.Laz
319
321
  signature?: string | null | undefined;
320
322
  interactionId?: string | null | undefined;
321
323
  pollingTimeoutMs?: number | null | undefined;
324
+ background?: boolean | null | undefined;
325
+ environment?: string | {
326
+ type: "remote";
327
+ sources?: ({
328
+ type: "gcs";
329
+ source: string;
330
+ target?: string | null | undefined;
331
+ } | {
332
+ type: "repository";
333
+ source: string;
334
+ target?: string | null | undefined;
335
+ } | {
336
+ type: "inline";
337
+ content: string;
338
+ target: string;
339
+ })[] | null | undefined;
340
+ network?: "disabled" | {
341
+ allowlist: {
342
+ domain: string;
343
+ transform?: Record<string, string>[] | null | undefined;
344
+ }[];
345
+ } | null | undefined;
346
+ } | null | undefined;
322
347
  }>;
323
348
  type GoogleLanguageModelInteractionsOptions = InferSchema<typeof googleInteractionsLanguageModelOptions>;
324
349
 
@@ -348,14 +373,12 @@ type GoogleInteractionsProviderMetadata = {
348
373
  * Type-only module: declares the union of supported Gemini Interactions agent
349
374
  * names. Used by the `google.interactions({ agent })` factory branch.
350
375
  *
351
- * Sourced from `googleapis/js-genai` `src/interactions/resources/interactions.ts`
352
- * (`Interaction.agent` enum). Subject to expansion as Google adds new agents.
353
- *
354
- * This is a strict string-literal union (no `string` escape hatch) so that
355
- * passing an unknown agent name is a compile-time error. Add new agents here
356
- * as Google publishes them.
376
+ * Strict string-literal union: unknown agent names are a compile-time error.
377
+ * User-defined agents (created via the `/agents` endpoint) are addressed by
378
+ * a separate `{ managedAgent: string }` factory shape — see
379
+ * `GoogleInteractionsModelInput`.
357
380
  */
358
- type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026';
381
+ type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026' | 'antigravity-preview-05-2026';
359
382
 
360
383
  declare const googleTools: {
361
384
  /**
@@ -478,11 +501,16 @@ interface GoogleGenerativeAIProvider extends ProviderV3 {
478
501
  videoModel(modelId: GoogleGenerativeAIVideoModelId): Experimental_VideoModelV3;
479
502
  /**
480
503
  * Creates a language model targeting the Gemini Interactions API
481
- * (`POST /v1beta/interactions`). Pass either a model ID (string) or
482
- * `{ agent: <name> }` to use a Gemini agent preset.
504
+ * (`POST /v1beta/interactions`). Pass:
505
+ * - a model ID (string),
506
+ * - `{ agent: <name> }` to use a known Gemini agent preset, or
507
+ * - `{ managedAgent: <name> }` to use a user-defined agent created via
508
+ * the `/v1beta/agents` endpoint.
483
509
  */
484
510
  interactions(modelIdOrAgent: GoogleInteractionsModelId | {
485
511
  agent: GoogleInteractionsAgentName;
512
+ } | {
513
+ managedAgent: string;
486
514
  }): LanguageModelV3;
487
515
  tools: typeof googleTools;
488
516
  }