@ai-sdk/google-vertex 5.0.132 → 5.0.134

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.
@@ -1045,19 +1045,29 @@ The following Zod features are known to not work with Google Vertex:
1045
1045
 
1046
1046
  ### Model Capabilities
1047
1047
 
1048
- | Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
1049
- | ------------------------ | ----------- | ----------------- | ---------- | -------------- |
1050
- | `gemini-nano-banana-2.1` | <Check /> | <Cross /> | <Cross /> | <Cross /> |
1051
- | `gemini-4-argon` | <Check /> | <Check /> | <Check /> | <Check /> |
1052
- | `gemini-3.8-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
1053
- | `gemini-3.7-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
1054
- | `gemini-3.6-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
1055
- | `gemini-3.5-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
1056
- | `gemini-3.5-flash-lite` | <Check /> | <Check /> | <Check /> | <Check /> |
1057
- | `gemini-3-pro-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
1058
- | `gemini-2.5-pro` | <Check /> | <Check /> | <Check /> | <Check /> |
1059
- | `gemini-2.5-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
1060
- | `gemini-2.0-flash-001` | <Check /> | <Check /> | <Check /> | <Check /> |
1048
+ {/* model-capabilities:google-vertex-language:start */}
1049
+
1050
+ | Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
1051
+ | -------------------------------- | ----------- | ----------------- | ---------- | -------------- |
1052
+ | `gemini-nano-banana-2.1` | <Check /> | <Cross /> | <Cross /> | <Cross /> |
1053
+ | `gemini-4-argon` | <Check /> | <Check /> | <Check /> | <Check /> |
1054
+ | `gemini-3.8-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
1055
+ | `gemini-3.7-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
1056
+ | `gemini-3.6-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
1057
+ | `gemini-3.5-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
1058
+ | `gemini-3.5-flash-lite` | <Check /> | <Check /> | <Check /> | <Check /> |
1059
+ | `gemini-2.5-pro` | <Check /> | <Check /> | <Check /> | <Check /> |
1060
+ | `gemini-2.5-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
1061
+ | `gemini-2.5-flash-lite` | <Check /> | <Check /> | <Check /> | <Check /> |
1062
+ | `gemini-2.0-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
1063
+ | `gemini-3-pro-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
1064
+ | `gemini-3-pro-image-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
1065
+ | `gemini-3-flash-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
1066
+ | `gemini-3.1-pro-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
1067
+ | `gemini-3.1-flash-image-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
1068
+ | `gemini-3.1-flash-lite-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
1069
+
1070
+ {/* model-capabilities:google-vertex-language:end */}
1061
1071
 
1062
1072
  <Note>
