@ai-sdk/google-vertex 5.0.145 → 5.0.147

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/anthropic/edge/index.d.ts +561 -88
  3. package/dist/anthropic/edge/index.d.ts.map +1 -1
  4. package/dist/anthropic/edge/index.js +1 -1
  5. package/dist/anthropic/index.d.ts +561 -88
  6. package/dist/anthropic/index.d.ts.map +1 -1
  7. package/dist/edge/index.d.ts +561 -88
  8. package/dist/edge/index.d.ts.map +1 -1
  9. package/dist/edge/index.js +671 -359
  10. package/dist/edge/index.js.map +1 -1
  11. package/dist/index.d.ts +561 -88
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +671 -359
  14. package/dist/index.js.map +1 -1
  15. package/dist/maas/edge/index.d.ts +561 -88
  16. package/dist/maas/edge/index.d.ts.map +1 -1
  17. package/dist/maas/edge/index.js +365 -18
  18. package/dist/maas/edge/index.js.map +1 -1
  19. package/dist/maas/index.d.ts +561 -88
  20. package/dist/maas/index.d.ts.map +1 -1
  21. package/dist/maas/index.js +364 -17
  22. package/dist/maas/index.js.map +1 -1
  23. package/dist/xai/edge/index.d.ts +561 -88
  24. package/dist/xai/edge/index.d.ts.map +1 -1
  25. package/dist/xai/edge/index.js +1 -1
  26. package/dist/xai/index.d.ts +561 -88
  27. package/dist/xai/index.d.ts.map +1 -1
  28. package/package.json +5 -5
  29. package/src/gemini-transcription/google-vertex-gemini-transcription-model.ts +1 -1
  30. package/src/google-vertex-embedding-model.ts +1 -1
  31. package/src/google-vertex-image-model.ts +1 -1
  32. package/src/google-vertex-model-catalog.ts +213 -436
  33. package/src/google-vertex-model-matrix.ts +799 -0
  34. package/src/google-vertex-provider-base.ts +1 -1
  35. package/src/maas/google-vertex-maas-provider.ts +1 -1
  36. package/src/google-vertex-model-catalog-config.ts +0 -42
