@ai-sdk/google-vertex 5.0.131 → 5.0.133
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 +53 -0
- package/dist/anthropic/edge/index.d.ts +7 -0
- package/dist/anthropic/edge/index.d.ts.map +1 -1
- package/dist/anthropic/edge/index.js +6 -2
- package/dist/anthropic/edge/index.js.map +1 -1
- package/dist/anthropic/index.d.ts +7 -0
- package/dist/anthropic/index.d.ts.map +1 -1
- package/dist/anthropic/index.js +5 -1
- package/dist/anthropic/index.js.map +1 -1
- package/dist/edge/index.d.ts.map +1 -1
- package/dist/edge/index.js +529 -17
- package/dist/edge/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +529 -17
- package/dist/index.js.map +1 -1
- package/dist/maas/edge/index.d.ts.map +1 -1
- package/dist/maas/edge/index.js +26 -6
- package/dist/maas/edge/index.js.map +1 -1
- package/dist/maas/index.d.ts.map +1 -1
- package/dist/maas/index.js +25 -5
- package/dist/maas/index.js.map +1 -1
- package/dist/xai/edge/index.js +1 -1
- package/docs/16-google-vertex.mdx +256 -32
- package/package.json +6 -6
- package/src/anthropic/google-vertex-anthropic-provider.ts +22 -3
- package/src/gemini-transcription/google-vertex-gemini-transcription-model.ts +46 -3
- package/src/google-vertex-embedding-model.ts +2 -1
- package/src/google-vertex-image-model.ts +5 -9
- package/src/google-vertex-model-catalog-config.ts +42 -0
- package/src/google-vertex-model-catalog.ts +586 -0
- package/src/google-vertex-provider-base.ts +4 -5
- package/src/google-vertex-video-model.ts +1 -1
- package/src/maas/google-vertex-maas-provider.ts +3 -6
|
@@ -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
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
|
1051
|
-
|
|
|
1052
|
-
| `gemini-
|
|
1053
|
-
| `gemini-
|
|
1054
|
-
| `gemini-3.
|
|
1055
|
-
| `gemini-3.
|
|
1056
|
-
| `gemini-3.
|
|
1057
|
-
| `gemini-3-
|
|
1058
|
-
| `gemini-
|
|
1059
|
-
| `gemini-2.5-
|
|
1060
|
-
| `gemini-2.
|
|
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
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
|
1132
|
-
|
|
|
1133
|
-
| `
|
|
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
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
|
1356
|
-
|
|
|
1357
|
-
| `veo-
|
|
1358
|
-
| `veo-
|
|
1359
|
-
| `veo-2.0-generate-001`
|
|
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
|
|
@@ -1384,21 +1420,47 @@ The `voice` argument accepts one of Gemini's [30 prebuilt voices](https://ai.goo
|
|
|
1384
1420
|
(e.g. `Kore`, `Puck`, `Zephyr`); it defaults to `Kore`. Multi-speaker dialogue is available via
|
|
1385
1421
|
`providerOptions.googleVertex.multiSpeakerVoiceConfig`.
|
|
1386
1422
|
|
|
1423
|
+
Set `language` to a supported BCP-47 code such as `en-US` to send
|
|
1424
|
+
`speechConfig.languageCode` for single- or multi-speaker Gemini speech. Omit it or
|
|
1425
|
+
use `language: 'auto'` for automatic detection.
|
|
1426
|
+
|
|
1387
1427
|
By default the audio is returned as a playable WAV (Gemini returns raw PCM, which the provider
|
|
1388
1428
|
wraps). Set `outputFormat: 'pcm'` for the raw signed 16-bit little-endian mono bytes; the sample
|
|
1389
1429
|
rate is reported in `result.providerMetadata.google.sampleRate`.
|
|
1390
1430
|
|
|
1391
1431
|
#### Speech Model Capabilities
|
|
1392
1432
|
|
|
1433
|
+
{/* model-capabilities:google-vertex-speech:start */}
|
|
1434
|
+
|
|
1393
1435
|
| Model | Multi-speaker | Style via instructions |
|
|
1394
1436
|
| ----------------------------------- | ------------- | ---------------------- |
|
|
1395
1437
|
| `gemini-2.5-flash-tts` | <Check /> | <Check /> |
|
|
1396
1438
|
| `gemini-2.5-pro-tts` | <Check /> | <Check /> |
|
|
1397
1439
|
| `gemini-2.5-flash-lite-preview-tts` | <Check /> | <Check /> |
|
|
1398
1440
|
| `gemini-3.1-flash-tts-preview` | <Check /> | <Check /> |
|
|
1441
|
+
| `chirp-3-hd` | <Cross /> | <Cross /> |
|
|
1442
|
+
|
|
1443
|
+
{/* model-capabilities:google-vertex-speech:end */}
|
|
1399
1444
|
|
|
1400
1445
|
### Transcription Models
|
|
1401
1446
|
|
|
1447
|
+
#### Gemini transcription
|
|
1448
|
+
|
|
1449
|
+
Gemini transcription models such as `gemini-3.5-transcribe` also support
|
|
1450
|
+
`googleVertex.transcription()`. Request word timing with the shared
|
|
1451
|
+
`timestampGranularities: ['word']` setting. An explicit
|
|
1452
|
+
`providerOptions.googleVertex.wordTimestamp` takes precedence, including
|
|
1453
|
+
`false`, which disables word timestamps and produces a warning if word timing
|
|
1454
|
+
was requested through the shared setting.
|
|
1455
|
+
|
|
1456
|
+
Returned words are exposed in the optional `result.words` array. For
|
|
1457
|
+
compatibility, `result.segments` continues to contain the same word timings.
|
|
1458
|
+
Gemini does not provide separate caption segments and warns if `'segment'` is
|
|
1459
|
+
requested. These shared timing controls currently apply to Gemini transcription;
|
|
1460
|
+
Chirp and telephony use their provider settings below.
|
|
1461
|
+
|
|
1462
|
+
#### Speech-to-Text transcription
|
|
1463
|
+
|
|
1402
1464
|
You can transcribe audio with Google Cloud Speech-to-Text models using the
|
|
1403
1465
|
`.transcription()` factory method together with
|
|
1404
1466
|
[`transcribe()`](/docs/reference/ai-sdk-core/transcribe).
|
|
@@ -1469,12 +1531,16 @@ The following provider options are available:
|
|
|
1469
1531
|
|
|
1470
1532
|
#### Transcription Model Capabilities
|
|
1471
1533
|
|
|
1534
|
+
{/* model-capabilities:google-vertex-transcription:start */}
|
|
1535
|
+
|
|
1472
1536
|
| Model | Word timestamps | Language detection |
|
|
1473
1537
|
| ----------- | --------------------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
1474
1538
|
| `chirp_2` | Available with a potential quality and speed tradeoff | Auto detection with `['auto']` |
|
|
1475
1539
|
| `chirp_3` | Available with a potential transcription quality tradeoff | Auto detection with `['auto']` |
|
|
1476
1540
|
| `telephony` | Available | Explicit supported language codes, with alternative language detection support |
|
|
1477
1541
|
|
|
1542
|
+
{/* model-capabilities:google-vertex-transcription:end */}
|
|
1543
|
+
|
|
1478
1544
|
## Google Vertex Anthropic Provider Usage
|
|
1479
1545
|
|
|
1480
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.
|
|
@@ -1519,6 +1585,15 @@ const vertexAnthropic = createVertexAnthropic({
|
|
|
1519
1585
|
|
|
1520
1586
|
You can use the following optional settings to customize the Google Vertex Anthropic provider instance:
|
|
1521
1587
|
|
|
1588
|
+
- **supportsNativeStructuredOutput** _boolean_
|
|
1589
|
+
|
|
1590
|
+
Optional. Defaults to `false`. Set to `true` to let
|
|
1591
|
+
`providerOptions.anthropic.structuredOutputMode: 'auto'` use native structured
|
|
1592
|
+
output for Claude 4.5 and newer model IDs. The Google Cloud organization policy
|
|
1593
|
+
must allow `structured_outputs` for every model used with native output.
|
|
1594
|
+
This setting does not enable strict tool input schemas.
|
|
1595
|
+
See [Native Structured Output](#native-structured-output).
|
|
1596
|
+
|
|
1522
1597
|
- **project** _string_
|
|
1523
1598
|
|
|
1524
1599
|
The Google Cloud project ID that you want to use for the API calls.
|
|
@@ -1694,6 +1769,65 @@ The following optional provider options are available for Anthropic models:
|
|
|
1694
1769
|
Optional. Metadata to include with the request. See the [Anthropic API documentation](https://platform.claude.com/docs/en/api/messages/create) for details.
|
|
1695
1770
|
- `userId` _string_ - An external identifier for the end-user.
|
|
1696
1771
|
|
|
1772
|
+
### Native Structured Output
|
|
1773
|
+
|
|
1774
|
+
Vertex Anthropic normally uses a JSON response tool to generate structured
|
|
1775
|
+
output. If your Google Cloud organization policy permits native structured output,
|
|
1776
|
+
you can opt in for a provider instance:
|
|
1777
|
+
|
|
1778
|
+
```ts
|
|
1779
|
+
import { createGoogleVertexAnthropic } from '@ai-sdk/google-vertex/anthropic';
|
|
1780
|
+
import { Output, streamText } from 'ai';
|
|
1781
|
+
import { z } from 'zod';
|
|
1782
|
+
|
|
1783
|
+
const vertexAnthropic = createGoogleVertexAnthropic({
|
|
1784
|
+
supportsNativeStructuredOutput: true,
|
|
1785
|
+
});
|
|
1786
|
+
|
|
1787
|
+
const result = streamText({
|
|
1788
|
+
model: vertexAnthropic('claude-sonnet-4-6'),
|
|
1789
|
+
output: Output.object({
|
|
1790
|
+
schema: z.object({ name: z.string(), ingredients: z.array(z.string()) }),
|
|
1791
|
+
}),
|
|
1792
|
+
prompt: 'Create a vegetarian lasagna recipe.',
|
|
1793
|
+
});
|
|
1794
|
+
|
|
1795
|
+
console.log(await result.output);
|
|
1796
|
+
```
|
|
1797
|
+
|
|
1798
|
+
The opt-in applies to `structuredOutputMode: 'auto'` (the default) for versioned
|
|
1799
|
+
Claude model IDs from 4.5 onward, including Vertex IDs with an `@` suffix.
|
|
1800
|
+
Older models and IDs without a recognizable Claude version, such as custom
|
|
1801
|
+
deployment names, continue to use the JSON response tool.
|
|
1802
|
+
The setting is available in both the Node.js and Edge providers.
|
|
1803
|
+
In `'auto'` mode, schemas that native output cannot safely represent, such as
|
|
1804
|
+
open objects, circular references, or schemas with too many optional properties,
|
|
1805
|
+
continue to use the JSON response tool.
|
|
1806
|
+
|
|
1807
|
+
Google Cloud denies the feature by default through
|
|
1808
|
+
`constraints/vertexai.allowedPartnerModelFeatures`. Allow the
|
|
1809
|
+
`structured_outputs` feature for each model you use.
|
|
1810
|
+
See [Google Cloud's structured output documentation](https://docs.cloud.google.com/vertex-ai/generative-ai/docs/partner-models/claude/structured-outputs)
|
|
1811
|
+
for supported models and policy configuration. Enabling the SDK setting does not
|
|
1812
|
+
change that policy. API errors, including policy rejections, are returned without
|
|
1813
|
+
automatically falling back to tool emulation.
|
|
1814
|
+
|
|
1815
|
+
You can still set `providerOptions.anthropic.structuredOutputMode` per request:
|
|
1816
|
+
|
|
1817
|
+
- `'jsonTool'` selects tool emulation. Models that reject forced tool use retain
|
|
1818
|
+
the Anthropic provider's existing behavior of switching to native output when
|
|
1819
|
+
the model supports it and the schema can be represented, even without this
|
|
1820
|
+
opt-in. This fallback also applies in `'auto'` mode with the opt-in disabled.
|
|
1821
|
+
Models such as `claude-opus-5-5`, `claude-sonnet-5-5`, and `claude-fable-5-1`
|
|
1822
|
+
therefore require the `structured_outputs` policy regardless of this setting.
|
|
1823
|
+
- `'outputFormat'` explicitly requests native output, bypassing the opt-in and
|
|
1824
|
+
model detection. The API rejects unsupported or policy-denied requests.
|
|
1825
|
+
|
|
1826
|
+
Native output constrains the final response generated with `Output.object`.
|
|
1827
|
+
Ordinary tool arguments use separate input schemas; this opt-in does not enable
|
|
1828
|
+
`strict: true` for Vertex tools. The SDK still validates generated output against
|
|
1829
|
+
your original schema, including constraints that the native API cannot enforce.
|
|
1830
|
+
|
|
1697
1831
|
### Billing Labels
|
|
1698
1832
|
|
|
1699
1833
|
Pass billing labels for Claude requests using `providerOptions.vertex.labels`.
|
|
@@ -1994,6 +2128,8 @@ These tools can be used in conjunction with supported Claude models to enable mo
|
|
|
1994
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).
|
|
1995
2129
|
See also [Anthropic Model Comparison](https://docs.anthropic.com/en/docs/about-claude/models#model-comparison).
|
|
1996
2130
|
|
|
2131
|
+
{/* model-capabilities:google-vertex-anthropic:start */}
|
|
2132
|
+
|
|
1997
2133
|
| Model | Image Input | Object Generation | Tool Usage | Tool Streaming | Computer Use |
|
|
1998
2134
|
| ------------------------------- | ----------- | ----------------- | ---------- | -------------- | ------------ |
|
|
1999
2135
|
| `claude-fable-5-1` | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
@@ -2005,6 +2141,8 @@ See also [Anthropic Model Comparison](https://docs.anthropic.com/en/docs/about-c
|
|
|
2005
2141
|
| `claude-3-haiku@20240307` | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
|
|
2006
2142
|
| `claude-3-opus@20240229` | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
|
|
2007
2143
|
|
|
2144
|
+
{/* model-capabilities:google-vertex-anthropic:end */}
|
|
2145
|
+
|
|
2008
2146
|
<Note>
|
|
2009
2147
|
The table above lists popular models. You can also pass any available provider
|
|
2010
2148
|
model ID as a string if needed.
|
|
@@ -2177,12 +2315,16 @@ const result = await generateText({
|
|
|
2177
2315
|
|
|
2178
2316
|
The following models are available through the Google Vertex xAI provider. You can also pass any valid model ID as a string.
|
|
2179
2317
|
|
|
2180
|
-
|
|
2318
|
+
{/* model-capabilities:google-vertex-xai:start */}
|
|
2319
|
+
|
|
2320
|
+
| Model | Reasoning |
|
|
2181
2321
|
| --------------------------------- | --------- |
|
|
2182
|
-
| `xai/grok-4.20-reasoning` |
|
|
2183
|
-
| `xai/grok-4.20-non-reasoning` |
|
|
2184
|
-
| `xai/grok-4.1-fast-reasoning` |
|
|
2185
|
-
| `xai/grok-4.1-fast-non-reasoning` |
|
|
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 */}
|
|
2186
2328
|
|
|
2187
2329
|
<Note>
|
|
2188
2330
|
Grok reasoning models on Vertex report reasoning token counts in usage
|
|
@@ -2312,7 +2454,9 @@ for await (const textPart of result.textStream) {
|
|
|
2312
2454
|
|
|
2313
2455
|
The following models are available through the MaaS provider. You can also pass any valid model ID as a string.
|
|
2314
2456
|
|
|
2315
|
-
|
|
2457
|
+
{/* model-capabilities:google-vertex-maas:start */}
|
|
2458
|
+
|
|
2459
|
+
| Model | Provider |
|
|
2316
2460
|
| ---------------------------------------------- | -------- |
|
|
2317
2461
|
| `deepseek-ai/deepseek-r1-0528-maas` | DeepSeek |
|
|
2318
2462
|
| `deepseek-ai/deepseek-v3.1-maas` | DeepSeek |
|
|
@@ -2327,6 +2471,8 @@ The following models are available through the MaaS provider. You can also pass
|
|
|
2327
2471
|
| `qwen/qwen3-next-80b-a3b-thinking-maas` | Qwen |
|
|
2328
2472
|
| `moonshotai/kimi-k2-thinking-maas` | Moonshot |
|
|
2329
2473
|
|
|
2474
|
+
{/* model-capabilities:google-vertex-maas:end */}
|
|
2475
|
+
|
|
2330
2476
|
<Note>
|
|
2331
2477
|
Llama 4 MaaS models default to their 8,192-token output limit when
|
|
2332
2478
|
`maxOutputTokens` is not specified. An explicit `maxOutputTokens` value takes
|
|
@@ -2339,3 +2485,81 @@ The following models are available through the MaaS provider. You can also pass
|
|
|
2339
2485
|
Garden](https://console.cloud.google.com/vertex-ai/model-garden) for the
|
|
2340
2486
|
latest available models.
|
|
2341
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.
|
|
3
|
+
"version": "5.0.133",
|
|
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.
|
|
75
|
-
"@ai-sdk/google": "4.0.
|
|
76
|
-
"@ai-sdk/openai-compatible": "3.0.
|
|
77
|
-
"@ai-sdk/provider": "4.0.
|
|
78
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
74
|
+
"@ai-sdk/anthropic": "4.0.98",
|
|
75
|
+
"@ai-sdk/google": "4.0.113",
|
|
76
|
+
"@ai-sdk/openai-compatible": "3.0.86",
|
|
77
|
+
"@ai-sdk/provider": "4.0.36",
|
|
78
|
+
"@ai-sdk/provider-utils": "5.0.75",
|
|
79
79
|
"google-auth-library": "^11.3.1"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
@@ -160,6 +160,14 @@ export interface GoogleVertexAnthropicProviderSettings {
|
|
|
160
160
|
*/
|
|
161
161
|
location?: string;
|
|
162
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Enable native structured output in `structuredOutputMode: 'auto'` for Claude
|
|
165
|
+
* 4.5 and newer. Defaults to false. Requires the Google Cloud organization
|
|
166
|
+
* policy to allow the `structured_outputs` feature for each model used.
|
|
167
|
+
* This does not enable strict tool input schemas.
|
|
168
|
+
*/
|
|
169
|
+
supportsNativeStructuredOutput?: boolean;
|
|
170
|
+
|
|
163
171
|
/**
|
|
164
172
|
* Use a different URL prefix for API calls, e.g. to use proxy servers.
|
|
165
173
|
* The default prefix is `https://api.anthropic.com/v1`.
|
|
@@ -265,9 +273,11 @@ export function createGoogleVertexAnthropic(
|
|
|
265
273
|
},
|
|
266
274
|
// Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion
|
|
267
275
|
supportedUrls: () => ({}),
|
|
268
|
-
//
|
|
269
|
-
supportsNativeStructuredOutput:
|
|
270
|
-
|
|
276
|
+
// Native output is default-denied by GCP policy and requires Claude 4.5+.
|
|
277
|
+
supportsNativeStructuredOutput:
|
|
278
|
+
options.supportsNativeStructuredOutput === true &&
|
|
279
|
+
supportsNativeStructuredOutput(modelId),
|
|
280
|
+
// Native final output does not opt in to strict tool input schemas.
|
|
271
281
|
supportsStrictTools: false,
|
|
272
282
|
});
|
|
273
283
|
|
|
@@ -298,3 +308,12 @@ export function createGoogleVertexAnthropic(
|
|
|
298
308
|
|
|
299
309
|
return provider;
|
|
300
310
|
}
|
|
311
|
+
|
|
312
|
+
function supportsNativeStructuredOutput(modelId: string): boolean {
|
|
313
|
+
const version = /^claude-[a-z]+-(\d+)(?:-(\d+))?(?:@|$)/.exec(modelId);
|
|
314
|
+
return (
|
|
315
|
+
version != null &&
|
|
316
|
+
(Number(version[1]) > 4 ||
|
|
317
|
+
(Number(version[1]) === 4 && Number(version[2]) >= 5))
|
|
318
|
+
);
|
|
319
|
+
}
|
|
@@ -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.
|
|
51
|
+
return getGoogleVertexRequestConfig(modelId).transcription?.live === true;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
/** Regional Vertex hostname (mirrors the provider's base-URL host rules). */
|
|
@@ -168,8 +169,29 @@ export class GoogleVertexGeminiTranscriptionModel implements TranscriptionModelV
|
|
|
168
169
|
const currentDate = this.config._internal?.currentDate?.() ?? new Date();
|
|
169
170
|
const warnings: SharedV4Warning[] = [];
|
|
170
171
|
const googleOptions = await this.parseOptions(options.providerOptions);
|
|
172
|
+
const wantsWord = options.timestampGranularities?.includes('word');
|
|
173
|
+
if (wantsWord && googleOptions?.wordTimestamp === false) {
|
|
174
|
+
warnings.push({
|
|
175
|
+
type: 'unsupported',
|
|
176
|
+
feature: 'timestampGranularities',
|
|
177
|
+
details:
|
|
178
|
+
'The provider wordTimestamp option is false and overrides the requested word timings.',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
if (options.timestampGranularities?.includes('segment')) {
|
|
182
|
+
warnings.push({
|
|
183
|
+
type: 'unsupported',
|
|
184
|
+
feature: 'timestampGranularities',
|
|
185
|
+
details:
|
|
186
|
+
'Vertex Gemini transcription returns word timings and does not provide separate caption segments.',
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
const resolvedOptions =
|
|
190
|
+
googleOptions?.wordTimestamp == null && wantsWord
|
|
191
|
+
? { ...googleOptions, wordTimestamp: true }
|
|
192
|
+
: googleOptions;
|
|
171
193
|
const audioTranscriptionConfig =
|
|
172
|
-
buildAudioTranscriptionConfig(
|
|
194
|
+
buildAudioTranscriptionConfig(resolvedOptions);
|
|
173
195
|
|
|
174
196
|
const requestBody = {
|
|
175
197
|
contents: [
|
|
@@ -222,6 +244,11 @@ export class GoogleVertexGeminiTranscriptionModel implements TranscriptionModelV
|
|
|
222
244
|
startSecond: number;
|
|
223
245
|
endSecond: number;
|
|
224
246
|
}> = [];
|
|
247
|
+
const words: Array<{
|
|
248
|
+
text: string;
|
|
249
|
+
startSecond: number;
|
|
250
|
+
endSecond: number;
|
|
251
|
+
}> = [];
|
|
225
252
|
for (const part of parts) {
|
|
226
253
|
const transcription = part.audioTranscription;
|
|
227
254
|
if (transcription == null) continue;
|
|
@@ -232,13 +259,29 @@ export class GoogleVertexGeminiTranscriptionModel implements TranscriptionModelV
|
|
|
232
259
|
if (word.word == null || startSecond == null || endSecond == null) {
|
|
233
260
|
continue;
|
|
234
261
|
}
|
|
235
|
-
|
|
262
|
+
const timing = { text: word.word, startSecond, endSecond };
|
|
263
|
+
words.push(timing);
|
|
264
|
+
segments.push({ ...timing });
|
|
236
265
|
}
|
|
237
266
|
}
|
|
238
267
|
|
|
268
|
+
if (
|
|
269
|
+
wantsWord &&
|
|
270
|
+
googleOptions?.wordTimestamp !== false &&
|
|
271
|
+
words.length === 0 &&
|
|
272
|
+
text.trim() !== ''
|
|
273
|
+
) {
|
|
274
|
+
warnings.push({
|
|
275
|
+
type: 'other',
|
|
276
|
+
message:
|
|
277
|
+
'The Vertex Gemini transcription response omitted the requested word timings.',
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
239
281
|
return {
|
|
240
282
|
text,
|
|
241
283
|
segments,
|
|
284
|
+
...(words.length > 0 ? { words } : {}),
|
|
242
285
|
language,
|
|
243
286
|
durationInSeconds: undefined,
|
|
244
287
|
warnings,
|
|
@@ -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
|
|
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
|
|
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.
|
|
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
|
);
|