1063
1073
  The table above lists popular models. Please see the [Google Vertex AI
@@ -1126,11 +1136,23 @@ The following optional provider options are available for Google Vertex AI embed
1126
1136
 
1127
1137
  #### Model Capabilities
1128
1138
 
1129
- | Model | Max Values Per Call | Parallel Calls | Multimodal |
1130
- | ---------------------------- | ------------------- | -------------- | ---------- |
1131
- | `text-embedding-005` | 2048 | <Check /> | <Cross /> |
1132
- | `gemini-embedding-2` | 2048 | <Check /> | <Check /> |
1133
- | `gemini-embedding-2-preview` | 2048 | <Check /> | <Check /> |
1139
+ {/* model-capabilities:google-vertex-embedding:start */}
1140
+
1141
+ | Model | Max Values Per Call | Parallel Calls | Multimodal |
1142
+ | -------------------------------------- | ------------------- | -------------- | ---------- |
1143
+ | `textembedding-gecko` | 250 | <Check /> | <Cross /> |
1144
+ | `textembedding-gecko@001` | 250 | <Check /> | <Cross /> |
1145
+ | `textembedding-gecko@003` | 250 | <Check /> | <Cross /> |
1146
+ | `textembedding-gecko-multilingual` | 250 | <Check /> | <Cross /> |
1147
+ | `textembedding-gecko-multilingual@001` | 250 | <Check /> | <Cross /> |
1148
+ | `text-multilingual-embedding-002` | 250 | <Check /> | <Cross /> |
1149
+ | `text-embedding-004` | 250 | <Check /> | <Cross /> |
1150
+ | `text-embedding-005` | 250 | <Check /> | <Cross /> |
1151
+ | `gemini-embedding-001` | 250 | <Check /> | <Cross /> |
1152
+ | `gemini-embedding-2` | 1 | <Check /> | <Check /> |
1153
+ | `gemini-embedding-2-preview` | 1 | <Check /> | <Check /> |
1154
+
1155
+ {/* model-capabilities:google-vertex-embedding:end */}
1134
1156
 
1135
1157
  <Note>
1136
1158
  The table above lists popular models. You can also pass any available provider
@@ -1197,13 +1219,17 @@ const { image } = await generateImage({
1197
1219
 
1198
1220
  ##### Gemini Image Model Capabilities
1199
1221
 
1222
+ {/* model-capabilities:google-vertex-image:start */}
1223
+
1200
1224
  | Model | Image Generation | Image Editing | Aspect Ratios |
1201
1225
  | -------------------------------- | ---------------- | ------------- | ----------------------------------------------------------------------- |
1202
1226
  | `gemini-nano-banana-2.1` | <Check /> | <Check /> | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:8, 8:1, 1:4, 4:1 |
1203
- | `gemini-3.1-flash-image-preview` | <Check /> | <Check /> | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 |
1204
1227
  | `gemini-3-pro-image-preview` | <Check /> | <Check /> | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 |
1228
+ | `gemini-3.1-flash-image-preview` | <Check /> | <Check /> | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 |
1205
1229
  | `gemini-2.5-flash-image` | <Check /> | <Check /> | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 |
1206
1230
 
1231
+ {/* model-capabilities:google-vertex-image:end */}
1232
+
1207
1233
  <Note>
1208
1234
  `gemini-3-pro-image-preview` supports additional features including up to 14
1209
1235
  reference images for editing (6 objects, 5 humans), resolution options (1K,
@@ -1350,13 +1376,23 @@ The following provider options are available:
1350
1376
 
1351
1377
  #### Model Capabilities
1352
1378
 
1353
- | Model | Audio Support |
1354
- | --------------------------- | ------------- |
1355
- | `veo-3.1-generate-001` | Yes |
1356
- | `veo-3.1-fast-generate-001` | Yes |
1357
- | `veo-3.0-generate-001` | Yes |
1358
- | `veo-3.0-fast-generate-001` | Yes |
1359
- | `veo-2.0-generate-001` | No |
1379
+ {/* model-capabilities:google-vertex-video:start */}
1380
+
1381
+ | Model | Audio Support |
1382
+ | ------------------------------- | ------------- |
1383
+ | `veo-2.0-generate-preview` | <Cross /> |
1384
+ | `veo-2.0-generate-exp` | <Cross /> |
1385
+ | `veo-2.0-generate-001` | <Cross /> |
1386
+ | `veo-3.0-generate-001` | <Check /> |
1387
+ | `veo-3.0-fast-generate-001` | <Check /> |
1388
+ | `veo-3.0-generate-preview` | <Check /> |
1389
+ | `veo-3.0-fast-generate-preview` | <Check /> |
1390
+ | `veo-3.1-generate-001` | <Check /> |
1391
+ | `veo-3.1-fast-generate-001` | <Check /> |
1392
+ | `veo-3.1-generate-preview` | <Check /> |
1393
+ | `veo-3.1-fast-generate-preview` | <Check /> |
1394
+
1395
+ {/* model-capabilities:google-vertex-video:end */}
1360
1396
 
1361
1397
  <Note>
1362
1398
  The table above lists popular models. You can also pass any available provider
@@ -1394,12 +1430,17 @@ rate is reported in `result.providerMetadata.google.sampleRate`.
1394
1430
 
1395
1431
  #### Speech Model Capabilities
1396
1432
 
1433
+ {/* model-capabilities:google-vertex-speech:start */}
1434
+
1397
1435
  | Model | Multi-speaker | Style via instructions |
1398
1436
  | ----------------------------------- | ------------- | ---------------------- |
1399
1437
  | `gemini-2.5-flash-tts` | <Check /> | <Check /> |
1400
1438
  | `gemini-2.5-pro-tts` | <Check /> | <Check /> |
1401
1439
  | `gemini-2.5-flash-lite-preview-tts` | <Check /> | <Check /> |
1402
1440
  | `gemini-3.1-flash-tts-preview` | <Check /> | <Check /> |
1441
+ | `chirp-3-hd` | <Cross /> | <Cross /> |
1442
+
1443
+ {/* model-capabilities:google-vertex-speech:end */}
1403
1444
 
1404
1445
  ### Transcription Models
1405
1446
 
@@ -1490,12 +1531,16 @@ The following provider options are available:
1490
1531
 
1491
1532
  #### Transcription Model Capabilities
1492
1533
 
1534
+ {/* model-capabilities:google-vertex-transcription:start */}
1535
+
1493
1536
  | Model | Word timestamps | Language detection |
1494
1537
  | ----------- | --------------------------------------------------------- | ------------------------------------------------------------------------------ |
1495
1538
  | `chirp_2` | Available with a potential quality and speed tradeoff | Auto detection with `['auto']` |
1496
1539
  | `chirp_3` | Available with a potential transcription quality tradeoff | Auto detection with `['auto']` |
1497
1540
  | `telephony` | Available | Explicit supported language codes, with alternative language detection support |
1498
1541
 
1542
+ {/* model-capabilities:google-vertex-transcription:end */}
1543
+
1499
1544
  ## Google Vertex Anthropic Provider Usage
1500
1545
 
1501
1546
  The Google Vertex Anthropic provider for the [AI SDK](/docs) offers support for Anthropic's Claude models through the Google Vertex AI APIs. This section provides details on how to set up and use the Google Vertex Anthropic provider.
@@ -2083,6 +2128,8 @@ These tools can be used in conjunction with supported Claude models to enable mo
2083
2128
  The latest Anthropic model list on Vertex AI is available [here](https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#model-list).
2084
2129
  See also [Anthropic Model Comparison](https://docs.anthropic.com/en/docs/about-claude/models#model-comparison).
2085
2130
 
2131
+ {/* model-capabilities:google-vertex-anthropic:start */}
2132
+
2086
2133
  | Model | Image Input | Object Generation | Tool Usage | Tool Streaming | Computer Use |
2087
2134
  | ------------------------------- | ----------- | ----------------- | ---------- | -------------- | ------------ |
2088
2135
  | `claude-fable-5-1` | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
@@ -2094,6 +2141,8 @@ See also [Anthropic Model Comparison](https://docs.anthropic.com/en/docs/about-c
2094
2141
  | `claude-3-haiku@20240307` | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
2095
2142
  | `claude-3-opus@20240229` | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
2096
2143
 
2144
+ {/* model-capabilities:google-vertex-anthropic:end */}
2145
+
2097
2146
  <Note>
2098
2147
  The table above lists popular models. You can also pass any available provider
2099
2148
  model ID as a string if needed.
@@ -2266,12 +2315,16 @@ const result = await generateText({
2266
2315
 
2267
2316
  The following models are available through the Google Vertex xAI provider. You can also pass any valid model ID as a string.
2268
2317
 
2269
- | Model ID | Reasoning |
2318
+ {/* model-capabilities:google-vertex-xai:start */}
2319
+
2320
+ | Model | Reasoning |
2270
2321
  | --------------------------------- | --------- |
2271
- | `xai/grok-4.20-reasoning` | Yes |
2272
- | `xai/grok-4.20-non-reasoning` | No |
2273
- | `xai/grok-4.1-fast-reasoning` | Yes |
2274
- | `xai/grok-4.1-fast-non-reasoning` | No |
2322
+ | `xai/grok-4.20-reasoning` | <Check /> |
2323
+ | `xai/grok-4.20-non-reasoning` | <Cross /> |
2324
+ | `xai/grok-4.1-fast-reasoning` | <Check /> |
2325
+ | `xai/grok-4.1-fast-non-reasoning` | <Cross /> |
2326
+
2327
+ {/* model-capabilities:google-vertex-xai:end */}
2275
2328
 
2276
2329
  <Note>
2277
2330
  Grok reasoning models on Vertex report reasoning token counts in usage
@@ -2401,7 +2454,9 @@ for await (const textPart of result.textStream) {
2401
2454
 
2402
2455
  The following models are available through the MaaS provider. You can also pass any valid model ID as a string.
2403
2456
 
2404
- | Model ID | Provider |
2457
+ {/* model-capabilities:google-vertex-maas:start */}
2458
+
2459
+ | Model | Provider |
2405
2460
  | ---------------------------------------------- | -------- |
2406
2461
  | `deepseek-ai/deepseek-r1-0528-maas` | DeepSeek |
2407
2462
  | `deepseek-ai/deepseek-v3.1-maas` | DeepSeek |
@@ -2416,6 +2471,8 @@ The following models are available through the MaaS provider. You can also pass
2416
2471
  | `qwen/qwen3-next-80b-a3b-thinking-maas` | Qwen |
2417
2472
  | `moonshotai/kimi-k2-thinking-maas` | Moonshot |
2418
2473
 
2474
+ {/* model-capabilities:google-vertex-maas:end */}
2475
+
2419
2476
  <Note>
2420
2477
  Llama 4 MaaS models default to their 8,192-token output limit when
2421
2478
  `maxOutputTokens` is not specified. An explicit `maxOutputTokens` value takes
@@ -2428,3 +2485,81 @@ The following models are available through the MaaS provider. You can also pass
2428
2485
  Garden](https://console.cloud.google.com/vertex-ai/model-garden) for the
2429
2486
  latest available models.
2430
2487
  </Note>
2488
+
2489
+ ### Transcription Capability Reference
2490
+
2491
+ {/* model-capabilities:google-vertex-transcription-all:start */}
2492
+
2493
+ | Model | Transcription | Streaming | Duration | Segments | Language |
2494
+ | ---------------------------- | ------------- | --------- | --------- | -------------------------------------- | --------- |
2495
+ | `chirp_2` | <Check /> | <Cross /> | <Check /> | Conditional: Requires word timestamps. | <Check /> |
2496
+ | `chirp_3` | <Check /> | <Cross /> | <Check /> | Conditional: Requires word timestamps. | <Check /> |
2497
+ | `telephony` | <Check /> | <Cross /> | <Check /> | Conditional: Requires word timestamps. | <Check /> |
2498
+ | `gemini-3.5-transcribe` | <Check /> | <Cross /> | <Cross /> | Conditional: Requires word timestamps. | <Check /> |
2499
+ | `gemini-3.5-transcribe-live` | <Cross /> | <Check /> | <Cross /> | <Cross /> | <Check /> |
2500
+
2501
+ {/* model-capabilities:google-vertex-transcription-all:end */}
2502
+
2503
+ ## Provider Option Reference
2504
+
2505
+ The following option definitions are generated from the provider catalog.
2506
+
2507
+ {/* model-capabilities:google-vertex-provider-options:start */}
2508
+
2509
+ | Operation | Option | Description |
2510
+ | ------------- | ----------------------------- | ----------------------------------------------------- |
2511
+ | language | `responseModalities` | Response modalities to generate. |
2512
+ | language | `thinkingConfig` | Thinking budget, level, and thought output. |
2513
+ | language | `cachedContent` | Cached content to use as request context. |
2514
+ | language | `structuredOutputs` | Whether to send the JSON response schema. |
2515
+ | language | `safetySettings` | Safety settings for the request. |
2516
+ | language | `threshold` | Default threshold for configurable safety categories. |
2517
+ | language | `audioTimestamp` | Enable timestamp understanding for audio. |
2518
+ | language | `labels` | Billing labels. Vertex AI only. |
2519
+ | language | `mediaResolution` | Resolution used to process media inputs. |
2520
+ | language | `imageConfig` | Image generation configuration. |
2521
+ | language | `retrievalConfig` | Retrieval configuration for tools. |
2522
+ | language | `streamFunctionCallArguments` | Stream function arguments. Vertex AI only. |
2523
+ | language | `serviceTier` | Service tier. Gemini API only. |
2524
+ | language | `continuationToken` | Resume a response using its continuation token. |
2525
+ | language | `sharedRequestType` | Shared PayGo tier. Vertex AI only. |
2526
+ | language | `requestType` | Request routing type. Vertex AI only. |
2527
+ | image | `thinkingConfig` | Thinking budget, level, and thought output. |
2528
+ | image | `cachedContent` | Cached content to use as request context. |
2529
+ | image | `structuredOutputs` | Whether to send the JSON response schema. |
2530
+ | image | `safetySettings` | Safety settings for the request. |
2531
+ | image | `threshold` | Default threshold for configurable safety categories. |
2532
+ | image | `audioTimestamp` | Enable timestamp understanding for audio. |
2533
+ | image | `labels` | Billing labels. Vertex AI only. |
2534
+ | image | `mediaResolution` | Resolution used to process media inputs. |
2535
+ | image | `imageConfig` | Image generation configuration. |
2536
+ | image | `retrievalConfig` | Retrieval configuration for tools. |
2537
+ | image | `streamFunctionCallArguments` | Stream function arguments. Vertex AI only. |
2538
+ | image | `serviceTier` | Service tier. Gemini API only. |
2539
+ | image | `continuationToken` | Resume a response using its continuation token. |
2540
+ | image | `sharedRequestType` | Shared PayGo tier. Vertex AI only. |
2541
+ | image | `requestType` | Request routing type. Vertex AI only. |
2542
+ | embedding | `outputDimensionality` | Reduced output dimensions. |
2543
+ | embedding | `taskType` | Task for which embeddings are optimized. |
2544
+ | embedding | `title` | Document title; requires RETRIEVAL_DOCUMENT. |
2545
+ | embedding | `autoTruncate` | Truncate inputs exceeding the model context. |
2546
+ | speech | `speechMetadata` | Directions for Gemini 3.8 speech. |
2547
+ | speech | `turns` | Structured transcript for Gemini 3.8 speech. |
2548
+ | speech | `multiSpeakerVoiceConfig` | Voice configuration for dialogue speakers. |
2549
+ | transcription | `languageCodes` | Language hints or automatic language detection. |
2550
+ | transcription | `enableAutomaticPunctuation` | Include punctuation in Cloud Speech transcripts. |
2551
+ | transcription | `enableWordTimeOffsets` | Include Cloud Speech word timestamps. |
2552
+ | transcription | `region` | Cloud Speech region. |
2553
+ | transcription | `customVocabulary` | Vocabulary hints for Gemini transcription. |
2554
+ | transcription | `wordTimestamp` | Include Gemini word timestamps. |
2555
+ | transcription | `diarization` | Enable Gemini speaker diarization. |
2556
+ | transcription | `mode` | Verbatim or smart Gemini transcription formatting. |
2557
+ | video | `pollIntervalMs` | Polling interval. |
2558
+ | video | `pollTimeoutMs` | Polling timeout. |
2559
+ | video | `personGeneration` | Policy for generating people. |
2560
+ | video | `negativePrompt` | Content to avoid. |
2561
+ | video | `generateAudio` | Generate synchronized audio. |
2562
+ | video | `gcsOutputDirectory` | Cloud Storage output directory. |
2563
+ | video | `referenceImages` | Reference images for video generation. |
2564
+
2565
+ {/* model-capabilities:google-vertex-provider-options:end */}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google-vertex",
3
- "version": "5.0.132",
3
+ "version": "5.0.134",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -71,11 +71,11 @@
71
71
  }
72
72
  },
73
73
  "dependencies": {
74
- "@ai-sdk/anthropic": "4.0.97",
75
- "@ai-sdk/google": "4.0.112",
76
- "@ai-sdk/openai-compatible": "3.0.85",
77
- "@ai-sdk/provider": "4.0.36",
78
- "@ai-sdk/provider-utils": "5.0.75",
74
+ "@ai-sdk/anthropic": "4.0.99",
75
+ "@ai-sdk/google": "4.0.114",
76
+ "@ai-sdk/openai-compatible": "3.0.87",
77
+ "@ai-sdk/provider": "4.0.37",
78
+ "@ai-sdk/provider-utils": "5.0.76",
79
79
  "google-auth-library": "^11.3.1"
80
80
  },
81
81
  "devDependencies": {
@@ -1,3 +1,4 @@
1
+ import { getGoogleVertexRequestConfig } from '../google-vertex-model-catalog-config';
1
2
  import {
2
3
  InvalidArgumentError,
3
4
  type Experimental_TranscriptionModelV4StreamOptions as TranscriptionModelV4StreamOptions,
@@ -47,7 +48,7 @@ const defaultFinishGraceMs = 3000;
47
48
 
48
49
  /** Live transcription is only supported by `*-live` model variants. */
49
50
  function isLiveTranscriptionModelId(modelId: string): boolean {
50
- return modelId.includes('-live');
51
+ return getGoogleVertexRequestConfig(modelId).transcription?.live === true;
51
52
  }
52
53
 
53
54
  /** Regional Vertex hostname (mirrors the provider's base-URL host rules). */
@@ -1,3 +1,4 @@
1
+ import { getGoogleVertexRequestConfig } from './google-vertex-model-catalog-config';
1
2
  import {
2
3
  TooManyEmbeddingValuesForCallError,
3
4
  type EmbeddingModelV4,
@@ -226,6 +227,6 @@ const googleVertexEmbedContentResponseSchema = lazySchema(() =>
226
227
 
227
228
  function usesEmbedContentEndpoint(modelId: GoogleVertexEmbeddingModelId) {
228
229
  return (
229
- modelId === 'gemini-embedding-2' || modelId === 'gemini-embedding-2-preview'
230
+ getGoogleVertexRequestConfig(modelId).embedding?.endpoint === 'embedContent'
230
231
  );
231
232
  }
@@ -1,3 +1,5 @@
1
+ import { getGoogleVertexRequestConfig } from './google-vertex-model-catalog-config';
2
+ import { getGoogleVertexImageModelEntry } from './google-vertex-model-catalog';
1
3
  import type { GoogleLanguageModelOptions } from '@ai-sdk/google';
2
4
  import { GoogleLanguageModel } from '@ai-sdk/google/internal';
3
5
  import type {
@@ -26,13 +28,6 @@ interface GoogleVertexImageModelConfig {
26
28
  };
27
29
  }
28
30
 
29
- const googleVertexImageModelsWithFileInputSupport = new Set<string>([
30
- 'gemini-2.5-flash-image',
31
- 'gemini-3-pro-image-preview',
32
- 'gemini-3.1-flash-image-preview',
33
- 'gemini-nano-banana-2.1',
34
- ]);
35
-
36
31
  export class GoogleVertexImageModel implements ImageModelV4 {
37
32
  readonly specificationVersion = 'v4';
38
33
 
@@ -53,7 +48,8 @@ export class GoogleVertexImageModel implements ImageModelV4 {
53
48
  readonly maxImagesPerCall = 1;
54
49
 
55
50
  get supportsFileInputs(): boolean | undefined {
56
- return googleVertexImageModelsWithFileInputSupport.has(this.modelId)
51
+ return getGoogleVertexImageModelEntry(this.modelId).capabilities.image
52
+ ?.fileInput === true
57
53
  ? true
58
54
  : undefined;
59
55
  }
@@ -74,7 +70,7 @@ export class GoogleVertexImageModel implements ImageModelV4 {
74
70
  async doGenerate(
75
71
  options: Parameters<ImageModelV4['doGenerate']>[0],
76
72
  ): Promise<Awaited<ReturnType<ImageModelV4['doGenerate']>>> {
77
- if (!this.modelId.startsWith('gemini-')) {
73
+ if (!getGoogleVertexRequestConfig(this.modelId).image?.gemini) {
78
74
  throw new Error(
79
75
  'Google image models other than Gemini are no longer supported. Use a model ID that starts with `gemini-`.',
80
76
  );
@@ -0,0 +1,42 @@
1
+ export type VertexRequestConfig = {
2
+ language?: { endpoint: boolean; maxOutputTokens?: number };
3
+ image?: { gemini: boolean };
4
+ embedding?: {
5
+ endpoint: 'embedContent' | 'predict';
6
+ maxEmbeddingsPerCall: number;
7
+ };
8
+ speech?: { api: 'cloud-tts' | 'gemini' };
9
+ transcription?: { api: 'gemini' | 'cloud-speech'; live: boolean };
10
+ };
11
+
12
+ function requestConfig(modelId: string): VertexRequestConfig {
13
+ const embedContent =
14
+ modelId === 'gemini-embedding-2' ||
15
+ modelId === 'gemini-embedding-2-preview';
16
+ return {
17
+ language: {
18
+ endpoint: modelId.startsWith('endpoints/'),
19
+ maxOutputTokens:
20
+ modelId === 'meta/llama-4-maverick-17b-128e-instruct-maas' ||
21
+ modelId === 'meta/llama-4-scout-17b-16e-instruct-maas'
22
+ ? 8192
23
+ : undefined,
24
+ },
25
+ image: { gemini: modelId.startsWith('gemini-') },
26
+ embedding: {
27
+ endpoint: embedContent ? 'embedContent' : 'predict',
28
+ maxEmbeddingsPerCall: embedContent ? 1 : 250,
29
+ },
30
+ speech: { api: modelId.startsWith('chirp') ? 'cloud-tts' : 'gemini' },
31
+ transcription: {
32
+ api: modelId.startsWith('gemini') ? 'gemini' : 'cloud-speech',
33
+ live: modelId.includes('-live'),
34
+ },
35
+ };
36
+ }
37
+
38
+ export function getGoogleVertexRequestConfig(
39
+ modelId: string,
40
+ ): VertexRequestConfig {
41
+ return requestConfig(modelId);
42
+ }