Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

models.ts

345 lines11.1 KB

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: 'dola-seedream-5-0-pro-260628',
90 name: 'Seedream 5.0 Pro',
91 description:
92 'BytePlus Seedream image generation, sized with a 1K/2K/4K token',
93 defaultSize: '2K' as const,
94 sizeType: 'standard' as const,
95 provider: 'byteplus' as const,
96 },
97] as const
98​
99export const VIDEO_MODELS = [
100 {
101 id: 'fal-ai/kling-video/v3/pro/text-to-video',
102 name: 'Kling 3 Pro (Text-to-Video)',
103 description: 'High-quality text-to-video generation',
104 mode: 'text-to-video' as const,
105 provider: 'fal' as const,
106 },
107 {
108 id: 'fal-ai/kling-video/v3/pro/image-to-video',
109 name: 'Kling 3 Pro (Image-to-Video)',
110 description: 'Animate images with Kling',
111 mode: 'image-to-video' as const,
112 provider: 'fal' as const,
113 },
114 {
115 id: 'fal-ai/veo3.1',
116 name: 'Veo 3.1 (Text-to-Video)',
117 description: 'Google Veo text-to-video',
118 mode: 'text-to-video' as const,
119 provider: 'fal' as const,
120 },
121 {
122 id: 'fal-ai/veo3.1/image-to-video',
123 name: 'Veo 3.1 (Image-to-Video)',
124 description: 'Google Veo image-to-video',
125 mode: 'image-to-video' as const,
126 provider: 'fal' as const,
127 },
128 {
129 id: 'xai/grok-imagine-video/text-to-video',
130 name: 'Grok Imagine Video (Text-to-Video)',
131 description: 'xAI video generation from text',
132 mode: 'text-to-video' as const,
133 provider: 'fal' as const,
134 },
135 {
136 id: 'xai/grok-imagine-video/image-to-video',
137 name: 'Grok Imagine Video (Image-to-Video)',
138 description: 'xAI animate images to video',
139 mode: 'image-to-video' as const,
140 provider: 'fal' as const,
141 },
142 {
143 id: 'grok-imagine-video',
144 name: 'Grok Imagine Video 1.0 (Text-to-Video)',
145 description:
146 'xAI Imagine API via the native grokVideo adapter (v1.0 supports text-to-video)',
147 mode: 'text-to-video' as const,
148 provider: 'xai' as const,
149 },
150 {
151 id: 'grok-imagine-video-1.5',
152 name: 'Grok Imagine Video 1.5 (Text-to-Video)',
153 description:
154 'xAI recommended video model via the native grokVideo adapter (native 1080p text-to-video)',
155 mode: 'text-to-video' as const,
156 provider: 'xai' as const,
157 },
158 {
159 id: 'grok-imagine-video-1.5/image-to-video',
160 name: 'Grok Imagine Video 1.5 (Image-to-Video)',
161 description: 'Animate a starting frame via the native grokVideo adapter',
162 mode: 'image-to-video' as const,
163 provider: 'xai' as const,
164 },
165 {
166 id: 'fal-ai/ltx-2.3/text-to-video/fast',
167 name: 'LTX-2.3 Fast (Text-to-Video)',
168 description: 'Fast text-to-video generation',
169 mode: 'text-to-video' as const,
170 provider: 'fal' as const,
171 },
172 {
173 id: 'fal-ai/ltx-2.3/image-to-video/fast',
174 name: 'LTX-2.3 Fast (Image-to-Video)',
175 description: 'Fast image-to-video animation',
176 mode: 'image-to-video' as const,
177 provider: 'fal' as const,
178 },
179 {
180 id: 'gemini-omni-1.1-flash',
181 name: 'Gemini Omni 1.1 Flash (Text-to-Video)',
182 description:
183 'Google multimodal video generation with conversational editing, via the Interactions API (3-10s, 360p/720p/1080p/4k)',
184 mode: 'text-to-video' as const,
185 provider: 'gemini' as const,
186 },
187 {
188 id: 'gemini-omni-1.1-flash/image-to-video',
189 name: 'Gemini Omni 1.1 Flash (Image-to-Video)',
190 description:
191 'Animate an image with Gemini Omni 1.1 Flash via the Interactions API',
192 mode: 'image-to-video' as const,
193 provider: 'gemini' as const,
194 },
195 {
196 id: 'dreamina-seedance-2-0-260128',
197 name: 'Seedance 2.0 (Text-to-Video)',
198 description:
199 'BytePlus Seedance text-to-video (4-15s, 480p/720p/1080p/4k) via ModelArk',
200 mode: 'text-to-video' as const,
201 provider: 'byteplus' as const,
202 },
203 {
204 id: 'bytedance/seedance-2.0',
205 name: 'Seedance 2.0 (Text-to-Video, OpenRouter)',
206 description:
207 "OpenRouter's async video API; duration typed 4–15s with snapDuration()",
208 mode: 'text-to-video' as const,
209 provider: 'openrouter' as const,
210 },
211 {
212 id: 'google/veo-3.1',
213 name: 'Veo 3.1 (Image-to-Video, OpenRouter)',
214 description:
215 'OpenRouter async video; duration snaps to the nearest of 4/6/8s',
216 mode: 'image-to-video' as const,
217 provider: 'openrouter' as const,
218 },
219] as const
220​
221export type ImageModel = (typeof IMAGE_MODELS)[number]
222export type VideoModel = (typeof VIDEO_MODELS)[number]
223export type VideoMode = 'text-to-video' | 'image-to-video'
224​
225export type LiveVideoProvider = 'reactor' | 'fal'
226​
227export type LiveVideoModelId = ReactorVideoModel | FalLiveVideoModel
228​
229export const LIVE_VIDEO_MODELS: ReadonlyArray<{
230 id: LiveVideoModelId
231 provider: LiveVideoProvider
232}> = [
233 ...REACTOR_VIDEO_MODELS.filter((id) => id !== 'ltx2').map((id) => ({
234 id,
235 provider: 'reactor' as const,
236 })),
237 { id: 'minimax/h3-max/director', provider: 'fal' },
239​
240export const LIVE_VIDEO_MODEL_LABELS: Record<LiveVideoModelId, string> = {
241 helios: 'Helios (Reactor)',
242 'fast-h3': 'FastH3 (Reactor)',
243 'longlive-v2': 'LongLive 2 (Reactor)',
244 ltx2: 'LTX (Reactor)',
245 'minimax/h3-max/director': 'H3 Max Director (fal)',
247​
248export const LIVE_VIDEO_PROMPTS = [
249 'Live shopping stream: a host holds up a gold watch to camera, studio lights, product close-up, talking to viewers.',
250 'Fake news channel: an anchor at a glass desk, lower-thirds ticker, breaking-news sting, locked-off studio shot.',
251 'A red sports car powerslides a mountain hairpin, gravel spraying, golden hour, helicopter tracking alongside.',
252 'A chef tosses noodles in a steel wok, flames leaping, close-up, steam toward the lens.',
253 'A violinist plays on a rain-soaked rooftop at night, city lights behind, slow push-in.',
254] as const
255​
256export const REACTOR_LIVE_RESOLUTIONS = ['1080p', '2k', '4k'] as const
257export const FAL_LIVE_RESOLUTIONS = ['480p', '768p'] as const
258​
259export type ReactorLiveResolution = (typeof REACTOR_LIVE_RESOLUTIONS)[number]
260export type FalLiveResolution = (typeof FAL_LIVE_RESOLUTIONS)[number]
261export type LiveVideoResolution = ReactorLiveResolution | FalLiveResolution
262​
263export function liveVideoProvider(model: LiveVideoModelId): LiveVideoProvider {
264 return isFalLiveVideoModel(model) ? 'fal' : 'reactor'
266​
267export function liveVideoResolutions(
268 provider: LiveVideoProvider,
269): ReadonlyArray<LiveVideoResolution> {
270 return provider === 'fal' ? FAL_LIVE_RESOLUTIONS : REACTOR_LIVE_RESOLUTIONS
272​
273export function isLiveVideoModelId(value: string): value is LiveVideoModelId {
274 return isReactorVideoModel(value) || isFalLiveVideoModel(value)
276​
277export {
278 FAL_LIVE_VIDEO_APP,
279 isReactorVideoModel,
280 isFalLiveVideoModel,
281 isReactorWorldModel,
282 isWorldLabsWorldModel,
284export type {
285 ReactorVideoModel,
286 FalLiveVideoModel,
287 ReactorWorldModel,
288 WorldLabsWorldModel,
290​
291export type WorldProvider = 'reactor' | 'worldlabs'
292export type WorldModelId = ReactorWorldModel | WorldLabsWorldModel
293​
294export const WORLD_MODELS = [
295 'visko-orbis-stable',
296 'visko-orbis-dynamic',
297 'lingbot-world-2',
298 'lingbot',
299 'helios',
300 ...WORLDLABS_WORLD_MODELS,
301] as const satisfies ReadonlyArray<WorldModelId>
302​
303export const WORLD_MODEL_LABELS: Record<WorldModelId, string> = {
304 'visko-orbis-stable': 'Orbis Stable',
305 'visko-orbis-dynamic': 'Orbis Dynamic',
306 'happy-oyster-adventure': 'Happy Oyster (adventure)',
307 'happy-oyster-director': 'Happy Oyster (director)',
308 'lingbot-world-2': 'LingBot World 2',
309 lingbot: 'LingBot',
310 helios: 'Helios',
311 'marble-1.1-plus': 'Marble 1.1 Plus (World Labs)',
312 'marble-1.1': 'Marble 1.1 (World Labs)',
313 'marble-1.0': 'Marble 1.0 (World Labs)',
314 'marble-1.0-draft': 'Marble 1.0 Draft (World Labs)',
316​
317export function worldProvider(model: WorldModelId): WorldProvider {
318 return isWorldLabsWorldModel(model) ? 'worldlabs' : 'reactor'
320​
321export function isWorldModelId(value: string): value is WorldModelId {
322 return isReactorWorldModel(value) || isWorldLabsWorldModel(value)
324​
325export const WORLD_PROMPTS = [
326 'A black volcanic coastline at golden hour, tide pools, a cliff path you can keep walking.',
327 'A neon rain-soaked city of alleys, markets, and towers you can wander at street level.',
328 'A cedar forest at dawn, mist in the trees, a trail beside a stream.',
329 'A desert canyon at noon, a dry riverbed between red rock walls, open sky above.',
330 'A snowbound mountain village at dusk, lanterns in the windows, one main street.',
331] as const
332​
333export const WORLD_RESOLUTIONS = REACTOR_LIVE_RESOLUTIONS
334​
335export type WorldResolution = (typeof WORLD_RESOLUTIONS)[number]
336​
337/**
338 * Gemini Omni Flash task modes (`generation_config.video_config.task`).
339 * Omit to let the model infer the mode from the prompt and attachments.
340 */
341export type OmniTaskMode =
342 | 'text_to_video'
343 | 'image_to_video'
344 | 'reference_to_video'
345 | 'edit'