Open History to see the last commit
1import {
2 REACTOR_VIDEO_MODELS,
3 isReactorVideoModel,
4 isReactorWorldModel,
5} from '@tanstack/ai-reactor'
6import { FAL_LIVE_VIDEO_APP, isFalLiveVideoModel } from '@tanstack/ai-fal'
7import {
8 WORLDLABS_WORLD_MODELS,
9 isWorldLabsWorldModel,
10} from '@tanstack/ai-worldlabs'
11import type { ReactorVideoModel, ReactorWorldModel } from '@tanstack/ai-reactor'
12import type { FalLiveVideoModel } from '@tanstack/ai-fal'
13import type { WorldLabsWorldModel } from '@tanstack/ai-worldlabs'
14
15export const IMAGE_MODELS = [
16 {
17 id: 'fal-ai/nano-banana-pro',
18 name: 'Nano Banana Pro (4k)',
19 description: 'Fast, high-quality image generation',
20 defaultSize: 'landscape_16_9' as const,
21 sizeType: 'standard' as const,
22 provider: 'fal' as const,
23 },
24 {
25 id: 'xai/grok-imagine-image',
26 name: 'Grok Imagine',
27 description: 'xAI highly aesthetic images with prompt enhancement',
28 defaultSize: '16:9' as const,
29 sizeType: 'aspect_ratio' as const,
30 provider: 'fal' as const,
31 },
32 {
33 id: 'grok-imagine-image',
34 name: 'Grok Imagine (xAI Direct)',
35 description: 'xAI Imagine API via the native grokImage adapter',
36 defaultSize: '16:9' as const,
37 sizeType: 'aspect_ratio' as const,
38 provider: 'xai' as const,
39 },
40 {
41 id: 'grok-imagine-image-2.0',
42 name: 'Grok Imagine 2.0 (xAI Direct)',
43 description: 'xAI recommended Imagine model with the quality option',
44 defaultSize: '16:9' as const,
45 sizeType: 'aspect_ratio' as const,
46 provider: 'xai' as const,
47 },
48 {
49 id: 'grok-imagine-image-quality',
50 name: 'Grok Imagine Quality (xAI Direct)',
51 description: 'Higher-quality xAI Imagine images via the native adapter',
52 defaultSize: '16:9' as const,
53 sizeType: 'aspect_ratio' as const,
54 provider: 'xai' as const,
55 },
56 {
57 id: 'fal-ai/flux-2/klein/9b',
58 name: 'FLUX.2 Klein 9B',
59 description: 'Enhanced realism, crisp text generation',
60 defaultSize: 'landscape_16_9' as const,
61 sizeType: 'standard' as const,
62 provider: 'fal' as const,
63 },
64 {
65 id: 'fal-ai/z-image/turbo',
66 name: 'Z-Image Turbo',
67 description: 'Super fast 6B parameter model',
68 defaultSize: 'landscape_16_9' as const,
69 sizeType: 'standard' as const,
70 provider: 'fal' as const,
71 },
72 {
73 id: 'gemini-nano-banana-2.1',
74 name: 'NanoBanana 2.1',
75 description: 'Latest Gemini native image generation',
76 defaultSize: '16:9_4K' as const,
77 sizeType: 'native' as const,
78 provider: 'gemini' as const,
79 },
80 {
81 id: 'gemini-3-pro-image',
82 name: 'NanoBanana Pro (Gemini 3 Pro)',
83 description: 'Higher quality Gemini native image generation',
84 defaultSize: '16:9_4K' as const,
85 sizeType: 'native' as const,
86 provider: 'gemini' as const,
87 },
88 {
89 id: 'imagen-4.0-ultra-generate-001',
90 name: 'Imagen 4.0 Ultra',
91 description: 'Best quality Imagen image generation',
92 defaultSize: '1024x1024' as const,
93 sizeType: 'standard' as const,
94 provider: 'gemini' as const,
95 },
96 {
97 id: 'imagen-4.0-generate-001',
98 name: 'Imagen 4.0',
99 description: 'High quality Imagen image generation',
100 defaultSize: '1024x1024' as const,
101 sizeType: 'standard' as const,
102 provider: 'gemini' as const,
103 },
104 {
105 id: 'imagen-4.0-fast-generate-001',
106 name: 'Imagen 4.0 Fast',
107 description: 'Fast Imagen image generation',
108 defaultSize: '1024x1024' as const,
109 sizeType: 'standard' as const,
110 provider: 'gemini' as const,
111 },
112 {
113 id: 'dola-seedream-5-0-pro-260628',
114 name: 'Seedream 5.0 Pro',
115 description:
116 'BytePlus Seedream image generation, sized with a 1K/2K/4K token',
117 defaultSize: '2K' as const,
118 sizeType: 'standard' as const,
119 provider: 'byteplus' as const,
120 },
121] as const
122
123export const VIDEO_MODELS = [
124 {
125 id: 'fal-ai/kling-video/v3/pro/text-to-video',
126 name: 'Kling 3 Pro (Text-to-Video)',
127 description: 'High-quality text-to-video generation',
128 mode: 'text-to-video' as const,
129 provider: 'fal' as const,
130 },
131 {
132 id: 'fal-ai/kling-video/v3/pro/image-to-video',
133 name: 'Kling 3 Pro (Image-to-Video)',
134 description: 'Animate images with Kling',
135 mode: 'image-to-video' as const,
136 provider: 'fal' as const,
137 },
138 {
139 id: 'fal-ai/veo3.1',
140 name: 'Veo 3.1 (Text-to-Video)',
141 description: 'Google Veo text-to-video',
142 mode: 'text-to-video' as const,
143 provider: 'fal' as const,
144 },
145 {
146 id: 'fal-ai/veo3.1/image-to-video',
147 name: 'Veo 3.1 (Image-to-Video)',
148 description: 'Google Veo image-to-video',
149 mode: 'image-to-video' as const,
150 provider: 'fal' as const,
151 },
152 {
153 id: 'xai/grok-imagine-video/text-to-video',
154 name: 'Grok Imagine Video (Text-to-Video)',
155 description: 'xAI video generation from text',
156 mode: 'text-to-video' as const,
157 provider: 'fal' as const,
158 },
159 {
160 id: 'xai/grok-imagine-video/image-to-video',
161 name: 'Grok Imagine Video (Image-to-Video)',
162 description: 'xAI animate images to video',
163 mode: 'image-to-video' as const,
164 provider: 'fal' as const,
165 },
166 {
167 id: 'grok-imagine-video',
168 name: 'Grok Imagine Video 1.0 (Text-to-Video)',
169 description:
170 'xAI Imagine API via the native grokVideo adapter (v1.0 supports text-to-video)',
171 mode: 'text-to-video' as const,
172 provider: 'xai' as const,
173 },
174 {
175 id: 'grok-imagine-video-1.5',
176 name: 'Grok Imagine Video 1.5 (Text-to-Video)',
177 description:
178 'xAI recommended video model via the native grokVideo adapter (native 1080p text-to-video)',
179 mode: 'text-to-video' as const,
180 provider: 'xai' as const,
181 },
182 {
183 id: 'grok-imagine-video-1.5/image-to-video',
184 name: 'Grok Imagine Video 1.5 (Image-to-Video)',
185 description: 'Animate a starting frame via the native grokVideo adapter',
186 mode: 'image-to-video' as const,
187 provider: 'xai' as const,
188 },
189 {
190 id: 'fal-ai/ltx-2.3/text-to-video/fast',
191 name: 'LTX-2.3 Fast (Text-to-Video)',
192 description: 'Fast text-to-video generation',
193 mode: 'text-to-video' as const,
194 provider: 'fal' as const,
195 },
196 {
197 id: 'fal-ai/ltx-2.3/image-to-video/fast',
198 name: 'LTX-2.3 Fast (Image-to-Video)',
199 description: 'Fast image-to-video animation',
200 mode: 'image-to-video' as const,
201 provider: 'fal' as const,
202 },
203 {
204 id: 'gemini-omni-1.1-flash',
205 name: 'Gemini Omni 1.1 Flash (Text-to-Video)',
206 description:
207 'Google multimodal video generation with conversational editing, via the Interactions API (3-10s, 360p/720p/1080p/4k)',
208 mode: 'text-to-video' as const,
209 provider: 'gemini' as const,
210 },
211 {
212 id: 'gemini-omni-1.1-flash/image-to-video',
213 name: 'Gemini Omni 1.1 Flash (Image-to-Video)',
214 description:
215 'Animate an image with Gemini Omni 1.1 Flash via the Interactions API',
216 mode: 'image-to-video' as const,
217 provider: 'gemini' as const,
218 },
219 {
220 id: 'dreamina-seedance-2-0-260128',
221 name: 'Seedance 2.0 (Text-to-Video)',
222 description:
223 'BytePlus Seedance text-to-video (4-15s, 480p/720p/1080p/4k) via ModelArk',
224 mode: 'text-to-video' as const,
225 provider: 'byteplus' as const,
226 },
227 {
228 id: 'bytedance/seedance-2.0',
229 name: 'Seedance 2.0 (Text-to-Video, OpenRouter)',
230 description:
231 "OpenRouter's async video API; duration typed 4–15s with snapDuration()",
232 mode: 'text-to-video' as const,
233 provider: 'openrouter' as const,
234 },
235 {
236 id: 'google/veo-3.1',
237 name: 'Veo 3.1 (Image-to-Video, OpenRouter)',
238 description:
239 'OpenRouter async video; duration snaps to the nearest of 4/6/8s',
240 mode: 'image-to-video' as const,
241 provider: 'openrouter' as const,
242 },
243] as const
244
245export type ImageModel = (typeof IMAGE_MODELS)[number]
246export type VideoModel = (typeof VIDEO_MODELS)[number]
247export type VideoMode = 'text-to-video' | 'image-to-video'
248
249export type LiveVideoProvider = 'reactor' | 'fal'
250
251export type LiveVideoModelId = ReactorVideoModel | FalLiveVideoModel
252
253export const LIVE_VIDEO_MODELS: ReadonlyArray<{
254 id: LiveVideoModelId
255 provider: LiveVideoProvider
256}> = [
257 ...REACTOR_VIDEO_MODELS.filter((id) => id !== 'ltx2').map((id) => ({
258 id,
259 provider: 'reactor' as const,
260 })),
261 { id: 'minimax/h3-max/director', provider: 'fal' },
262]
263
264export const LIVE_VIDEO_MODEL_LABELS: Record<LiveVideoModelId, string> = {
265 helios: 'Helios (Reactor)',
266 'fast-h3': 'FastH3 (Reactor)',
267 'longlive-v2': 'LongLive 2 (Reactor)',
268 ltx2: 'LTX (Reactor)',
269 'minimax/h3-max/director': 'H3 Max Director (fal)',
270}
271
272export const LIVE_VIDEO_PROMPTS = [
273 'Live shopping stream: a host holds up a gold watch to camera, studio lights, product close-up, talking to viewers.',
274 'Fake news channel: an anchor at a glass desk, lower-thirds ticker, breaking-news sting, locked-off studio shot.',
275 'A red sports car powerslides a mountain hairpin, gravel spraying, golden hour, helicopter tracking alongside.',
276 'A chef tosses noodles in a steel wok, flames leaping, close-up, steam toward the lens.',
277 'A violinist plays on a rain-soaked rooftop at night, city lights behind, slow push-in.',
278] as const
279
280export const REACTOR_LIVE_RESOLUTIONS = ['1080p', '2k', '4k'] as const
281export const FAL_LIVE_RESOLUTIONS = ['480p', '768p'] as const
282
283export type ReactorLiveResolution = (typeof REACTOR_LIVE_RESOLUTIONS)[number]
284export type FalLiveResolution = (typeof FAL_LIVE_RESOLUTIONS)[number]
285export type LiveVideoResolution = ReactorLiveResolution | FalLiveResolution
286
287export function liveVideoProvider(model: LiveVideoModelId): LiveVideoProvider {
288 return isFalLiveVideoModel(model) ? 'fal' : 'reactor'
289}
290
291export function liveVideoResolutions(
292 provider: LiveVideoProvider,
293): ReadonlyArray<LiveVideoResolution> {
294 return provider === 'fal' ? FAL_LIVE_RESOLUTIONS : REACTOR_LIVE_RESOLUTIONS
295}
296
297export function isLiveVideoModelId(value: string): value is LiveVideoModelId {
298 return isReactorVideoModel(value) || isFalLiveVideoModel(value)
299}
300
301export {
302 FAL_LIVE_VIDEO_APP,
303 isReactorVideoModel,
304 isFalLiveVideoModel,
305 isReactorWorldModel,
306 isWorldLabsWorldModel,
307}
308export type {
309 ReactorVideoModel,
310 FalLiveVideoModel,
311 ReactorWorldModel,
312 WorldLabsWorldModel,
313}
314
315export type WorldProvider = 'reactor' | 'worldlabs'
316export type WorldModelId = ReactorWorldModel | WorldLabsWorldModel
317
318export const WORLD_MODELS = [
319 'visko-orbis-stable',
320 'visko-orbis-dynamic',
321 'lingbot-world-2',
322 'lingbot',
323 'helios',
324 ...WORLDLABS_WORLD_MODELS,
325] as const satisfies ReadonlyArray<WorldModelId>
326
327export const WORLD_MODEL_LABELS: Record<WorldModelId, string> = {
328 'visko-orbis-stable': 'Orbis Stable',
329 'visko-orbis-dynamic': 'Orbis Dynamic',
330 'happy-oyster-adventure': 'Happy Oyster (adventure)',
331 'happy-oyster-director': 'Happy Oyster (director)',
332 'lingbot-world-2': 'LingBot World 2',
333 lingbot: 'LingBot',
334 helios: 'Helios',
335 'marble-1.1-plus': 'Marble 1.1 Plus (World Labs)',
336 'marble-1.1': 'Marble 1.1 (World Labs)',
337 'marble-1.0': 'Marble 1.0 (World Labs)',
338 'marble-1.0-draft': 'Marble 1.0 Draft (World Labs)',
339}
340
341export function worldProvider(model: WorldModelId): WorldProvider {
342 return isWorldLabsWorldModel(model) ? 'worldlabs' : 'reactor'
343}
344
345export function isWorldModelId(value: string): value is WorldModelId {
346 return isReactorWorldModel(value) || isWorldLabsWorldModel(value)
347}
348
349export const WORLD_PROMPTS = [
350 'A black volcanic coastline at golden hour, tide pools, a cliff path you can keep walking.',
351 'A neon rain-soaked city of alleys, markets, and towers you can wander at street level.',
352 'A cedar forest at dawn, mist in the trees, a trail beside a stream.',
353 'A desert canyon at noon, a dry riverbed between red rock walls, open sky above.',
354 'A snowbound mountain village at dusk, lanterns in the windows, one main street.',
355] as const
356
357export const WORLD_RESOLUTIONS = REACTOR_LIVE_RESOLUTIONS
358
359export type WorldResolution = (typeof WORLD_RESOLUTIONS)[number]
360
361/**
362 * Gemini Omni Flash task modes (`generation_config.video_config.task`).
363 * Omit to let the model infer the mode from the prompt and attachments.
364 */
365export type OmniTaskMode =
366 | 'text_to_video'
367 | 'image_to_video'
368 | 'reference_to_video'
369 | 'edit'