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 /**
60 * Type-level description of which provider options this model supports.
61 */
62 providerOptions?: TProviderOptions
63 /** The model's data for `chat({ reasoning })`. None: it does not reason. */
64 reasoning?: ModelReasoning
65}
66
67const GEMINI_3_1_PRO = {
68 name: 'gemini-3.1-pro-preview',
69 max_input_tokens: 1_048_576,
70 max_output_tokens: 65_536,
71 knowledge_cutoff: '2025-01-01',
72 supports: {
73 input: ['text', 'image', 'audio', 'video', 'document'],
74 output: ['text'],
75 capabilities: [
76 'batch_api',
77 'caching',
78 'function_calling',
79 'structured_output',
80 'thinking',
81 ],
82 tools: ['code_execution', 'file_search', 'google_search', 'url_context'],
83 },
84 reasoning: EFFORT_LOW_TO_HIGH,
85} as const satisfies ModelMeta<
86 GeminiToolConfigOptions &
87 GeminiSafetyOptions &
88 GeminiCommonConfigOptions &
89 GeminiCachedContentOptions &
90 GeminiStructuredOutputOptions
91>
92
93const GEMINI_3_FLASH = {
94 name: 'gemini-3-flash-preview',
95 max_input_tokens: 1_048_576,
96 max_output_tokens: 65_536,
97 knowledge_cutoff: '2025-01-01',
98 supports: {
99 input: ['text', 'image', 'audio', 'video', 'document'],
100 output: ['text'],
101 capabilities: [
102 'batch_api',
103 'caching',
104 'function_calling',
105 'structured_output',
106 'thinking',
107 ],
108 tools: ['code_execution', 'file_search', 'google_search', 'url_context'],
109 },
110 reasoning: EFFORT_MINIMAL_TO_HIGH,
111} as const satisfies ModelMeta<
112 GeminiToolConfigOptions &
113 GeminiSafetyOptions &
114 GeminiCommonConfigOptions &
115 GeminiCachedContentOptions &
116 GeminiStructuredOutputOptions
117>
118
119/**
120 * Gemini 3 Pro Image ("Nano Banana Pro") — GA. Accepts the ten standard
121 * aspect ratios at 1K / 2K / 4K.
122 * @see https://ai.google.dev/gemini-api/docs/models/gemini-3-pro-image
123 */
124const GEMINI_3_PRO_IMAGE = {
125 name: 'gemini-3-pro-image',
126 max_input_tokens: 65_536,
127 max_output_tokens: 32_768,
128 knowledge_cutoff: '2025-01-01',
129 supports: {
130 input: ['text', 'image'],
131 output: ['text', 'image'],
132 capabilities: ['batch_api', 'structured_output', 'thinking'],
133 tools: ['google_search'],
134 },
135} as const satisfies ModelMeta<
136 GeminiToolConfigOptions &
137 GeminiSafetyOptions &
138 GeminiCommonConfigOptions &
139 GeminiCachedContentOptions &
140 GeminiStructuredOutputOptions
141>
142
143/**
144 * Gemini 3.1 Flash Image ("Nano Banana 2") — GA. The only native image model
145 * that accepts the four extreme banner ratios (1:4, 4:1, 1:8, 8:1) and the
146 * 512 (0.5K) resolution tier.
147 * @see https://ai.google.dev/gemini-api/docs/models/gemini-3.1-flash-image
148 */
149const GEMINI_3_1_FLASH_IMAGE = {
150 name: 'gemini-3.1-flash-image',
151 max_input_tokens: 131_072,
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', 'thinking'],
158 tools: ['google_search'],
159 },
160} as const satisfies ModelMeta<
161 GeminiToolConfigOptions &
162 GeminiSafetyOptions &
163 GeminiCommonConfigOptions &
164 GeminiCachedContentOptions
165>
166
167/**
168 * Gemini 3.1 Flash Lite Image ("Nano Banana 2 Lite") — GA. 1K output only.
169 * @see https://ai.google.dev/gemini-api/docs/models/gemini-3.1-flash-lite-image
170 */
171const GEMINI_3_1_FLASH_LITE_IMAGE = {
172 name: 'gemini-3.1-flash-lite-image',
173 max_input_tokens: 65_536,
174 max_output_tokens: 65_536,
175 knowledge_cutoff: '2025-01-01',
176 supports: {
177 input: ['text', 'image'],
178 output: ['text', 'image'],
179 capabilities: ['batch_api', 'structured_output', 'thinking'],
180 tools: ['google_search'],
181 },
182} as const satisfies ModelMeta<
183 GeminiToolConfigOptions &
184 GeminiSafetyOptions &
185 GeminiCommonConfigOptions &
186 GeminiCachedContentOptions &
187 GeminiStructuredOutputOptions
188>
189
190/**
191 * Nano Banana 2.1 — GA. 1K / 2K / 4K output, no 512 tier. The id does not
192 * follow the `gemini-<version>-flash-image` pattern of the earlier models.
193 * Token limits are the values `GET /v1beta/models` returns.
194 * @see https://ai.google.dev/gemini-api/docs/models/gemini-nano-banana-2.1
195 */
196const GEMINI_NANO_BANANA_2_1 = {
197 name: 'gemini-nano-banana-2.1',
198 max_input_tokens: 65_536,
199 max_output_tokens: 65_536,
200 supports: {
201 input: ['text', 'image'],
202 output: ['text', 'image'],
203 capabilities: ['batch_api', 'thinking'],
204 tools: ['google_search'],
205 },
206} as const satisfies ModelMeta<
207 GeminiToolConfigOptions &
208 GeminiSafetyOptions &
209 GeminiCommonConfigOptions &
210 GeminiCachedContentOptions
211>
212
213const GEMINI_3_1_FLASH_LITE = {
214 name: 'gemini-3.1-flash-lite',
215 max_input_tokens: 1_048_576,
216 max_output_tokens: 65_536,
217 knowledge_cutoff: '2025-01-01',
218 supports: {
219 input: ['text', 'image', 'audio', 'video', 'document'],
220 output: ['text'],
221 capabilities: [
222 'batch_api',
223 'caching',
224 'function_calling',
225 'structured_output',
226 'thinking',
227 ],
228 tools: ['code_execution', 'file_search', 'google_search', 'url_context'],
229 },
230 reasoning: EFFORT_MINIMAL_TO_HIGH,
231} as const satisfies ModelMeta<
232 GeminiToolConfigOptions &
233 GeminiSafetyOptions &
234 GeminiCommonConfigOptions &
235 GeminiCachedContentOptions &
236 GeminiStructuredOutputOptions
237>
238
239const GEMINI_3_1_FLASH_LITE_PREVIEW = {
240 name: 'gemini-3.1-flash-lite-preview',
241 max_input_tokens: 1_048_576,
242 max_output_tokens: 65_536,
243 knowledge_cutoff: '2025-01-01',
244 supports: {
245 input: ['text', 'image', 'audio', 'video', 'document'],
246 output: ['text'],
247 capabilities: [
248 'batch_api',
249 'caching',
250 'function_calling',
251 'structured_output',
252 'thinking',
253 ],
254 tools: ['code_execution', 'file_search', 'google_search', 'url_context'],
255 },
256 reasoning: EFFORT_MINIMAL_TO_HIGH,
257} as const satisfies ModelMeta<
258 GeminiToolConfigOptions &
259 GeminiSafetyOptions &
260 GeminiCommonConfigOptions &
261 GeminiCachedContentOptions &
262 GeminiStructuredOutputOptions
263>
264
265const GEMINI_2_5_PRO = {
266 name: 'gemini-2.5-pro',
267 max_input_tokens: 1_048_576,
268 max_output_tokens: 65_536,
269 knowledge_cutoff: '2025-01-01',
270 supports: {
271 input: ['text', 'image', 'audio', 'video', 'document'],
272 output: ['text'],
273 capabilities: [
274 'batch_api',
275 'caching',
276 'function_calling',
277 'structured_output',
278 'thinking',
279 ],
280 tools: [
281 'code_execution',
282 'file_search',
283 'google_maps',
284 'google_search',
285 'url_context',
286 ],
287 },
288 reasoning: BUDGET_MINIMAL_TO_HIGH,
289} as const satisfies ModelMeta<
290 GeminiToolConfigOptions &
291 GeminiSafetyOptions &
292 GeminiCommonConfigOptions &
293 GeminiCachedContentOptions &
294 GeminiStructuredOutputOptions
295>
296
297const GEMINI_2_5_PRO_TTS = {
298 name: 'gemini-2.5-pro-preview-tts',
299 max_input_tokens: 8_192,
300 max_output_tokens: 16_384,
301 knowledge_cutoff: '2025-05-01',
302 supports: {
303 input: ['text'],
304 output: ['audio'],
305 capabilities: ['audio_generation'],
306 },
307} as const satisfies ModelMeta<
308 GeminiToolConfigOptions &
309 GeminiSafetyOptions &
310 GeminiCommonConfigOptions &
311 GeminiCachedContentOptions
312>
313
314const GEMINI_2_5_FLASH = {
315 name: 'gemini-2.5-flash',
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'],
321 output: ['text'],
322 capabilities: [
323 'batch_api',
324 'caching',
325 'function_calling',
326 'structured_output',
327 'thinking',
328 ],
329 tools: [
330 'code_execution',
331 'file_search',
332 'google_maps',
333 'google_search',
334 'url_context',
335 ],
336 },
337 reasoning: BUDGET_OFF_HIGH,
338} as const satisfies ModelMeta<
339 GeminiToolConfigOptions &
340 GeminiSafetyOptions &
341 GeminiCommonConfigOptions &
342 GeminiCachedContentOptions &
343 GeminiStructuredOutputOptions
344>
345
346/**
347const GEMINI_2_5_FLASH_LIVE = {
348 name: 'gemini-2.5-flash-native-audio-preview-09-2025',
349 max_input_tokens: 141_072,
350 max_output_tokens: 8_192,
351 knowledge_cutoff: '2025-01-01',
352 supports: {
353 input: ['text', 'audio', 'video'],
354 output: ['text', 'audio'],
355 capabilities: [
356 'audio_generation',
357 'file_search',
358 'function_calling',
359 'live_api',
360 'search_grounding',
361 'thinking',
362 ],
363 },
364} as const satisfies ModelMeta<
365 GeminiToolConfigOptions &
366 GeminiSafetyOptions &
367 GeminiGenerationConfigOptions &
368 GeminiCachedContentOptions
369>
370*/
371const GEMINI_2_5_FLASH_TTS = {
372 name: 'gemini-2.5-flash-preview-tts',
373 max_input_tokens: 8_192,
374 max_output_tokens: 16_384,
375 knowledge_cutoff: '2025-05-01',
376 supports: {
377 input: ['text'],
378 output: ['audio'],
379 capabilities: ['audio_generation', 'batch_api'],
380 },
381} as const satisfies ModelMeta<
382 GeminiToolConfigOptions &
383 GeminiSafetyOptions &
384 GeminiCommonConfigOptions &
385 GeminiCachedContentOptions
386>
387
388/**
389 * Gemini 3.1 Flash TTS Preview - latest expressive TTS model with
390 * 200+ audio tags, 70+ languages, and multi-speaker dialogue support.
391 * @see https://ai.google.dev/gemini-api/docs/models/gemini-3.1-flash-tts-preview
392 */
393const GEMINI_3_1_FLASH_TTS = {
394 name: 'gemini-3.1-flash-tts-preview',
395 max_input_tokens: 32_768,
396 max_output_tokens: 16_384,
397 knowledge_cutoff: '2025-05-01',
398 supports: {
399 input: ['text'],
400 output: ['audio'],
401 capabilities: ['audio_generation', 'batch_api'],
402 },
403} as const satisfies ModelMeta<
404 GeminiToolConfigOptions &
405 GeminiSafetyOptions &
406 GeminiCommonConfigOptions &
407 GeminiCachedContentOptions
408>
409
410/**
411 * Lyria 3 Pro Preview — Google's flagship music generation model.
412 * Generates full-length songs with multiple verses, choruses, and bridges.
413 * Outputs MP3 or WAV at 48 kHz stereo.
414 * @see https://ai.google.dev/gemini-api/docs/models/lyria-3-pro-preview
415 */
416const LYRIA_3_PRO = {
417 name: 'lyria-3-pro-preview',
418 max_input_tokens: 131_072,
419 supports: {
420 input: ['text', 'image'],
421 output: ['audio'],
422 capabilities: ['audio_generation'],
423 },
424} as const satisfies ModelMeta
425
426/**
427 * Lyria 3 Clip Preview — 30-second music clips in MP3 format.
428 * @see https://ai.google.dev/gemini-api/docs/music-generation
429 */
430const LYRIA_3_CLIP = {
431 name: 'lyria-3-clip-preview',
432 max_input_tokens: 131_072,
433 supports: {
434 input: ['text', 'image'],
435 output: ['audio'],
436 capabilities: ['audio_generation'],
437 },
438} as const satisfies ModelMeta
439
440const GEMINI_2_5_FLASH_LITE = {
441 name: 'gemini-2.5-flash-lite',
442 max_input_tokens: 1_048_576,
443 max_output_tokens: 65_536,
444 knowledge_cutoff: '2025-01-01',
445 supports: {
446 input: ['text', 'image', 'audio', 'video', 'document'],
447 output: ['text'],
448 capabilities: [
449 'batch_api',
450 'caching',
451 'function_calling',
452 'structured_output',
453 'thinking',
454 ],
455 tools: ['code_execution', 'google_maps', 'google_search', 'url_context'],
456 },
457 reasoning: BUDGET_OFF_HIGH,
458} as const satisfies ModelMeta<
459 GeminiToolConfigOptions &
460 GeminiSafetyOptions &
461 GeminiCommonConfigOptions &
462 GeminiCachedContentOptions &
463 GeminiStructuredOutputOptions
464>
465
466/**
467 * Veo video generation models.
468 * @experimental Veo video generation is an experimental feature and may change.
469 */
470const VEO_3_1_PREVIEW = {
471 name: 'veo-3.1-generate-preview',
472 max_input_tokens: 1024,
473 max_output_tokens: 1,
474 supports: {
475 input: ['text', 'image'],
476 output: ['video', 'audio'],
477 },
478} as const satisfies ModelMeta<
479 GeminiToolConfigOptions &
480 GeminiSafetyOptions &
481 GeminiCommonConfigOptions &
482 GeminiCachedContentOptions
483>
484
485const VEO_3_1_FAST_PREVIEW = {
486 name: 'veo-3.1-fast-generate-preview',
487 max_input_tokens: 1024,
488 max_output_tokens: 1,
489 supports: {
490 input: ['text', 'image'],
491 output: ['video', 'audio'],
492 },
493} as const satisfies ModelMeta<
494 GeminiToolConfigOptions &
495 GeminiSafetyOptions &
496 GeminiCommonConfigOptions &
497 GeminiCachedContentOptions
498>
499
500const VEO_3_1_LITE_PREVIEW = {
501 name: 'veo-3.1-lite-generate-preview',
502 max_input_tokens: 1024,
503 max_output_tokens: 1,
504 supports: {
505 input: ['text', 'image'],
506 output: ['video', 'audio'],
507 },
508} as const satisfies ModelMeta<
509 GeminiToolConfigOptions &
510 GeminiSafetyOptions &
511 GeminiCommonConfigOptions &
512 GeminiCachedContentOptions
513>
514
515/**
516 * Gemini Omni 1.1 Flash — GA. Multimodal video generation with
517 * conversational editing. Serves only the Interactions API
518 * (`generateContent` rejects it), so it routes through the
519 * interactions-based path of the video adapter, not Veo's
520 * `:predictLongRunning` flow. 360p / 720p (default) / 1080p / 4k at 24 FPS, 3–10 second
521 * clips (default 10s).
522 * @see https://ai.google.dev/gemini-api/docs/models/gemini-omni-flash
523 * @experimental Omni video generation is an experimental feature and may change.
524 */
525const GEMINI_OMNI_1_1_FLASH = {
526 name: 'gemini-omni-1.1-flash',
527 max_input_tokens: 1_048_576,
528 max_output_tokens: 1,
529 supports: {
530 input: ['text', 'image', 'video'],
531 output: ['video', 'audio'],
532 },
533} as const satisfies ModelMeta<
534 GeminiToolConfigOptions &
535 GeminiSafetyOptions &
536 GeminiCommonConfigOptions &
537 GeminiCachedContentOptions
538>
539
540const GEMINI_3_8_FLASH = {
541 name: 'gemini-3.8-flash',
542 max_input_tokens: 1_048_576,
543 max_output_tokens: 65_536,
544 knowledge_cutoff: '2026-03-01',
545 supports: {
546 input: ['text', 'image', 'video', 'audio', 'document'],
547 output: ['text'],
548 capabilities: [
549 'agentic_video',
550 'batch_api',
551 'caching',
552 'function_calling',
553 'structured_output',
554 'thinking',
555 ],
556 tools: [
557 'code_execution',
558 'file_search',
559 'google_search',
560 'google_maps',
561 'url_context',
562 'computer_use',
563 ],
564 },
565 reasoning: EFFORT_LOW_TO_HIGH,
566} as const satisfies ModelMeta<
567 GeminiToolConfigOptions &
568 GeminiSafetyOptions &
569 GeminiCommonConfigOptions &
570 GeminiCachedContentOptions &
571 GeminiStructuredOutputOptions
572>
573
574const GEMINI_3_7_FLASH = {
575 name: 'gemini-3.7-flash',
576 max_input_tokens: 1_048_576,
577 max_output_tokens: 65_536,
578 knowledge_cutoff: '2026-03-01',
579 supports: {
580 input: ['text', 'image', 'video', 'audio', 'document'],
581 output: ['text'],
582 capabilities: [
583 'agentic_video',
584 'batch_api',
585 'caching',
586 'function_calling',
587 'structured_output',
588 'thinking',
589 ],
590 tools: [
591 'code_execution',
592 'file_search',
593 'google_search',
594 'google_maps',
595 'url_context',
596 'computer_use',
597 ],
598 },
599 reasoning: EFFORT_LOW_TO_HIGH,
600} as const satisfies ModelMeta<
601 GeminiToolConfigOptions &
602 GeminiSafetyOptions &
603 GeminiCommonConfigOptions &
604 GeminiCachedContentOptions &
605 GeminiStructuredOutputOptions
606>
607
608const GEMINI_3_6_FLASH = {
609 name: 'gemini-3.6-flash',
610 max_input_tokens: 1_048_576,
611 max_output_tokens: 65_536,
612 knowledge_cutoff: '2026-03-01',
613 supports: {
614 input: ['text', 'image', 'video', 'audio', 'document'],
615 output: ['text'],
616 capabilities: [
617 'agentic_video',
618 'batch_api',
619 'caching',
620 'function_calling',
621 'structured_output',
622 'thinking',
623 ],
624 tools: [
625 'code_execution',
626 'file_search',
627 'google_search',
628 'google_maps',
629 'url_context',
630 'computer_use',
631 ],
632 },
633 reasoning: EFFORT_MINIMAL_TO_HIGH,
634} as const satisfies ModelMeta<
635 GeminiToolConfigOptions &
636 GeminiSafetyOptions &
637 GeminiCommonConfigOptions &
638 GeminiCachedContentOptions &
639 GeminiStructuredOutputOptions
640>
641
642const GEMINI_3_5_FLASH = {
643 name: 'gemini-3.5-flash',
644 max_input_tokens: 1_048_576,
645 max_output_tokens: 65_536,
646 supports: {
647 input: ['text', 'image', 'video', 'document', 'audio'],
648 output: ['text'],
649 capabilities: [
650 'batch_api',
651 'caching',
652 'function_calling',
653 'structured_output',
654 'thinking',
655 ],
656 tools: [
657 'code_execution',
658 'file_search',
659 'google_search',
660 'google_maps',
661 'url_context',
662 'computer_use',
663 ],
664 },
665 reasoning: EFFORT_MINIMAL_TO_HIGH,
666} as const satisfies ModelMeta<
667 GeminiToolConfigOptions &
668 GeminiSafetyOptions &
669 GeminiCommonConfigOptions &
670 GeminiCachedContentOptions &
671 GeminiStructuredOutputOptions
672>
673
674const GEMINI_3_5_FLASH_LITE = {
675 name: 'gemini-3.5-flash-lite',
676 max_input_tokens: 1_048_576,
677 max_output_tokens: 65_536,
678 knowledge_cutoff: '2025-01-01',
679 supports: {
680 input: ['text', 'image', 'video', 'audio', 'document'],
681 output: ['text'],
682 capabilities: [
683 'agentic_video',
684 'batch_api',
685 'caching',
686 'function_calling',
687 'structured_output',
688 'thinking',
689 ],
690 tools: [
691 'code_execution',
692 'file_search',
693 'google_search',
694 'google_maps',
695 'url_context',
696 ],
697 },
698 reasoning: EFFORT_MINIMAL_TO_HIGH,
699} as const satisfies ModelMeta<
700 GeminiToolConfigOptions &
701 GeminiSafetyOptions &
702 GeminiCommonConfigOptions &
703 GeminiCachedContentOptions &
704 GeminiStructuredOutputOptions
705>
706
707const GEMINI_4_ARGON = {
708 name: 'gemini-4-argon',
709 max_input_tokens: 1_048_576,
710 max_output_tokens: 943_718,
711 supports: {
712 input: ['audio', 'document', 'image', 'text', 'video'],
713 output: ['text'],
714 capabilities: ['function_calling', 'structured_output', 'thinking'],
715 tools: ['code_execution', 'file_search', 'google_search', 'url_context'],
716 },
717} as const satisfies ModelMeta<
718 GeminiToolConfigOptions &
719 GeminiSafetyOptions &
720 GeminiCommonConfigOptions &
721 GeminiCachedContentOptions &
722 GeminiStructuredOutputOptions
723>
724
725export const GEMINI_MODELS = [
726 GEMINI_4_ARGON.name,
727 GEMINI_3_8_FLASH.name,
728 GEMINI_3_7_FLASH.name,
729 GEMINI_3_6_FLASH.name,
730 GEMINI_3_5_FLASH.name,
731 GEMINI_3_5_FLASH_LITE.name,
732 GEMINI_3_1_PRO.name,
733 GEMINI_3_FLASH.name,
734 GEMINI_3_1_FLASH_LITE.name,
735 GEMINI_3_1_FLASH_LITE_PREVIEW.name,
736 GEMINI_2_5_PRO.name,
737 GEMINI_2_5_FLASH.name,
738 GEMINI_2_5_FLASH_LITE.name,
739] as const
740
741/**
742 * Gemini models that support combining `tools` + `responseSchema` in a
743 * single streaming `generateContent` call (per issue #605). Per the
744 * provider matrix, Gemini 3.x natively interleaves the schema-constrained
745 * answer with function-calling on one pass; Gemini 2.x is unsupported /
746 * brittle and keeps the engine's legacy finalization fallback.
747 */
748export const GEMINI_COMBINED_TOOLS_AND_SCHEMA_MODELS = new Set<string>([
749 GEMINI_3_8_FLASH.name,
750 GEMINI_3_7_FLASH.name,
751 GEMINI_3_6_FLASH.name,
752 GEMINI_3_5_FLASH.name,
753 GEMINI_3_5_FLASH_LITE.name,
754 GEMINI_3_1_PRO.name,
755 GEMINI_3_FLASH.name,
756 GEMINI_3_1_FLASH_LITE.name,
757 GEMINI_3_1_FLASH_LITE_PREVIEW.name,
758])
759
760export type GeminiModels = (typeof GEMINI_MODELS)[number]
761
762export type GeminiImageModels = (typeof GEMINI_IMAGE_MODELS)[number]
763
764/**
765 * Image generation models.
766 */
767export const GEMINI_IMAGE_MODELS = [
768 GEMINI_NANO_BANANA_2_1.name,
769 GEMINI_3_1_FLASH_IMAGE.name,
770 GEMINI_3_1_FLASH_LITE_IMAGE.name,
771 GEMINI_3_PRO_IMAGE.name,
772] as const
773
774/**
775 * Text-to-speech models
776 * @experimental Gemini TTS is an experimental feature and may change.
777 */
778export const GEMINI_TTS_MODELS = [
779 GEMINI_3_1_FLASH_TTS.name,
780 GEMINI_2_5_FLASH_TTS.name,
781 GEMINI_2_5_PRO_TTS.name,
782] as const
783
784/**
785 * Audio generation models (Lyria music generation).
786 * @experimental Lyria music generation is an experimental feature and may change.
787 */
788export const GEMINI_AUDIO_MODELS = [
789 LYRIA_3_PRO.name,
790 LYRIA_3_CLIP.name,
791] as const
792
793/**
794 * Available voice names for Gemini TTS
795 * @see https://ai.google.dev/gemini-api/docs/speech-generation
796 */
797export const GEMINI_TTS_VOICES = [
798 'Zephyr',
799 'Puck',
800 'Charon',
801 'Kore',
802 'Fenrir',
803 'Leda',
804 'Orus',
805 'Aoede',
806 'Callirrhoe',
807 'Autonoe',
808 'Enceladus',
809 'Iapetus',
810 'Umbriel',
811 'Algieba',
812 'Despina',
813 'Erinome',
814 'Algenib',
815 'Rasalgethi',
816 'Laomedeia',
817 'Achernar',
818 'Alnilam',
819 'Schedar',
820 'Gacrux',
821 'Pulcherrima',
822 'Achird',
823 'Zubenelgenubi',
824 'Vindemiatrix',
825 'Sadachbia',
826 'Sadaltager',
827 'Sulafat',
828] as const
829
830export type GeminiTTSVoice = (typeof GEMINI_TTS_VOICES)[number]
831
832/**
833 * Video generation models. Veo models run on the long-running
834 * `:predictLongRunning` flow; Gemini Omni Flash runs on the Interactions
835 * API — the video adapter routes by model.
836 * @experimental Video generation is an experimental feature and may change.
837 */
838export const GEMINI_VIDEO_MODELS = [
839 VEO_3_1_PREVIEW.name,
840 VEO_3_1_FAST_PREVIEW.name,
841 VEO_3_1_LITE_PREVIEW.name,
842 GEMINI_OMNI_1_1_FLASH.name,
843] as const
844
845/**
846 * Video models served by the Interactions API rather than Veo's
847 * `:predictLongRunning` operations flow.
848 * @experimental Omni video generation is an experimental feature and may change.
849 */
850export const GEMINI_INTERACTIONS_VIDEO_MODELS = [
851 GEMINI_OMNI_1_1_FLASH.name,
852] as const
853
854/**
855 * Embedding models
856 */
857export const GEMINI_EMBEDDING_MODELS = ['gemini-embedding-001'] as const
858
859export type GeminiEmbeddingModel = (typeof GEMINI_EMBEDDING_MODELS)[number]
860
861/**
862 * Type-only map from embedding model name to its provider options type.
863 */
864export type GeminiEmbeddingModelProviderOptionsByName = {
865 'gemini-embedding-001': GeminiEmbeddingProviderOptions
866}
867
868/**
869 * Per-model input modalities for embedding models. Gemini embedding models
870 * are text-only, so image inputs fail at compile time.
871 */
872export type GeminiEmbeddingModelInputModalitiesByName = {
873 'gemini-embedding-001': readonly ['text']
874}
875
876// Manual type map for per-model provider options
877export type GeminiChatModelProviderOptionsByName = {
878 // Models with thinking and structured output support
879 [GEMINI_3_8_FLASH.name]: GeminiToolConfigOptions &
880 GeminiSafetyOptions &
881 GeminiCommonConfigOptions &
882 GeminiCachedContentOptions &
883 GeminiStructuredOutputOptions
884 [GEMINI_3_7_FLASH.name]: GeminiToolConfigOptions &
885 GeminiSafetyOptions &
886 GeminiCommonConfigOptions &
887 GeminiCachedContentOptions &
888 GeminiStructuredOutputOptions
889 [GEMINI_3_6_FLASH.name]: GeminiToolConfigOptions &
890 GeminiSafetyOptions &
891 GeminiCommonConfigOptions &
892 GeminiCachedContentOptions &
893 GeminiStructuredOutputOptions
894 [GEMINI_3_5_FLASH.name]: GeminiToolConfigOptions &
895 GeminiSafetyOptions &
896 GeminiCommonConfigOptions &
897 GeminiCachedContentOptions &
898 GeminiStructuredOutputOptions
899 [GEMINI_3_5_FLASH_LITE.name]: GeminiToolConfigOptions &
900 GeminiSafetyOptions &
901 GeminiCommonConfigOptions &
902 GeminiCachedContentOptions &
903 GeminiStructuredOutputOptions
904 [GEMINI_3_1_PRO.name]: GeminiToolConfigOptions &
905 GeminiSafetyOptions &
906 GeminiCommonConfigOptions &
907 GeminiCachedContentOptions &
908 GeminiStructuredOutputOptions
909 [GEMINI_3_FLASH.name]: GeminiToolConfigOptions &
910 GeminiSafetyOptions &
911 GeminiCommonConfigOptions &
912 GeminiCachedContentOptions &
913 GeminiStructuredOutputOptions
914 [GEMINI_3_1_FLASH_LITE.name]: GeminiToolConfigOptions &
915 GeminiSafetyOptions &
916 GeminiCommonConfigOptions &
917 GeminiCachedContentOptions &
918 GeminiStructuredOutputOptions
919 [GEMINI_3_1_FLASH_LITE_PREVIEW.name]: GeminiToolConfigOptions &
920 GeminiSafetyOptions &
921 GeminiCommonConfigOptions &
922 GeminiCachedContentOptions &
923 GeminiStructuredOutputOptions
924 [GEMINI_2_5_PRO.name]: GeminiToolConfigOptions &
925 GeminiSafetyOptions &
926 GeminiCommonConfigOptions &
927 GeminiCachedContentOptions &
928 GeminiStructuredOutputOptions
929 [GEMINI_2_5_FLASH.name]: GeminiToolConfigOptions &
930 GeminiSafetyOptions &
931 GeminiCommonConfigOptions &
932 GeminiCachedContentOptions &
933 GeminiStructuredOutputOptions
934 [GEMINI_2_5_FLASH_LITE.name]: GeminiToolConfigOptions &
935 GeminiSafetyOptions &
936 GeminiCommonConfigOptions &
937 GeminiCachedContentOptions &
938 GeminiStructuredOutputOptions
939 [GEMINI_4_ARGON.name]: GeminiToolConfigOptions &
940 GeminiSafetyOptions &
941 GeminiCommonConfigOptions &
942 GeminiCachedContentOptions &
943 GeminiStructuredOutputOptions
944}
945
946/**
947 * Type-only map from chat model name to its supported tool capabilities.
948 * Based on the 'supports.tools' arrays defined for each model.
949 */
950export type GeminiChatModelToolCapabilitiesByName = {
951 [GEMINI_3_8_FLASH.name]: typeof GEMINI_3_8_FLASH.supports.tools
952 [GEMINI_3_7_FLASH.name]: typeof GEMINI_3_7_FLASH.supports.tools
953 [GEMINI_3_6_FLASH.name]: typeof GEMINI_3_6_FLASH.supports.tools
954 [GEMINI_3_5_FLASH.name]: typeof GEMINI_3_5_FLASH.supports.tools
955 [GEMINI_3_5_FLASH_LITE.name]: typeof GEMINI_3_5_FLASH_LITE.supports.tools
956 [GEMINI_3_1_PRO.name]: typeof GEMINI_3_1_PRO.supports.tools
957 [GEMINI_3_FLASH.name]: typeof GEMINI_3_FLASH.supports.tools
958 [GEMINI_3_1_FLASH_LITE.name]: typeof GEMINI_3_1_FLASH_LITE.supports.tools
959 [GEMINI_3_1_FLASH_LITE_PREVIEW.name]: typeof GEMINI_3_1_FLASH_LITE_PREVIEW.supports.tools
960 [GEMINI_2_5_PRO.name]: typeof GEMINI_2_5_PRO.supports.tools
961 [GEMINI_2_5_FLASH.name]: typeof GEMINI_2_5_FLASH.supports.tools
962 [GEMINI_2_5_FLASH_LITE.name]: typeof GEMINI_2_5_FLASH_LITE.supports.tools
963 [GEMINI_4_ARGON.name]: typeof GEMINI_4_ARGON.supports.tools
964}
965
966/**
967 * Type-only map from chat model name to its supported input modalities.
968 * Based on the 'supports.input' arrays defined for each model.
969 * Note: 'document' in the model meta is mapped to 'document' modality.
970 * Used by the core AI types to constrain ContentPart types based on the selected model.
971 * Note: These must be inlined as readonly arrays (not typeof) because the model
972 * constants are not exported and typeof references don't work in .d.ts files
973 * when consumed by external packages.
974 *
975 * @see https://ai.google.dev/gemini-api/docs/vision
976 * @see https://ai.google.dev/gemini-api/docs/audio
977 * @see https://ai.google.dev/gemini-api/docs/document-processing
978 */
979export type GeminiModelInputModalitiesByName = {
980 // Models with full multimodal support (text, image, audio, video, document)
981 [GEMINI_3_8_FLASH.name]: typeof GEMINI_3_8_FLASH.supports.input
982 [GEMINI_3_7_FLASH.name]: typeof GEMINI_3_7_FLASH.supports.input
983 [GEMINI_3_6_FLASH.name]: typeof GEMINI_3_6_FLASH.supports.input
984 [GEMINI_3_5_FLASH.name]: typeof GEMINI_3_5_FLASH.supports.input
985 [GEMINI_3_5_FLASH_LITE.name]: typeof GEMINI_3_5_FLASH_LITE.supports.input
986 [GEMINI_3_1_PRO.name]: typeof GEMINI_3_1_PRO.supports.input
987 [GEMINI_3_FLASH.name]: typeof GEMINI_3_FLASH.supports.input
988 [GEMINI_3_1_FLASH_LITE.name]: typeof GEMINI_3_1_FLASH_LITE.supports.input
989 [GEMINI_3_1_FLASH_LITE_PREVIEW.name]: typeof GEMINI_3_1_FLASH_LITE_PREVIEW.supports.input
990 [GEMINI_2_5_PRO.name]: typeof GEMINI_2_5_PRO.supports.input
991 [GEMINI_2_5_FLASH_LITE.name]: typeof GEMINI_2_5_FLASH_LITE.supports.input
992
993 // Models with text, image, audio, video (no document)
994 [GEMINI_2_5_FLASH.name]: typeof GEMINI_2_5_FLASH.supports.input
995 [GEMINI_4_ARGON.name]: typeof GEMINI_4_ARGON.supports.input
996}
997
998/**
999 * Runtime map from chat model name to its supported input modalities, for the
1000 * text adapter's `inputModalities`. `satisfies` keeps it equal to
1001 * {@link GeminiModelInputModalitiesByName}. An unknown name gives `undefined`.
1002 */
1003export const GEMINI_MODEL_INPUT_MODALITIES: Readonly<
1004 Record<string, ReadonlyArray<Modality>>
1005> = {
1006 [GEMINI_3_8_FLASH.name]: GEMINI_3_8_FLASH.supports.input,
1007 [GEMINI_3_7_FLASH.name]: GEMINI_3_7_FLASH.supports.input,
1008 [GEMINI_3_6_FLASH.name]: GEMINI_3_6_FLASH.supports.input,
1009 [GEMINI_3_5_FLASH.name]: GEMINI_3_5_FLASH.supports.input,
1010 [GEMINI_3_5_FLASH_LITE.name]: GEMINI_3_5_FLASH_LITE.supports.input,
1011 [GEMINI_3_1_PRO.name]: GEMINI_3_1_PRO.supports.input,
1012 [GEMINI_3_FLASH.name]: GEMINI_3_FLASH.supports.input,
1013 [GEMINI_3_1_FLASH_LITE.name]: GEMINI_3_1_FLASH_LITE.supports.input,
1014 [GEMINI_3_1_FLASH_LITE_PREVIEW.name]:
1015 GEMINI_3_1_FLASH_LITE_PREVIEW.supports.input,
1016 [GEMINI_2_5_PRO.name]: GEMINI_2_5_PRO.supports.input,
1017 [GEMINI_2_5_FLASH_LITE.name]: GEMINI_2_5_FLASH_LITE.supports.input,
1018 [GEMINI_2_5_FLASH.name]: GEMINI_2_5_FLASH.supports.input,
1019 [GEMINI_4_ARGON.name]: GEMINI_4_ARGON.supports.input,
1020} satisfies GeminiModelInputModalitiesByName
1021
1022// Reasoning
1023//
1024// Each model's `reasoning` field holds its data for `chat({ reasoning })`: the
1025// levels it has, with the provider value for each, and whether it takes a
1026// thinking token budget. The data comes from models.dev. The generator that
1027// writes it comes with the model catalog later. Until then, the sync scripts
1028// keep these fields as they are.
1029
1030const GEMINI_REASONING = {
1031 [GEMINI_3_8_FLASH.name]: GEMINI_3_8_FLASH.reasoning,
1032 [GEMINI_3_7_FLASH.name]: GEMINI_3_7_FLASH.reasoning,
1033 [GEMINI_3_6_FLASH.name]: GEMINI_3_6_FLASH.reasoning,
1034 [GEMINI_3_5_FLASH.name]: GEMINI_3_5_FLASH.reasoning,
1035 [GEMINI_3_5_FLASH_LITE.name]: GEMINI_3_5_FLASH_LITE.reasoning,
1036 [GEMINI_3_1_PRO.name]: GEMINI_3_1_PRO.reasoning,
1037 [GEMINI_3_FLASH.name]: GEMINI_3_FLASH.reasoning,
1038 [GEMINI_3_1_FLASH_LITE.name]: GEMINI_3_1_FLASH_LITE.reasoning,
1039 [GEMINI_3_1_FLASH_LITE_PREVIEW.name]: GEMINI_3_1_FLASH_LITE_PREVIEW.reasoning,
1040 [GEMINI_2_5_PRO.name]: GEMINI_2_5_PRO.reasoning,
1041 [GEMINI_2_5_FLASH_LITE.name]: GEMINI_2_5_FLASH_LITE.reasoning,
1042 [GEMINI_2_5_FLASH.name]: GEMINI_2_5_FLASH.reasoning,
1043}
1044
1045/**
1046 * Each chat model's reasoning levels, and whether it takes a token budget,
1047 * for `chat({ reasoning })`. Derived from the `reasoning` field. A model
1048 * that is not here does not reason.
1049 */
1050export type GeminiModelReasoningByName = {
1051 [K in keyof typeof GEMINI_REASONING]: ModelReasoningCapability<
1052 (typeof GEMINI_REASONING)[K]
1053 >
1054}
1055
1056/**
1057 * Runtime map from chat model name to its reasoning data, for the text adapter.
1058 * An unknown name gives `undefined`: the adapter sends no reasoning field.
1059 */
1060export const GEMINI_MODEL_REASONING: Readonly<Record<string, ModelReasoning>> =
1061 GEMINI_REASONING