@tanstack/ai-gemini 0.0.1

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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +131 -0
  3. package/dist/esm/gemini-adapter.d.ts +71 -0
  4. package/dist/esm/gemini-adapter.js +375 -0
  5. package/dist/esm/gemini-adapter.js.map +1 -0
  6. package/dist/esm/index.d.ts +6 -0
  7. package/dist/esm/index.js +7 -0
  8. package/dist/esm/index.js.map +1 -0
  9. package/dist/esm/message-types.d.ts +84 -0
  10. package/dist/esm/model-meta.d.ts +189 -0
  11. package/dist/esm/model-meta.js +43 -0
  12. package/dist/esm/model-meta.js.map +1 -0
  13. package/dist/esm/text/text-provider-options.d.ts +184 -0
  14. package/dist/esm/tools/code-execution-tool.d.ts +7 -0
  15. package/dist/esm/tools/code-execution-tool.js +9 -0
  16. package/dist/esm/tools/code-execution-tool.js.map +1 -0
  17. package/dist/esm/tools/computer-use-tool.d.ts +10 -0
  18. package/dist/esm/tools/computer-use-tool.js +13 -0
  19. package/dist/esm/tools/computer-use-tool.js.map +1 -0
  20. package/dist/esm/tools/file-search-tool.d.ts +7 -0
  21. package/dist/esm/tools/file-search-tool.js +10 -0
  22. package/dist/esm/tools/file-search-tool.js.map +1 -0
  23. package/dist/esm/tools/function-declaration-tool.d.ts +5 -0
  24. package/dist/esm/tools/google-maps-tool.d.ts +7 -0
  25. package/dist/esm/tools/google-maps-tool.js +10 -0
  26. package/dist/esm/tools/google-maps-tool.js.map +1 -0
  27. package/dist/esm/tools/google-search-retriveal-tool.d.ts +7 -0
  28. package/dist/esm/tools/google-search-retriveal-tool.js +10 -0
  29. package/dist/esm/tools/google-search-retriveal-tool.js.map +1 -0
  30. package/dist/esm/tools/google-search-tool.d.ts +7 -0
  31. package/dist/esm/tools/google-search-tool.js +10 -0
  32. package/dist/esm/tools/google-search-tool.js.map +1 -0
  33. package/dist/esm/tools/index.d.ts +9 -0
  34. package/dist/esm/tools/tool-converter.d.ts +22 -0
  35. package/dist/esm/tools/tool-converter.js +64 -0
  36. package/dist/esm/tools/tool-converter.js.map +1 -0
  37. package/dist/esm/tools/url-context-tool.d.ts +7 -0
  38. package/dist/esm/tools/url-context-tool.js +9 -0
  39. package/dist/esm/tools/url-context-tool.js.map +1 -0
  40. package/package.json +53 -0
  41. package/src/gemini-adapter.ts +577 -0
  42. package/src/index.ts +22 -0
  43. package/src/message-types.ts +125 -0
  44. package/src/model-meta.ts +887 -0
  45. package/src/text/text-provider-options.ts +246 -0
  46. package/src/tools/code-execution-tool.ts +17 -0
  47. package/src/tools/computer-use-tool.ts +25 -0
  48. package/src/tools/file-search-tool.ts +19 -0
  49. package/src/tools/function-declaration-tool.ts +34 -0
  50. package/src/tools/google-maps-tool.ts +19 -0
  51. package/src/tools/google-search-retriveal-tool.ts +21 -0
  52. package/src/tools/google-search-tool.ts +19 -0
  53. package/src/tools/index.ts +18 -0
  54. package/src/tools/tool-converter.ts +99 -0
  55. package/src/tools/url-context-tool.ts +17 -0