@@ -0,0 +1,799 @@
1
+ import type { ModelCapability } from '@ai-sdk/provider';
2
+
3
+ export type VertexRequestConfig = {
4
+ language?: { endpoint: boolean; maxOutputTokens?: number };
5
+ image?: { gemini: boolean };
6
+ embedding?: {
7
+ endpoint: 'embedContent' | 'predict';
8
+ maxEmbeddingsPerCall: number;
9
+ };
10
+ speech?: { api: 'cloud-tts' | 'gemini' };
11
+ transcription?: { api: 'gemini' | 'cloud-speech'; live: boolean };
12
+ };
13
+
14
+ /*
15
+ * The model matrices of the Vertex AI provider: for every operation, the row
16
+ * type and the matrix (model IDs by capability). The builders that turn a row
17
+ * into a catalog entry are in `google-vertex-model-catalog.ts`.
18
+ *
19
+ * A row is flat and every listed model fills in every cell. Nothing in a row
20
+ * is derived from the model ID. Facts that depend on each other share one
21
+ * cell, so a row cannot contradict itself.
22
+ *
23
+ * Model IDs that are not listed are resolved at the end of the file, which is
24
+ * the only place that looks at the model ID.
25
+ */
26
+
27
+ // Language models (Gemini)
28
+
29
+ /**
30
+ * One row of the Gemini language model matrix. A Gemini model on Vertex AI
31
+ * extends a model of the Google provider: the row names that model, and the
32
+ * builder applies the Vertex AI restrictions on top of its capabilities.
33
+ */
34
+ export type GoogleVertexLanguageModelRow = {
35
+ /** Model ID in the `@ai-sdk/google` catalog that this model extends. */
36
+ googleModelId: string;
37
+ };
38
+
39
+ export const languageModelDefinitions = {
40
+ 'gemini-nano-banana-2.1': { googleModelId: 'gemini-nano-banana-2.1' },
41
+ 'gemini-4-argon': { googleModelId: 'gemini-4-argon' },
42
+ 'gemini-4-carbon': { googleModelId: 'gemini-4-carbon' },
43
+ 'gemini-4-hydrogen': { googleModelId: 'gemini-4-hydrogen' },
44
+ 'gemini-4-neon': { googleModelId: 'gemini-4-neon' },
45
+ 'gemini-3.8-flash': { googleModelId: 'gemini-3.8-flash' },
46
+ 'gemini-3.7-flash': { googleModelId: 'gemini-3.7-flash' },
47
+ 'gemini-3.6-flash': { googleModelId: 'gemini-3.6-flash' },
48
+ 'gemini-3.5-flash': { googleModelId: 'gemini-3.5-flash' },
49
+ 'gemini-3.5-flash-lite': { googleModelId: 'gemini-3.5-flash-lite' },
50
+ 'gemini-2.5-pro': { googleModelId: 'gemini-2.5-pro' },
51
+ 'gemini-2.5-flash': { googleModelId: 'gemini-2.5-flash' },
52
+ 'gemini-2.5-flash-lite': { googleModelId: 'gemini-2.5-flash-lite' },
53
+ 'gemini-2.0-flash-lite': { googleModelId: 'gemini-2.0-flash-lite' },
54
+ 'gemini-2.0-flash': { googleModelId: 'gemini-2.0-flash' },
55
+ 'gemini-2.0-flash-001': { googleModelId: 'gemini-2.0-flash-001' },
56
+ 'gemini-1.5-flash': { googleModelId: 'gemini-1.5-flash' },
57
+ 'gemini-1.5-flash-001': { googleModelId: 'gemini-1.5-flash-001' },
58
+ 'gemini-1.5-flash-002': { googleModelId: 'gemini-1.5-flash-002' },
59
+ 'gemini-1.5-pro': { googleModelId: 'gemini-1.5-pro' },
60
+ 'gemini-1.5-pro-001': { googleModelId: 'gemini-1.5-pro-001' },
61
+ 'gemini-1.5-pro-002': { googleModelId: 'gemini-1.5-pro-002' },
62
+ 'gemini-1.0-pro-001': { googleModelId: 'gemini-1.0-pro-001' },
63
+ 'gemini-1.0-pro-vision-001': { googleModelId: 'gemini-1.0-pro-vision-001' },
64
+ 'gemini-1.0-pro': { googleModelId: 'gemini-1.0-pro' },
65
+ 'gemini-1.0-pro-002': { googleModelId: 'gemini-1.0-pro-002' },
66
+ 'gemini-2.0-flash-lite-preview-02-05': {
67
+ googleModelId: 'gemini-2.0-flash-lite-preview-02-05',
68
+ },
69
+ 'gemini-2.5-flash-preview-09-2025': {
70
+ googleModelId: 'gemini-2.5-flash-preview-09-2025',
71
+ },
72
+ 'gemini-3-pro-preview': { googleModelId: 'gemini-3-pro-preview' },
73
+ 'gemini-3-pro-image-preview': { googleModelId: 'gemini-3-pro-image-preview' },
74
+ 'gemini-3-flash-preview': { googleModelId: 'gemini-3-flash-preview' },
75
+ 'gemini-3.1-pro-preview': { googleModelId: 'gemini-3.1-pro-preview' },
76
+ 'gemini-3.1-flash-image-preview': {
77
+ googleModelId: 'gemini-3.1-flash-image-preview',
78
+ },
79
+ 'gemini-3.1-flash-lite-preview': {
80
+ googleModelId: 'gemini-3.1-flash-lite-preview',
81
+ },
82
+ 'gemini-2.0-pro-exp-02-05': { googleModelId: 'gemini-2.0-pro-exp-02-05' },
83
+ 'gemini-2.0-flash-exp': { googleModelId: 'gemini-2.0-flash-exp' },
84
+ } satisfies Record<string, GoogleVertexLanguageModelRow>;
85
+
86
+ /** Listed Gemini models are called by model ID, not through an endpoint. */
87
+ export const listedLanguageRequestConfig: VertexRequestConfig['language'] = {
88
+ endpoint: false,
89
+ maxOutputTokens: undefined,
90
+ };
91
+
92
+ // Image models
93
+
94
+ export type GoogleVertexImageModelRow = {
95
+ /**
96
+ * `false`: nothing is documented for the model ID. File and mask input are
97
+ * then reported as `'unknown'`.
98
+ */
99
+ documented: boolean;
100
+ /** API that generates the image. */
101
+ api: 'gemini' | 'imagen';
102
+ aspectRatios: readonly string[];
103
+ };
104
+
105
+ export const imageModelDefinitions = {
106
+ 'gemini-2.5-flash-image': {
107
+ documented: true,
108
+ api: 'gemini',
109
+ aspectRatios: [
110
+ '1:1',
111
+ '2:3',
112
+ '3:2',
113
+ '3:4',
114
+ '4:3',
115
+ '4:5',
116
+ '5:4',
117
+ '9:16',
118
+ '16:9',
119
+ '21:9',
120
+ ],
121
+ },
122
+ 'gemini-3-pro-image-preview': {
123
+ documented: true,
124
+ api: 'gemini',
125
+ aspectRatios: [
126
+ '1:1',
127
+ '2:3',
128
+ '3:2',
129
+ '3:4',
130
+ '4:3',
131
+ '4:5',
132
+ '5:4',
133
+ '9:16',
134
+ '16:9',
135
+ '21:9',
136
+ ],
137
+ },
138
+ 'gemini-3.1-flash-image-preview': {
139
+ documented: true,
140
+ api: 'gemini',
141
+ aspectRatios: [
142
+ '1:1',
143
+ '2:3',
144
+ '3:2',
145
+ '3:4',
146
+ '4:3',
147
+ '4:5',
148
+ '5:4',
149
+ '9:16',
150
+ '16:9',
151
+ '21:9',
152
+ ],
153
+ },
154
+ 'gemini-nano-banana-2.1': {
155
+ documented: true,
156
+ api: 'gemini',
157
+ aspectRatios: [
158
+ '1:1',
159
+ '2:3',
160
+ '3:2',
161
+ '3:4',
162
+ '4:3',
163
+ '4:5',
164
+ '5:4',
165
+ '9:16',
166
+ '16:9',
167
+ '21:9',
168
+ '1:8',
169
+ '8:1',
170
+ '1:4',
171
+ '4:1',
172
+ ],
173
+ },
174
+ } satisfies Record<string, GoogleVertexImageModelRow>;
175
+
176
+ // Embedding models
177
+
178
+ export type GoogleVertexEmbeddingModelRow = {
179
+ endpoint: 'embedContent' | 'predict';
180
+ maxEmbeddingsPerCall: number;
181
+ multimodal: boolean;
182
+ defaultDimensions: number;
183
+ };
184
+
185
+ export const embeddingModelDefinitions = {
186
+ 'textembedding-gecko': {
187
+ endpoint: 'predict',
188
+ maxEmbeddingsPerCall: 250,
189
+ multimodal: false,
190
+ defaultDimensions: 768,
191
+ },
192
+ 'textembedding-gecko@001': {
193
+ endpoint: 'predict',
194
+ maxEmbeddingsPerCall: 250,
195
+ multimodal: false,
196
+ defaultDimensions: 768,
197
+ },
198
+ 'textembedding-gecko@003': {
199
+ endpoint: 'predict',
200
+ maxEmbeddingsPerCall: 250,
201
+ multimodal: false,
202
+ defaultDimensions: 768,
203
+ },
204
+ 'textembedding-gecko-multilingual': {
205
+ endpoint: 'predict',
206
+ maxEmbeddingsPerCall: 250,
207
+ multimodal: false,
208
+ defaultDimensions: 768,
209
+ },
210
+ 'textembedding-gecko-multilingual@001': {
211
+ endpoint: 'predict',
212
+ maxEmbeddingsPerCall: 250,
213
+ multimodal: false,
214
+ defaultDimensions: 768,
215
+ },
216
+ 'text-multilingual-embedding-002': {
217
+ endpoint: 'predict',
218
+ maxEmbeddingsPerCall: 250,
219
+ multimodal: false,
220
+ defaultDimensions: 768,
221
+ },
222
+ 'text-embedding-004': {
223
+ endpoint: 'predict',
224
+ maxEmbeddingsPerCall: 250,
225
+ multimodal: false,
226
+ defaultDimensions: 768,
227
+ },
228
+ 'text-embedding-005': {
229
+ endpoint: 'predict',
230
+ maxEmbeddingsPerCall: 250,
231
+ multimodal: false,
232
+ defaultDimensions: 768,
233
+ },
234
+ 'gemini-embedding-001': {
235
+ endpoint: 'predict',
236
+ maxEmbeddingsPerCall: 250,
237
+ multimodal: false,
238
+ defaultDimensions: 3072,
239
+ },
240
+ 'gemini-embedding-2': {
241
+ endpoint: 'embedContent',
242
+ maxEmbeddingsPerCall: 1,
243
+ multimodal: true,
244
+ defaultDimensions: 3072,
245
+ },
246
+ 'gemini-embedding-2-preview': {
247
+ endpoint: 'embedContent',
248
+ maxEmbeddingsPerCall: 1,
249
+ multimodal: true,
250
+ defaultDimensions: 3072,
251
+ },
252
+ } satisfies Record<string, GoogleVertexEmbeddingModelRow>;
253
+
254
+ /** Request settings for embedding model IDs that are not listed. */
255
+ const unlistedEmbeddingModel: Pick<
256
+ GoogleVertexEmbeddingModelRow,
257
+ 'endpoint' | 'maxEmbeddingsPerCall'
258
+ > = { endpoint: 'predict', maxEmbeddingsPerCall: 250 };
259
+
260
+ // Video models
261
+
262
+ export type GoogleVertexVideoModelRow = {
263
+ generateAudio: boolean;
264
+ };
265
+
266
+ export const videoModelDefinitions = {
267
+ 'veo-2.0-generate-preview': { generateAudio: false },
268
+ 'veo-2.0-generate-exp': { generateAudio: false },
269
+ 'veo-2.0-generate-001': { generateAudio: false },
270
+ 'veo-3.0-generate-001': { generateAudio: true },
271
+ 'veo-3.0-fast-generate-001': { generateAudio: true },
272
+ 'veo-3.0-generate-preview': { generateAudio: true },
273
+ 'veo-3.0-fast-generate-preview': { generateAudio: true },
274
+ 'veo-3.1-generate-001': { generateAudio: true },
275
+ 'veo-3.1-fast-generate-001': { generateAudio: true },
276
+ 'veo-3.1-generate-preview': { generateAudio: true },
277
+ 'veo-3.1-fast-generate-preview': { generateAudio: true },
278
+ } satisfies Record<string, GoogleVertexVideoModelRow>;
279
+
280
+ // Speech models
281
+
282
+ const requiresGemini38Tts = { condition: 'Requires Gemini 3.8 TTS.' } as const;
283
+
284
+ export type GoogleVertexSpeechModelRow = {
285
+ /** API that synthesizes the speech. */
286
+ api: 'cloud-tts' | 'gemini';
287
+ instructions: boolean;
288
+ /** Multi-speaker output, set with `multiSpeakerVoiceConfig`. */
289
+ multiSpeaker: boolean;
290
+ speechMetadata: ModelCapability;
291
+ turns: ModelCapability;
292
+ };
293
+
294
+ export const speechModelDefinitions = {
295
+ 'gemini-2.5-flash-tts': {
296
+ api: 'gemini',
297
+ instructions: true,
298
+ multiSpeaker: true,
299
+ speechMetadata: requiresGemini38Tts,
300
+ turns: requiresGemini38Tts,
301
+ },
302
+ 'gemini-2.5-pro-tts': {
303
+ api: 'gemini',
304
+ instructions: true,
305
+ multiSpeaker: true,
306
+ speechMetadata: requiresGemini38Tts,
307
+ turns: requiresGemini38Tts,
308
+ },
309
+ 'gemini-2.5-flash-lite-preview-tts': {
310
+ api: 'gemini',
311
+ instructions: true,
312
+ multiSpeaker: true,
313
+ speechMetadata: requiresGemini38Tts,
314
+ turns: requiresGemini38Tts,
315
+ },
316
+ 'gemini-3.1-flash-tts-preview': {
317
+ api: 'gemini',
318
+ instructions: true,
319
+ multiSpeaker: true,
320
+ speechMetadata: requiresGemini38Tts,
321
+ turns: requiresGemini38Tts,
322
+ },
323
+ 'chirp-3-hd': {
324
+ api: 'cloud-tts',
325
+ instructions: false,
326
+ multiSpeaker: false,
327
+ speechMetadata: false,
328
+ turns: false,
329
+ },
330
+ } satisfies Record<string, GoogleVertexSpeechModelRow>;
331
+
332
+ // Transcription models
333
+
334
+ const requiresWordTimestamps = {
335
+ condition: 'Requires word timestamps.',
336
+ } as const;
337
+
338
+ export type GoogleVertexTranscriptionModelRow = {
339
+ /**
340
+ * API that transcribes the audio. It also decides which provider options
341
+ * apply, because each API has its own.
342
+ */
343
+ api: 'cloud-speech' | 'gemini';
344
+ /** `batch` transcribes a complete file. `live` transcribes a stream. */
345
+ mode: 'batch' | 'live';
346
+ duration: boolean;
347
+ segments: ModelCapability;
348
+ /** Documented word timestamp support. `undefined`: not documented. */
349
+ wordTimestamps: string | undefined;
350
+ /** Documented language detection. `undefined`: not documented. */
351
+ languageDetection: string | undefined;
352
+ };
353
+
354
+ export const transcriptionModelDefinitions = {
355
+ chirp_2: {
356
+ api: 'cloud-speech',
357
+ mode: 'batch',
358
+ duration: true,
359
+ segments: requiresWordTimestamps,
360
+ wordTimestamps: 'Available with a potential quality and speed tradeoff',
361
+ languageDetection: "Auto detection with `['auto']`",
362
+ },
363
+ chirp_3: {
364
+ api: 'cloud-speech',
365
+ mode: 'batch',
366
+ duration: true,
367
+ segments: requiresWordTimestamps,
368
+ wordTimestamps: 'Available with a potential transcription quality tradeoff',
369
+ languageDetection: "Auto detection with `['auto']`",
370
+ },
371
+ telephony: {
372
+ api: 'cloud-speech',
373
+ mode: 'batch',
374
+ duration: true,
375
+ segments: requiresWordTimestamps,
376
+ wordTimestamps: 'Available',
377
+ languageDetection:
378
+ 'Explicit supported language codes, with alternative language detection support',
379
+ },
380
+ 'gemini-3.5-transcribe': {
381
+ api: 'gemini',
382
+ mode: 'batch',
383
+ duration: false,
384
+ segments: requiresWordTimestamps,
385
+ wordTimestamps: undefined,
386
+ languageDetection: undefined,
387
+ },
388
+ 'gemini-3.5-transcribe-live': {
389
+ api: 'gemini',
390
+ mode: 'live',
391
+ duration: false,
392
+ segments: false,
393
+ wordTimestamps: undefined,
394
+ languageDetection: undefined,
395
+ },
396
+ } satisfies Record<string, GoogleVertexTranscriptionModelRow>;
397
+
398
+ // Anthropic models on Vertex AI
399
+
400
+ export type GoogleVertexAnthropicModelRow = {
401
+ /**
402
+ * `false` keeps a known model ID out of the exported catalog and the
403
+ * generated documentation.
404
+ */
405
+ documented: boolean;
406
+ image: ModelCapability;
407
+ objectGeneration: ModelCapability;
408
+ tools: ModelCapability;
409
+ toolStreaming: ModelCapability;
410
+ computerUse: ModelCapability;
411
+ };
412
+
413
+ export const anthropicModelDefinitions = {
414
+ 'claude-fable-5-1': {
415
+ documented: true,
416
+ image: true,
417
+ objectGeneration: true,
418
+ tools: true,
419
+ toolStreaming: true,
420
+ computerUse: true,
421
+ },
422
+ 'claude-fable-5-2': {
423
+ documented: true,
424
+ image: true,
425
+ objectGeneration: true,
426
+ tools: true,
427
+ toolStreaming: true,
428
+ computerUse: true,
429
+ },
430
+ 'claude-3-7-sonnet@20250219': {
431
+ documented: true,
432
+ image: true,
433
+ objectGeneration: true,
434
+ tools: true,
435
+ toolStreaming: true,
436
+ computerUse: true,
437
+ },
438
+ 'claude-3-5-sonnet-v2@20241022': {
439
+ documented: true,
440
+ image: true,
441
+ objectGeneration: true,
442
+ tools: true,
443
+ toolStreaming: true,
444
+ computerUse: true,
445
+ },
446
+ 'claude-3-5-sonnet@20240620': {
447
+ documented: true,
448
+ image: true,
449
+ objectGeneration: true,
450
+ tools: true,
451
+ toolStreaming: true,
452
+ computerUse: false,
453
+ },
454
+ 'claude-3-5-haiku@20241022': {
455
+ documented: true,
456
+ image: false,
457
+ objectGeneration: true,
458
+ tools: true,
459
+ toolStreaming: true,
460
+ computerUse: false,
461
+ },
462
+ 'claude-3-sonnet@20240229': {
463
+ documented: true,
464
+ image: true,
465
+ objectGeneration: true,
466
+ tools: true,
467
+ toolStreaming: true,
468
+ computerUse: false,
469
+ },
470
+ 'claude-3-haiku@20240307': {
471
+ documented: true,
472
+ image: true,
473
+ objectGeneration: true,
474
+ tools: true,
475
+ toolStreaming: true,
476
+ computerUse: false,
477
+ },
478
+ 'claude-3-opus@20240229': {
479
+ documented: true,
480
+ image: true,
481
+ objectGeneration: true,
482
+ tools: true,
483
+ toolStreaming: true,
484
+ computerUse: false,
485
+ },
486
+ 'claude-fable-5': {
487
+ documented: false,
488
+ image: 'unknown',
489
+ objectGeneration: 'unknown',
490
+ tools: 'unknown',
491
+ toolStreaming: 'unknown',
492
+ computerUse: 'unknown',
493
+ },
494
+ 'claude-haiku-5-5': {
495
+ documented: false,
496
+ image: 'unknown',
497
+ objectGeneration: 'unknown',
498
+ tools: 'unknown',
499
+ toolStreaming: 'unknown',
500
+ computerUse: 'unknown',
501
+ },
502
+ 'claude-opus-4-1@20250805': {
503
+ documented: false,
504
+ image: 'unknown',
505
+ objectGeneration: 'unknown',
506
+ tools: 'unknown',
507
+ toolStreaming: 'unknown',
508
+ computerUse: 'unknown',
509
+ },
510
+ 'claude-opus-4-5@20251101': {
511
+ documented: false,
512
+ image: 'unknown',
513
+ objectGeneration: 'unknown',
514
+ tools: 'unknown',
515
+ toolStreaming: 'unknown',
516
+ computerUse: 'unknown',
517
+ },
518
+ 'claude-opus-4-6': {
519
+ documented: false,
520
+ image: 'unknown',
521
+ objectGeneration: 'unknown',
522
+ tools: 'unknown',
523
+ toolStreaming: 'unknown',
524
+ computerUse: 'unknown',
525
+ },
526
+ 'claude-opus-4-7': {
527
+ documented: false,
528
+ image: 'unknown',
529
+ objectGeneration: 'unknown',
530
+ tools: 'unknown',
531
+ toolStreaming: 'unknown',
532
+ computerUse: 'unknown',
533
+ },
534
+ 'claude-opus-4-8': {
535
+ documented: false,
536
+ image: 'unknown',
537
+ objectGeneration: 'unknown',
538
+ tools: 'unknown',
539
+ toolStreaming: 'unknown',
540
+ computerUse: 'unknown',
541
+ },
542
+ 'claude-opus-4@20250514': {
543
+ documented: false,
544
+ image: 'unknown',
545
+ objectGeneration: 'unknown',
546
+ tools: 'unknown',
547
+ toolStreaming: 'unknown',
548
+ computerUse: 'unknown',
549
+ },
550
+ 'claude-opus-5': {
551
+ documented: false,
552
+ image: 'unknown',
553
+ objectGeneration: 'unknown',
554
+ tools: 'unknown',
555
+ toolStreaming: 'unknown',
556
+ computerUse: 'unknown',
557
+ },
558
+ 'claude-opus-5-5': {
559
+ documented: false,
560
+ image: 'unknown',
561
+ objectGeneration: 'unknown',
562
+ tools: 'unknown',
563
+ toolStreaming: 'unknown',
564
+ computerUse: 'unknown',
565
+ },
566
+ 'claude-sonnet-4-5@20250929': {
567
+ documented: false,
568
+ image: 'unknown',
569
+ objectGeneration: 'unknown',
570
+ tools: 'unknown',
571
+ toolStreaming: 'unknown',
572
+ computerUse: 'unknown',
573
+ },
574
+ 'claude-sonnet-4-6': {
575
+ documented: false,
576
+ image: 'unknown',
577
+ objectGeneration: 'unknown',
578
+ tools: 'unknown',
579
+ toolStreaming: 'unknown',
580
+ computerUse: 'unknown',
581
+ },
582
+ 'claude-sonnet-4@20250514': {
583
+ documented: false,
584
+ image: 'unknown',
585
+ objectGeneration: 'unknown',
586
+ tools: 'unknown',
587
+ toolStreaming: 'unknown',
588
+ computerUse: 'unknown',
589
+ },
590
+ 'claude-sonnet-5': {
591
+ documented: false,
592
+ image: 'unknown',
593
+ objectGeneration: 'unknown',
594
+ tools: 'unknown',
595
+ toolStreaming: 'unknown',
596
+ computerUse: 'unknown',
597
+ },
598
+ 'claude-sonnet-5-5': {
599
+ documented: false,
600
+ image: 'unknown',
601
+ objectGeneration: 'unknown',
602
+ tools: 'unknown',
603
+ toolStreaming: 'unknown',
604
+ computerUse: 'unknown',
605
+ },
606
+ } satisfies Record<string, GoogleVertexAnthropicModelRow>;
607
+
608
+ // xAI models on Vertex AI
609
+
610
+ export type GoogleVertexXaiModelRow = {
611
+ reasoning: boolean;
612
+ };
613
+
614
+ export const xaiModelDefinitions = {
615
+ 'xai/grok-4.20-reasoning': { reasoning: true },
616
+ 'xai/grok-4.20-non-reasoning': { reasoning: false },
617
+ 'xai/grok-4.1-fast-reasoning': { reasoning: true },
618
+ 'xai/grok-4.1-fast-non-reasoning': { reasoning: false },
619
+ } satisfies Record<string, GoogleVertexXaiModelRow>;
620
+
621
+ // Model as a Service (MaaS) models on Vertex AI
622
+
623
+ export type GoogleVertexMaasModelRow = {
624
+ publisher: string;
625
+ /**
626
+ * Output token limit that the SDK applies to requests. `undefined`: no
627
+ * limit is applied.
628
+ */
629
+ maxOutputTokens: number | undefined;
630
+ };
631
+
632
+ export const maasModelDefinitions = {
633
+ 'deepseek-ai/deepseek-r1-0528-maas': {
634
+ publisher: 'DeepSeek',
635
+ maxOutputTokens: undefined,
636
+ },
637
+ 'deepseek-ai/deepseek-v3.1-maas': {
638
+ publisher: 'DeepSeek',
639
+ maxOutputTokens: undefined,
640
+ },
641
+ 'deepseek-ai/deepseek-v3.2-maas': {
642
+ publisher: 'DeepSeek',
643
+ maxOutputTokens: undefined,
644
+ },
645
+ 'openai/gpt-oss-120b-maas': {
646
+ publisher: 'OpenAI',
647
+ maxOutputTokens: undefined,
648
+ },
649
+ 'openai/gpt-oss-20b-maas': {
650
+ publisher: 'OpenAI',
651
+ maxOutputTokens: undefined,
652
+ },
653
+ 'meta/llama-4-maverick-17b-128e-instruct-maas': {
654
+ publisher: 'Meta',
655
+ maxOutputTokens: 8192,
656
+ },
657
+ 'meta/llama-4-scout-17b-16e-instruct-maas': {
658
+ publisher: 'Meta',
659
+ maxOutputTokens: 8192,
660
+ },
661
+ 'minimax/minimax-m2-maas': {
662
+ publisher: 'MiniMax',
663
+ maxOutputTokens: undefined,
664
+ },
665
+ 'qwen/qwen3-coder-480b-a35b-instruct-maas': {
666
+ publisher: 'Qwen',
667
+ maxOutputTokens: undefined,
668
+ },
669
+ 'qwen/qwen3-next-80b-a3b-instruct-maas': {
670
+ publisher: 'Qwen',
671
+ maxOutputTokens: undefined,
672
+ },
673
+ 'qwen/qwen3-next-80b-a3b-thinking-maas': {
674
+ publisher: 'Qwen',
675
+ maxOutputTokens: undefined,
676
+ },
677
+ 'moonshotai/kimi-k2-thinking-maas': {
678
+ publisher: 'Moonshot',
679
+ maxOutputTokens: undefined,
680
+ },
681
+ } satisfies Record<string, GoogleVertexMaasModelRow>;
682
+
683
+ // Lookup by model ID
684
+
685
+ /**
686
+ * Request settings for a model ID, per operation. A listed model ID uses its
687
+ * row. Every other model ID uses the fallback for unlisted IDs.
688
+ */
689
+ export function getGoogleVertexRequestConfig(
690
+ modelId: string,
691
+ ): VertexRequestConfig {
692
+ const maas = findRow<GoogleVertexMaasModelRow>(maasModelDefinitions, modelId);
693
+ const image =
694
+ findRow<GoogleVertexImageModelRow>(imageModelDefinitions, modelId) ??
695
+ getUnlistedImageModelRow(modelId);
696
+ const embedding =
697
+ findRow<GoogleVertexEmbeddingModelRow>(
698
+ embeddingModelDefinitions,
699
+ modelId,
700
+ ) ?? unlistedEmbeddingModel;
701
+ const speech = findRow<GoogleVertexSpeechModelRow>(
702
+ speechModelDefinitions,
703
+ modelId,
704
+ );
705
+ const transcription = findRow<GoogleVertexTranscriptionModelRow>(
706
+ transcriptionModelDefinitions,
707
+ modelId,
708
+ );
709
+
710
+ return {
711
+ language:
712
+ maas != null
713
+ ? { endpoint: false, maxOutputTokens: maas.maxOutputTokens }
714
+ : findRow(languageModelDefinitions, modelId) != null
715
+ ? listedLanguageRequestConfig
716
+ : getUnlistedLanguageRequestConfig(modelId),
717
+ image: { gemini: image.api === 'gemini' },
718
+ embedding: {
719
+ endpoint: embedding.endpoint,
720
+ maxEmbeddingsPerCall: embedding.maxEmbeddingsPerCall,
721
+ },
722
+ speech: { api: speech?.api ?? getUnlistedSpeechApi(modelId) },
723
+ transcription:
724
+ transcription != null
725
+ ? { api: transcription.api, live: transcription.mode === 'live' }
726
+ : getUnlistedTranscriptionRequestConfig(modelId),
727
+ };
728
+ }
729
+
730
+ export function findRow<Row>(
731
+ definitions: Readonly<Record<string, Row>>,
732
+ modelId: string,
733
+ ): Row | undefined {
734
+ return Object.prototype.hasOwnProperty.call(definitions, modelId)
735
+ ? definitions[modelId]
736
+ : undefined;
737
+ }
738
+
739
+ /*
740
+ * Fallback for model IDs that are not listed in a matrix, such as new models,
741
+ * tuned models, and endpoints. This is the only place that derives anything
742
+ * from the model ID, so that new models keep working before they are listed.
743
+ */
744
+
745
+ function getUnlistedLanguageRequestConfig(
746
+ modelId: string,
747
+ ): VertexRequestConfig['language'] {
748
+ return {
749
+ endpoint: modelId.startsWith('endpoints/'),
750
+ maxOutputTokens: undefined,
751
+ };
752
+ }
753
+
754
+ export function getUnlistedImageModelRow(
755
+ modelId: string,
756
+ ): GoogleVertexImageModelRow {
757
+ return {
758
+ documented: false,
759
+ api: modelId.startsWith('gemini-') ? 'gemini' : 'imagen',
760
+ aspectRatios: [],
761
+ };
762
+ }
763
+
764
+ function getUnlistedSpeechApi(
765
+ modelId: string,
766
+ ): GoogleVertexSpeechModelRow['api'] {
767
+ return modelId.startsWith('chirp') ? 'cloud-tts' : 'gemini';
768
+ }
769
+
770
+ function getUnlistedTranscriptionRequestConfig(
771
+ modelId: string,
772
+ ): NonNullable<VertexRequestConfig['transcription']> {
773
+ return {
774
+ api: modelId.startsWith('gemini') ? 'gemini' : 'cloud-speech',
775
+ live: modelId.includes('-live'),
776
+ };
777
+ }
778
+
779
+ type TranscriptionModelIdFor<
780
+ Api extends GoogleVertexTranscriptionModelRow['api'],
781
+ > = {
782
+ [ModelId in keyof typeof transcriptionModelDefinitions]: (typeof transcriptionModelDefinitions)[ModelId]['api'] extends Api
783
+ ? ModelId
784
+ : never;
785
+ }[keyof typeof transcriptionModelDefinitions];
786
+
787
+ /** Known model IDs, derived from the matrices used to build the catalog. */
788
+ export type GoogleVertexModelIds = {
789
+ language: keyof typeof languageModelDefinitions;
790
+ image: keyof typeof imageModelDefinitions;
791
+ embedding: keyof typeof embeddingModelDefinitions;
792
+ video: keyof typeof videoModelDefinitions;
793
+ speech: keyof typeof speechModelDefinitions;
794
+ transcription: TranscriptionModelIdFor<'cloud-speech'>;
795
+ geminiTranscription: TranscriptionModelIdFor<'gemini'>;
796
+ anthropic: keyof typeof anthropicModelDefinitions;
797
+ xai: keyof typeof xaiModelDefinitions;
798
+ maas: keyof typeof maasModelDefinitions;
799
+ };