Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat(create): enforce t2v/i2v catalog flags in the Video/Animate pickers

purple6eab6151006f
diff --git a/src/components/create/experimental/ModelChip.tsx b/src/components/create/experimental/ModelChip.tsx
index 55f7f00a..644ec72f 100644
--- a/src/components/create/experimental/ModelChip.tsx
+++ b/src/components/create/experimental/ModelChip.tsx
@@ -1,5 +1,5 @@
import { useCreateStore } from '../../../stores/createStore'
-import { useCloudCatalogStore, defaultCloudModel, defaultEditModel, isEditCapable } from '../../../stores/cloudCatalogStore'
+import { useCloudCatalogStore, defaultCloudModel } from '../../../stores/cloudCatalogStore'
import { Select, type SelectOption } from '../ui/Select'
import { TYPE_BADGE } from './badges'
@@ -24,16 +24,20 @@ function CloudModelChip() {
const isVideo = mode === 'video'
const kind = isVideo ? 'video' : 'image'
- // Edit needs a masked-img2img model (flux-dev today). Only offer the models
- // that can actually do it — otherwise the picker lists t2i-only checkpoints
- // that useCloudCreate silently swaps out at submit, so the user's choice was
- // a lie. (Video: every catalog clip model is t2v+i2v, so no per-op filter.)
- const editOnly = intent === 'edit'
- const list = models.filter((m) => m.kind === kind && (!editOnly || m.edit))
+ // List only the models that can run the current op — otherwise the picker
+ // offers checkpoints that useCloudCreate silently swaps out at submit, so the
+ // user's choice was a lie. Edit needs masked-img2img (flux-dev); Animate needs
+ // i2v; Video needs t2v (absent flag = capable, so today's dual-capable fleet
+ // lists in full, and a future t2v-only model that sets i2v:false is excluded).
+ const list =
+ intent === 'edit' ? models.filter((m) => m.kind === 'image' && m.edit)
+ : intent === 'animate' ? models.filter((m) => m.kind === 'video' && m.i2v !== false)
+ : intent === 'video' ? models.filter((m) => m.kind === 'video' && m.t2v !== false)
+ : models.filter((m) => m.kind === kind)
const current = (isVideo ? cloudVideoModel : cloudImageModel) || defaultCloudModel(kind)?.id || ''
- // Reflect the model the run will really use, so a t2i model left over from
- // the Image tab doesn't show as "selected" on an edit it can't perform.
- const value = editOnly && !isEditCapable(current) ? (defaultEditModel()?.id ?? current) : current
+ // Reflect the model the run will really use, so a leftover pick the current op
+ // can't perform doesn't show as "selected".
+ const value = list.some((m) => m.id === current) ? current : (list[0]?.id ?? current)
const options: SelectOption[] = list.map((m) => ({
value: m.id,
diff --git a/src/hooks/useCloudCreate.ts b/src/hooks/useCloudCreate.ts
index 17b81785..9e0ceb93 100644
--- a/src/hooks/useCloudCreate.ts
+++ b/src/hooks/useCloudCreate.ts
@@ -24,8 +24,7 @@ import {
} from '../api/cloud/jobs'
import {
defaultCloudModel,
- defaultEditModel,
- isEditCapable,
+ modelForOp,
cloudMediaLive,
} from '../stores/cloudCatalogStore'
import { checkPromptSafety, SAFETY_BLOCK_MESSAGE } from '../lib/render/safety'
@@ -71,10 +70,9 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
const { kind, op } = intentToJob(intent)
const picked =
(kind === 'video' ? s.cloudVideoModel : s.cloudImageModel) || defaultCloudModel(kind).id
- // Edit needs an i2i-capable model; the picker may still hold a t2i-only
- // one the user chose for a generate — fall back so the submit never 400s.
- const model =
- op === 'edit' && !isEditCapable(picked) ? (defaultEditModel()?.id ?? picked) : picked
+ // Coerce a leftover/incapable pick onto a model that can run this op
+ // (edit→i2i, animate→i2v, video→t2v) so the submit never 400s.
+ const model = modelForOp(kind, op, picked)
s.setError(null)
if (!cloudMediaLive()) {
diff --git a/src/lib/render/cloud-models.ts b/src/lib/render/cloud-models.ts
index f17a19c9..552b26d8 100644
--- a/src/lib/render/cloud-models.ts
+++ b/src/lib/render/cloud-models.ts
@@ -12,6 +12,12 @@ export interface CloudModel {
kind: RenderKind
/** Supports the masked img2img 'edit' op (flux-dev only today). */
edit?: boolean
+ /** Video: renders text-to-video (the "Video" intent). Absent = yes; set false
+ * on an i2v-only model to keep it out of the Video picker. */
+ t2v?: boolean
+ /** Video: renders image-to-video (the "Animate Image" intent). Absent = yes;
+ * set false on a t2v-only model to keep it out of the Animate picker. */
+ i2v?: boolean
/** Whether the hosted endpoint honours guidance_scale (CFG). */
cfg?: boolean
/** Whether the hosted endpoint honours negative_prompt. */
@@ -35,9 +41,13 @@ export const CLOUD_MODEL_SEED: CloudModel[] = [
{ id: 'chroma', label: 'Chroma', kind: 'image' },
{ id: 'prefect-pony', label: 'Prefect Pony XL', kind: 'image' },
{ id: 'neta-lumina', label: 'Neta Lumina (anime)', kind: 'image' },
- { id: 'wan-2.2-720p', label: 'Wan 2.2 720p', kind: 'video', negative_prompt: true, clip: CLIP },
- { id: 'wan-2.2-fast', label: 'Wan 2.2 Fast', kind: 'video', negative_prompt: true, clip: CLIP },
- { id: 'ltx-2', label: 'LTX-2 (with audio)', kind: 'video', clip: CLIP },
- { id: 'hunyuan-video', label: 'HunyuanVideo 1.5', kind: 'video', negative_prompt: true, clip: CLIP },
- { id: 'ltx-2.3', label: 'LTX 2.3', kind: 'video', clip: CLIP },
+ // Every hosted clip model does both t2v + i2v, so both flags are true. They're
+ // the enforced contract (Video/Animate pickers + submit filter on them), not a
+ // note — a future t2v-only or i2v-only model MUST set the flag it lacks to
+ // false. Server truth is /api/jobs/catalog; keep in sync with uselu.
+ { id: 'wan-2.2-720p', label: 'Wan 2.2 720p', kind: 'video', t2v: true, i2v: true, negative_prompt: true, clip: CLIP },
+ { id: 'wan-2.2-fast', label: 'Wan 2.2 Fast', kind: 'video', t2v: true, i2v: true, negative_prompt: true, clip: CLIP },
+ { id: 'ltx-2', label: 'LTX-2 (with audio)', kind: 'video', t2v: true, i2v: true, clip: CLIP },
+ { id: 'hunyuan-video', label: 'HunyuanVideo 1.5', kind: 'video', t2v: true, i2v: true, negative_prompt: true, clip: CLIP },
+ { id: 'ltx-2.3', label: 'LTX 2.3', kind: 'video', t2v: true, i2v: true, clip: CLIP },
]
diff --git a/src/stores/__tests__/cloudCatalogStore.test.ts b/src/stores/__tests__/cloudCatalogStore.test.ts
index 56b657d2..23626289 100644
--- a/src/stores/__tests__/cloudCatalogStore.test.ts
+++ b/src/stores/__tests__/cloudCatalogStore.test.ts
@@ -7,6 +7,9 @@ import {
isEditCapable,
cloudMediaLive,
runCredits,
+ t2vModels,
+ i2vModels,
+ modelForOp,
} from '../cloudCatalogStore'
import { CLOUD_MODEL_SEED } from '../../lib/render/cloud-models'
import type { CloudCatalog } from '../../api/cloud/catalog'
@@ -129,4 +132,41 @@ describe('cloudCatalogStore', () => {
expect(runCredits('image', 'generate', 'not-in-catalog', undefined, 321)).toBe(321)
})
})
+
+ describe('video capability flags (t2v / i2v)', () => {
+ const mixed: CloudCatalog = {
+ ...serverCatalog,
+ models: [
+ { id: 'flux-9', label: 'Flux 9', kind: 'image', edit: true },
+ { id: 'dual', label: 'Dual', kind: 'video', t2v: true, i2v: true },
+ { id: 't2v-only', label: 'T2V only', kind: 'video', t2v: true, i2v: false },
+ { id: 'legacy', label: 'Legacy (no flags)', kind: 'video' },
+ ],
+ }
+
+ it('every seed clip model does both t2v and i2v', () => {
+ const vids = CLOUD_MODEL_SEED.filter((m) => m.kind === 'video')
+ expect(vids.length).toBeGreaterThan(0)
+ expect(vids.every((m) => m.t2v !== false && m.i2v !== false)).toBe(true)
+ })
+
+ it('i2vModels excludes an i2v:false model; an absent flag stays capable', () => {
+ useCloudCatalogStore.getState().setCatalog(mixed)
+ expect(i2vModels().map((m) => m.id)).toEqual(['dual', 'legacy'])
+ expect(t2vModels().map((m) => m.id)).toEqual(['dual', 't2v-only', 'legacy'])
+ })
+
+ it('modelForOp coerces an incapable pick onto the op’s first valid model', () => {
+ useCloudCatalogStore.getState().setCatalog(mixed)
+ // animate with a t2v-only pick → first i2v-capable clip model
+ expect(modelForOp('video', 'animate', 't2v-only')).toBe('dual')
+ // a capable pick is kept untouched
+ expect(modelForOp('video', 'animate', 'legacy')).toBe('legacy')
+ expect(modelForOp('video', 'generate', 't2v-only')).toBe('t2v-only')
+ // edit still coerces onto the edit-capable image model
+ expect(modelForOp('image', 'edit', 'dual')).toBe('flux-9')
+ // a non-video, non-edit op keeps the pick
+ expect(modelForOp('image', 'generate', 'flux-9')).toBe('flux-9')
+ })
+ })
})
diff --git a/src/stores/cloudCatalogStore.ts b/src/stores/cloudCatalogStore.ts
index 089821ec..7a8d15cd 100644
--- a/src/stores/cloudCatalogStore.ts
+++ b/src/stores/cloudCatalogStore.ts
@@ -75,6 +75,30 @@ export function defaultEditModel(): CloudModel | undefined {
return useCloudCatalogStore.getState().models.find((m) => m.kind === 'image' && m.edit)
}
+// Video models that render text-to-video (the "Video" intent) / image-to-video
+// (the "Animate Image" intent). Absent flag = capable, so a persisted catalog
+// cached before this field existed still lists every clip model; only an
+// explicit false hides a capability-restricted model from that picker.
+export function t2vModels(): CloudModel[] {
+ return useCloudCatalogStore.getState().models.filter((m) => m.kind === 'video' && m.t2v !== false)
+}
+
+export function i2vModels(): CloudModel[] {
+ return useCloudCatalogStore.getState().models.filter((m) => m.kind === 'video' && m.i2v !== false)
+}
+
+/** The model a run will really use for this op — coerces a leftover/incapable
+ * pick onto a capable one (edit→i2i, animate→i2v, video→t2v) so submit + the
+ * credits gate agree. Mirrors each picker's per-op filter. */
+export function modelForOp(kind: RenderKind, op: RenderOp, pickedId: string): string {
+ if (op === 'edit') return isEditCapable(pickedId) ? pickedId : (defaultEditModel()?.id ?? pickedId)
+ if (kind === 'video' && (op === 'generate' || op === 'animate')) {
+ const list = op === 'animate' ? i2vModels() : t2vModels()
+ return list.some((m) => m.id === pickedId) ? pickedId : (list[0]?.id ?? pickedId)
+ }
+ return pickedId
+}
+
/** Credits the upcoming run draws, priced from the server catalog: per-op
* utility rates, per-model base/long clip rates (the long rate books from
* ~6.5 s, mirroring the server's mediaCredits split). Edit coerces onto the
@@ -102,8 +126,7 @@ export function runCredits(
const rate = ops ? { removebg: ops.removebg, eraser: ops.eraser, upscale }[op] : undefined
return rate ?? fallback
}
- const model =
- op === 'edit' && !isEditCapable(pickedModel) ? (defaultEditModel()?.id ?? pickedModel) : pickedModel
+ const model = modelForOp(kind, op, pickedModel)
const credits = cloudModelById(model)?.credits
if (!credits) return fallback
return kind === 'video' && seconds !== undefined && seconds >= 6.5