@@ -0,0 +1,887 @@
1
+ import type {
2
+ GeminiCachedContentOptions,
3
+ GeminiGenerationConfigOptions,
4
+ GeminiSafetyOptions,
5
+ GeminiStructuredOutputOptions,
6
+ GeminiThinkingOptions,
7
+ GeminiToolConfigOptions,
8
+ } from './text/text-provider-options'
9
+
10
+ interface ModelMeta<TProviderOptions = unknown> {
11
+ name: string
12
+ supports: {
13
+ input: Array<'text' | 'image' | 'audio' | 'video' | 'document'>
14
+ output: Array<'text' | 'image' | 'audio' | 'video'>
15
+ capabilities?: Array<
16
+ | 'audio_generation'
17
+ | 'batch_api'
18
+ | 'caching'
19
+ | 'code_execution'
20
+ | 'file_search'
21
+ | 'function_calling'
22
+ | 'grounding_with_gmaps'
23
+ | 'image_generation'
24
+ | 'live_api'
25
+ | 'search_grounding'
26
+ | 'structured_output'
27
+ | 'thinking'
28
+ | 'url_context'
29
+ >
30
+ }
31
+ max_input_tokens?: number
32
+ max_output_tokens?: number
33
+ knowledge_cutoff?: string
34
+ pricing?: {
35
+ input: {
36
+ normal: number
37
+ cached?: number
38
+ }
39
+ output: {
40
+ normal: number
41
+ }
42
+ }
43
+ /**
44
+ * Type-level description of which provider options this model supports.
45
+ */
46
+ providerOptions?: TProviderOptions
47
+ }
48
+
49
+ const GEMINI_3_PRO = {
50
+ name: 'gemini-3-pro-preview',
51
+ max_input_tokens: 1_048_576,
52
+ max_output_tokens: 65_536,
53
+ knowledge_cutoff: '2025-01-01',
54
+ supports: {
55
+ input: ['text', 'image', 'audio', 'video', 'document'],
56
+ output: ['text'],
57
+ capabilities: [
58
+ 'batch_api',
59
+ 'caching',
60
+ 'code_execution',
61
+ 'file_search',
62
+ 'function_calling',
63
+ 'search_grounding',
64
+ 'structured_output',
65
+ 'thinking',
66
+ 'url_context',
67
+ ],
68
+ },
69
+ pricing: {
70
+ input: {
71
+ normal: 2.5,
72
+ },
73
+ output: {
74
+ normal: 15,
75
+ },
76
+ },
77
+ } as const satisfies ModelMeta<
78
+ GeminiToolConfigOptions &
79
+ GeminiSafetyOptions &
80
+ GeminiGenerationConfigOptions &
81
+ GeminiCachedContentOptions &
82
+ GeminiStructuredOutputOptions &
83
+ GeminiThinkingOptions
84
+ >
85
+
86
+ const GEMINI_2_5_PRO = {
87
+ name: 'gemini-2.5-pro',
88
+ max_input_tokens: 1_048_576,
89
+ max_output_tokens: 65_536,
90
+ knowledge_cutoff: '2025-01-01',
91
+ supports: {
92
+ input: ['text', 'image', 'audio', 'video', 'document'],
93
+ output: ['text'],
94
+ capabilities: [
95
+ 'batch_api',
96
+ 'caching',
97
+ 'code_execution',
98
+ 'file_search',
99
+ 'function_calling',
100
+ 'grounding_with_gmaps',
101
+ 'search_grounding',
102
+ 'structured_output',
103
+ 'thinking',
104
+ 'url_context',
105
+ ],
106
+ },
107
+ pricing: {
108
+ input: {
109
+ normal: 2.5,
110
+ },
111
+ output: {
112
+ normal: 15,
113
+ },
114
+ },
115
+ } as const satisfies ModelMeta<
116
+ GeminiToolConfigOptions &
117
+ GeminiSafetyOptions &
118
+ GeminiGenerationConfigOptions &
119
+ GeminiCachedContentOptions &
120
+ GeminiStructuredOutputOptions &
121
+ GeminiThinkingOptions
122
+ >
123
+
124
+ /* const GEMINI_2_5_PRO_TTS = {
125
+ name: 'gemini-2.5-pro-preview-tts',
126
+ max_input_tokens: 8_192,
127
+ max_output_tokens: 16_384,
128
+ knowledge_cutoff: '2025-05-01',
129
+ supports: {
130
+ input: ['text'],
131
+ output: ['audio'],
132
+ capabilities: ['audio_generation', 'file_search'],
133
+ },
134
+ pricing: {
135
+ input: {
136
+ normal: 2.5,
137
+ },
138
+ output: {
139
+ normal: 15,
140
+ },
141
+ },
142
+ } as const satisfies ModelMeta<
143
+ GeminiToolConfigOptions &
144
+ GeminiSafetyOptions &
145
+ GeminiGenerationConfigOptions &
146
+ GeminiCachedContentOptions
147
+ > */
148
+
149
+ const GEMINI_2_5_FLASH = {
150
+ name: 'gemini-2.5-flash',
151
+ max_input_tokens: 1_048_576,
152
+ max_output_tokens: 65_536,
153
+ knowledge_cutoff: '2025-01-01',
154
+ supports: {
155
+ input: ['text', 'image', 'audio', 'video'],
156
+ output: ['text'],
157
+ capabilities: [
158
+ 'batch_api',
159
+ 'caching',
160
+ 'code_execution',
161
+ 'file_search',
162
+ 'function_calling',
163
+ 'grounding_with_gmaps',
164
+ 'search_grounding',
165
+ 'structured_output',
166
+ 'thinking',
167
+ 'url_context',
168
+ ],
169
+ },
170
+ pricing: {
171
+ input: {
172
+ normal: 1,
173
+ },
174
+ output: {
175
+ normal: 2.5,
176
+ },
177
+ },
178
+ } as const satisfies ModelMeta<
179
+ GeminiToolConfigOptions &
180
+ GeminiSafetyOptions &
181
+ GeminiGenerationConfigOptions &
182
+ GeminiCachedContentOptions &
183
+ GeminiStructuredOutputOptions &
184
+ GeminiThinkingOptions
185
+ >
186
+
187
+ const GEMINI_2_5_FLASH_PREVIEW = {
188
+ name: 'gemini-2.5-flash-preview-09-2025',
189
+ max_input_tokens: 1_048_576,
190
+ max_output_tokens: 65_536,
191
+ knowledge_cutoff: '2025-01-01',
192
+ supports: {
193
+ input: ['text', 'image', 'audio', 'video'],
194
+ output: ['text'],
195
+ capabilities: [
196
+ 'batch_api',
197
+ 'caching',
198
+ 'code_execution',
199
+ 'file_search',
200
+ 'function_calling',
201
+ 'search_grounding',
202
+ 'structured_output',
203
+ 'thinking',
204
+ 'url_context',
205
+ ],
206
+ },
207
+ pricing: {
208
+ input: {
209
+ normal: 1,
210
+ },
211
+ output: {
212
+ normal: 2.5,
213
+ },
214
+ },
215
+ } as const satisfies ModelMeta<
216
+ GeminiToolConfigOptions &
217
+ GeminiSafetyOptions &
218
+ GeminiGenerationConfigOptions &
219
+ GeminiCachedContentOptions &
220
+ GeminiStructuredOutputOptions &
221
+ GeminiThinkingOptions
222
+ >
223
+ /*
224
+ const GEMINI_2_5_FLASH_IMAGE = {
225
+ name: 'gemini-2.5-flash-image',
226
+ max_input_tokens: 1_048_576,
227
+ max_output_tokens: 65_536,
228
+ knowledge_cutoff: '2025-06-01',
229
+ supports: {
230
+ input: ['text', 'image'],
231
+ output: ['text', 'image'],
232
+ capabilities: [
233
+ 'batch_api',
234
+ 'caching',
235
+ 'file_search',
236
+ 'image_generation',
237
+ 'structured_output',
238
+ ],
239
+ },
240
+ pricing: {
241
+ input: {
242
+ normal: 0.3,
243
+ },
244
+ output: {
245
+ normal: 0.4,
246
+ },
247
+ },
248
+ } as const satisfies ModelMeta<
249
+ GeminiToolConfigOptions &
250
+ GeminiSafetyOptions &
251
+ GeminiGenerationConfigOptions &
252
+ GeminiCachedContentOptions
253
+ >
254
+
255
+ const GEMINI_2_5_FLASH_LIVE = {
256
+ name: 'gemini-2.5-flash-native-audio-preview-09-2025',
257
+ max_input_tokens: 141_072,
258
+ max_output_tokens: 8_192,
259
+ knowledge_cutoff: '2025-01-01',
260
+ supports: {
261
+ input: ['text', 'audio', 'video'],
262
+ output: ['text', 'audio'],
263
+ capabilities: [
264
+ 'audio_generation',
265
+ 'file_search',
266
+ 'function_calling',
267
+ 'live_api',
268
+ 'search_grounding',
269
+ 'thinking',
270
+ ],
271
+ },
272
+ pricing: {
273
+ // todo find this info
274
+ input: {
275
+ normal: 0,
276
+ },
277
+ output: {
278
+ normal: 0,
279
+ },
280
+ },
281
+ } as const satisfies ModelMeta<
282
+ GeminiToolConfigOptions &
283
+ GeminiSafetyOptions &
284
+ GeminiGenerationConfigOptions &
285
+ GeminiCachedContentOptions &
286
+ GeminiThinkingOptions
287
+ >
288
+
289
+ const GEMINI_2_5_FLASH_TTS = {
290
+ name: 'gemini-2.5-flash-preview-tts',
291
+ max_input_tokens: 8_192,
292
+ max_output_tokens: 16_384,
293
+ knowledge_cutoff: '2025-05-01',
294
+ supports: {
295
+ input: ['text'],
296
+ output: ['audio'],
297
+ capabilities: ['audio_generation', 'batch_api', 'file_search'],
298
+ },
299
+ pricing: {
300
+ input: {
301
+ normal: 1,
302
+ },
303
+ output: {
304
+ normal: 2.5,
305
+ },
306
+ },
307
+ } as const satisfies ModelMeta<
308
+ GeminiToolConfigOptions &
309
+ GeminiSafetyOptions &
310
+ GeminiGenerationConfigOptions &
311
+ GeminiCachedContentOptions
312
+ > */
313
+
314
+ const GEMINI_2_5_FLASH_LITE = {
315
+ name: 'gemini-2.5-flash-lite',
316
+ max_input_tokens: 1_048_576,
317
+ max_output_tokens: 65_536,
318
+ knowledge_cutoff: '2025-01-01',
319
+ supports: {
320
+ input: ['text', 'image', 'audio', 'video', 'document'],
321
+ output: ['text'],
322
+ capabilities: [
323
+ 'batch_api',
324
+ 'caching',
325
+ 'code_execution',
326
+ 'function_calling',
327
+ 'grounding_with_gmaps',
328
+ 'search_grounding',
329
+ 'structured_output',
330
+ 'thinking',
331
+ 'url_context',
332
+ ],
333
+ },
334
+ pricing: {
335
+ input: {
336
+ normal: 0.1,
337
+ },
338
+ output: {
339
+ normal: 0.4,
340
+ },
341
+ },
342
+ } as const satisfies ModelMeta<
343
+ GeminiToolConfigOptions &
344
+ GeminiSafetyOptions &
345
+ GeminiGenerationConfigOptions &
346
+ GeminiCachedContentOptions &
347
+ GeminiStructuredOutputOptions &
348
+ GeminiThinkingOptions
349
+ >
350
+
351
+ const GEMINI_2_5_FLASH_LITE_PREVIEW = {
352
+ name: 'gemini-2.5-flash-lite-preview-09-2025',
353
+ max_input_tokens: 1_048_576,
354
+ max_output_tokens: 65_536,
355
+ knowledge_cutoff: '2025-01-01',
356
+ supports: {
357
+ input: ['text', 'image', 'audio', 'video', 'document'],
358
+ output: ['text'],
359
+ capabilities: [
360
+ 'batch_api',
361
+ 'caching',
362
+ 'code_execution',
363
+ 'function_calling',
364
+ 'search_grounding',
365
+ 'structured_output',
366
+ 'thinking',
367
+ 'url_context',
368
+ ],
369
+ },
370
+ pricing: {
371
+ input: {
372
+ normal: 0.1,
373
+ },
374
+ output: {
375
+ normal: 0.4,
376
+ },
377
+ },
378
+ } as const satisfies ModelMeta<
379
+ GeminiToolConfigOptions &
380
+ GeminiSafetyOptions &
381
+ GeminiGenerationConfigOptions &
382
+ GeminiCachedContentOptions &
383
+ GeminiStructuredOutputOptions &
384
+ GeminiThinkingOptions
385
+ >
386
+
387
+ const GEMINI_2_FLASH = {
388
+ name: 'gemini-2.0-flash',
389
+ max_input_tokens: 1_048_576,
390
+ max_output_tokens: 8_192,
391
+ knowledge_cutoff: '2024-08-01',
392
+ supports: {
393
+ input: ['text', 'image', 'audio', 'video'],
394
+ output: ['text'],
395
+ capabilities: [
396
+ 'batch_api',
397
+ 'caching',
398
+ 'code_execution',
399
+ 'function_calling',
400
+ 'grounding_with_gmaps',
401
+ 'live_api',
402
+ 'search_grounding',
403
+ 'structured_output',
404
+ ],
405
+ },
406
+ pricing: {
407
+ input: {
408
+ normal: 0.1,
409
+ },
410
+ output: {
411
+ normal: 0.4,
412
+ },
413
+ },
414
+ } as const satisfies ModelMeta<
415
+ GeminiToolConfigOptions &
416
+ GeminiSafetyOptions &
417
+ GeminiGenerationConfigOptions &
418
+ GeminiCachedContentOptions &
419
+ GeminiStructuredOutputOptions
420
+ >
421
+ /*
422
+ const GEMINI_2_FLASH_IMAGE = {
423
+ name: 'gemini-2.0-flash-preview-image-generation',
424
+ max_input_tokens: 32_768,
425
+ max_output_tokens: 8_192,
426
+ knowledge_cutoff: '2024-08-01',
427
+ supports: {
428
+ input: ['text', 'image', 'audio', 'video'],
429
+ output: ['text'],
430
+ capabilities: [
431
+ 'batch_api',
432
+ 'caching',
433
+ 'image_generation',
434
+ 'structured_output',
435
+ ],
436
+ },
437
+ pricing: {
438
+ input: {
439
+ normal: 0.1,
440
+ },
441
+ output: {
442
+ normal: 0.039,
443
+ },
444
+ },
445
+ } as const satisfies ModelMeta<
446
+ GeminiToolConfigOptions &
447
+ GeminiSafetyOptions &
448
+ GeminiGenerationConfigOptions &
449
+ GeminiCachedContentOptions
450
+ > */
451
+ /*
452
+ const GEMINI_2_FLASH_LIVE = {
453
+ name: 'gemini-2.0-flash-live-001',
454
+ max_input_tokens: 1_048_576,
455
+ max_output_tokens: 8_192,
456
+ knowledge_cutoff: '2024-08-01',
457
+ supports: {
458
+ input: ['text', 'audio', 'video'],
459
+ output: ['text', 'audio'],
460
+ capabilities: [
461
+ 'audio_generation',
462
+ 'code_execution',
463
+ 'function_calling',
464
+ 'live_api',
465
+ 'search_grounding',
466
+ 'structured_output',
467
+ 'url_context',
468
+ ],
469
+ },
470
+ pricing: {
471
+ // todo find this info
472
+ input: {
473
+ normal: 0,
474
+ },
475
+ output: {
476
+ normal: 0,
477
+ },
478
+ },
479
+ } as const satisfies ModelMeta<
480
+ GeminiToolConfigOptions &
481
+ GeminiSafetyOptions &
482
+ GeminiGenerationConfigOptions &
483
+ GeminiCachedContentOptions
484
+ > */
485
+
486
+ const GEMINI_2_FLASH_LITE = {
487
+ name: 'gemini-2.0-flash-lite',
488
+ max_input_tokens: 1_048_576,
489
+ max_output_tokens: 8_192,
490
+ knowledge_cutoff: '2024-08-01',
491
+ supports: {
492
+ input: ['text', 'audio', 'video', 'image'],
493
+ output: ['text'],
494
+ capabilities: [
495
+ 'batch_api',
496
+ 'caching',
497
+ 'function_calling',
498
+ 'structured_output',
499
+ ],
500
+ },
501
+ pricing: {
502
+ input: {
503
+ normal: 0.075,
504
+ },
505
+ output: {
506
+ normal: 0.3,
507
+ },
508
+ },
509
+ } as const satisfies ModelMeta<
510
+ GeminiToolConfigOptions &
511
+ GeminiSafetyOptions &
512
+ GeminiGenerationConfigOptions &
513
+ GeminiCachedContentOptions &
514
+ GeminiStructuredOutputOptions
515
+ >
516
+
517
+ /* const IMAGEN_4_GENERATE = {
518
+ name: 'imagen-4.0-generate-001',
519
+ max_input_tokens: 480,
520
+ max_output_tokens: 4,
521
+ supports: {
522
+ input: ['text'],
523
+ output: ['image'],
524
+ },
525
+ pricing: {
526
+ input: {
527
+ normal: 0,
528
+ },
529
+ output: {
530
+ normal: 0.4,
531
+ },
532
+ },
533
+ } as const satisfies ModelMeta<
534
+ GeminiToolConfigOptions &
535
+ GeminiSafetyOptions &
536
+ GeminiGenerationConfigOptions &
537
+ GeminiCachedContentOptions
538
+ >
539
+
540
+ const IMAGEN_4_GENERATE_ULTRA = {
541
+ name: 'imagen-4.0-ultra-generate-001',
542
+ max_input_tokens: 480,
543
+ max_output_tokens: 4,
544
+ supports: {
545
+ input: ['text'],
546
+ output: ['image'],
547
+ },
548
+ pricing: {
549
+ input: {
550
+ normal: 0,
551
+ },
552
+ output: {
553
+ normal: 0.6,
554
+ },
555
+ },
556
+ } as const satisfies ModelMeta<
557
+ GeminiToolConfigOptions &
558
+ GeminiSafetyOptions &
559
+ GeminiGenerationConfigOptions &
560
+ GeminiCachedContentOptions
561
+ >
562
+
563
+ const IMAGEN_4_GENERATE_FAST = {
564
+ name: 'imagen-4.0-fast-generate-001',
565
+ max_input_tokens: 480,
566
+ max_output_tokens: 4,
567
+ supports: {
568
+ input: ['text'],
569
+ output: ['image'],
570
+ },
571
+ pricing: {
572
+ input: {
573
+ normal: 0,
574
+ },
575
+ output: {
576
+ normal: 0.2,
577
+ },
578
+ },
579
+ } as const satisfies ModelMeta<
580
+ GeminiToolConfigOptions &
581
+ GeminiSafetyOptions &
582
+ GeminiGenerationConfigOptions &
583
+ GeminiCachedContentOptions
584
+ >
585
+
586
+ const IMAGEN_3 = {
587
+ name: 'imagen-3.0-generate-002',
588
+ max_output_tokens: 4,
589
+ supports: {
590
+ input: ['text'],
591
+ output: ['image'],
592
+ },
593
+ pricing: {
594
+ input: {
595
+ normal: 0,
596
+ },
597
+ output: {
598
+ normal: 0.03,
599
+ },
600
+ },
601
+ } as const satisfies ModelMeta<
602
+ GeminiToolConfigOptions &
603
+ GeminiSafetyOptions &
604
+ GeminiGenerationConfigOptions &
605
+ GeminiCachedContentOptions
606
+ >
607
+
608
+ const VEO_3_1_PREVIEW = {
609
+ name: 'veo-3.1-generate-preview',
610
+ max_input_tokens: 1024,
611
+ max_output_tokens: 1,
612
+ supports: {
613
+ input: ['text', 'image'],
614
+ output: ['video', 'audio'],
615
+ },
616
+ pricing: {
617
+ input: {
618
+ normal: 0,
619
+ },
620
+ output: {
621
+ normal: 0.4,
622
+ },
623
+ },
624
+ } as const satisfies ModelMeta<
625
+ GeminiToolConfigOptions &
626
+ GeminiSafetyOptions &
627
+ GeminiGenerationConfigOptions &
628
+ GeminiCachedContentOptions
629
+ >
630
+
631
+ const VEO_3_1_FAST_PREVIEW = {
632
+ name: 'veo-3.1-fast-generate-preview',
633
+ max_input_tokens: 1024,
634
+ max_output_tokens: 1,
635
+ supports: {
636
+ input: ['text', 'image'],
637
+ output: ['video', 'audio'],
638
+ },
639
+ pricing: {
640
+ input: {
641
+ normal: 0,
642
+ },
643
+ output: {
644
+ normal: 0.15,
645
+ },
646
+ },
647
+ } as const satisfies ModelMeta<
648
+ GeminiToolConfigOptions &
649
+ GeminiSafetyOptions &
650
+ GeminiGenerationConfigOptions &
651
+ GeminiCachedContentOptions
652
+ >
653
+
654
+ const VEO_3 = {
655
+ name: 'veo-3.0-generate-001',
656
+ max_input_tokens: 1024,
657
+ max_output_tokens: 1,
658
+ supports: {
659
+ input: ['text', 'image'],
660
+ output: ['video', 'audio'],
661
+ },
662
+ pricing: {
663
+ input: {
664
+ normal: 0,
665
+ },
666
+ output: {
667
+ normal: 0.4,
668
+ },
669
+ },
670
+ } as const satisfies ModelMeta<
671
+ GeminiToolConfigOptions &
672
+ GeminiSafetyOptions &
673
+ GeminiGenerationConfigOptions &
674
+ GeminiCachedContentOptions
675
+ >
676
+
677
+ const VEO_3_FAST = {
678
+ name: 'veo-3.0-fast-generate-001',
679
+ max_input_tokens: 1024,
680
+ max_output_tokens: 1,
681
+ supports: {
682
+ input: ['text', 'image'],
683
+ output: ['video', 'audio'],
684
+ },
685
+ pricing: {
686
+ input: {
687
+ normal: 0,
688
+ },
689
+ output: {
690
+ normal: 0.15,
691
+ },
692
+ },
693
+ } as const satisfies ModelMeta<
694
+ GeminiToolConfigOptions &
695
+ GeminiSafetyOptions &
696
+ GeminiGenerationConfigOptions &
697
+ GeminiCachedContentOptions
698
+ >
699
+
700
+ const VEO_2 = {
701
+ name: 'veo-2.0-generate-001',
702
+ max_output_tokens: 2,
703
+ supports: {
704
+ input: ['text', 'image'],
705
+ output: ['video'],
706
+ },
707
+ pricing: {
708
+ input: {
709
+ normal: 0,
710
+ },
711
+ output: {
712
+ normal: 0.35,
713
+ },
714
+ },
715
+ } as const satisfies ModelMeta<
716
+ GeminiToolConfigOptions &
717
+ GeminiSafetyOptions &
718
+ GeminiGenerationConfigOptions &
719
+ GeminiCachedContentOptions
720
+ > */
721
+
722
+ const GEMINI_EMBEDDING = {
723
+ name: 'gemini-embedding-001',
724
+ max_input_tokens: 2048,
725
+ supports: {
726
+ input: ['text'],
727
+ output: ['text'],
728
+ },
729
+ pricing: {
730
+ input: {
731
+ normal: 0,
732
+ },
733
+ output: {
734
+ normal: 0.15,
735
+ },
736
+ },
737
+ } as const satisfies ModelMeta<
738
+ GeminiToolConfigOptions &
739
+ GeminiSafetyOptions &
740
+ GeminiGenerationConfigOptions &
741
+ GeminiCachedContentOptions
742
+ >
743
+
744
+ /* const GEMINI_MODEL_META = {
745
+ [GEMINI_3_PRO.name]: GEMINI_3_PRO,
746
+ [GEMINI_2_5_PRO.name]: GEMINI_2_5_PRO,
747
+ [GEMINI_2_5_PRO_TTS.name]: GEMINI_2_5_PRO_TTS,
748
+ [GEMINI_2_5_FLASH.name]: GEMINI_2_5_FLASH,
749
+ [GEMINI_2_5_FLASH_PREVIEW.name]: GEMINI_2_5_FLASH_PREVIEW,
750
+ [GEMINI_2_5_FLASH_IMAGE.name]: GEMINI_2_5_FLASH_IMAGE,
751
+ [GEMINI_2_5_FLASH_LIVE.name]: GEMINI_2_5_FLASH_LIVE,
752
+ [GEMINI_2_5_FLASH_TTS.name]: GEMINI_2_5_FLASH_TTS,
753
+ [GEMINI_2_5_FLASH_LITE.name]: GEMINI_2_5_FLASH_LITE,
754
+ [GEMINI_2_5_FLASH_LITE_PREVIEW.name]: GEMINI_2_5_FLASH_LITE_PREVIEW,
755
+ [GEMINI_2_FLASH.name]: GEMINI_2_FLASH,
756
+ [GEMINI_2_FLASH_IMAGE.name]: GEMINI_2_FLASH_IMAGE,
757
+ [GEMINI_2_FLASH_LIVE.name]: GEMINI_2_FLASH_LIVE,
758
+ [GEMINI_2_FLASH_LITE.name]: GEMINI_2_FLASH_LITE,
759
+ [IMAGEN_4_GENERATE.name]: IMAGEN_4_GENERATE,
760
+ [IMAGEN_4_GENERATE_ULTRA.name]: IMAGEN_4_GENERATE_ULTRA,
761
+ [IMAGEN_4_GENERATE_FAST.name]: IMAGEN_4_GENERATE_FAST,
762
+ [IMAGEN_3.name]: IMAGEN_3,
763
+ [VEO_3_1_PREVIEW.name]: VEO_3_1_PREVIEW,
764
+ [VEO_3_1_FAST_PREVIEW.name]: VEO_3_1_FAST_PREVIEW,
765
+ [VEO_3.name]: VEO_3,
766
+ [VEO_3_FAST.name]: VEO_3_FAST,
767
+ [VEO_2.name]: VEO_2,
768
+ [GEMINI_EMBEDDING.name]: GEMINI_EMBEDDING,
769
+ } as const */
770
+
771
+ export const GEMINI_MODELS = [
772
+ GEMINI_3_PRO.name,
773
+ GEMINI_2_5_PRO.name,
774
+ GEMINI_2_5_FLASH.name,
775
+ GEMINI_2_5_FLASH_PREVIEW.name,
776
+ GEMINI_2_5_FLASH_LITE.name,
777
+ GEMINI_2_5_FLASH_LITE_PREVIEW.name,
778
+ GEMINI_2_FLASH.name,
779
+ GEMINI_2_FLASH_LITE.name,
780
+ ] as const
781
+
782
+ /* const GEMINI_IMAGE_MODELS = [
783
+ GEMINI_2_5_FLASH_IMAGE.name,
784
+ GEMINI_2_FLASH_IMAGE.name,
785
+ IMAGEN_3.name,
786
+ IMAGEN_4_GENERATE.name,
787
+ IMAGEN_4_GENERATE_FAST.name,
788
+ IMAGEN_4_GENERATE_ULTRA.name,
789
+ ] as const */
790
+
791
+ export const GEMINI_EMBEDDING_MODELS = [GEMINI_EMBEDDING.name] as const
792
+
793
+ /* const GEMINI_AUDIO_MODELS = [
794
+ GEMINI_2_5_PRO_TTS.name,
795
+ GEMINI_2_5_FLASH_TTS.name,
796
+ GEMINI_2_5_FLASH_LIVE.name,
797
+ GEMINI_2_FLASH_LIVE.name,
798
+ ] as const
799
+
800
+ const GEMINI_VIDEO_MODELS = [
801
+ VEO_3_1_PREVIEW.name,
802
+ VEO_3_1_FAST_PREVIEW.name,
803
+ VEO_3.name,
804
+ VEO_3_FAST.name,
805
+ VEO_2.name,
806
+ ] as const */
807
+
808
+ // export type GeminiChatModels = (typeof GEMINI_MODELS)[number]
809
+
810
+ // Manual type map for per-model provider options
811
+ export type GeminiChatModelProviderOptionsByName = {
812
+ // Models with thinking and structured output support
813
+ [GEMINI_3_PRO.name]: GeminiToolConfigOptions &
814
+ GeminiSafetyOptions &
815
+ GeminiGenerationConfigOptions &
816
+ GeminiCachedContentOptions &
817
+ GeminiStructuredOutputOptions &
818
+ GeminiThinkingOptions
819
+ [GEMINI_2_5_PRO.name]: GeminiToolConfigOptions &
820
+ GeminiSafetyOptions &
821
+ GeminiGenerationConfigOptions &
822
+ GeminiCachedContentOptions &
823
+ GeminiStructuredOutputOptions &
824
+ GeminiThinkingOptions
825
+ [GEMINI_2_5_FLASH.name]: GeminiToolConfigOptions &
826
+ GeminiSafetyOptions &
827
+ GeminiGenerationConfigOptions &
828
+ GeminiCachedContentOptions &
829
+ GeminiStructuredOutputOptions &
830
+ GeminiThinkingOptions
831
+ [GEMINI_2_5_FLASH_PREVIEW.name]: GeminiToolConfigOptions &
832
+ GeminiSafetyOptions &
833
+ GeminiGenerationConfigOptions &
834
+ GeminiCachedContentOptions &
835
+ GeminiStructuredOutputOptions &
836
+ GeminiThinkingOptions
837
+ [GEMINI_2_5_FLASH_LITE.name]: GeminiToolConfigOptions &
838
+ GeminiSafetyOptions &
839
+ GeminiGenerationConfigOptions &
840
+ GeminiCachedContentOptions &
841
+ GeminiStructuredOutputOptions &
842
+ GeminiThinkingOptions
843
+ [GEMINI_2_5_FLASH_LITE_PREVIEW.name]: GeminiToolConfigOptions &
844
+ GeminiSafetyOptions &
845
+ GeminiGenerationConfigOptions &
846
+ GeminiCachedContentOptions &
847
+ GeminiStructuredOutputOptions &
848
+ GeminiThinkingOptions
849
+ // Models with structured output but no thinking support
850
+ [GEMINI_2_FLASH.name]: GeminiToolConfigOptions &
851
+ GeminiSafetyOptions &
852
+ GeminiGenerationConfigOptions &
853
+ GeminiCachedContentOptions &
854
+ GeminiStructuredOutputOptions
855
+ [GEMINI_2_FLASH_LITE.name]: GeminiToolConfigOptions &
856
+ GeminiSafetyOptions &
857
+ GeminiGenerationConfigOptions &
858
+ GeminiCachedContentOptions &
859
+ GeminiStructuredOutputOptions
860
+ }
861
+
862
+ /**
863
+ * Type-only map from chat model name to its supported input modalities.
864
+ * Based on the 'supports.input' arrays defined for each model.
865
+ * Note: 'document' in the model meta is mapped to 'document' modality.
866
+ * Used by the core AI types to constrain ContentPart types based on the selected model.
867
+ * Note: These must be inlined as readonly arrays (not typeof) because the model
868
+ * constants are not exported and typeof references don't work in .d.ts files
869
+ * when consumed by external packages.
870
+ *
871
+ * @see https://ai.google.dev/gemini-api/docs/vision
872
+ * @see https://ai.google.dev/gemini-api/docs/audio
873
+ * @see https://ai.google.dev/gemini-api/docs/document-processing
874
+ */
875
+ export type GeminiModelInputModalitiesByName = {
876
+ // Models with full multimodal support (text, image, audio, video, document)
877
+ [GEMINI_3_PRO.name]: typeof GEMINI_3_PRO.supports.input
878
+ [GEMINI_2_5_PRO.name]: typeof GEMINI_2_5_PRO.supports.input
879
+ [GEMINI_2_5_FLASH_LITE.name]: typeof GEMINI_2_5_FLASH_LITE.supports.input
880
+ [GEMINI_2_5_FLASH_LITE_PREVIEW.name]: typeof GEMINI_2_5_FLASH_LITE_PREVIEW.supports.input
881
+
882
+ // Models with text, image, audio, video (no document)
883
+ [GEMINI_2_5_FLASH.name]: typeof GEMINI_2_5_FLASH.supports.input
884
+ [GEMINI_2_5_FLASH_PREVIEW.name]: typeof GEMINI_2_5_FLASH_PREVIEW.supports.input
885
+ [GEMINI_2_FLASH.name]: typeof GEMINI_2_FLASH.supports.input
886
+ [GEMINI_2_FLASH_LITE.name]: typeof GEMINI_2_FLASH_LITE.supports.input
887
+ }