Open History to see the last commit
1import type { Modality, ModelReasoning } from '@tanstack/ai'
2import type { ModelReasoningCapability } from '@tanstack/ai/adapter-internals'
3import type {
4 GeminiCachedContentOptions,
5 GeminiCommonConfigOptions,
6 GeminiSafetyOptions,
7 GeminiStructuredOutputOptions,
8 GeminiToolConfigOptions,
9} from './text/text-provider-options'
10import type { GeminiEmbeddingProviderOptions } from './embedding/embedding-provider-options'
11
12// Reasoning shapes: the levels a model has for `chat({ reasoning })`, and
13// the provider value to send for each. Each model points at one of them.
14const BUDGET_MINIMAL_TO_HIGH = {
15 levels: { minimal: 'minimal', low: 'low', medium: 'medium', high: 'high' },
16 budget: true,
17} as const
18const BUDGET_OFF_HIGH = {
19 levels: { off: 'off', high: 'high' },
20 budget: true,
21} as const
22const EFFORT_LOW_TO_HIGH = {
23 levels: { low: 'low', medium: 'medium', high: 'high' },
24 budget: false,
25} as const
26const EFFORT_MINIMAL_TO_HIGH = {
27 levels: { minimal: 'minimal', low: 'low', medium: 'medium', high: 'high' },
28 budget: false,
29} as const
30
31interface ModelMeta<TProviderOptions = unknown> {
32 name: string
33 supports: {
34 input: Array<'text' | 'image' | 'audio' | 'video' | 'document'>
35 output: Array<'text' | 'image' | 'audio' | 'video'>
36 capabilities?: Array<
37 | 'agentic_video'
38 | 'audio_generation'
39 | 'batch_api'
40 | 'caching'
41 | 'function_calling'
42 | 'live_api'
43 | 'structured_output'
44 | 'thinking'
45 >
46 tools?: Array<
47 | 'code_execution'
48 | 'file_search'
49 | 'google_search'
50 | 'google_search_retrieval'
51 | 'google_maps'
52 | 'url_context'
53 | 'computer_use'
54 >
55 }
56 max_input_tokens?: number
57 max_output_tokens?: number
58 knowledge_cutoff?: string
59 pricing?: {
60 input: {
61 normal: number
62 cached?: number
63 }
64 output: {
65 normal: number
66 }
67 }
68 /**
69 * Type-level description of which provider options this model supports.
70 */
71 providerOptions?: TProviderOptions
72 /** The model's data for `chat({ reasoning })`. None: it does not reason. */
73 reasoning?: ModelReasoning
74}
75
76const GEMINI_3_1_PRO = {
77 name: 'gemini-3.1-pro-preview',
78 max_input_tokens: 1_048_576,
79 max_output_tokens: 65_536,
80 knowledge_cutoff: '2025-01-01',
81 supports: {
82 input: ['text', 'image', 'audio', 'video', 'document'],
83 output: ['text'],
84 capabilities: [
85 'batch_api',
86 'caching',
87 'function_calling',
88 'structured_output',
89 'thinking',
90 ],
91 tools: ['code_execution', 'file_search', 'google_search', 'url_context'],
92 },
93 pricing: {
94 input: {
95 normal: 2.5,
96 },
97 output: {
98 normal: 15,
99 },
100 },
101 reasoning: EFFORT_LOW_TO_HIGH,
102} as const satisfies ModelMeta<
103 GeminiToolConfigOptions &
104 GeminiSafetyOptions &
105 GeminiCommonConfigOptions &
106 GeminiCachedContentOptions &
107 GeminiStructuredOutputOptions
108>
109
110const GEMINI_3_FLASH = {
111 name: 'gemini-3-flash-preview',
112 max_input_tokens: 1_048_576,
113 max_output_tokens: 65_536,
114 knowledge_cutoff: '2025-01-01',
115 supports: {
116 input: ['text', 'image', 'audio', 'video', 'document'],
117 output: ['text'],
118 capabilities: [
119 'batch_api',
120 'caching',
121 'function_calling',
122 'structured_output',
123 'thinking',
124 ],
125 tools: ['code_execution', 'file_search', 'google_search', 'url_context'],
126 },
127 pricing: {
128 input: {
129 normal: 0.5,
130 },
131 output: {
132 normal: 3,
133 },
134 },
135 reasoning: EFFORT_MINIMAL_TO_HIGH,
136} as const satisfies ModelMeta<
137 GeminiToolConfigOptions &
138 GeminiSafetyOptions &
139 GeminiCommonConfigOptions &
140 GeminiCachedContentOptions &
141 GeminiStructuredOutputOptions
142>
143
144/**
145 * Gemini 3 Pro Image ("Nano Banana Pro") — GA. Accepts the ten standard
146 * aspect ratios at 1K / 2K / 4K.
147 * @see https://ai.google.dev/gemini-api/docs/models/gemini-3-pro-image
148 */
149const GEMINI_3_PRO_IMAGE = {
150 name: 'gemini-3-pro-image',
151 max_input_tokens: 65_536,
152 max_output_tokens: 32_768,
153 knowledge_cutoff: '2025-01-01',
154 supports: {
155 input: ['text', 'image'],
156 output: ['text', 'image'],
157 capabilities: ['batch_api', 'structured_output', 'thinking'],
158 tools: ['google_search'],
159 },
160 pricing: {
161 input: {
162 normal: 2,
163 },
164 output: {
165 normal: 0.134,
166 },
167 },
168} as const satisfies ModelMeta<
169 GeminiToolConfigOptions &
170 GeminiSafetyOptions &
171 GeminiCommonConfigOptions &
172 GeminiCachedContentOptions &
173 GeminiStructuredOutputOptions
174>
175
176/**
177 * Gemini 3.1 Flash Image ("Nano Banana 2") — GA. The only native image model
178 * that accepts the four extreme banner ratios (1:4, 4:1, 1:8, 8:1) and the
179 * 512 (0.5K) resolution tier.
180 * @see https://ai.google.dev/gemini-api/docs/models/gemini-3.1-flash-image
181 */
182const GEMINI_3_1_FLASH_IMAGE = {
183 name: 'gemini-3.1-flash-image',
184 max_input_tokens: 131_072,
185 max_output_tokens: 32_768,
186 knowledge_cutoff: '2025-01-01',
187 supports: {
188 input: ['text', 'image'],
189 output: ['text', 'image'],
190 capabilities: ['batch_api', 'thinking'],
191 tools: ['google_search'],
192 },
193 pricing: {
194 input: {
195 normal: 0.5,
196 },
197 output: {
198 normal: 3,
199 },
200 },
201} as const satisfies ModelMeta<
202 GeminiToolConfigOptions &
203 GeminiSafetyOptions &
204 GeminiCommonConfigOptions &
205 GeminiCachedContentOptions
206>
207
208/**
209 * Gemini 3.1 Flash Lite Image ("Nano Banana 2 Lite") — GA. 1K output only.
210 * @see https://ai.google.dev/gemini-api/docs/models/gemini-3.1-flash-lite-image
211 */
212const GEMINI_3_1_FLASH_LITE_IMAGE = {
213 name: 'gemini-3.1-flash-lite-image',
214 max_input_tokens: 65_536,
215 max_output_tokens: 65_536,
216 knowledge_cutoff: '2025-01-01',
217 supports: {
218 input: ['text', 'image'],
219 output: ['text', 'image'],
220 capabilities: ['batch_api', 'structured_output', 'thinking'],
221 tools: ['google_search'],
222 },
223 pricing: {
224 input: {
225 normal: 0.25,
226 },
227 output: {
228 normal: 1.5,
229 },
230 },
231} as const satisfies ModelMeta<
232 GeminiToolConfigOptions &
233 GeminiSafetyOptions &
234 GeminiCommonConfigOptions &
235 GeminiCachedContentOptions &
236 GeminiStructuredOutputOptions
237>
238
239/**
240 * Nano Banana 2.1 — GA. 1K / 2K / 4K output, no 512 tier. The id does not
241 * follow the `gemini-<version>-flash-image` pattern of the earlier models.
242 * Token limits are the values `GET /v1beta/models` returns.
243 * @see https://ai.google.dev/gemini-api/docs/models/gemini-nano-banana-2.1
244 */
245const GEMINI_NANO_BANANA_2_1 = {
246 name: 'gemini-nano-banana-2.1',
247 max_input_tokens: 65_536,
248 max_output_tokens: 65_536,
249 supports: {
250 input: ['text', 'image'],
251 output: ['text', 'image'],
252 capabilities: ['batch_api', 'thinking'],
253 tools: ['google_search'],
254 },
255 pricing: {
256 input: {
257 normal: 1.5,
258 },
259 output: {
260 normal: 7.5,
261 },
262 },
263} as const satisfies ModelMeta<
264 GeminiToolConfigOptions &
265 GeminiSafetyOptions &
266 GeminiCommonConfigOptions &
267 GeminiCachedContentOptions
268>
269
270const GEMINI_3_1_FLASH_LITE = {
271 name: 'gemini-3.1-flash-lite',
272 max_input_tokens: 1_048_576,
273 max_output_tokens: 65_536,
274 knowledge_cutoff: '2025-01-01',
275 supports: {
276 input: ['text', 'image', 'audio', 'video', 'document'],
277 output: ['text'],
278 capabilities: [
279 'batch_api',
280 'caching',
281 'function_calling',
282 'structured_output',
283 'thinking',
284 ],
285 tools: ['code_execution', 'file_search', 'google_search', 'url_context'],
286 },
287 pricing: {
288 input: {
289 normal: 0.25,
290 },
291 output: {
292 normal: 1.5,
293 },
294 },
295 reasoning: EFFORT_MINIMAL_TO_HIGH,
296} as const satisfies ModelMeta<
297 GeminiToolConfigOptions &
298 GeminiSafetyOptions &
299 GeminiCommonConfigOptions &
300 GeminiCachedContentOptions &
301 GeminiStructuredOutputOptions
302>
303
304const GEMINI_3_1_FLASH_LITE_PREVIEW = {
305 name: 'gemini-3.1-flash-lite-preview',
306 max_input_tokens: 1_048_576,
307 max_output_tokens: 65_536,
308 knowledge_cutoff: '2025-01-01',
309 supports: {
310 input: ['text', 'image', 'audio', 'video', 'document'],
311 output: ['text'],
312 capabilities: [
313 'batch_api',
314 'caching',
315 'function_calling',
316 'structured_output',
317 'thinking',
318 ],
319 tools: ['code_execution', 'file_search', 'google_search', 'url_context'],
320 },
321 pricing: {
322 input: {
323 normal: 0.25,
324 },
325 output: {
326 normal: 1.5,
327 },
328 },
329 reasoning: EFFORT_MINIMAL_TO_HIGH,
330} as const satisfies ModelMeta<
331 GeminiToolConfigOptions &
332 GeminiSafetyOptions &
333 GeminiCommonConfigOptions &
334 GeminiCachedContentOptions &
335 GeminiStructuredOutputOptions
336>
337
338const GEMINI_2_5_PRO = {
339 name: 'gemini-2.5-pro',
340 max_input_tokens: 1_048_576,
341 max_output_tokens: 65_536,
342 knowledge_cutoff: '2025-01-01',
343 supports: {
344 input: ['text', 'image', 'audio', 'video', 'document'],
345 output: ['text'],
346 capabilities: [
347 'batch_api',
348 'caching',
349 'function_calling',
350 'structured_output',
351 'thinking',
352 ],
353 tools: [
354 'code_execution',
355 'file_search',
356 'google_maps',
357 'google_search',
358 'url_context',
359 ],
360 },
361 pricing: {
362 input: {
363 normal: 2.5,
364 },
365 output: {
366 normal: 15,
367 },
368 },
369 reasoning: BUDGET_MINIMAL_TO_HIGH,
370} as const satisfies ModelMeta<
371 GeminiToolConfigOptions &
372 GeminiSafetyOptions &
373 GeminiCommonConfigOptions &
374 GeminiCachedContentOptions &
375 GeminiStructuredOutputOptions
376>
377
378const GEMINI_2_5_PRO_TTS = {
379 name: 'gemini-2.5-pro-preview-tts',
380 max_input_tokens: 8_192,
381 max_output_tokens: 16_384,
382 knowledge_cutoff: '2025-05-01',
383 supports: {
384 input: ['text'],
385 output: ['audio'],
386 capabilities: ['audio_generation'],
387 },
388 pricing: {
389 input: {
390 normal: 2.5,
391 },
392 output: {
393 normal: 15,
394 },
395 },
396} as const satisfies ModelMeta<
397 GeminiToolConfigOptions &
398 GeminiSafetyOptions &
399 GeminiCommonConfigOptions &
400 GeminiCachedContentOptions
401>
402
403const GEMINI_2_5_FLASH = {
404 name: 'gemini-2.5-flash',
405 max_input_tokens: 1_048_576,
406 max_output_tokens: 65_536,
407 knowledge_cutoff: '2025-01-01',
408 supports: {
409 input: ['text', 'image', 'audio', 'video'],
410 output: ['text'],
411 capabilities: [
412 'batch_api',
413 'caching',
414 'function_calling',
415 'structured_output',
416 'thinking',
417 ],
418 tools: [
419 'code_execution',
420 'file_search',
421 'google_maps',
422 'google_search',
423 'url_context',
424 ],
425 },
426 pricing: {
427 input: {
428 normal: 1,
429 },
430 output: {
431 normal: 2.5,
432 },
433 },
434 reasoning: BUDGET_OFF_HIGH,
435} as const satisfies ModelMeta<
436 GeminiToolConfigOptions &
437 GeminiSafetyOptions &
438 GeminiCommonConfigOptions &
439 GeminiCachedContentOptions &
440 GeminiStructuredOutputOptions
441>
442
443/**
444const GEMINI_2_5_FLASH_LIVE = {
445 name: 'gemini-2.5-flash-native-audio-preview-09-2025',
446 max_input_tokens: 141_072,
447 max_output_tokens: 8_192,
448 knowledge_cutoff: '2025-01-01',
449 supports: {
450 input: ['text', 'audio', 'video'],
451 output: ['text', 'audio'],
452 capabilities: [
453 'audio_generation',
454 'file_search',
455 'function_calling',
456 'live_api',
457 'search_grounding',
458 'thinking',
459 ],
460 },
461 pricing: {
462 // todo find this info
463 input: {
464 normal: 0,
465 },
466 output: {
467 normal: 0,
468 },
469 },
470} as const satisfies ModelMeta<
471 GeminiToolConfigOptions &
472 GeminiSafetyOptions &
473 GeminiGenerationConfigOptions &
474 GeminiCachedContentOptions
475>
476*/
477const GEMINI_2_5_FLASH_TTS = {
478 name: 'gemini-2.5-flash-preview-tts',
479 max_input_tokens: 8_192,
480 max_output_tokens: 16_384,
481 knowledge_cutoff: '2025-05-01',
482 supports: {
483 input: ['text'],
484 output: ['audio'],
485 capabilities: ['audio_generation', 'batch_api'],
486 },
487 pricing: {
488 input: {
489 normal: 1,
490 },
491 output: {
492 normal: 2.5,
493 },
494 },
495} as const satisfies ModelMeta<
496 GeminiToolConfigOptions &
497 GeminiSafetyOptions &
498 GeminiCommonConfigOptions &
499 GeminiCachedContentOptions
500>
501
502/**
503 * Gemini 3.1 Flash TTS Preview - latest expressive TTS model with
504 * 200+ audio tags, 70+ languages, and multi-speaker dialogue support.
505 * @see https://ai.google.dev/gemini-api/docs/models/gemini-3.1-flash-tts-preview
506 */
507const GEMINI_3_1_FLASH_TTS = {
508 name: 'gemini-3.1-flash-tts-preview',
509 max_input_tokens: 32_768,
510 max_output_tokens: 16_384,
511 knowledge_cutoff: '2025-05-01',
512 supports: {
513 input: ['text'],
514 output: ['audio'],
515 capabilities: ['audio_generation', 'batch_api'],
516 },
517 pricing: {
518 input: {
519 normal: 0.5,
520 },
521 output: {
522 normal: 10,
523 },
524 },
525} as const satisfies ModelMeta<
526 GeminiToolConfigOptions &
527 GeminiSafetyOptions &
528 GeminiCommonConfigOptions &
529 GeminiCachedContentOptions
530>
531
532/**
533 * Lyria 3 Pro Preview — Google's flagship music generation model.
534 * Generates full-length songs with multiple verses, choruses, and bridges.
535 * Outputs MP3 or WAV at 48 kHz stereo.
536 * @see https://ai.google.dev/gemini-api/docs/models/lyria-3-pro-preview
537 */
538const LYRIA_3_PRO = {
539 name: 'lyria-3-pro-preview',
540 max_input_tokens: 131_072,
541 supports: {
542 input: ['text', 'image'],
543 output: ['audio'],
544 capabilities: ['audio_generation'],
545 },
546 pricing: {
547 input: {
548 normal: 0,
549 },
550 output: {
551 normal: 0,
552 },
553 },
554} as const satisfies ModelMeta
555
556/**
557 * Lyria 3 Clip Preview — 30-second music clips in MP3 format.
558 * @see https://ai.google.dev/gemini-api/docs/music-generation
559 */
560const LYRIA_3_CLIP = {
561 name: 'lyria-3-clip-preview',
562 max_input_tokens: 131_072,
563 supports: {
564 input: ['text', 'image'],
565 output: ['audio'],
566 capabilities: ['audio_generation'],
567 },
568 pricing: {
569 input: {
570 normal: 0,
571 },
572 output: {
573 normal: 0,
574 },
575 },
576} as const satisfies ModelMeta
577
578const GEMINI_2_5_FLASH_LITE = {
579 name: 'gemini-2.5-flash-lite',
580 max_input_tokens: 1_048_576,
581 max_output_tokens: 65_536,
582 knowledge_cutoff: '2025-01-01',
583 supports: {
584 input: ['text', 'image', 'audio', 'video', 'document'],
585 output: ['text'],
586 capabilities: [
587 'batch_api',
588 'caching',
589 'function_calling',
590 'structured_output',
591 'thinking',
592 ],
593 tools: ['code_execution', 'google_maps', 'google_search', 'url_context'],
594 },
595 pricing: {
596 input: {
597 normal: 0.1,
598 },
599 output: {
600 normal: 0.4,
601 },
602 },
603 reasoning: BUDGET_OFF_HIGH,
604} as const satisfies ModelMeta<
605 GeminiToolConfigOptions &
606 GeminiSafetyOptions &
607 GeminiCommonConfigOptions &
608 GeminiCachedContentOptions &
609 GeminiStructuredOutputOptions
610>
611
612const IMAGEN_4_GENERATE = {
613 name: 'imagen-4.0-generate-001',
614 max_input_tokens: 480,
615 max_output_tokens: 4,
616 supports: {
617 input: ['text'],
618 output: ['image'],
619 },
620 pricing: {
621 input: {
622 normal: 0,
623 },
624 output: {
625 normal: 0.4,
626 },
627 },
628} as const satisfies ModelMeta<
629 GeminiToolConfigOptions &
630 GeminiSafetyOptions &
631 GeminiCommonConfigOptions &
632 GeminiCachedContentOptions
633>
634
635const IMAGEN_4_GENERATE_ULTRA = {
636 name: 'imagen-4.0-ultra-generate-001',
637 max_input_tokens: 480,
638 max_output_tokens: 4,
639 supports: {
640 input: ['text'],
641 output: ['image'],
642 },
643 pricing: {
644 input: {
645 normal: 0,
646 },
647 output: {
648 normal: 0.6,
649 },
650 },
651} as const satisfies ModelMeta<
652 GeminiToolConfigOptions &
653 GeminiSafetyOptions &
654 GeminiCommonConfigOptions &
655 GeminiCachedContentOptions
656>
657
658const IMAGEN_4_GENERATE_FAST = {
659 name: 'imagen-4.0-fast-generate-001',
660 max_input_tokens: 480,
661 max_output_tokens: 4,
662 supports: {
663 input: ['text'],
664 output: ['image'],
665 },
666 pricing: {
667 input: {
668 normal: 0,
669 },
670 output: {
671 normal: 0.2,
672 },
673 },
674} as const satisfies ModelMeta<
675 GeminiToolConfigOptions &
676 GeminiSafetyOptions &
677 GeminiCommonConfigOptions &
678 GeminiCachedContentOptions
679>
680
681/**
682 * Veo video generation models. Pricing is per second of generated video
683 * (audio+video rate where the model supports audio).
684 * @experimental Veo video generation is an experimental feature and may change.
685 */
686const VEO_3_1_PREVIEW = {
687 name: 'veo-3.1-generate-preview',
688 max_input_tokens: 1024,
689 max_output_tokens: 1,
690 supports: {
691 input: ['text', 'image'],
692 output: ['video', 'audio'],
693 },
694 pricing: {
695 input: {
696 normal: 0,
697 },
698 output: {
699 normal: 0.4,
700 },
701 },
702} as const satisfies ModelMeta<
703 GeminiToolConfigOptions &
704 GeminiSafetyOptions &
705 GeminiCommonConfigOptions &
706 GeminiCachedContentOptions
707>
708
709const VEO_3_1_FAST_PREVIEW = {
710 name: 'veo-3.1-fast-generate-preview',
711 max_input_tokens: 1024,
712 max_output_tokens: 1,
713 supports: {
714 input: ['text', 'image'],
715 output: ['video', 'audio'],
716 },
717 pricing: {
718 input: {
719 normal: 0,
720 },
721 output: {
722 normal: 0.15,
723 },
724 },
725} as const satisfies ModelMeta<
726 GeminiToolConfigOptions &
727 GeminiSafetyOptions &
728 GeminiCommonConfigOptions &
729 GeminiCachedContentOptions
730>
731
732const VEO_3_1_LITE_PREVIEW = {
733 name: 'veo-3.1-lite-generate-preview',
734 max_input_tokens: 1024,
735 max_output_tokens: 1,
736 supports: {
737 input: ['text', 'image'],
738 output: ['video', 'audio'],
739 },
740 pricing: {
741 input: {
742 normal: 0,
743 },
744 output: {
745 normal: 0.05,
746 },
747 },
748} as const satisfies ModelMeta<
749 GeminiToolConfigOptions &
750 GeminiSafetyOptions &
751 GeminiCommonConfigOptions &
752 GeminiCachedContentOptions
753>
754
755/**
756 * Gemini Omni 1.1 Flash — GA. Multimodal video generation with
757 * conversational editing. Serves only the Interactions API
758 * (`generateContent` rejects it), so it routes through the
759 * interactions-based path of the video adapter, not Veo's
760 * `:predictLongRunning` flow. Pricing is per second of generated video
761 * ($0.10/sec). 360p / 720p (default) / 1080p / 4k at 24 FPS, 3–10 second
762 * clips (default 10s).
763 * @see https://ai.google.dev/gemini-api/docs/models/gemini-omni-flash
764 * @experimental Omni video generation is an experimental feature and may change.
765 */
766const GEMINI_OMNI_1_1_FLASH = {
767 name: 'gemini-omni-1.1-flash',
768 max_input_tokens: 1_048_576,
769 max_output_tokens: 1,
770 supports: {
771 input: ['text', 'image', 'video'],
772 output: ['video', 'audio'],
773 },
774 pricing: {
775 input: {
776 normal: 0,
777 },
778 output: {
779 normal: 0.1,
780 },
781 },
782} as const satisfies ModelMeta<
783 GeminiToolConfigOptions &
784 GeminiSafetyOptions &
785 GeminiCommonConfigOptions &
786 GeminiCachedContentOptions
787>
788
789const GEMINI_3_8_FLASH = {
790 name: 'gemini-3.8-flash',
791 max_input_tokens: 1_048_576,
792 max_output_tokens: 65_536,
793 knowledge_cutoff: '2026-03-01',
794 supports: {
795 input: ['text', 'image', 'video', 'audio', 'document'],
796 output: ['text'],
797 capabilities: [
798 'agentic_video',
799 'batch_api',
800 'caching',
801 'function_calling',
802 'structured_output',
803 'thinking',
804 ],
805 tools: [
806 'code_execution',
807 'file_search',
808 'google_search',
809 'google_maps',
810 'url_context',
811 'computer_use',
812 ],
813 },
814 pricing: {
815 input: {
816 normal: 0.75,
817 cached: 0.075,
818 },
819 output: {
820 normal: 3.75,
821 },
822 },
823 reasoning: EFFORT_LOW_TO_HIGH,
824} as const satisfies ModelMeta<
825 GeminiToolConfigOptions &
826 GeminiSafetyOptions &
827 GeminiCommonConfigOptions &
828 GeminiCachedContentOptions &
829 GeminiStructuredOutputOptions
830>
831
832const GEMINI_3_7_FLASH = {
833 name: 'gemini-3.7-flash',
834 max_input_tokens: 1_048_576,
835 max_output_tokens: 65_536,
836 knowledge_cutoff: '2026-03-01',
837 supports: {
838 input: ['text', 'image', 'video', 'audio', 'document'],
839 output: ['text'],
840 capabilities: [
841 'agentic_video',
842 'batch_api',
843 'caching',
844 'function_calling',
845 'structured_output',
846 'thinking',
847 ],
848 tools: [
849 'code_execution',
850 'file_search',
851 'google_search',
852 'google_maps',
853 'url_context',
854 'computer_use',
855 ],
856 },
857 // Currently 50% off through the end of 2026.
858 // https://ai.google.dev/gemini-api/docs/pricing#gemini-3.7-flash
859 pricing: {
860 input: {
861 normal: 0.75,
862 cached: 0.075,
863 },
864 output: {
865 normal: 3.75,
866 },
867 },
868 reasoning: EFFORT_LOW_TO_HIGH,
869} as const satisfies ModelMeta<
870 GeminiToolConfigOptions &
871 GeminiSafetyOptions &
872 GeminiCommonConfigOptions &
873 GeminiCachedContentOptions &
874 GeminiStructuredOutputOptions
875>
876
877const GEMINI_3_6_FLASH = {
878 name: 'gemini-3.6-flash',
879 max_input_tokens: 1_048_576,
880 max_output_tokens: 65_536,
881 knowledge_cutoff: '2026-03-01',
882 supports: {
883 input: ['text', 'image', 'video', 'audio', 'document'],
884 output: ['text'],
885 capabilities: [
886 'agentic_video',
887 'batch_api',
888 'caching',
889 'function_calling',
890 'structured_output',
891 'thinking',
892 ],
893 tools: [
894 'code_execution',
895 'file_search',
896 'google_search',
897 'google_maps',
898 'url_context',
899 'computer_use',
900 ],
901 },
902 pricing: {
903 input: {
904 normal: 1.5,
905 cached: 0.15,
906 },
907 output: {
908 normal: 7.5,
909 },
910 },
911 reasoning: EFFORT_MINIMAL_TO_HIGH,
912} as const satisfies ModelMeta<
913 GeminiToolConfigOptions &
914 GeminiSafetyOptions &
915 GeminiCommonConfigOptions &
916 GeminiCachedContentOptions &
917 GeminiStructuredOutputOptions
918>
919
920const GEMINI_3_5_FLASH = {
921 name: 'gemini-3.5-flash',
922 max_input_tokens: 1_048_576,
923 max_output_tokens: 65_536,
924 supports: {
925 input: ['text', 'image', 'video', 'document', 'audio'],
926 output: ['text'],
927 capabilities: [
928 'batch_api',
929 'caching',
930 'function_calling',
931 'structured_output',
932 'thinking',
933 ],
934 tools: [
935 'code_execution',
936 'file_search',
937 'google_search',
938 'google_maps',
939 'url_context',
940 'computer_use',
941 ],
942 },
943 pricing: {
944 input: {
945 normal: 1.5,
946 cached: 0.15,
947 },
948 output: {
949 normal: 9,
950 },
951 },
952 reasoning: EFFORT_MINIMAL_TO_HIGH,
953} as const satisfies ModelMeta<
954 GeminiToolConfigOptions &
955 GeminiSafetyOptions &
956 GeminiCommonConfigOptions &
957 GeminiCachedContentOptions &
958 GeminiStructuredOutputOptions
959>
960
961const GEMINI_3_5_FLASH_LITE = {
962 name: 'gemini-3.5-flash-lite',
963 max_input_tokens: 1_048_576,
964 max_output_tokens: 65_536,
965 knowledge_cutoff: '2025-01-01',
966 supports: {
967 input: ['text', 'image', 'video', 'audio', 'document'],
968 output: ['text'],
969 capabilities: [
970 'agentic_video',
971 'batch_api',
972 'caching',
973 'function_calling',
974 'structured_output',
975 'thinking',
976 ],
977 tools: [
978 'code_execution',
979 'file_search',
980 'google_search',
981 'google_maps',
982 'url_context',
983 ],
984 },
985 pricing: {
986 input: {
987 normal: 0.3,
988 cached: 0.03,
989 },
990 output: {
991 normal: 2.5,
992 },
993 },
994 reasoning: EFFORT_MINIMAL_TO_HIGH,
995} as const satisfies ModelMeta<
996 GeminiToolConfigOptions &
997 GeminiSafetyOptions &
998 GeminiCommonConfigOptions &
999 GeminiCachedContentOptions &
1000 GeminiStructuredOutputOptions
1001>
1002
1003export const GEMINI_MODELS = [
1004 GEMINI_3_8_FLASH.name,
1005 GEMINI_3_7_FLASH.name,
1006 GEMINI_3_6_FLASH.name,
1007 GEMINI_3_5_FLASH.name,
1008 GEMINI_3_5_FLASH_LITE.name,
1009 GEMINI_3_1_PRO.name,
1010 GEMINI_3_FLASH.name,
1011 GEMINI_3_1_FLASH_LITE.name,
1012 GEMINI_3_1_FLASH_LITE_PREVIEW.name,
1013 GEMINI_2_5_PRO.name,
1014 GEMINI_2_5_FLASH.name,
1015 GEMINI_2_5_FLASH_LITE.name,
1016] as const
1017
1018/**
1019 * Gemini models that support combining `tools` + `responseSchema` in a
1020 * single streaming `generateContent` call (per issue #605). Per the
1021 * provider matrix, Gemini 3.x natively interleaves the schema-constrained
1022 * answer with function-calling on one pass; Gemini 2.x is unsupported /
1023 * brittle and keeps the engine's legacy finalization fallback.
1024 */
1025export const GEMINI_COMBINED_TOOLS_AND_SCHEMA_MODELS = new Set<string>([
1026 GEMINI_3_8_FLASH.name,
1027 GEMINI_3_7_FLASH.name,
1028 GEMINI_3_6_FLASH.name,
1029 GEMINI_3_5_FLASH.name,
1030 GEMINI_3_5_FLASH_LITE.name,
1031 GEMINI_3_1_PRO.name,
1032 GEMINI_3_FLASH.name,
1033 GEMINI_3_1_FLASH_LITE.name,
1034 GEMINI_3_1_FLASH_LITE_PREVIEW.name,
1035])
1036
1037export type GeminiModels = (typeof GEMINI_MODELS)[number]
1038
1039export type GeminiImageModels = (typeof GEMINI_IMAGE_MODELS)[number]
1040
1041/**
1042 * Image generation models.
1043 */
1044export const GEMINI_IMAGE_MODELS = [
1045 GEMINI_NANO_BANANA_2_1.name,
1046 GEMINI_3_1_FLASH_IMAGE.name,
1047 GEMINI_3_1_FLASH_LITE_IMAGE.name,
1048 GEMINI_3_PRO_IMAGE.name,
1049 IMAGEN_4_GENERATE.name,
1050 IMAGEN_4_GENERATE_FAST.name,
1051 IMAGEN_4_GENERATE_ULTRA.name,
1052] as const
1053
1054/**
1055 * Text-to-speech models
1056 * @experimental Gemini TTS is an experimental feature and may change.
1057 */
1058export const GEMINI_TTS_MODELS = [
1059 GEMINI_3_1_FLASH_TTS.name,
1060 GEMINI_2_5_FLASH_TTS.name,
1061 GEMINI_2_5_PRO_TTS.name,
1062] as const
1063
1064/**
1065 * Audio generation models (Lyria music generation).
1066 * @experimental Lyria music generation is an experimental feature and may change.
1067 */
1068export const GEMINI_AUDIO_MODELS = [
1069 LYRIA_3_PRO.name,
1070 LYRIA_3_CLIP.name,
1071] as const
1072
1073/**
1074 * Available voice names for Gemini TTS
1075 * @see https://ai.google.dev/gemini-api/docs/speech-generation
1076 */
1077export const GEMINI_TTS_VOICES = [
1078 'Zephyr',
1079 'Puck',
1080 'Charon',
1081 'Kore',
1082 'Fenrir',
1083 'Leda',
1084 'Orus',
1085 'Aoede',
1086 'Callirrhoe',
1087 'Autonoe',
1088 'Enceladus',
1089 'Iapetus',
1090 'Umbriel',
1091 'Algieba',
1092 'Despina',
1093 'Erinome',
1094 'Algenib',
1095 'Rasalgethi',
1096 'Laomedeia',
1097 'Achernar',
1098 'Alnilam',
1099 'Schedar',
1100 'Gacrux',
1101 'Pulcherrima',
1102 'Achird',
1103 'Zubenelgenubi',
1104 'Vindemiatrix',
1105 'Sadachbia',
1106 'Sadaltager',
1107 'Sulafat',
1108] as const
1109
1110export type GeminiTTSVoice = (typeof GEMINI_TTS_VOICES)[number]
1111
1112/**
1113 * Video generation models. Veo models run on the long-running
1114 * `:predictLongRunning` flow; Gemini Omni Flash runs on the Interactions
1115 * API — the video adapter routes by model.
1116 * @experimental Video generation is an experimental feature and may change.
1117 */
1118export const GEMINI_VIDEO_MODELS = [
1119 VEO_3_1_PREVIEW.name,
1120 VEO_3_1_FAST_PREVIEW.name,
1121 VEO_3_1_LITE_PREVIEW.name,
1122 GEMINI_OMNI_1_1_FLASH.name,
1123] as const
1124
1125/**
1126 * Video models served by the Interactions API rather than Veo's
1127 * `:predictLongRunning` operations flow.
1128 * @experimental Omni video generation is an experimental feature and may change.
1129 */
1130export const GEMINI_INTERACTIONS_VIDEO_MODELS = [
1131 GEMINI_OMNI_1_1_FLASH.name,
1132] as const
1133
1134/**
1135 * Embedding models
1136 */
1137export const GEMINI_EMBEDDING_MODELS = ['gemini-embedding-001'] as const
1138
1139export type GeminiEmbeddingModel = (typeof GEMINI_EMBEDDING_MODELS)[number]
1140
1141/**
1142 * Type-only map from embedding model name to its provider options type.
1143 */
1144export type GeminiEmbeddingModelProviderOptionsByName = {
1145 'gemini-embedding-001': GeminiEmbeddingProviderOptions
1146}
1147
1148/**
1149 * Per-model input modalities for embedding models. Gemini embedding models
1150 * are text-only, so image inputs fail at compile time.
1151 */
1152export type GeminiEmbeddingModelInputModalitiesByName = {
1153 'gemini-embedding-001': readonly ['text']
1154}
1155
1156// Manual type map for per-model provider options
1157export type GeminiChatModelProviderOptionsByName = {
1158 // Models with thinking and structured output support
1159 [GEMINI_3_8_FLASH.name]: GeminiToolConfigOptions &
1160 GeminiSafetyOptions &
1161 GeminiCommonConfigOptions &
1162 GeminiCachedContentOptions &
1163 GeminiStructuredOutputOptions
1164 [GEMINI_3_7_FLASH.name]: GeminiToolConfigOptions &
1165 GeminiSafetyOptions &
1166 GeminiCommonConfigOptions &
1167 GeminiCachedContentOptions &
1168 GeminiStructuredOutputOptions
1169 [GEMINI_3_6_FLASH.name]: GeminiToolConfigOptions &
1170 GeminiSafetyOptions &
1171 GeminiCommonConfigOptions &
1172 GeminiCachedContentOptions &
1173 GeminiStructuredOutputOptions
1174 [GEMINI_3_5_FLASH.name]: GeminiToolConfigOptions &
1175 GeminiSafetyOptions &
1176 GeminiCommonConfigOptions &
1177 GeminiCachedContentOptions &
1178 GeminiStructuredOutputOptions
1179 [GEMINI_3_5_FLASH_LITE.name]: GeminiToolConfigOptions &
1180 GeminiSafetyOptions &
1181 GeminiCommonConfigOptions &
1182 GeminiCachedContentOptions &
1183 GeminiStructuredOutputOptions
1184 [GEMINI_3_1_PRO.name]: GeminiToolConfigOptions &
1185 GeminiSafetyOptions &
1186 GeminiCommonConfigOptions &
1187 GeminiCachedContentOptions &
1188 GeminiStructuredOutputOptions
1189 [GEMINI_3_FLASH.name]: GeminiToolConfigOptions &
1190 GeminiSafetyOptions &
1191 GeminiCommonConfigOptions &
1192 GeminiCachedContentOptions &
1193 GeminiStructuredOutputOptions
1194 [GEMINI_3_1_FLASH_LITE.name]: GeminiToolConfigOptions &
1195 GeminiSafetyOptions &
1196 GeminiCommonConfigOptions &
1197 GeminiCachedContentOptions &
1198 GeminiStructuredOutputOptions
1199 [GEMINI_3_1_FLASH_LITE_PREVIEW.name]: GeminiToolConfigOptions &
1200 GeminiSafetyOptions &
1201 GeminiCommonConfigOptions &
1202 GeminiCachedContentOptions &
1203 GeminiStructuredOutputOptions
1204 [GEMINI_2_5_PRO.name]: GeminiToolConfigOptions &
1205 GeminiSafetyOptions &
1206 GeminiCommonConfigOptions &
1207 GeminiCachedContentOptions &
1208 GeminiStructuredOutputOptions
1209 [GEMINI_2_5_FLASH.name]: GeminiToolConfigOptions &
1210 GeminiSafetyOptions &
1211 GeminiCommonConfigOptions &
1212 GeminiCachedContentOptions &
1213 GeminiStructuredOutputOptions
1214 [GEMINI_2_5_FLASH_LITE.name]: GeminiToolConfigOptions &
1215 GeminiSafetyOptions &
1216 GeminiCommonConfigOptions &
1217 GeminiCachedContentOptions &
1218 GeminiStructuredOutputOptions
1219}
1220
1221/**
1222 * Type-only map from chat model name to its supported tool capabilities.
1223 * Based on the 'supports.tools' arrays defined for each model.
1224 */
1225export type GeminiChatModelToolCapabilitiesByName = {
1226 [GEMINI_3_8_FLASH.name]: typeof GEMINI_3_8_FLASH.supports.tools
1227 [GEMINI_3_7_FLASH.name]: typeof GEMINI_3_7_FLASH.supports.tools
1228 [GEMINI_3_6_FLASH.name]: typeof GEMINI_3_6_FLASH.supports.tools
1229 [GEMINI_3_5_FLASH.name]: typeof GEMINI_3_5_FLASH.supports.tools
1230 [GEMINI_3_5_FLASH_LITE.name]: typeof GEMINI_3_5_FLASH_LITE.supports.tools
1231 [GEMINI_3_1_PRO.name]: typeof GEMINI_3_1_PRO.supports.tools
1232 [GEMINI_3_FLASH.name]: typeof GEMINI_3_FLASH.supports.tools
1233 [GEMINI_3_1_FLASH_LITE.name]: typeof GEMINI_3_1_FLASH_LITE.supports.tools
1234 [GEMINI_3_1_FLASH_LITE_PREVIEW.name]: typeof GEMINI_3_1_FLASH_LITE_PREVIEW.supports.tools
1235 [GEMINI_2_5_PRO.name]: typeof GEMINI_2_5_PRO.supports.tools
1236 [GEMINI_2_5_FLASH.name]: typeof GEMINI_2_5_FLASH.supports.tools
1237 [GEMINI_2_5_FLASH_LITE.name]: typeof GEMINI_2_5_FLASH_LITE.supports.tools
1238}
1239
1240/**
1241 * Type-only map from chat model name to its supported input modalities.
1242 * Based on the 'supports.input' arrays defined for each model.
1243 * Note: 'document' in the model meta is mapped to 'document' modality.
1244 * Used by the core AI types to constrain ContentPart types based on the selected model.
1245 * Note: These must be inlined as readonly arrays (not typeof) because the model
1246 * constants are not exported and typeof references don't work in .d.ts files
1247 * when consumed by external packages.
1248 *
1249 * @see https://ai.google.dev/gemini-api/docs/vision
1250 * @see https://ai.google.dev/gemini-api/docs/audio
1251 * @see https://ai.google.dev/gemini-api/docs/document-processing
1252 */
1253export type GeminiModelInputModalitiesByName = {
1254 // Models with full multimodal support (text, image, audio, video, document)
1255 [GEMINI_3_8_FLASH.name]: typeof GEMINI_3_8_FLASH.supports.input
1256 [GEMINI_3_7_FLASH.name]: typeof GEMINI_3_7_FLASH.supports.input
1257 [GEMINI_3_6_FLASH.name]: typeof GEMINI_3_6_FLASH.supports.input
1258 [GEMINI_3_5_FLASH.name]: typeof GEMINI_3_5_FLASH.supports.input
1259 [GEMINI_3_5_FLASH_LITE.name]: typeof GEMINI_3_5_FLASH_LITE.supports.input
1260 [GEMINI_3_1_PRO.name]: typeof GEMINI_3_1_PRO.supports.input
1261 [GEMINI_3_FLASH.name]: typeof GEMINI_3_FLASH.supports.input
1262 [GEMINI_3_1_FLASH_LITE.name]: typeof GEMINI_3_1_FLASH_LITE.supports.input
1263 [GEMINI_3_1_FLASH_LITE_PREVIEW.name]: typeof GEMINI_3_1_FLASH_LITE_PREVIEW.supports.input
1264 [GEMINI_2_5_PRO.name]: typeof GEMINI_2_5_PRO.supports.input
1265 [GEMINI_2_5_FLASH_LITE.name]: typeof GEMINI_2_5_FLASH_LITE.supports.input
1266
1267 // Models with text, image, audio, video (no document)
1268 [GEMINI_2_5_FLASH.name]: typeof GEMINI_2_5_FLASH.supports.input
1269}
1270
1271/**
1272 * Runtime map from chat model name to its supported input modalities, for the
1273 * text adapter's `inputModalities`. `satisfies` keeps it equal to
1274 * {@link GeminiModelInputModalitiesByName}. An unknown name gives `undefined`.
1275 */
1276export const GEMINI_MODEL_INPUT_MODALITIES: Readonly<
1277 Record<string, ReadonlyArray<Modality>>
1278> = {
1279 [GEMINI_3_8_FLASH.name]: GEMINI_3_8_FLASH.supports.input,
1280 [GEMINI_3_7_FLASH.name]: GEMINI_3_7_FLASH.supports.input,
1281 [GEMINI_3_6_FLASH.name]: GEMINI_3_6_FLASH.supports.input,
1282 [GEMINI_3_5_FLASH.name]: GEMINI_3_5_FLASH.supports.input,
1283 [GEMINI_3_5_FLASH_LITE.name]: GEMINI_3_5_FLASH_LITE.supports.input,
1284 [GEMINI_3_1_PRO.name]: GEMINI_3_1_PRO.supports.input,
1285 [GEMINI_3_FLASH.name]: GEMINI_3_FLASH.supports.input,
1286 [GEMINI_3_1_FLASH_LITE.name]: GEMINI_3_1_FLASH_LITE.supports.input,
1287 [GEMINI_3_1_FLASH_LITE_PREVIEW.name]:
1288 GEMINI_3_1_FLASH_LITE_PREVIEW.supports.input,
1289 [GEMINI_2_5_PRO.name]: GEMINI_2_5_PRO.supports.input,
1290 [GEMINI_2_5_FLASH_LITE.name]: GEMINI_2_5_FLASH_LITE.supports.input,
1291 [GEMINI_2_5_FLASH.name]: GEMINI_2_5_FLASH.supports.input,
1292} satisfies GeminiModelInputModalitiesByName
1293
1294// Reasoning
1295//
1296// Each model's `reasoning` field holds its data for `chat({ reasoning })`: the
1297// levels it has, with the provider value for each, and whether it takes a
1298// thinking token budget. The data comes from models.dev. The generator that
1299// writes it comes with the model catalog later. Until then, the sync scripts
1300// keep these fields as they are.
1301
1302const GEMINI_REASONING = {
1303 [GEMINI_3_8_FLASH.name]: GEMINI_3_8_FLASH.reasoning,
1304 [GEMINI_3_7_FLASH.name]: GEMINI_3_7_FLASH.reasoning,
1305 [GEMINI_3_6_FLASH.name]: GEMINI_3_6_FLASH.reasoning,
1306 [GEMINI_3_5_FLASH.name]: GEMINI_3_5_FLASH.reasoning,
1307 [GEMINI_3_5_FLASH_LITE.name]: GEMINI_3_5_FLASH_LITE.reasoning,
1308 [GEMINI_3_1_PRO.name]: GEMINI_3_1_PRO.reasoning,
1309 [GEMINI_3_FLASH.name]: GEMINI_3_FLASH.reasoning,
1310 [GEMINI_3_1_FLASH_LITE.name]: GEMINI_3_1_FLASH_LITE.reasoning,
1311 [GEMINI_3_1_FLASH_LITE_PREVIEW.name]: GEMINI_3_1_FLASH_LITE_PREVIEW.reasoning,
1312 [GEMINI_2_5_PRO.name]: GEMINI_2_5_PRO.reasoning,
1313 [GEMINI_2_5_FLASH_LITE.name]: GEMINI_2_5_FLASH_LITE.reasoning,
1314 [GEMINI_2_5_FLASH.name]: GEMINI_2_5_FLASH.reasoning,
1315}
1316
1317/**
1318 * Each chat model's reasoning levels, and whether it takes a token budget,
1319 * for `chat({ reasoning })`. Derived from the `reasoning` field. A model
1320 * that is not here does not reason.
1321 */
1322export type GeminiModelReasoningByName = {
1323 [K in keyof typeof GEMINI_REASONING]: ModelReasoningCapability<
1324 (typeof GEMINI_REASONING)[K]
1325 >
1326}
1327
1328/**
1329 * Runtime map from chat model name to its reasoning data, for the text adapter.
1330 * An unknown name gives `undefined`: the adapter sends no reasoning field.
1331 */
1332export const GEMINI_MODEL_REASONING: Readonly<Record<string, ModelReasoning>> =
1333 GEMINI_REASONING