The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Originals O3: Soul ID trains on every base, licences shown as information
Claudedc7e4656ea54
diff --git a/docs/research/fuobe-originals-recipes-5.json b/docs/research/fuobe-originals-recipes-5.jsonindex 27e78740..4e5dd971 100644--- a/docs/research/fuobe-originals-recipes-5.json+++ b/docs/research/fuobe-originals-recipes-5.json@@ -1611,7 +1611,139 @@"num_inference_steps": "integer default=4 minimum=4 maximum=8","image_size": "anyOf[object {height:integer default=512 maximum=14142; width:integer default=512 maximum=14142}, string enum=[\"square_hd\", \"square\", \"portrait_4_3\", \"portrait_"},- "pathAccepts": "URL, HuggingFace repo ID (owner/repo), or local path to LoRA weights."+ "pathAccepts": "URL, HuggingFace repo ID (owner/repo), or local path to LoRA weights.",+ "inputs": {+ "prompt": {+ "type": "string",+ "required": true,+ "desc": "The prompt to generate an image from.",+ "examples": [+ "A bright, surreal scene on a vast white salt flat under a clear blue sky, featuring two fluffy white alpacas standing in the foreground. Behind them sits a sleek white supercar with its scissor doors open, creating a dramatic futuristic silhouette. The sunlight is strong and crisp, casting sharp shadows on the ground and giving the image a clean, high-contrast cinematic look. Minimalist composition, playful luxury vibe, ultra sharp detail, wide-angle perspective, high resolution."+ ]+ },+ "seed": {+ "nullable": true,+ "type": "integer",+ "required": false,+ "desc": "The seed to use for the generation. If not provided, a random seed will be used."+ },+ "num_inference_steps": {+ "type": "integer",+ "required": false,+ "default": 4,+ "minimum": 4,+ "maximum": 8,+ "desc": "The number of inference steps to perform."+ },+ "image_size": {+ "type": "union",+ "variants": [+ {+ "type": "object",+ "fields": {+ "width": {+ "type": "integer",+ "required": false,+ "default": 512,+ "maximum": 14142,+ "minimumExclusive": 0,+ "desc": "The width of the generated image."+ },+ "height": {+ "type": "integer",+ "required": false,+ "default": 512,+ "maximum": 14142,+ "minimumExclusive": 0,+ "desc": "The height of the generated image."+ }+ },+ "required": false+ },+ {+ "type": "enum",+ "values": [+ "square_hd",+ "square",+ "portrait_4_3",+ "portrait_16_9",+ "landscape_4_3",+ "landscape_16_9"+ ],+ "valueType": "string",+ "required": false+ }+ ],+ "default": "landscape_4_3",+ "desc": "The size of the image to generate."+ },+ "num_images": {+ "type": "integer",+ "required": false,+ "default": 1,+ "minimum": 1,+ "maximum": 4,+ "desc": "The number of images to generate."+ },+ "sync_mode": {+ "type": "boolean",+ "required": false,+ "default": false,+ "desc": "If `True`, the media will be returned as a data URI. Output is not stored when this is True."+ },+ "enable_safety_checker": {+ "type": "boolean",+ "required": false,+ "default": true,+ "desc": "If set to true, the safety checker will be enabled. Disabling it requires account authorization; unauthorized requests are always checked, and images flagged as unsafe are returned as black images."+ },+ "output_format": {+ "type": "enum",+ "values": [+ "jpeg",+ "png",+ "webp"+ ],+ "valueType": "string",+ "required": false,+ "default": "png",+ "desc": "The format of the generated image."+ },+ "loras": {+ "type": "array",+ "items": "object",+ "itemSchema": {+ "path": {+ "type": "string",+ "required": false,+ "desc": "URL, HuggingFace repo ID (owner/repo), or local path to LoRA weights."+ },+ "scale": {+ "type": "number",+ "required": false,+ "default": 1,+ "minimum": 0,+ "maximum": 4,+ "desc": "Scale factor for LoRA application (0.0 to 4.0)."+ }+ },+ "itemRequired": [+ "path"+ ],+ "required": false,+ "default": [],+ "desc": "List of LoRA weights to apply (maximum 3)."+ }+ },+ "keyFields": {+ "prompt": "prompt",+ "aspectRatio": "image_size",+ "seed": "seed",+ "numOutputs": "num_images",+ "loras": "loras"+ },+ "output": "images[].url",+ "inputsChecked": "2026-10-27"},{"provider": "fal",@@ -1642,69 +1774,530 @@"acceleration": "string default=\"regular\" enum=[\"none\", \"regular\", \"high\"]","image_size": "anyOf[object {height:integer default=512 maximum=14142; width:integer default=512 maximum=14142}, string enum=[\"square_hd\", \"square\", \"portrait_4_3\", \"portrait_"},- "pathAccepts": "URL, HuggingFace repo ID (owner/repo), or local path to LoRA weights."- },- {- "provider": "fal",- "id": "fal-ai/flux-lora",- "family": "FLUX.1 [dev]",- "op": "t2i",- "roleForOriginals": "not for Originals",- "lora": {- "field": "loras",- "required": false,- "itemFields": "scale:number default=1 minimum=0 maximum=4; path:string",- "maxCount": "any number (description)"- },- "keyFieldsRequired": [- "prompt"- ],- "price": "$0.035 per megapixels",- "baseLicence": "FLUX.1 [dev] Non-Commercial License",- "commercialWeights": false,- "licenceNote": "Weights are non-commercial; the fal page says 'All generated images are cleared for commercial use' (fal's licence, not the weights')",- "falLicenseType": "commercial",- "status": "active",- "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/flux-lora",- "pageUrl": "https://fal.ai/models/fal-ai/flux-lora",- "checked": "2026-10-23",- "otherFields": {- "num_inference_steps": "integer default=28 minimum=1 maximum=50",- "acceleration": "string default=\"none\" enum=[\"none\", \"regular\"]",- "image_size": "anyOf[object {height:integer default=512 maximum=14142; width:integer default=512 maximum=14142}, string enum=[\"square_hd\", \"square\", \"portrait_4_3\", \"portrait_"- },- "pathAccepts": "URL or the path to the LoRA weights."- },- {- "provider": "fal",- "id": "fal-ai/flux-krea-lora",- "family": "FLUX.1 Krea [dev]",- "op": "t2i",- "roleForOriginals": "not for Originals",- "lora": {- "field": "loras",- "required": false,- "itemFields": "path:string; scale:number default=1 minimum=0 maximum=4",- "maxCount": "any number (description)"+ "pathAccepts": "URL, HuggingFace repo ID (owner/repo), or local path to LoRA weights.",+ "inputs": {+ "prompt": {+ "type": "string",+ "required": true,+ "desc": "The prompt to generate an image from.",+ "examples": [+ "Close shot a pianist plays in a luxurious room with tall windows overlooking a rainy metropolis. Shot with a 50mm lens at a side profile angle, soft tungsten light highlighting hands moving over keys. Capture detailed reflections in polished black piano surfaces, raindrops sliding down glass, and atmospheric warm/cool lighting contrast."+ ]+ },+ "guidance_scale": {+ "type": "number",+ "required": false,+ "default": 2.5,+ "minimum": 0,+ "maximum": 20,+ "desc": "Guidance Scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you."+ },+ "seed": {+ "nullable": true,+ "type": "integer",+ "required": false,+ "desc": "The seed to use for the generation. If not provided, a random seed will be used."+ },+ "num_inference_steps": {+ "type": "integer",+ "required": false,+ "default": 28,+ "minimum": 4,+ "maximum": 50,+ "desc": "The number of inference steps to perform."+ },+ "image_size": {+ "type": "union",+ "variants": [+ {+ "type": "object",+ "fields": {+ "width": {+ "type": "integer",+ "required": false,+ "default": 512,+ "maximum": 14142,+ "minimumExclusive": 0,+ "desc": "The width of the generated image."+ },+ "height": {+ "type": "integer",+ "required": false,+ "default": 512,+ "maximum": 14142,+ "minimumExclusive": 0,+ "desc": "The height of the generated image."+ }+ },+ "required": false+ },+ {+ "type": "enum",+ "values": [+ "square_hd",+ "square",+ "portrait_4_3",+ "portrait_16_9",+ "landscape_4_3",+ "landscape_16_9"+ ],+ "valueType": "string",+ "required": false+ }+ ],+ "default": "landscape_4_3",+ "desc": "The size of the image to generate. The width and height must be between 512 and 2048 pixels."+ },+ "num_images": {+ "type": "integer",+ "required": false,+ "default": 1,+ "minimum": 1,+ "maximum": 4,+ "desc": "The number of images to generate."+ },+ "acceleration": {+ "type": "enum",+ "values": [+ "none",+ "regular",+ "high"+ ],+ "valueType": "string",+ "required": false,+ "default": "regular",+ "desc": "The acceleration level to use for the image generation.",+ "examples": [+ "regular"+ ]+ },+ "enable_prompt_expansion": {+ "type": "boolean",+ "required": false,+ "default": false,+ "desc": "If set to true, the prompt will be expanded for better results."+ },+ "sync_mode": {+ "type": "boolean",+ "required": false,+ "default": false,+ "desc": "If `True`, the media will be returned as a data URI and the output data won't be available in the request history."+ },+ "enable_safety_checker": {+ "type": "boolean",+ "required": false,+ "default": true,+ "desc": "If set to true, the safety checker will be enabled. Disabling it requires account authorization; unauthorized requests are always checked, and images flagged as unsafe are returned as black images."+ },+ "output_format": {+ "type": "enum",+ "values": [+ "jpeg",+ "png",+ "webp"+ ],+ "valueType": "string",+ "required": false,+ "default": "png",+ "desc": "The format of the generated image."+ },+ "loras": {+ "type": "array",+ "items": "object",+ "itemSchema": {+ "path": {+ "type": "string",+ "required": false,+ "desc": "URL, HuggingFace repo ID (owner/repo), or local path to LoRA weights."+ },+ "scale": {+ "type": "number",+ "required": false,+ "default": 1,+ "minimum": 0,+ "maximum": 4,+ "desc": "Scale factor for LoRA application (0.0 to 4.0)."+ }+ },+ "itemRequired": [+ "path"+ ],+ "required": false,+ "default": [],+ "desc": "List of LoRA weights to apply (maximum 3). Each LoRA can be a URL, HuggingFace repo ID, or local path."+ }+ },+ "keyFields": {+ "prompt": "prompt",+ "aspectRatio": "image_size",+ "seed": "seed",+ "numOutputs": "num_images",+ "loras": "loras"+ },+ "output": "images[].url",+ "inputsChecked": "2026-10-27"+ },+ {+ "provider": "fal",+ "id": "fal-ai/flux-lora",+ "family": "FLUX.1 [dev]",+ "op": "t2i",+ "roleForOriginals": "not for Originals",+ "lora": {+ "field": "loras",+ "required": false,+ "itemFields": "scale:number default=1 minimum=0 maximum=4; path:string",+ "maxCount": "any number (description)"+ },+ "keyFieldsRequired": [+ "prompt"+ ],+ "price": "$0.035 per megapixels",+ "baseLicence": "FLUX.1 [dev] Non-Commercial License",+ "commercialWeights": false,+ "licenceNote": "Weights are non-commercial; the fal page says 'All generated images are cleared for commercial use' (fal's licence, not the weights')",+ "falLicenseType": "commercial",+ "status": "active",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/flux-lora",+ "pageUrl": "https://fal.ai/models/fal-ai/flux-lora",+ "checked": "2026-10-23",+ "otherFields": {+ "num_inference_steps": "integer default=28 minimum=1 maximum=50",+ "acceleration": "string default=\"none\" enum=[\"none\", \"regular\"]",+ "image_size": "anyOf[object {height:integer default=512 maximum=14142; width:integer default=512 maximum=14142}, string enum=[\"square_hd\", \"square\", \"portrait_4_3\", \"portrait_"+ },+ "pathAccepts": "URL or the path to the LoRA weights.",+ "inputs": {+ "prompt": {+ "type": "string",+ "required": true,+ "desc": "The prompt to generate an image from.",+ "examples": [+ "Extreme close-up of a single tiger eye, direct frontal view. Detailed iris and pupil. Sharp focus on eye texture and color. Natural lighting to capture authentic eye shine and depth. The word \"FLUX\" is painted over it in big, white brush strokes with visible texture."+ ]+ },+ "image_size": {+ "type": "union",+ "variants": [+ {+ "type": "object",+ "fields": {+ "height": {+ "type": "integer",+ "required": false,+ "default": 512,+ "maximum": 14142,+ "minimumExclusive": 0,+ "desc": "The height of the generated image."+ },+ "width": {+ "type": "integer",+ "required": false,+ "default": 512,+ "maximum": 14142,+ "minimumExclusive": 0,+ "desc": "The width of the generated image."+ }+ },+ "required": false+ },+ {+ "type": "enum",+ "values": [+ "square_hd",+ "square",+ "portrait_4_3",+ "portrait_16_9",+ "landscape_4_3",+ "landscape_16_9"+ ],+ "valueType": "string",+ "required": false+ }+ ],+ "default": "landscape_4_3",+ "desc": "The size of the generated image."+ },+ "num_inference_steps": {+ "type": "integer",+ "required": false,+ "default": 28,+ "minimum": 1,+ "maximum": 50,+ "desc": "The number of inference steps to perform."+ },+ "seed": {+ "nullable": true,+ "type": "integer",+ "required": false,+ "desc": "\n The same seed and the same prompt given to the same version of the model\n will output the same image every time.\n "+ },+ "loras": {+ "type": "array",+ "items": "object",+ "itemSchema": {+ "scale": {+ "type": "number",+ "required": false,+ "default": 1,+ "minimum": 0,+ "maximum": 4,+ "desc": "\n The scale of the LoRA weight. This is used to scale the LoRA weight\n before merging it with the base model.\n "+ },+ "path": {+ "type": "string",+ "required": false,+ "desc": "URL or the path to the LoRA weights."+ }+ },+ "itemRequired": [+ "path"+ ],+ "required": false,+ "default": [],+ "desc": "\n The LoRAs to use for the image generation. You can use any number of LoRAs\n and they will be merged together to generate the final image.\n "+ },+ "guidance_scale": {+ "type": "number",+ "required": false,+ "default": 3.5,+ "minimum": 0,+ "maximum": 35,+ "desc": "\n The CFG (Classifier Free Guidance) scale is a measure of how close you want\n the model to stick to your prompt when looking for a related image to show you.\n "+ },+ "sync_mode": {+ "type": "boolean",+ "required": false,+ "default": false,+ "desc": "If `True`, the media will be returned as a data URI and the output data won't be available in the request history."+ },+ "num_images": {+ "type": "integer",+ "required": false,+ "default": 1,+ "minimum": 1,+ "maximum": 4,+ "desc": "The number of images to generate. This is always set to 1 for streaming output."+ },+ "enable_safety_checker": {+ "type": "boolean",+ "required": false,+ "default": true,+ "desc": "If set to true, the safety checker will be enabled."+ },+ "output_format": {+ "type": "enum",+ "values": [+ "jpeg",+ "png"+ ],+ "valueType": "string",+ "required": false,+ "default": "jpeg",+ "desc": "The format of the generated image."+ },+ "acceleration": {+ "type": "enum",+ "values": [+ "none",+ "regular"+ ],+ "valueType": "string",+ "required": false,+ "default": "none",+ "desc": "Acceleration level for image generation. 'regular' balances speed and quality."+ }+ },+ "keyFields": {+ "prompt": "prompt",+ "aspectRatio": "image_size",+ "seed": "seed",+ "numOutputs": "num_images",+ "loras": "loras"+ },+ "output": "images[].url",+ "inputsChecked": "2026-10-27"+ },+ {+ "provider": "fal",+ "id": "fal-ai/flux-krea-lora",+ "family": "FLUX.1 Krea [dev]",+ "op": "t2i",+ "roleForOriginals": "not for Originals",+ "lora": {+ "field": "loras",+ "required": false,+ "itemFields": "path:string; scale:number default=1 minimum=0 maximum=4",+ "maxCount": "any number (description)"+ },+ "keyFieldsRequired": [+ "prompt"+ ],+ "price": "$0.035 per megapixels",+ "baseLicence": "FLUX.1 [dev] Non-Commercial License",+ "commercialWeights": false,+ "licenceNote": "Weights are non-commercial; the fal page says 'All generated images are cleared for commercial use' (fal's licence, not the weights')",+ "falLicenseType": "commercial",+ "status": "active",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/flux-krea-lora",+ "pageUrl": "https://fal.ai/models/fal-ai/flux-krea-lora",+ "checked": "2026-10-23",+ "otherFields": {+ "num_inference_steps": "integer default=28 minimum=1 maximum=50",+ "acceleration": "string default=\"none\" enum=[\"none\", \"regular\"]",+ "image_size": "anyOf[object {width:integer default=512 maximum=14142; height:integer default=512 maximum=14142}, string enum=[\"square_hd\", \"square\", \"portrait_4_3\", \"portrait_"+ },+ "pathAccepts": "URL or the path to the LoRA weights.",+ "inputs": {+ "prompt": {+ "type": "string",+ "required": true,+ "desc": "The prompt to generate an image from.",+ "examples": [+ "Extreme close-up of a single tiger eye, direct frontal view. Detailed iris and pupil. Sharp focus on eye texture and color. Natural lighting to capture authentic eye shine and depth. The word \"FLUX\" is painted over it in big, white brush strokes with visible texture."+ ]+ },+ "image_size": {+ "type": "union",+ "variants": [+ {+ "type": "object",+ "fields": {+ "height": {+ "type": "integer",+ "required": false,+ "default": 512,+ "maximum": 14142,+ "minimumExclusive": 0,+ "desc": "The height of the generated image."+ },+ "width": {+ "type": "integer",+ "required": false,+ "default": 512,+ "maximum": 14142,+ "minimumExclusive": 0,+ "desc": "The width of the generated image."+ }+ },+ "required": false+ },+ {+ "type": "enum",+ "values": [+ "square_hd",+ "square",+ "portrait_4_3",+ "portrait_16_9",+ "landscape_4_3",+ "landscape_16_9"+ ],+ "valueType": "string",+ "required": false+ }+ ],+ "default": "landscape_4_3",+ "desc": "The size of the generated image."+ },+ "num_inference_steps": {+ "type": "integer",+ "required": false,+ "default": 28,+ "minimum": 1,+ "maximum": 50,+ "desc": "The number of inference steps to perform."+ },+ "seed": {+ "nullable": true,+ "type": "integer",+ "required": false,+ "desc": "\n The same seed and the same prompt given to the same version of the model\n will output the same image every time.\n "+ },+ "loras": {+ "type": "array",+ "items": "object",+ "itemSchema": {+ "scale": {+ "type": "number",+ "required": false,+ "default": 1,+ "minimum": 0,+ "maximum": 4,+ "desc": "\n The scale of the LoRA weight. This is used to scale the LoRA weight\n before merging it with the base model.\n "+ },+ "path": {+ "type": "string",+ "required": false,+ "desc": "URL or the path to the LoRA weights."+ }+ },+ "itemRequired": [+ "path"+ ],+ "required": false,+ "default": [],+ "desc": "\n The LoRAs to use for the image generation. You can use any number of LoRAs\n and they will be merged together to generate the final image.\n "+ },+ "guidance_scale": {+ "type": "number",+ "required": false,+ "default": 3.5,+ "minimum": 0,+ "maximum": 35,+ "desc": "\n The CFG (Classifier Free Guidance) scale is a measure of how close you want\n the model to stick to your prompt when looking for a related image to show you.\n "+ },+ "sync_mode": {+ "type": "boolean",+ "required": false,+ "default": false,+ "desc": "If `True`, the media will be returned as a data URI and the output data won't be available in the request history."+ },+ "num_images": {+ "type": "integer",+ "required": false,+ "default": 1,+ "minimum": 1,+ "maximum": 4,+ "desc": "The number of images to generate. This is always set to 1 for streaming output."+ },+ "enable_safety_checker": {+ "type": "boolean",+ "required": false,+ "default": true,+ "desc": "If set to true, the safety checker will be enabled. Disabling it requires account authorization; unauthorized requests are always checked, and images flagged as unsafe are returned as black images."+ },+ "output_format": {+ "type": "enum",+ "values": [+ "jpeg",+ "png"+ ],+ "valueType": "string",+ "required": false,+ "default": "jpeg",+ "desc": "The format of the generated image."+ },+ "acceleration": {+ "type": "enum",+ "values": [+ "none",+ "regular"+ ],+ "valueType": "string",+ "required": false,+ "default": "none",+ "desc": "Acceleration level for image generation. 'regular' balances speed and quality."+ }},- "keyFieldsRequired": [- "prompt"- ],- "price": "$0.035 per megapixels",- "baseLicence": "FLUX.1 [dev] Non-Commercial License",- "commercialWeights": false,- "licenceNote": "Weights are non-commercial; the fal page says 'All generated images are cleared for commercial use' (fal's licence, not the weights')",- "falLicenseType": "commercial",- "status": "active",- "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/flux-krea-lora",- "pageUrl": "https://fal.ai/models/fal-ai/flux-krea-lora",- "checked": "2026-10-23",- "otherFields": {- "num_inference_steps": "integer default=28 minimum=1 maximum=50",- "acceleration": "string default=\"none\" enum=[\"none\", \"regular\"]",- "image_size": "anyOf[object {width:integer default=512 maximum=14142; height:integer default=512 maximum=14142}, string enum=[\"square_hd\", \"square\", \"portrait_4_3\", \"portrait_"+ "keyFields": {+ "prompt": "prompt",+ "aspectRatio": "image_size",+ "seed": "seed",+ "numOutputs": "num_images",+ "loras": "loras"},- "pathAccepts": "URL or the path to the LoRA weights."+ "output": "images[].url",+ "inputsChecked": "2026-10-27"},{"provider": "fal",@@ -1734,7 +2327,148 @@"acceleration": "string default=\"none\" enum=[\"none\", \"regular\"]","image_size": "anyOf[object {height:integer default=512 maximum=14142; width:integer default=512 maximum=14142}, string enum=[\"square_hd\", \"square\", \"portrait_4_3\", \"portrait_"},- "pathAccepts": "URL, HuggingFace repo ID (owner/repo), or local path to LoRA weights."+ "pathAccepts": "URL, HuggingFace repo ID (owner/repo), or local path to LoRA weights.",+ "inputs": {+ "prompt": {+ "type": "string",+ "required": true,+ "desc": "Base text description of the image to generate.",+ "examples": [+ "a vintage travel poster for Mars"+ ]+ },+ "seed": {+ "nullable": true,+ "type": "integer",+ "required": false,+ "desc": "Random seed for reproducible generation. Image *i* uses `seed + i`."+ },+ "image_size": {+ "type": "union",+ "variants": [+ {+ "type": "object",+ "fields": {+ "height": {+ "type": "integer",+ "required": false,+ "default": 512,+ "maximum": 14142,+ "minimumExclusive": 0,+ "desc": "The height of the generated image."+ },+ "width": {+ "type": "integer",+ "required": false,+ "default": 512,+ "maximum": 14142,+ "minimumExclusive": 0,+ "desc": "The width of the generated image."+ }+ },+ "required": false+ },+ {+ "type": "enum",+ "values": [+ "square_hd",+ "square",+ "portrait_4_3",+ "portrait_16_9",+ "landscape_4_3",+ "landscape_16_9"+ ],+ "valueType": "string",+ "required": false+ }+ ],+ "default": "square_hd",+ "desc": "The size of the generated image."+ },+ "num_images": {+ "type": "integer",+ "required": false,+ "default": 1,+ "minimum": 1,+ "maximum": 4,+ "desc": "The number of images to generate."+ },+ "acceleration": {+ "type": "enum",+ "values": [+ "none",+ "regular"+ ],+ "valueType": "string",+ "required": false,+ "default": "none",+ "desc": "The acceleration level to use for the image generation."+ },+ "enable_prompt_expansion": {+ "type": "boolean",+ "required": false,+ "default": false,+ "desc": "If true, the prompt is expanded with an LLM into a more detailed image-generation prompt for higher quality results. On failure, the original prompt is used unchanged."+ },+ "sync_mode": {+ "type": "boolean",+ "required": false,+ "default": false,+ "desc": "If `True`, the media will be returned as a data URI and the output data won't be available in the request history."+ },+ "enable_safety_checker": {+ "type": "boolean",+ "required": false,+ "default": true,+ "desc": "If true, the output safety checker is enabled. Disabling it requires account authorization; unauthorized requests are always checked, and images flagged as unsafe are returned as black images."+ },+ "output_format": {+ "type": "enum",+ "values": [+ "jpeg",+ "png"+ ],+ "valueType": "string",+ "required": false,+ "default": "png",+ "desc": "The format of the generated image. Default value: \"png\"."+ },+ "loras": {+ "type": "array",+ "items": "object",+ "itemSchema": {+ "path": {+ "type": "string",+ "required": false,+ "desc": "URL, HuggingFace repo ID (owner/repo), or local path to LoRA weights."+ },+ "scale": {+ "type": "number",+ "required": false,+ "default": 1,+ "minimum": 0,+ "maximum": 4,+ "desc": "Scale factor for LoRA application (0.0 to 4.0)."+ }+ },+ "itemRequired": [+ "path"+ ],+ "maxItems": 3,+ "required": false,+ "default": [],+ "desc": "List of LoRA weights to apply (maximum 3)."+ }+ },+ "keyFields": {+ "prompt": "prompt",+ "aspectRatio": "image_size",+ "seed": "seed",+ "numOutputs": "num_images",+ "loras": "loras"+ },+ "output": "images[].url",+ "inputsChecked": "2026-10-27"},{"provider": "fal",@@ -5026,7 +5760,11 @@"commercialWeights": true,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/z-image-turbo-trainer-v2",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "diffusers_lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal",@@ -5048,7 +5786,11 @@"commercialWeights": true,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/z-image-trainer",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "diffusers_lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal",@@ -5069,7 +5811,11 @@"commercialWeights": true,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/qwen-image-2512-trainer",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "diffusers_lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal",@@ -5090,7 +5836,11 @@"commercialWeights": true,"status": "unlisted (schema served, not in the catalog)","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/qwen-image-trainer",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal",@@ -5111,7 +5861,11 @@"commercialWeights": true,"status": "unlisted (schema served, not in the catalog)","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/qwen-image-edit-2511-trainer",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "diffusers_lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal",@@ -5132,13 +5886,17 @@"commercialWeights": true,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/qwen-image-edit-2509-trainer",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "diffusers_lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal","id": "fal-ai/flux-2-klein-4b-base-trainer","family": "FLUX.2 [klein] 4B base",- "role": "Apache image LoRAs",+ "role": "Soul ID on FLUX.2 [klein] 4B (o/soul-id)","required": ["image_data_url"],@@ -5154,13 +5912,18 @@"commercialWeights": true,"status": "unlisted (schema served, not in the catalog)","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/flux-2-klein-4b-base-trainer",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "diffusers_lora_file"+ ],+ "outputChecked": "2026-10-27",+ "roleBefore": "Apache image LoRAs"},{"provider": "fal","id": "fal-ai/flux-2-klein-9b-base-trainer","family": "FLUX.2 [klein] 9B base",- "role": "not for Originals",+ "role": "Soul ID on FLUX.2 [klein] 9B (o/soul-id; non-commercial weights, shown as information)","required": ["image_data_url"],@@ -5176,13 +5939,18 @@"commercialWeights": false,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/flux-2-klein-9b-base-trainer",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "diffusers_lora_file"+ ],+ "outputChecked": "2026-10-27",+ "roleBefore": "not for Originals"},{"provider": "fal","id": "fal-ai/flux-2-trainer-v2","family": "FLUX.2 [dev]",- "role": "not for Originals",+ "role": "Soul ID on FLUX.2 [dev] (o/soul-id; non-commercial weights, shown as information)","required": ["image_data_url"],@@ -5198,7 +5966,12 @@"commercialWeights": false,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/flux-2-trainer-v2",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "diffusers_lora_file"+ ],+ "outputChecked": "2026-10-27",+ "roleBefore": "not for Originals"},{"provider": "fal",@@ -5222,13 +5995,17 @@"commercialWeights": false,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/flux-lora-fast-training",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "diffusers_lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal","id": "fal-ai/flux-lora-portrait-trainer","family": "FLUX.1 [dev]",- "role": "not for Originals",+ "role": "Soul ID on FLUX.1 [dev] and Krea [dev] (o/soul-id; non-commercial weights, shown as information)","required": ["images_data_url"],@@ -5248,13 +6025,18 @@"commercialWeights": false,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/flux-lora-portrait-trainer",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "diffusers_lora_file"+ ],+ "outputChecked": "2026-10-27",+ "roleBefore": "not for Originals"},{"provider": "fal","id": "fal-ai/krea-2-trainer","family": "Krea 2",- "role": "optional",+ "role": "Soul ID on Krea 2 (o/soul-id; revenue-tier licence, shown as information)","required": ["images_data_url"],@@ -5272,7 +6054,12 @@"commercialWeights": null,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/krea-2-trainer",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "lora_file"+ ],+ "outputChecked": "2026-10-27",+ "roleBefore": "optional"},{"provider": "fal",@@ -5299,7 +6086,12 @@"commercialWeights": true,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/wan-22-image-trainer",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "diffusers_lora_file",+ "high_noise_lora"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal",@@ -5321,7 +6113,11 @@"commercialWeights": true,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/wan-22-trainer/i2v-a14b",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal",@@ -5343,7 +6139,11 @@"commercialWeights": true,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/wan-22-trainer/t2v-a14b",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal",@@ -5365,7 +6165,11 @@"commercialWeights": true,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/wan-trainer/i2v-720p",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal",@@ -5406,7 +6210,11 @@"commercialWeights": true,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/ltx23-trainer-v2/i2v",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal",@@ -5446,7 +6254,11 @@"commercialWeights": true,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/ltx23-trainer-v2/t2v",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal",@@ -5486,7 +6298,11 @@"commercialWeights": true,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/ltx23-trainer-v2/ic-lora/v2v",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "fal",@@ -5528,7 +6344,11 @@"commercialWeights": true,"status": "active","schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/ltx23-video-trainer",- "checked": "2026-10-23"+ "checked": "2026-10-23",+ "loraOutput": [+ "lora_file"+ ],+ "outputChecked": "2026-10-27"},{"provider": "replicate",diff --git a/docs/research/fuobe-originals-recipes-5.md b/docs/research/fuobe-originals-recipes-5.mdindex 558b7e80..6767bf4d 100644--- a/docs/research/fuobe-originals-recipes-5.md+++ b/docs/research/fuobe-originals-recipes-5.md@@ -148,6 +148,8 @@ Extra fields that matter:The data each fal trainer wants is a zip URL: Z-Image Turbo v2 and Qwen 2512 take `image_data_url` with `001.jpg` + `001.txt` caption pairs and a `default_caption`; Wan 2.2 and LTX-2.3 take `training_data_url` (images and/or videos with same-name `.txt` captions) and a `trigger_phrase`. The Wan 2.2 I2V trainer returns a single `lora_file` (whether fal applies it to both experts is **unverified**: pass it with `transformer: both`).+*Updated 2026-10-27 (o/soul-id): licences are information, not gates (the owner's decision of 2026-10-27).* Soul ID now trains on every image base above that has a hosted LoRA model, with the weights' licence shown next to the price: FLUX.1 [dev] (`fal-ai/flux-lora-portrait-trainer` → `fal-ai/flux-lora`, `fal-ai/flux-krea-lora`), FLUX.2 [dev] (`fal-ai/flux-2-trainer-v2` → `fal-ai/flux-2/lora`), FLUX.2 [klein] 4B and 9B (their base trainers → `fal-ai/flux-2/klein/4b/lora`, `fal-ai/flux-2/klein/9b/lora`) and Krea 2 (`fal-ai/krea-2-trainer` → `fal-ai/krea-2/turbo/lora`); the "not for Originals" roles in the table are superseded (the JSON keeps them as `roleBefore`). `scripts/fetch-hosted-schemas.py --trainers` read each fal trainer's response schema on 2026-10-27 and recorded where its LoRA comes back (`trainers[].loraOutput`): `diffusers_lora_file` for most, `lora_file` for Krea 2, Qwen-Image (2508) and the Wan / LTX video trainers, and a pair for `fal-ai/wan-22-image-trainer` (`diffusers_lora_file` + `high_noise_lora`, so Wan 2.2 image Soul IDs need a two-LoRA element and are not offered yet). The FLUX portrait and Krea 2 trainers take `images_data_url` (the same `001.jpg` + `001.txt` zip; captions win, `trigger_phrase` fills in) rather than `image_data_url`. The five hosted LoRA endpoints' inputs were read the same day (`hostedLoraEndpoints[].inputs`). AI-Toolkit (README and `extensions_built_in/diffusion_models`, read 2026-10-27) trains FLUX.1 [dev] (`arch: flux`), FLUX.2 [dev] (`flux2`), FLUX.2 [klein] base 4B / 9B (`flux2_klein_4b` / `flux2_klein_9b`), Qwen-Image 2512 (`qwen_image`), Krea 2 (`krea2`) and Z-Image Turbo; whether a LoRA trained on a klein *base* model behaves the same on the distilled klein endpoint is **unverified**.+### 3.4 Downloading LoRAsHugging Face `resolve/main` URLs download without a login (fal, Replicate and ComfyUI can use them as they are). **civitai download URLs answer HTTP 401 without a token**: pass `?token=<the user's civitai API key>` or mirror the file once to Fuobe's or fal's storage (allowed when the civitai permissions include Rent or Sell; whether fal accepts a tokenised civitai URL in `path` is **unverified**). Several civitai files share a name (`V1.safetensors`), so the JSON gives each LoRA a unique local `file` name; Fuobe's `injectLoras` keys on `lora_name`, so names must be unique in `ComfyUI/models/loras`. Gated Hugging Face repos (Lightricks LTX-2.5 LoRAs) need the licence accepted and an HF token. *Corrected 2026-10-24 (o/lora-plumbing):* two Hugging Face files had names many unrelated LoRAs share (`pytorch_lora_weights.safetensors`, `lora_weights_step_02000.safetensors`), so a file already in ComfyUI's folder under that name could be another LoRA; the JSON now names them `suayptalha-z-image-turbo-realism.safetensors` and `theburgstall-earthzoomout-ltx2-19b.safetensors`, and `scripts/gen-lora-library.py` refuses such names. *Added 2026-10-24 (o/lora-plumbing):* every LoRA is pinned to exact bytes. `scripts/fetch-lora-pins.py` read each file's SHA256 and size (Hugging Face: the LFS hash at the commit `main` was at, now in `revision`; civitai: the pinned version's primary file, after checking the version belongs to the entry's model), and the generated library downloads Hugging Face files from `resolve/<revision>/…`, so a file replaced upstream is never fetched silently. The downloader keeps a file only when it matches the pinned hash.diff --git a/scripts/fetch-hosted-schemas.py b/scripts/fetch-hosted-schemas.pyindex a8c6c196..bd38b99a 100644--- a/scripts/fetch-hosted-schemas.py+++ b/scripts/fetch-hosted-schemas.py@@ -12,8 +12,13 @@ docs/research/fuobe-originals-recipes-5.json in the same shape as paid-model-apikeyFields (which input is the prompt, the image, the clip…) are this script's curation, as in theearlier research files. scripts/gen-cloud-models.py reads both lists.+- trainers[<id>].loraOutput for fal's LoRA trainers (--trainers): the response fields that hold the trained+ LoRA files (diffusers_lora_file, lora_file, or Wan 2.2's pair with high_noise_lora), read from each+ trainer's OpenAPI output schema, so src/server/training.ts knows where a finished training's LoRA is.+Run: python3 scripts/fetch-hosted-schemas.pypython3 scripts/fetch-hosted-schemas.py --only fal-ai/z-image/turbo/image-to-image/lora (one endpoint, the rest kept)+ python3 scripts/fetch-hosted-schemas.py --trainers (only the trainers' outputs)"""import datetimeimport json@@ -51,6 +56,14 @@ LORA = {"fal-ai/z-image/turbo/image-to-image/lora": {**{k: v for k, v in T2I.items() if k not in ("negativePrompt", "aspectRatio")}, "image": "image_url"},"fal-ai/qwen-image-2512/lora": T2I,"prunaai/z-image-turbo-lora": {"prompt": "prompt", "width": "width", "height": "height", "seed": "seed"},+ # Soul ID on every base fal trains (O3, o/soul-id): the models a LoRA trained on FLUX.1 [dev], FLUX.1 Krea [dev],+ # FLUX.2 [dev], Krea 2 or FLUX.2 [klein] 9B runs on. Their licences are recorded as information, never a gate+ # (the owner's decision of 2026-10-27: the admin turns models on or off in Settings).+ "fal-ai/flux-lora": KLEIN,+ "fal-ai/flux-krea-lora": KLEIN,+ "fal-ai/flux-2/lora": KLEIN,+ "fal-ai/krea-2/turbo/lora": KLEIN,+ "fal-ai/flux-2/klein/9b/lora": KLEIN,}BASE = {"fal-ai/ltx-2.3-22b/image-to-video": ("i2v", {**{k: v for k, v in LTX.items() if k != "loras"}, "image": "image_url", "endImage": "end_image_url"}),@@ -162,9 +175,34 @@ def fal_price(endpoint):return re.sub(r"^(Price:\s*)", "", m.group(0).replace("**", "").strip(" -*")) if m else None+def trainer_outputs(data):+ """Record which response fields of each fal trainer hold LoRA files (File fields named *lora*)."""+ for t in data["trainers"]:+ if t.get("provider") != "fal":+ continue+ ep = t["id"]+ root = json.loads(get(f"https://fal.ai/api/openapi/queue/openapi.json?endpoint_id={ep}"))+ result = root["paths"][f"/{ep}/requests/{{request_id}}"]["get"]["responses"]["200"]["content"]["application/json"]["schema"]+ props = resolve(result, root).get("properties") or {}+ files = []+ for name, p in props.items():+ refs = [p] + list(p.get("anyOf") or p.get("allOf") or [])+ if any(resolve(r, root).get("title") == "File" or str(r.get("$ref", "")).endswith("/File") for r in refs if isinstance(r, dict)):+ # Configs, debug datasets and validation samples (LTX's video / audio) aren't LoRAs.+ if "lora" in name:+ files.append(name)+ t["loraOutput"] = files+ t["outputChecked"] = TODAY+ print(f"{ep}: {files}")++def main():raw = FILE.read_text(encoding="utf-8")data = json.loads(raw)+ if "--trainers" in sys.argv:+ trainer_outputs(data)+ FILE.write_text(json.dumps(data, indent=1, ensure_ascii=False) + "\n", encoding="utf-8")+ returnby_id = {e["id"]: e for e in data["hostedLoraEndpoints"]}only = sys.argv[sys.argv.index("--only") + 1:] if "--only" in sys.argv else Nonefor ep, kf in LORA.items():diff --git a/scripts/gen-cloud-models.py b/scripts/gen-cloud-models.pyindex a9443bab..f16b382c 100644--- a/scripts/gen-cloud-models.py+++ b/scripts/gen-cloud-models.py@@ -203,6 +203,25 @@ model("flux-2-klein-4b-cloud", "FLUX.2 [klein] 4B (hosted)", "Black Forest Labs"model("wan-2-2-a14b-image-cloud", "Wan 2.2 A14B Image (hosted)", "Alibaba Wan", "wan", "image","Open-weights Wan 2.2 stills that take Wan LoRAs",[("t2i", "fal-ai/wan/v2.2-a14b/text-to-image/lora", "fal")], defaults={"aspectRatio": "16:9"})+# Soul ID on every base fal trains (O3, o/soul-id): a character or style LoRA trained on FLUX.1 [dev], FLUX.2 [dev],+# Krea 2 or FLUX.2 [klein] 9B runs on these. The weights' licences are information shown with the model, never a gate+# (the owner's decision of 2026-10-27): FLUX [dev] and klein 9B weights are non-commercial (fal clears its own hosted+# outputs), Krea 2 has revenue tiers. The admin turns models on or off in Settings.+model("flux-1-dev-lora-cloud", "FLUX.1 [dev] with LoRAs (hosted)", "Black Forest Labs", "flux", "image",+ "FLUX.1 [dev] with your trained characters and styles · non-commercial weights, fal clears its outputs",+ [("t2i", "fal-ai/flux-lora", "fal")], defaults={"aspectRatio": "3:4"})+model("flux-1-krea-lora-cloud", "FLUX.1 Krea [dev] with LoRAs (hosted)", "Black Forest Labs × Krea", "flux", "image",+ "Natural photoreal FLUX.1 Krea with FLUX.1 LoRAs · non-commercial weights, fal clears its outputs",+ [("t2i", "fal-ai/flux-krea-lora", "fal")], defaults={"aspectRatio": "3:4"})+model("flux-2-dev-lora-cloud", "FLUX.2 [dev] with LoRAs (hosted)", "Black Forest Labs", "flux", "image",+ "FLUX.2 [dev] with your trained characters and styles · non-commercial weights, fal clears its outputs",+ [("t2i", "fal-ai/flux-2/lora", "fal")], defaults={"aspectRatio": "3:4"})+model("flux-2-klein-9b-lora-cloud", "FLUX.2 [klein] 9B with LoRAs (hosted)", "Black Forest Labs", "flux", "image",+ "The 9B FLUX.2 [klein] with your LoRAs · non-commercial weights, fal clears its outputs",+ [("t2i", "fal-ai/flux-2/klein/9b/lora", "fal")], badges=["fast"], defaults={"aspectRatio": "3:4"})+model("krea-2-turbo-lora-cloud", "Krea 2 Turbo with LoRAs (hosted)", "Krea", "krea", "image",+ "Krea 2's aesthetic with your trained characters and styles · Krea 2 Community licence (revenue tiers)",+ [("t2i", "fal-ai/krea-2/turbo/lora", "fal")], badges=["fast"], defaults={"aspectRatio": "3:4"})# ----- Originals (O2): Fuobe Soul's cloud halves on hosted open weights (docs/research/fuobe-originals-recipes-5.md §4).# models.ts joins each to its ComfyUI routes as one model that runs on both engines (ModelDef.engines). Sizes are# Soul's table per tier (soul.settings.comfyui.sizes); steps, prompt expansion and format follow the recipe (§4.3).diff --git a/scripts/gen-trainers.py b/scripts/gen-trainers.pyindex 25ca9dee..14bf2271 100644--- a/scripts/gen-trainers.py+++ b/scripts/gen-trainers.py@@ -1,19 +1,23 @@#!/usr/bin/env python3"""-Generate src/lib/catalog/trainers.generated.ts: the hosted LoRA trainers Fuobe Soul ID and personal moodboards-can run in the cloud (build plan O3), with each one's request fields, its price per step and the licence of the-weights it trains on.-Source: docs/research/fuobe-originals-recipes-5.json → trainers[] (read from fal's OpenAPI and llms.txt).--Only fal's image trainers are generated (their data is a zip of 001.jpg + 001.txt caption pairs in-`image_data_url`): video trainers (Wan, LTX) and Replicate's GPU-time trainers aren't Soul ID routes.-src/lib/catalog/training.ts turns a training target into a request with these fields, so nothing about a-trainer's API is typed by hand.+Generate src/lib/catalog/trainers.generated.ts: every LoRA trainer fal hosts (build plan O3), with each one's request+fields, the response field its LoRA comes back in, its price per step and the licence of the weights it trains on.+Source: docs/research/fuobe-originals-recipes-5.json → trainers[] (read from fal's OpenAPI and llms.txt;+loraOutput by scripts/fetch-hosted-schemas.py --trainers).++Licences are information, not gates (the owner's decision of 2026-10-27: "Forget licences restrictions etc. Just put+them as info in settings instead so admin decides what to activate"): every trainer is generated with its licence+and whether its weights allow selling outputs (true, false, or null when a revenue tier decides), and Soul ID offers+non-commercial bases (FLUX.1 / FLUX.2 [dev], FLUX.2 [klein] 9B) and Krea 2 next to the Apache-2.0 ones; the admin+turns models on or off in Settings. Replicate's trainers are billed by GPU time and have no fields here.+src/lib/catalog/training.ts turns a training target into a request with these fields, so nothing about a trainer's+API is typed by hand.Fails (exit 1) when a trainer Fuobe's targets use (USED below):-- trains on weights that aren't commercial (a default must be commercial-safe), or isn't active / served;-- lacks a field its request sends (steps, default_caption, learning_rate; training_type for a style trainer);-- has a price this script can't read (the spend shown before a run, and the eval harness's cap, need it).+- isn't active or served (status);+- lacks a field its request sends (steps, the caption or trigger, learning_rate, training_type for a style);+- has no LoRA in its response, or a price this script can't read (the spend shown before a run, and the eval+ harness's cap, need it).Run: python3 scripts/gen-trainers.py"""@@ -31,7 +35,16 @@ USED = {"fal-ai/z-image-turbo-trainer-v2": ["steps", "default_caption", "learning_rate"],"fal-ai/z-image-trainer": ["steps", "default_caption", "learning_rate", "training_type"],"fal-ai/qwen-image-2512-trainer": ["steps", "default_caption", "learning_rate"],+ "fal-ai/flux-2-klein-4b-base-trainer": ["steps", "default_caption", "learning_rate"],+ "fal-ai/flux-2-klein-9b-base-trainer": ["steps", "default_caption", "learning_rate"],+ "fal-ai/flux-2-trainer-v2": ["steps", "default_caption", "learning_rate"],+ "fal-ai/flux-lora-portrait-trainer": ["steps", "trigger_phrase", "learning_rate"],+ "fal-ai/krea-2-trainer": ["steps", "trigger_phrase", "learning_rate"],}+# Where each trainer's dataset zip goes (the first of these its schema requires).+DATA_FIELDS = ("image_data_url", "images_data_url", "training_data_url")+# Trainers that learn motion from clips (Wan, LTX) rather than a subject or a look from photos.+VIDEO = re.compile(r"wan-22-trainer|wan-trainer|ltx")errors = []@@ -57,8 +70,13 @@ def field(spec):rest = rest.replace(m.group(0), "")m = re.search(r'default=("[^"]*"|\S+)', rest)if m:- raw = m.group(1)- out["default"] = json.loads(raw) if raw.startswith('"') else (raw == "true" if raw in ("true", "false") else num(raw))+ try:+ v = json.loads(m.group(1))+ except json.JSONDecodeError:+ v = m.group(1)+ # Lists, objects and null (a video trainer's validation prompts) aren't a field Soul ID sets.+ if isinstance(v, (str, bool, int, float)):+ out["default"] = v if isinstance(v, (str, bool)) else num(str(v))for key, name in (("minimum", "min"), ("maximum", "max")):m = re.search(rf"{key}=(\S+)", rest)if m:@@ -67,14 +85,15 @@ def field(spec):def pricing(text):- """The price per step and the fewest steps billed, from fal's own sentence (None when it names neither)."""+ """The price per step and the fewest steps billed, from fal's own sentence (None when it names neither).+ Numbers stop before a sentence's full stop ("a minimum charge of $2.40.")."""t = text or ""per = Nonefor pat, div in (- (r"\$([\d.,]+) per 1000-step", 1000),- (r"\$([\d.,]+) for 1,000 requested steps", 1000),- (r"\$([\d.,]+) per steps?\b", 1),- (r"([\d.]+) \* steps", 1),+ (r"\$(\d[\d,]*(?:\.\d+)?) per 1000-step", 1000),+ (r"\$(\d[\d,]*(?:\.\d+)?) for 1,000 requested steps", 1000),+ (r"\$(\d[\d,]*(?:\.\d+)?) per steps?\b", 1),+ (r"(\d+(?:\.\d+)?) \* steps", 1),):m = re.search(pat, t)if m:@@ -88,7 +107,7 @@ def pricing(text):if m:floor = int(m.group(1).replace(",", ""))break- m = re.search(r"minimum charge of \$([\d.,]+)", t)+ m = re.search(r"minimum charge of \$(\d[\d,]*(?:\.\d+)?)", t)if m and floor == 1:floor = round(float(m.group(1).replace(",", "")) / per)return {"usdPerStep": round(per, 8), "minBilledSteps": floor}@@ -96,22 +115,27 @@ def pricing(text):trainers = []for raw in DATA["trainers"]:- if raw.get("provider") != "fal" or "image_data_url" not in (raw.get("required") or []):+ data_field = next((f for f in DATA_FIELDS if f in (raw.get("required") or [])), None)+ if raw.get("provider") != "fal" or not data_field:continuetid = raw["id"]price = pricing(raw.get("price"))fields = {k: field(v) for k, v in sorted((raw.get("fields") or {}).items())}status = raw.get("status") or ""+ commercial = raw.get("commercialWeights")entry = {"id": tid,"provider": "fal","family": raw.get("family") or "","base": slug(raw.get("family") or ""),+ "media": "video" if VIDEO.search(tid) else "image","role": raw.get("role") or "",- "dataField": "image_data_url",+ "dataField": data_field,+ "loraOutput": raw.get("loraOutput") or [],"fields": fields,"licence": raw.get("baseLicence") or "",- "commercial": bool(raw.get("commercialWeights")),+ # True: the weights allow selling outputs; false: non-commercial weights; null: a revenue tier decides.+ "commercial": commercial if isinstance(commercial, bool) else None,"status": "active" if status == "active" else "unlisted" if status.startswith("unlisted") else status or "unknown","checked": raw.get("checked") or "","schemaUrl": raw.get("schemaUrl") or "",@@ -120,18 +144,15 @@ for raw in DATA["trainers"]:if price:entry.update(price)if tid in USED:- if not entry["commercial"]:- errors.append(f"{tid}: trains on non-commercial weights ({entry['licence']}), so no Fuobe Soul ID target may use it")if entry["status"] not in ("active", "unlisted"):errors.append(f"{tid}: status {status!r}")for f in USED[tid]:if f not in fields:errors.append(f"{tid}: has no {f} field")+ if not entry["loraOutput"]:+ errors.append(f"{tid}: no LoRA field in its response (run scripts/fetch-hosted-schemas.py --trainers)")if not price:errors.append(f"{tid}: can't read its price from {raw.get('price')!r}")- elif not price:- # Not used by a target: kept without a price (the UI never offers it).- passtrainers.append(entry)missing = sorted(set(USED) - {t["id"] for t in trainers})@@ -139,7 +160,7 @@ for tid in missing:errors.append(f"{tid}: not in the research's trainers[]")if errors:- print("gen-trainers: the research breaks the Soul ID rules:", file=sys.stderr)+ print("gen-trainers: a trainer Soul ID uses can't be called as the research stands:", file=sys.stderr)for e in errors:print(f" - {e}", file=sys.stderr)sys.exit(1)@@ -149,7 +170,7 @@ ts = ('import type { HostedTrainer } from "./training";\n\n'"/** When the trainers' schemas and prices were read. */\n"f"export const TRAINERS_AS_OF = {json.dumps(DATA['asOf'])};\n\n"- "/** fal's image LoRA trainers (a zip of 001.jpg + 001.txt pairs in image_data_url), with their fields and prices. */\n"+ "/** fal's LoRA trainers (a zip of 001.jpg + 001.txt pairs, or clips for video), with their fields, prices and licences. */\n"f"export const HOSTED_TRAINERS: HostedTrainer[] = {json.dumps(trainers, indent=2, ensure_ascii=False)};\n")OUT.write_text(ts, encoding="utf-8")diff --git a/src/app/api/elements/[id]/lora/route.ts b/src/app/api/elements/[id]/lora/route.tsindex 85591b44..e155df48 100644--- a/src/app/api/elements/[id]/lora/route.ts+++ b/src/app/api/elements/[id]/lora/route.ts@@ -1,14 +1,15 @@import { z } from "zod";+import { TRAINING_FAMILY_IDS, type TrainingFamily } from "@/lib/catalog/training";import { attachLora } from "@/server/training";import { getElement } from "@/server/elements";const Body = z.object({file: z.string().min(1).max(300),trigger: z.string().max(80).default(""),- family: z.enum(["z-image-turbo", "qwen-image-2512"]).default("z-image-turbo"),+ family: z.enum(TRAINING_FAMILY_IDS as [TrainingFamily, ...TrainingFamily[]]).default("z-image-turbo"),});-/** Attach a LoRA you trained yourself (already in ComfyUI/models/loras): Z-Image Turbo unless it says Qwen-Image 2512. */+/** Attach a LoRA you trained yourself (already in ComfyUI/models/loras): Z-Image Turbo unless it names its family. */export async function POST(request: Request, ctx: RouteContext<"/api/elements/[id]/lora">) {const { id } = await ctx.params;const parsed = Body.safeParse(await request.json().catch(() => null));diff --git a/src/app/api/elements/[id]/training-kit/route.ts b/src/app/api/elements/[id]/training-kit/route.tsindex ef796955..ccc0f0b5 100644--- a/src/app/api/elements/[id]/training-kit/route.ts+++ b/src/app/api/elements/[id]/training-kit/route.ts@@ -1,10 +1,13 @@+import { AITK_FAMILIES, type TrainingFamily } from "@/lib/catalog/training";import { trainingKit } from "@/server/training";-/** Dataset + AI-Toolkit config + README, to train the element's LoRA on any GPU. */-export async function GET(_req: Request, ctx: RouteContext<"/api/elements/[id]/training-kit">) {+/** Dataset + AI-Toolkit config + README, to train the element's LoRA on any GPU (?family= picks the base; Z-Image Turbo by default). */+export async function GET(req: Request, ctx: RouteContext<"/api/elements/[id]/training-kit">) {const { id } = await ctx.params;+ const asked = new URL(req.url).searchParams.get("family") ?? "z-image-turbo";+ if (!AITK_FAMILIES.includes(asked as TrainingFamily)) return Response.json({ error: `AI-Toolkit kits are for ${AITK_FAMILIES.join(", ")}` }, { status: 400 });try {- const kit = await trainingKit(id);+ const kit = await trainingKit(id, asked as TrainingFamily);return new Response(new Uint8Array(kit.data), {headers: { "Content-Type": "application/zip", "Content-Disposition": `attachment; filename="${kit.name}"` },});diff --git a/src/components/element-studio.tsx b/src/components/element-studio.tsxindex 61f8759d..16683d17 100644--- a/src/components/element-studio.tsx+++ b/src/components/element-studio.tsx@@ -24,9 +24,9 @@ export function ElementStudio({ id }: { id: string }) {const el = q.data;const config = useMemo<StudioConfig | null>(() => {if (!el) return null;- // A trained Soul ID runs on its family's lead model (Fuobe Soul, or Soul HD) on both engines: start there.+ // A trained Soul ID runs on its family's lead model (Fuobe Soul, Soul HD, FLUX…): start there, on each engine it has.const fam = el.loras.filter((l) => !l.demo).map(loraFamily).find(Boolean);- const soul = fam ? TRAINING_FAMILIES[fam].lead : null;+ const lead = fam ? TRAINING_FAMILIES[fam].lead : null;return {feature: `element:${el.id}`,title: el.name,@@ -38,7 +38,7 @@ export function ElementStudio({ id }: { id: string }) {: el.kind === "prop"? `Where should ${el.name} show up?`: `What should look like ${el.name}?`,- subtitle: soul+ subtitle: lead? `Trained: @${el.handle} uses its Soul ID on ${TRAINING_FAMILIES[fam!].name}. Mention it in any studio to use ${el.kind === "character" ? "them" : "it"} there too.`: `Mention @${el.handle} in any studio to use ${el.kind === "character" ? "them" : "it"} there too.`,placeholder: `Describe a scene with @${el.handle}…`,@@ -47,7 +47,7 @@ export function ElementStudio({ id }: { id: string }) {feed: { features: [`element:${el.id}`, `character:${el.id}`] },slots: [],multiRef: { label: "Add ref", max: 8 },- defaultModels: soul ? { cloud: soul, open: soul } : { cloud: "nano-banana-pro", open: "oss-qwen-edit" },+ defaultModels: { cloud: lead?.cloud ?? "nano-banana-pro", open: lead?.open ?? "oss-qwen-edit" },};}, [el]);diff --git a/src/components/train-dialog.tsx b/src/components/train-dialog.tsxindex 777f42c7..66557edf 100644--- a/src/components/train-dialog.tsx+++ b/src/components/train-dialog.tsx@@ -1,18 +1,22 @@"use client";import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";-import { AlertTriangle, Check, CircleCheck, Cloud, Cpu, Download, GraduationCap, Loader2, RotateCcw, Trash2 } from "lucide-react";+import { AlertTriangle, Check, ChevronDown, CircleCheck, Cloud, Cpu, Download, GraduationCap, Loader2, RotateCcw, Trash2 } from "lucide-react";import Link from "next/link";import { useId, useState } from "react";import { toast } from "sonner";import { Button } from "@/components/ui/button";import { Checkbox } from "@/components/ui/checkbox";+import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog";import { Input } from "@/components/ui/input";import { Progress } from "@/components/ui/progress";+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";import type { ElementLora, StudioElement } from "@/lib/catalog/elements";import {+ AITK_FAMILIES,identityKey,+ licenceNote,loraFamily,needsConsent,photosBlocker,@@ -36,7 +40,7 @@ interface Training {createdAt: number;}-type Target = TrainingTarget & { blocker: string | null; demo: boolean; licence: string };+type Target = TrainingTarget & { blocker: string | null; demo: boolean };function useTrainings(id: string, open: boolean) {return useQuery({@@ -57,6 +61,12 @@ function engines(l: ElementLora): string {const price = (t: Target) => (t.costUsd === 0 ? "Free" : `$${t.costUsd.toFixed(2)}`);+/** Where a family's LoRA runs: both engines, or the one it has models on. */+function familyEngines(f: TrainingFamily): string {+ const lead = TRAINING_FAMILIES[f].lead;+ return lead.open && lead.cloud ? "Runs on your GPU and in the cloud" : lead.cloud ? "Runs in the cloud" : "Runs on your GPU";+}+/*** Fuobe Soul ID: train the element once (on your GPU or in the cloud), then every @mention on Fuobe Soul, Soul Cinema* and Soul HD uses the trained LoRA on both engines instead of reference photos. Photo rules and the consent line come@@ -66,6 +76,7 @@ export function TrainDialog({ element, open, onOpenChange }: { element: StudioElconst qc = useQueryClient();const q = useTrainings(element.id, open);const [file, setFile] = useState("");+ const [kitFamily, setKitFamily] = useState<TrainingFamily>("z-image-turbo");const [consent, setConsent] = useState(false);const consentId = useId();const photos = element.references.filter((r) => !/\.(wav|mp3|ogg|flac|m4a|webm)$/i.test(r));@@ -101,7 +112,7 @@ export function TrainDialog({ element, open, onOpenChange }: { element: StudioElconst res = await fetch(`/api/elements/${element.id}/lora`, {method: "POST",headers: { "Content-Type": "application/json" },- body: JSON.stringify({ file, trigger: triggerFor(element.handle) }),+ body: JSON.stringify({ file, trigger: triggerFor(element.handle), family: kitFamily }),});const body = await res.json();if (!res.ok) throw new Error(body.error);@@ -126,10 +137,87 @@ export function TrainDialog({ element, open, onOpenChange }: { element: StudioElconst targets = q.data?.targets ?? [];const families = [...new Set(targets.map((t) => t.family))] as TrainingFamily[];const hasFamily = (f: TrainingFamily) => trained.some((l) => !l.demo && loraFamily(l) === f);+ const busyFamily = (f: TrainingFamily) => targets.some((t) => t.family === f && ["queued", "running"].includes(latest(t.id)?.status ?? ""));+ const originals = families.filter((f) => TRAINING_FAMILIES[f].original);+ const more = families.filter((f) => !TRAINING_FAMILIES[f].original);const busyAny = q.data?.items.some((t) => t.status === "queued" || t.status === "running");// "Retrain for Fuobe Soul" on a Higgsfield Soul ID: the first option that can run now.const retrainTarget = targets.find((t) => t.family === "z-image-turbo" && !t.blocker && !t.demo) ?? targets.find((t) => t.family === "z-image-turbo" && !t.blocker);++ const anyTrained = families.some((g) => hasFamily(g));+ /** One family: its models, its licence (information), and where it trains with each one's price first. */+ const familySection = (f: TrainingFamily) => {+ const fam = TRAINING_FAMILIES[f];+ const lic = targets.find((t) => t.family === f);+ return (+ <section key={f} aria-label={fam.name} className="space-y-2">+ <div className="flex flex-wrap items-baseline justify-between gap-x-2">+ <h3 className="text-[14px] font-semibold">{fam.name}</h3>+ <p className="text-[12px] text-muted-foreground">+ {fam.base} LoRA · {familyEngines(f)}+ {anyTrained && !hasFamily(f) ? " · upgrade: the same photos, another model" : ""}+ </p>+ </div>+ {lic && (+ <p className={cn("text-[11.5px]", lic.commercial === true ? "text-muted-foreground" : "text-warning")}>Licence: {licenceNote(lic)}</p>+ )}+ {targets+ .filter((t) => t.family === f)+ .map((t) => {+ const job = latest(t.id);+ const busy = job && (job.status === "queued" || job.status === "running");+ const needConsent = person && !consent;+ const label = busy ? "Training" : hasFamily(f) ? "Retrain" : anyTrained ? "Upgrade" : "Train";+ return (+ <div key={t.id} className={cn("rounded-xl border p-3", busy && "border-primary")}>+ <div className="flex flex-wrap items-start gap-3">+ <span className="mt-0.5 grid size-8 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground">+ {t.engine === "open" ? <Cpu className="size-4" /> : <Cloud className="size-4" />}+ </span>+ <div className="min-w-0 flex-1 basis-48">+ <p className="flex flex-wrap items-center gap-x-2 text-[14px] font-medium">+ {t.name}+ <span className={cn("rounded-full px-2 py-px text-[11.5px] font-medium tabular-nums", t.costUsd === 0 ? "bg-success/15 text-success" : "bg-muted text-foreground")}>{price(t)}</span>+ <span className="text-[12px] font-normal text-muted-foreground">{t.eta}</span>+ </p>+ <p className="text-[12px] text-muted-foreground">{t.description}</p>+ <p className="mt-0.5 text-[11.5px] text-muted-foreground tabular-nums">{t.steps.toLocaleString("en-US")} steps</p>+ </div>+ <Button+ size="sm"+ className="ml-auto"+ variant={busy ? "secondary" : "default"}+ disabled={!!t.blocker || !!tooFew || !!busy || start.isPending || needConsent}+ onClick={() => start.mutate(t.id)}+ >+ {busy && <Loader2 className="animate-spin" />}+ {label}+ </Button>+ </div>+ {!busy && (t.blocker || t.demo) && (+ <p className="mt-2 text-[12px] text-muted-foreground">+ {t.blocker ?? (t.provider === "fal" ? "No fal.ai key yet: this runs as a demo and trains nothing." : "No AI-Toolkit set up yet: this runs as a demo and trains nothing.")}{" "}+ <Link href="/settings" className="text-brand-text underline underline-offset-2">+ Open Settings+ </Link>+ </p>+ )}+ {busy && (+ <div className="mt-3 space-y-1">+ <Progress value={(job.progress ?? 0.05) * 100} className="h-1.5" />+ <p className="text-[12px] text-muted-foreground">{job.message}</p>+ </div>+ )}+ {job?.status === "failed" && <p className="mt-2 text-[12px] text-destructive">{job.error}</p>}+ {job?.status === "succeeded" && job.message && <p className="mt-2 text-[12px] text-warning">{job.message}</p>}+ </div>+ );+ })}+ </section>+ );+ };+return (<Dialog open={open} onOpenChange={onOpenChange}><DialogContent className="max-h-[90svh] overflow-y-auto sm:max-w-[640px]">@@ -239,73 +327,21 @@ export function TrainDialog({ element, open, onOpenChange }: { element: StudioEl{/* Where to train, by family */}<div className="space-y-4">{q.isLoading && <p className="text-[13px] text-muted-foreground">Loading training options…</p>}- {families.map((f, i) => {- const otherTrained = families.some((g) => g !== f && hasFamily(g));- return (- <section key={f} aria-label={TRAINING_FAMILIES[f].name} className="space-y-2">- <div className="flex flex-wrap items-baseline justify-between gap-x-2">- <h3 className="text-[14px] font-semibold">{TRAINING_FAMILIES[f].name}</h3>- <p className="text-[12px] text-muted-foreground">- {TRAINING_FAMILIES[f].base} LoRA{i > 0 && otherTrained && !hasFamily(f) ? " · upgrade: the same photos, another model" : ""}- </p>- </div>- {targets- .filter((t) => t.family === f)- .map((t) => {- const job = latest(t.id);- const busy = job && (job.status === "queued" || job.status === "running");- const needConsent = person && !consent;- const label = busy ? "Training" : hasFamily(f) ? "Retrain" : otherTrained ? "Upgrade" : "Train";- return (- <div key={t.id} className={cn("rounded-xl border p-3", busy && "border-primary")}>- <div className="flex flex-wrap items-start gap-3">- <span className="mt-0.5 grid size-8 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground">- {t.engine === "open" ? <Cpu className="size-4" /> : <Cloud className="size-4" />}- </span>- <div className="min-w-0 flex-1 basis-48">- <p className="flex flex-wrap items-center gap-x-2 text-[14px] font-medium">- {t.name}- <span className={cn("rounded-full px-2 py-px text-[11.5px] font-medium tabular-nums", t.costUsd === 0 ? "bg-success/15 text-success" : "bg-muted text-foreground")}>{price(t)}</span>- <span className="text-[12px] font-normal text-muted-foreground">{t.eta}</span>- </p>- <p className="text-[12px] text-muted-foreground">{t.description}</p>- <p className="mt-0.5 text-[11.5px] text-muted-foreground">- {t.steps.toLocaleString("en-US")} steps · {t.licence} weights, commercial use- </p>- </div>- <Button- size="sm"- className="ml-auto"- variant={busy ? "secondary" : "default"}- disabled={!!t.blocker || !!tooFew || !!busy || start.isPending || needConsent}- onClick={() => start.mutate(t.id)}- >- {busy && <Loader2 className="animate-spin" />}- {label}- </Button>- </div>- {!busy && (t.blocker || t.demo) && (- <p className="mt-2 text-[12px] text-muted-foreground">- {t.blocker ?? (t.provider === "fal" ? "No fal.ai key yet: this runs as a demo and trains nothing." : "No AI-Toolkit set up yet: this runs as a demo and trains nothing.")}{" "}- <Link href="/settings" className="text-brand-text underline underline-offset-2">- Open Settings- </Link>- </p>- )}- {busy && (- <div className="mt-3 space-y-1">- <Progress value={(job.progress ?? 0.05) * 100} className="h-1.5" />- <p className="text-[12px] text-muted-foreground">{job.message}</p>- </div>- )}- {job?.status === "failed" && <p className="mt-2 text-[12px] text-destructive">{job.error}</p>}- {job?.status === "succeeded" && job.message && <p className="mt-2 text-[12px] text-warning">{job.message}</p>}- </div>- );- })}- </section>- );- })}+ {originals.map(familySection)}+ {more.length > 0 && (+ <Collapsible defaultOpen={more.some((f) => hasFamily(f) || busyFamily(f))} className="rounded-xl border">+ <CollapsibleTrigger className="group flex w-full items-center gap-2 px-3 py-2.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/50">+ <span className="min-w-0 flex-1">+ <span className="block text-[14px] font-semibold">More models</span>+ <span className="block text-[12px] text-muted-foreground">{more.map((f) => TRAINING_FAMILIES[f].name).join(" · ")}</span>+ </span>+ <ChevronDown className="size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" />+ </CollapsibleTrigger>+ <CollapsibleContent className="space-y-4 px-3 pb-3">+ {more.map(familySection)}+ </CollapsibleContent>+ </Collapsible>+ )}{person && !consent && targets.length > 0 && <p className="text-[12px] text-muted-foreground">Tick the consent line above to train.</p>}</div>@@ -315,8 +351,20 @@ export function TrainDialog({ element, open, onOpenChange }: { element: StudioElDownload a ready-to-run AI-Toolkit kit (photos, captions, config), train on any GPU, then attach the LoRA file you copied into ComfyUI/models/loras.</p><div className="flex flex-wrap gap-2">+ <Select value={kitFamily} onValueChange={(v) => setKitFamily(v as TrainingFamily)}>+ <SelectTrigger size="sm" className="h-8 w-auto min-w-0" aria-label="Base model">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {AITK_FAMILIES.map((f) => (+ <SelectItem key={f} value={f}>+ {TRAINING_FAMILIES[f].base}+ </SelectItem>+ ))}+ </SelectContent>+ </Select><Button asChild variant="outline" size="sm">- <a href={`/api/elements/${element.id}/training-kit`}>+ <a href={`/api/elements/${element.id}/training-kit?family=${kitFamily}`}><Download /> Training kit</a></Button>diff --git a/src/lib/catalog/cloud-models.generated.ts b/src/lib/catalog/cloud-models.generated.tsindex b0ec7bda..187536ca 100644--- a/src/lib/catalog/cloud-models.generated.ts+++ b/src/lib/catalog/cloud-models.generated.ts@@ -2257,6 +2257,345 @@ export const CLOUD_MODELS: ModelDef[] = ["usd": 0.05}},+ {+ "id": "flux-1-dev-lora-cloud",+ "name": "FLUX.1 [dev] with LoRAs (hosted)",+ "vendor": "Black Forest Labs",+ "family": "flux",+ "engine": "cloud",+ "kind": "image",+ "tagline": "FLUX.1 [dev] with your trained characters and styles \u00b7 non-commercial weights, fal clears its outputs",+ "routes": [+ {+ "op": "t2i",+ "provider": "fal",+ "endpoint": "fal-ai/flux-lora",+ "map": {+ "numOutputs": "num_images",+ "seed": "seed",+ "aspectRatio": {+ "key": "image_size",+ "values": {+ "1:1": "square_hd",+ "4:3": "landscape_4_3",+ "3:4": "portrait_4_3",+ "16:9": "landscape_16_9",+ "9:16": "portrait_16_9",+ "3:2": "landscape_4_3",+ "2:3": "portrait_4_3",+ "21:9": "landscape_16_9",+ "5:4": "landscape_4_3",+ "4:5": "portrait_4_3"+ }+ },+ "loras": {+ "shape": "items",+ "key": "loras",+ "range": {+ "min": 0,+ "max": 4+ }+ }+ }+ }+ ],+ "options": {+ "seed": true,+ "aspectRatios": [+ "1:1",+ "4:3",+ "3:4",+ "16:9",+ "9:16",+ "3:2",+ "2:3",+ "21:9",+ "5:4",+ "4:5"+ ],+ "maxOutputs": 4+ },+ "defaults": {+ "aspectRatio": "3:4"+ },+ "pricing": {+ "unit": "megapixel",+ "usd": 0.035+ }+ },+ {+ "id": "flux-1-krea-lora-cloud",+ "name": "FLUX.1 Krea [dev] with LoRAs (hosted)",+ "vendor": "Black Forest Labs \u00d7 Krea",+ "family": "flux",+ "engine": "cloud",+ "kind": "image",+ "tagline": "Natural photoreal FLUX.1 Krea with FLUX.1 LoRAs \u00b7 non-commercial weights, fal clears its outputs",+ "routes": [+ {+ "op": "t2i",+ "provider": "fal",+ "endpoint": "fal-ai/flux-krea-lora",+ "map": {+ "numOutputs": "num_images",+ "seed": "seed",+ "aspectRatio": {+ "key": "image_size",+ "values": {+ "1:1": "square_hd",+ "4:3": "landscape_4_3",+ "3:4": "portrait_4_3",+ "16:9": "landscape_16_9",+ "9:16": "portrait_16_9",+ "3:2": "landscape_4_3",+ "2:3": "portrait_4_3",+ "21:9": "landscape_16_9",+ "5:4": "landscape_4_3",+ "4:5": "portrait_4_3"+ }+ },+ "loras": {+ "shape": "items",+ "key": "loras",+ "range": {+ "min": 0,+ "max": 4+ }+ }+ }+ }+ ],+ "options": {+ "seed": true,+ "aspectRatios": [+ "1:1",+ "4:3",+ "3:4",+ "16:9",+ "9:16",+ "3:2",+ "2:3",+ "21:9",+ "5:4",+ "4:5"+ ],+ "maxOutputs": 4+ },+ "defaults": {+ "aspectRatio": "3:4"+ },+ "pricing": {+ "unit": "megapixel",+ "usd": 0.035+ }+ },+ {+ "id": "flux-2-dev-lora-cloud",+ "name": "FLUX.2 [dev] with LoRAs (hosted)",+ "vendor": "Black Forest Labs",+ "family": "flux",+ "engine": "cloud",+ "kind": "image",+ "tagline": "FLUX.2 [dev] with your trained characters and styles \u00b7 non-commercial weights, fal clears its outputs",+ "routes": [+ {+ "op": "t2i",+ "provider": "fal",+ "endpoint": "fal-ai/flux-2/lora",+ "map": {+ "numOutputs": "num_images",+ "seed": "seed",+ "aspectRatio": {+ "key": "image_size",+ "values": {+ "1:1": "square_hd",+ "4:3": "landscape_4_3",+ "3:4": "portrait_4_3",+ "16:9": "landscape_16_9",+ "9:16": "portrait_16_9",+ "3:2": "landscape_4_3",+ "2:3": "portrait_4_3",+ "21:9": "landscape_16_9",+ "5:4": "landscape_4_3",+ "4:5": "portrait_4_3"+ }+ },+ "loras": {+ "shape": "items",+ "key": "loras",+ "max": 3,+ "range": {+ "min": 0,+ "max": 4+ }+ }+ }+ }+ ],+ "options": {+ "seed": true,+ "aspectRatios": [+ "1:1",+ "4:3",+ "3:4",+ "16:9",+ "9:16",+ "3:2",+ "2:3",+ "21:9",+ "5:4",+ "4:5"+ ],+ "maxOutputs": 4+ },+ "defaults": {+ "aspectRatio": "3:4"+ },+ "pricing": {+ "unit": "megapixel",+ "usd": 0.021+ }+ },+ {+ "id": "flux-2-klein-9b-lora-cloud",+ "name": "FLUX.2 [klein] 9B with LoRAs (hosted)",+ "vendor": "Black Forest Labs",+ "family": "flux",+ "engine": "cloud",+ "kind": "image",+ "tagline": "The 9B FLUX.2 [klein] with your LoRAs \u00b7 non-commercial weights, fal clears its outputs",+ "routes": [+ {+ "op": "t2i",+ "provider": "fal",+ "endpoint": "fal-ai/flux-2/klein/9b/lora",+ "map": {+ "numOutputs": "num_images",+ "seed": "seed",+ "aspectRatio": {+ "key": "image_size",+ "values": {+ "1:1": "square_hd",+ "4:3": "landscape_4_3",+ "3:4": "portrait_4_3",+ "16:9": "landscape_16_9",+ "9:16": "portrait_16_9",+ "3:2": "landscape_4_3",+ "2:3": "portrait_4_3",+ "21:9": "landscape_16_9",+ "5:4": "landscape_4_3",+ "4:5": "portrait_4_3"+ }+ },+ "loras": {+ "shape": "items",+ "key": "loras",+ "max": 3,+ "range": {+ "min": 0,+ "max": 4+ }+ }+ }+ }+ ],+ "options": {+ "seed": true,+ "aspectRatios": [+ "1:1",+ "4:3",+ "3:4",+ "16:9",+ "9:16",+ "3:2",+ "2:3",+ "21:9",+ "5:4",+ "4:5"+ ],+ "maxOutputs": 4+ },+ "badges": [+ "fast"+ ],+ "defaults": {+ "aspectRatio": "3:4"+ },+ "pricing": {+ "unit": "megapixel",+ "usd": 0.015+ }+ },+ {+ "id": "krea-2-turbo-lora-cloud",+ "name": "Krea 2 Turbo with LoRAs (hosted)",+ "vendor": "Krea",+ "family": "krea",+ "engine": "cloud",+ "kind": "image",+ "tagline": "Krea 2's aesthetic with your trained characters and styles \u00b7 Krea 2 Community licence (revenue tiers)",+ "routes": [+ {+ "op": "t2i",+ "provider": "fal",+ "endpoint": "fal-ai/krea-2/turbo/lora",+ "map": {+ "numOutputs": "num_images",+ "seed": "seed",+ "aspectRatio": {+ "key": "image_size",+ "values": {+ "1:1": "square_hd",+ "4:3": "landscape_4_3",+ "3:4": "portrait_4_3",+ "16:9": "landscape_16_9",+ "9:16": "portrait_16_9",+ "3:2": "landscape_4_3",+ "2:3": "portrait_4_3",+ "21:9": "landscape_16_9",+ "5:4": "landscape_4_3",+ "4:5": "portrait_4_3"+ }+ },+ "loras": {+ "shape": "items",+ "key": "loras",+ "max": 3,+ "range": {+ "min": 0,+ "max": 4+ }+ }+ }+ }+ ],+ "options": {+ "seed": true,+ "aspectRatios": [+ "1:1",+ "4:3",+ "3:4",+ "16:9",+ "9:16",+ "3:2",+ "2:3",+ "21:9",+ "5:4",+ "4:5"+ ],+ "maxOutputs": 4+ },+ "badges": [+ "fast"+ ],+ "defaults": {+ "aspectRatio": "3:4"+ },+ "pricing": {+ "unit": "megapixel",+ "usd": 0.01+ }+ },{"id": "imagen-4","name": "Imagen 4",diff --git a/src/lib/catalog/trainers.generated.ts b/src/lib/catalog/trainers.generated.tsindex 727322cf..ae879b3a 100644--- a/src/lib/catalog/trainers.generated.ts+++ b/src/lib/catalog/trainers.generated.ts@@ -4,15 +4,19 @@ import type { HostedTrainer } from "./training";/** When the trainers' schemas and prices were read. */export const TRAINERS_AS_OF = "2026-10-23";-/** fal's image LoRA trainers (a zip of 001.jpg + 001.txt pairs in image_data_url), with their fields and prices. */+/** fal's LoRA trainers (a zip of 001.jpg + 001.txt pairs, or clips for video), with their fields, prices and licences. */export const HOSTED_TRAINERS: HostedTrainer[] = [{"id": "fal-ai/z-image-turbo-trainer-v2","provider": "fal","family": "Z-Image Turbo","base": "z-image-turbo",+ "media": "image","role": "Soul ID, preset LoRAs (fast, cheapest)","dataField": "image_data_url",+ "loraOutput": [+ "diffusers_lora_file"+ ],"fields": {"default_caption": {"type": "string"@@ -45,8 +49,12 @@ export const HOSTED_TRAINERS: HostedTrainer[] = ["provider": "fal","family": "Z-Image (base)","base": "z-image",+ "media": "image","role": "style LoRAs (training_type content | style | balanced)","dataField": "image_data_url",+ "loraOutput": [+ "diffusers_lora_file"+ ],"fields": {"default_caption": {"type": "string"@@ -88,8 +96,12 @@ export const HOSTED_TRAINERS: HostedTrainer[] = ["provider": "fal","family": "Qwen-Image 2512","base": "qwen-image-2512",+ "media": "image","role": "typography / HD preset LoRAs","dataField": "image_data_url",+ "loraOutput": [+ "diffusers_lora_file"+ ],"fields": {"default_caption": {"type": "string"@@ -122,8 +134,12 @@ export const HOSTED_TRAINERS: HostedTrainer[] = ["provider": "fal","family": "Qwen-Image","base": "qwen-image",+ "media": "image","role": "","dataField": "image_data_url",+ "loraOutput": [+ "lora_file"+ ],"fields": {"image_data_url": {"type": "string"@@ -159,8 +175,12 @@ export const HOSTED_TRAINERS: HostedTrainer[] = ["provider": "fal","family": "Qwen-Image-Edit 2511","base": "qwen-image-edit-2511",+ "media": "image","role": "edit LoRAs (image pairs)","dataField": "image_data_url",+ "loraOutput": [+ "diffusers_lora_file"+ ],"fields": {"default_caption": {"type": "string"@@ -193,8 +213,12 @@ export const HOSTED_TRAINERS: HostedTrainer[] = ["provider": "fal","family": "Qwen-Image-Edit 2509","base": "qwen-image-edit-2509",+ "media": "image","role": "","dataField": "image_data_url",+ "loraOutput": [+ "diffusers_lora_file"+ ],"fields": {"default_caption": {"type": "string"@@ -227,8 +251,12 @@ export const HOSTED_TRAINERS: HostedTrainer[] = ["provider": "fal","family": "FLUX.2 [klein] 4B base","base": "flux-2-klein-4b-base",- "role": "Apache image LoRAs",+ "media": "image",+ "role": "Soul ID on FLUX.2 [klein] 4B (o/soul-id)","dataField": "image_data_url",+ "loraOutput": [+ "diffusers_lora_file"+ ],"fields": {"default_caption": {"type": "string"@@ -269,8 +297,12 @@ export const HOSTED_TRAINERS: HostedTrainer[] = ["provider": "fal","family": "FLUX.2 [klein] 9B base","base": "flux-2-klein-9b-base",- "role": "not for Originals",+ "media": "image",+ "role": "Soul ID on FLUX.2 [klein] 9B (o/soul-id; non-commercial weights, shown as information)","dataField": "image_data_url",+ "loraOutput": [+ "diffusers_lora_file"+ ],"fields": {"default_caption": {"type": "string"@@ -311,8 +343,12 @@ export const HOSTED_TRAINERS: HostedTrainer[] = ["provider": "fal","family": "FLUX.2 [dev]","base": "flux-2-dev",- "role": "not for Originals",+ "media": "image",+ "role": "Soul ID on FLUX.2 [dev] (o/soul-id; non-commercial weights, shown as information)","dataField": "image_data_url",+ "loraOutput": [+ "diffusers_lora_file"+ ],"fields": {"default_caption": {"type": "string"@@ -347,5 +383,1008 @@ export const HOSTED_TRAINERS: HostedTrainer[] = ["priceText": "The cost of training depends on the number of steps. The formula is: 0.0064 * steps. With 1000 steps, your request will cost $6.40.","usdPerStep": 0.0064,"minBilledSteps": 1+ },+ {+ "id": "fal-ai/flux-lora-fast-training",+ "provider": "fal",+ "family": "FLUX.1 [dev]",+ "base": "flux-1-dev",+ "media": "image",+ "role": "not for Originals",+ "dataField": "images_data_url",+ "loraOutput": [+ "diffusers_lora_file"+ ],+ "fields": {+ "create_masks": {+ "type": "boolean",+ "default": true+ },+ "data_archive_format": {+ "type": "string"+ },+ "images_data_url": {+ "type": "string"+ },+ "is_input_format_already_preprocessed": {+ "type": "boolean",+ "default": false+ },+ "is_style": {+ "type": "boolean",+ "default": false+ },+ "steps": {+ "type": "integer",+ "min": 1,+ "max": 10000+ },+ "trigger_word": {+ "type": "string"+ }+ },+ "licence": "FLUX.1 [dev] Non-Commercial License",+ "commercial": false,+ "status": "active",+ "checked": "2026-10-23",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/flux-lora-fast-training",+ "priceText": "Your request will cost $2 per training run (scales linearly with steps). For $2 you can run this model approximately 1 time."+ },+ {+ "id": "fal-ai/flux-lora-portrait-trainer",+ "provider": "fal",+ "family": "FLUX.1 [dev]",+ "base": "flux-1-dev",+ "media": "image",+ "role": "Soul ID on FLUX.1 [dev] and Krea [dev] (o/soul-id; non-commercial weights, shown as information)",+ "dataField": "images_data_url",+ "loraOutput": [+ "diffusers_lora_file"+ ],+ "fields": {+ "create_masks": {+ "type": "boolean",+ "default": false+ },+ "data_archive_format": {+ "type": "string"+ },+ "images_data_url": {+ "type": "string"+ },+ "learning_rate": {+ "type": "number",+ "default": 9e-05,+ "min": 1e-06,+ "max": 0.001+ },+ "multiresolution_training": {+ "type": "boolean",+ "default": true+ },+ "resume_from_checkpoint": {+ "type": "string",+ "default": ""+ },+ "steps": {+ "type": "integer",+ "default": 2500,+ "min": 1,+ "max": 10000+ },+ "subject_crop": {+ "type": "boolean",+ "default": true+ },+ "trigger_phrase": {+ "type": "string"+ }+ },+ "licence": "FLUX.1 [dev] Non-Commercial License",+ "commercial": false,+ "status": "active",+ "checked": "2026-10-23",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/flux-lora-portrait-trainer",+ "priceText": "Training costs $2.40 for 1,000 requested steps, with a minimum charge of $2.40. Above the minimum, the cost scales at approximately $0.0024 per requested step; for example, 2,000 steps cost $4.80.",+ "usdPerStep": 0.0024,+ "minBilledSteps": 1000+ },+ {+ "id": "fal-ai/krea-2-trainer",+ "provider": "fal",+ "family": "Krea 2",+ "base": "krea-2",+ "media": "image",+ "role": "Soul ID on Krea 2 (o/soul-id; revenue-tier licence, shown as information)",+ "dataField": "images_data_url",+ "loraOutput": [+ "lora_file"+ ],+ "fields": {+ "auto_captioning": {+ "type": "string",+ "enum": [+ "Off",+ "Object/Character",+ "Style",+ "Custom"+ ],+ "default": "Off"+ },+ "debug_dataset": {+ "type": "boolean",+ "default": false+ },+ "images_data_url": {+ "type": "string"+ },+ "learning_rate": {+ "type": "number",+ "default": 0.0005,+ "min": 1e-06,+ "max": 0.01+ },+ "resolution": {+ "type": "integer",+ "enum": [+ 768,+ 1024+ ],+ "default": 768+ },+ "steps": {+ "type": "integer",+ "default": 100,+ "min": 50,+ "max": 10000+ },+ "trigger_phrase": {+ "type": "string",+ "default": ""+ }+ },+ "licence": "Krea 2 Community License (gated, revenue tiers)",+ "commercial": null,+ "status": "active",+ "checked": "2026-10-23",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/krea-2-trainer",+ "priceText": "Your request will cost $0.003 per step (minimum of 100 steps is charged). For $3.00 you can fine-tune a LoRA for 1000 steps.",+ "usdPerStep": 0.003,+ "minBilledSteps": 100+ },+ {+ "id": "fal-ai/wan-22-image-trainer",+ "provider": "fal",+ "family": "Wan 2.2 (image)",+ "base": "wan-2-2-image",+ "media": "image",+ "role": "",+ "dataField": "training_data_url",+ "loraOutput": [+ "diffusers_lora_file",+ "high_noise_lora"+ ],+ "fields": {+ "include_synthetic_captions": {+ "type": "boolean",+ "default": false+ },+ "is_style": {+ "type": "boolean",+ "default": false+ },+ "learning_rate": {+ "type": "number",+ "default": 0.0007,+ "min": 1e-06,+ "max": 0.1+ },+ "steps": {+ "type": "integer",+ "default": 1000,+ "min": 10,+ "max": 6000+ },+ "training_data_url": {+ "type": "string"+ },+ "trigger_phrase": {+ "type": "string"+ },+ "use_face_cropping": {+ "type": "boolean",+ "default": false+ },+ "use_face_detection": {+ "type": "boolean",+ "default": true+ },+ "use_masks": {+ "type": "boolean",+ "default": true+ }+ },+ "licence": "Apache-2.0",+ "commercial": true,+ "status": "active",+ "checked": "2026-10-23",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/wan-22-image-trainer",+ "priceText": "Your request will cost $0.0045 per step (minimum of 100 steps is charged). For $4.5 you can fine-tune a LoRA for 1000 steps.",+ "usdPerStep": 0.0045,+ "minBilledSteps": 100+ },+ {+ "id": "fal-ai/wan-22-trainer/i2v-a14b",+ "provider": "fal",+ "family": "Wan 2.2 A14B I2V",+ "base": "wan-2-2-a14b-i2v",+ "media": "video",+ "role": "camera / VFX LoRAs for Motions and Effects",+ "dataField": "training_data_url",+ "loraOutput": [+ "lora_file"+ ],+ "fields": {+ "auto_scale_input": {+ "type": "boolean",+ "default": false+ },+ "learning_rate": {+ "type": "number",+ "default": 0.0002,+ "min": 1e-06,+ "max": 1+ },+ "number_of_steps": {+ "type": "integer",+ "default": 400,+ "min": 100,+ "max": 20000+ },+ "training_data_url": {+ "type": "string"+ },+ "trigger_phrase": {+ "type": "string",+ "default": ""+ }+ },+ "licence": "Apache-2.0",+ "commercial": true,+ "status": "active",+ "checked": "2026-10-23",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/wan-22-trainer/i2v-a14b",+ "priceText": "Your request will cost $0.005 per step (minimum of 100 steps is charged). For $5 you can fine-tune a LoRA for 1000 steps.",+ "usdPerStep": 0.005,+ "minBilledSteps": 100+ },+ {+ "id": "fal-ai/wan-22-trainer/t2v-a14b",+ "provider": "fal",+ "family": "Wan 2.2 A14B T2V",+ "base": "wan-2-2-a14b-t2v",+ "media": "video",+ "role": "",+ "dataField": "training_data_url",+ "loraOutput": [+ "lora_file"+ ],+ "fields": {+ "auto_scale_input": {+ "type": "boolean",+ "default": false+ },+ "learning_rate": {+ "type": "number",+ "default": 0.0002,+ "min": 1e-06,+ "max": 1+ },+ "number_of_steps": {+ "type": "integer",+ "default": 400,+ "min": 100,+ "max": 20000+ },+ "training_data_url": {+ "type": "string"+ },+ "trigger_phrase": {+ "type": "string",+ "default": ""+ }+ },+ "licence": "Apache-2.0",+ "commercial": true,+ "status": "active",+ "checked": "2026-10-23",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/wan-22-trainer/t2v-a14b",+ "priceText": "Your request will cost $0.004 per step (minimum of 100 steps is charged). For $4 you can fine-tune a LoRA for 1000 steps.",+ "usdPerStep": 0.004,+ "minBilledSteps": 100+ },+ {+ "id": "fal-ai/wan-trainer/i2v-720p",+ "provider": "fal",+ "family": "Wan 2.1 I2V 720p",+ "base": "wan-2-1-i2v-720p",+ "media": "video",+ "role": "",+ "dataField": "training_data_url",+ "loraOutput": [+ "lora_file"+ ],+ "fields": {+ "auto_scale_input": {+ "type": "boolean",+ "default": false+ },+ "learning_rate": {+ "type": "number",+ "default": 0.0002,+ "min": 1e-06,+ "max": 1+ },+ "number_of_steps": {+ "type": "integer",+ "default": 400,+ "min": 100,+ "max": 20000+ },+ "training_data_url": {+ "type": "string"+ },+ "trigger_phrase": {+ "type": "string",+ "default": ""+ }+ },+ "licence": "Apache-2.0",+ "commercial": true,+ "status": "active",+ "checked": "2026-10-23",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/wan-trainer/i2v-720p",+ "priceText": "$0.005 per steps",+ "usdPerStep": 0.005,+ "minBilledSteps": 1+ },+ {+ "id": "fal-ai/ltx23-trainer-v2/i2v",+ "provider": "fal",+ "family": "LTX-2.3",+ "base": "ltx-2-3",+ "media": "video",+ "role": "LTX motion LoRAs",+ "dataField": "training_data_url",+ "loraOutput": [+ "lora_file"+ ],+ "fields": {+ "aspect_ratio": {+ "type": "string",+ "enum": [+ "16:9",+ "1:1",+ "9:16"+ ],+ "default": "1:1"+ },+ "audio_normalize": {+ "type": "boolean",+ "default": true+ },+ "audio_preserve_pitch": {+ "type": "boolean",+ "default": true+ },+ "auto_scale_input": {+ "type": "boolean",+ "default": false+ },+ "debug_dataset": {+ "type": "boolean",+ "default": false+ },+ "first_frame_conditioning_p": {+ "type": "number",+ "default": 0.5,+ "min": 0,+ "max": 1+ },+ "frame_rate": {+ "type": "integer",+ "default": 24,+ "min": 8,+ "max": 60+ },+ "learning_rate": {+ "type": "number",+ "default": 0.0002,+ "min": 1e-06,+ "max": 1+ },+ "number_of_frames": {+ "type": "integer",+ "default": 89,+ "min": 9,+ "max": 121+ },+ "number_of_steps": {+ "type": "integer",+ "default": 2000,+ "min": 100,+ "max": 10000+ },+ "rank": {+ "type": "integer",+ "enum": [+ 8,+ 16,+ 32,+ 64,+ 128+ ],+ "default": 32+ },+ "resolution": {+ "type": "string",+ "enum": [+ "low",+ "medium",+ "high"+ ],+ "default": "medium"+ },+ "split_input_duration_threshold": {+ "type": "number",+ "default": 30,+ "min": 1,+ "max": 60+ },+ "split_input_into_scenes": {+ "type": "boolean",+ "default": true+ },+ "stg_scale": {+ "type": "number",+ "default": 1,+ "min": 0,+ "max": 3+ },+ "training_data_url": {+ "type": "string"+ },+ "trigger_phrase": {+ "type": "string",+ "default": ""+ },+ "validation": {+ "type": "array"+ },+ "validation_aspect_ratio": {+ "type": "string",+ "enum": [+ "16:9",+ "1:1",+ "9:16"+ ],+ "default": "1:1"+ },+ "validation_frame_rate": {+ "type": "integer",+ "default": 24,+ "min": 8,+ "max": 60+ },+ "validation_negative_prompt": {+ "type": "string",+ "default": "\"blurry,"+ },+ "validation_number_of_frames": {+ "type": "integer",+ "default": 89,+ "min": 9,+ "max": 121+ },+ "validation_resolution": {+ "type": "string",+ "enum": [+ "low",+ "medium",+ "high"+ ],+ "default": "high"+ },+ "with_audio": {+ "type": "boolean"+ }+ },+ "licence": "LTX-2 / LTX-2.x Community License",+ "commercial": true,+ "status": "active",+ "checked": "2026-10-23",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/ltx23-trainer-v2/i2v",+ "priceText": "The cost of training depends on the number of steps. The formula is: 0.0024 * steps. With 1000 steps, your request will cost $2.40.",+ "usdPerStep": 0.0024,+ "minBilledSteps": 1+ },+ {+ "id": "fal-ai/ltx23-trainer-v2/t2v",+ "provider": "fal",+ "family": "LTX-2.3",+ "base": "ltx-2-3",+ "media": "video",+ "role": "",+ "dataField": "training_data_url",+ "loraOutput": [+ "lora_file"+ ],+ "fields": {+ "aspect_ratio": {+ "type": "string",+ "enum": [+ "16:9",+ "1:1",+ "9:16"+ ],+ "default": "1:1"+ },+ "audio_normalize": {+ "type": "boolean",+ "default": true+ },+ "audio_preserve_pitch": {+ "type": "boolean",+ "default": true+ },+ "auto_scale_input": {+ "type": "boolean",+ "default": false+ },+ "debug_dataset": {+ "type": "boolean",+ "default": false+ },+ "frame_rate": {+ "type": "integer",+ "default": 24,+ "min": 8,+ "max": 60+ },+ "learning_rate": {+ "type": "number",+ "default": 0.0002,+ "min": 1e-06,+ "max": 1+ },+ "number_of_frames": {+ "type": "integer",+ "default": 89,+ "min": 9,+ "max": 121+ },+ "number_of_steps": {+ "type": "integer",+ "default": 2000,+ "min": 100,+ "max": 10000+ },+ "rank": {+ "type": "integer",+ "enum": [+ 8,+ 16,+ 32,+ 64,+ 128+ ],+ "default": 32+ },+ "resolution": {+ "type": "string",+ "enum": [+ "low",+ "medium",+ "high"+ ],+ "default": "medium"+ },+ "split_input_duration_threshold": {+ "type": "number",+ "default": 30,+ "min": 1,+ "max": 60+ },+ "split_input_into_scenes": {+ "type": "boolean",+ "default": true+ },+ "stg_scale": {+ "type": "number",+ "default": 1,+ "min": 0,+ "max": 3+ },+ "training_data_url": {+ "type": "string"+ },+ "trigger_phrase": {+ "type": "string",+ "default": ""+ },+ "validation": {+ "type": "array"+ },+ "validation_aspect_ratio": {+ "type": "string",+ "enum": [+ "16:9",+ "1:1",+ "9:16"+ ],+ "default": "1:1"+ },+ "validation_frame_rate": {+ "type": "integer",+ "default": 24,+ "min": 8,+ "max": 60+ },+ "validation_negative_prompt": {+ "type": "string",+ "default": "\"blurry,"+ },+ "validation_number_of_frames": {+ "type": "integer",+ "default": 89,+ "min": 9,+ "max": 121+ },+ "validation_resolution": {+ "type": "string",+ "enum": [+ "low",+ "medium",+ "high"+ ],+ "default": "high"+ },+ "with_audio": {+ "type": "boolean"+ }+ },+ "licence": "LTX-2 / LTX-2.x Community License",+ "commercial": true,+ "status": "active",+ "checked": "2026-10-23",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/ltx23-trainer-v2/t2v",+ "priceText": "The cost of training depends on the number of steps. The formula is: 0.006 * steps. With 1000 steps, your request will cost $6.00.",+ "usdPerStep": 0.006,+ "minBilledSteps": 1+ },+ {+ "id": "fal-ai/ltx23-trainer-v2/ic-lora/v2v",+ "provider": "fal",+ "family": "LTX-2.3 IC-LoRA",+ "base": "ltx-2-3-ic-lora",+ "media": "video",+ "role": "video-to-video effects",+ "dataField": "training_data_url",+ "loraOutput": [+ "lora_file"+ ],+ "fields": {+ "aspect_ratio": {+ "type": "string",+ "enum": [+ "16:9",+ "1:1",+ "9:16"+ ],+ "default": "1:1"+ },+ "auto_scale_input": {+ "type": "boolean",+ "default": false+ },+ "debug_dataset": {+ "type": "boolean",+ "default": false+ },+ "first_frame_conditioning_p": {+ "type": "number",+ "default": 0.1,+ "min": 0,+ "max": 1+ },+ "frame_rate": {+ "type": "integer",+ "default": 24,+ "min": 8,+ "max": 60+ },+ "learning_rate": {+ "type": "number",+ "default": 0.0002,+ "min": 1e-06,+ "max": 1+ },+ "number_of_frames": {+ "type": "integer",+ "default": 89,+ "min": 9,+ "max": 121+ },+ "number_of_steps": {+ "type": "integer",+ "default": 3000,+ "min": 100,+ "max": 10000+ },+ "rank": {+ "type": "integer",+ "enum": [+ 8,+ 16,+ 32,+ 64,+ 128+ ],+ "default": 32+ },+ "reference_downscale_factor": {+ "type": "integer",+ "default": 1,+ "min": 1,+ "max": 8+ },+ "reference_temporal_scale_factor": {+ "type": "integer",+ "default": 1,+ "min": 1,+ "max": 8+ },+ "resolution": {+ "type": "string",+ "enum": [+ "low",+ "medium",+ "high"+ ],+ "default": "medium"+ },+ "split_input_duration_threshold": {+ "type": "number",+ "default": 30,+ "min": 1,+ "max": 60+ },+ "split_input_into_scenes": {+ "type": "boolean",+ "default": true+ },+ "stg_scale": {+ "type": "number",+ "default": 1,+ "min": 0,+ "max": 3+ },+ "training_data_url": {+ "type": "string"+ },+ "trigger_phrase": {+ "type": "string",+ "default": ""+ },+ "validation": {+ "type": "array"+ },+ "validation_aspect_ratio": {+ "type": "string",+ "enum": [+ "16:9",+ "1:1",+ "9:16"+ ],+ "default": "1:1"+ },+ "validation_frame_rate": {+ "type": "integer",+ "default": 24,+ "min": 8,+ "max": 60+ },+ "validation_negative_prompt": {+ "type": "string",+ "default": "\"blurry,"+ },+ "validation_number_of_frames": {+ "type": "integer",+ "default": 89,+ "min": 9,+ "max": 121+ },+ "validation_resolution": {+ "type": "string",+ "enum": [+ "low",+ "medium",+ "high"+ ],+ "default": "high"+ }+ },+ "licence": "LTX-2 / LTX-2.x Community License",+ "commercial": true,+ "status": "active",+ "checked": "2026-10-23",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/ltx23-trainer-v2/ic-lora/v2v",+ "priceText": "The cost of training depends on the number of steps. The formula is: 0.0059 * steps. With 1000 steps, your request will cost $5.90.",+ "usdPerStep": 0.0059,+ "minBilledSteps": 1+ },+ {+ "id": "fal-ai/ltx23-video-trainer",+ "provider": "fal",+ "family": "LTX-2.3",+ "base": "ltx-2-3",+ "media": "video",+ "role": "",+ "dataField": "training_data_url",+ "loraOutput": [+ "lora_file"+ ],+ "fields": {+ "aspect_ratio": {+ "type": "string",+ "enum": [+ "16:9",+ "1:1",+ "9:16"+ ],+ "default": "1:1"+ },+ "audio_normalize": {+ "type": "boolean",+ "default": true+ },+ "audio_preserve_pitch": {+ "type": "boolean",+ "default": true+ },+ "auto_scale_input": {+ "type": "boolean",+ "default": false+ },+ "debug_dataset": {+ "type": "boolean",+ "default": false+ },+ "first_frame_conditioning_p": {+ "type": "number",+ "default": 0.5,+ "min": 0,+ "max": 1+ },+ "frame_rate": {+ "type": "integer",+ "default": 25,+ "min": 8,+ "max": 60+ },+ "generate_audio_in_validation": {+ "type": "boolean",+ "default": true+ },+ "learning_rate": {+ "type": "number",+ "default": 0.0002,+ "min": 1e-06,+ "max": 1+ },+ "number_of_frames": {+ "type": "integer",+ "default": 89,+ "min": 9,+ "max": 121+ },+ "number_of_steps": {+ "type": "integer",+ "default": 2000,+ "min": 100,+ "max": 6000+ },+ "rank": {+ "type": "integer",+ "enum": [+ 8,+ 16,+ 32,+ 64,+ 128+ ],+ "default": 32+ },+ "resolution": {+ "type": "string",+ "enum": [+ "low",+ "medium",+ "high"+ ],+ "default": "medium"+ },+ "split_input_duration_threshold": {+ "type": "number",+ "default": 30,+ "min": 1,+ "max": 60+ },+ "split_input_into_scenes": {+ "type": "boolean",+ "default": true+ },+ "stg_scale": {+ "type": "number",+ "default": 1,+ "min": 0,+ "max": 3+ },+ "training_data_url": {+ "type": "string"+ },+ "trigger_phrase": {+ "type": "string",+ "default": ""+ },+ "validation": {+ "type": "array"+ },+ "validation_aspect_ratio": {+ "type": "string",+ "enum": [+ "16:9",+ "1:1",+ "9:16"+ ],+ "default": "1:1"+ },+ "validation_frame_rate": {+ "type": "integer",+ "default": 25,+ "min": 8,+ "max": 60+ },+ "validation_negative_prompt": {+ "type": "string",+ "default": "worst quality, inconsistent motion, blurry, jittery, distorted"+ },+ "validation_number_of_frames": {+ "type": "integer",+ "default": 89,+ "min": 9,+ "max": 121+ },+ "validation_resolution": {+ "type": "string",+ "enum": [+ "low",+ "medium",+ "high"+ ],+ "default": "high"+ },+ "with_audio": {+ "type": "boolean"+ }+ },+ "licence": "LTX-2 / LTX-2.x Community License",+ "commercial": true,+ "status": "active",+ "checked": "2026-10-23",+ "schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/ltx23-video-trainer",+ "priceText": "Your request will cost $0.0048 per step. For example, the default 2000-step training will cost $9.60.",+ "usdPerStep": 0.0048,+ "minBilledSteps": 1}];diff --git a/src/lib/catalog/training.ts b/src/lib/catalog/training.tsindex 47774f25..c2c9a7a6 100644--- a/src/lib/catalog/training.ts+++ b/src/lib/catalog/training.ts@@ -2,14 +2,17 @@* Fuobe Soul ID (build plan O3): a character or a style trained as a LoRA on open weights, on either engine* (AI-Toolkit on the user's GPU, or fal's hosted trainers), then used whenever the element is @mentioned on a* model of the family it was trained for: Fuobe Soul and Soul Cinema (Z-Image Turbo), Fuobe Soul HD- * (Qwen-Image 2512), and the plain open-weight models of the same base. Pure logic, no I/O.+ * (Qwen-Image 2512), and every other base fal or AI-Toolkit trains (FLUX.1 / FLUX.2 [dev], FLUX.2 [klein] 4B and 9B,+ * Krea 2) on the models of that base. Pure logic, no I/O.*- * - A LoRA belongs to a family (its base), not to one model, and works on both engines: a LoRA trained on fal is- * downloaded into ComfyUI for open runs, one trained on the user's GPU is copied to the cloud provider for cloud- * runs (src/server/loras.ts). Another family means training again on the same photos ("Upgrade character"), as- * Higgsfield retrains a Soul ID per model family.- * - The hosted trainers' fields and prices are generated from the research (trainers.generated.ts by- * scripts/gen-trainers.py); every one a target uses trains on commercial weights (Apache-2.0).+ * - A LoRA belongs to a family (its base), not to one model, and works on both engines where the family has models:+ * a LoRA trained on fal is downloaded into ComfyUI for open runs, one trained on the user's GPU is copied to the+ * cloud provider for cloud runs (src/server/loras.ts). Another family means training again on the same photos+ * ("Upgrade character"), as Higgsfield retrains a Soul ID per model family.+ * - The hosted trainers' fields, prices, response fields and licences are generated from the research+ * (trainers.generated.ts by scripts/gen-trainers.py). Licences are information, never a gate (the owner's decision+ * of 2026-10-27): every target says the licence of the weights it trains on and whether they allow selling+ * outputs, and the admin turns models on or off in Settings.* - Photo rules and the consent line follow Higgsfield's character flow (docs/research/higgsfield-originals-5.md* §3.4, higgsfield-delta-4.md G18): 20+ photos recommended, 80 at most, one person, a full-body shot, consent* before a person's photos are trained.@@ -21,7 +24,7 @@ import type { Engine, ModelDef } from "./types";export type TrainingProvider = "fal" | "ai-toolkit";/** The base a LoRA is trained on. A trained LoRA works on every model of its family. */-export type TrainingFamily = "z-image-turbo" | "qwen-image-2512";+export type TrainingFamily = "z-image-turbo" | "qwen-image-2512" | "flux1-dev" | "flux2-dev" | "flux2-klein-4b" | "flux2-klein-9b" | "krea-2";/** What a training learns: a subject (a person, a place, an object) or a style (a moodboard). */export type TrainingKind = "subject" | "style";@@ -32,7 +35,7 @@ export interface TrainerField {default?: string | number | boolean;min?: number;max?: number;- enum?: string[];+ enum?: (string | number)[];}/** A hosted LoRA trainer (generated from the research by scripts/gen-trainers.py). */@@ -44,13 +47,17 @@ export interface HostedTrainer {family: string;/** The base as a slug ("z-image-turbo", "z-image", "qwen-image-2512"). */base: string;+ /** What it learns from: photos (a subject or a look) or clips (a motion). */+ media: "image" | "video";role: string;- /** Where the zip of 001.jpg + 001.txt pairs goes. */+ /** Where the zip of 001.jpg + 001.txt pairs goes (image_data_url, images_data_url or training_data_url). */dataField: string;+ /** The response fields that hold the trained LoRA, the one to use first (diffusers_lora_file, lora_file). */+ loraOutput: string[];fields: Record<string, TrainerField>;licence: string;- /** The weights it trains on allow selling outputs. */- commercial: boolean;+ /** The weights it trains on allow selling outputs: true, false (non-commercial) or null (a revenue tier decides). Information, not a gate. */+ commercial: boolean | null;status: string;checked: string;schemaUrl: string;@@ -64,7 +71,7 @@ export interface TrainingTarget {id: string;/** Short: where it trains ("Your GPU", "Cloud"). The family says what for. */name: string;- /** The engine the training runs on (the LoRA then works on both). */+ /** The engine the training runs on (the LoRA then works on both where its family has models). */engine: Engine;provider: TrainingProvider;family: TrainingFamily;@@ -73,9 +80,9 @@ export interface TrainingTarget {trainer?: string;steps: number;learningRate?: number;- /** Other fields sent to the trainer (fal's training_type). */- extra?: Record<string, string>;- /** Models the trained LoRA applies to (the family's, on both engines). */+ /** Other fields sent to the trainer when its schema has them (fal's training_type, Krea 2's resolution). */+ extra?: Record<string, string | number | boolean>;+ /** Models the trained LoRA applies to (the family's, on the engines each runs on). */modelIds: string[];minImages: number;description: string;@@ -85,24 +92,98 @@ export interface TrainingTarget {costUsd: number;/** Rough wall-clock time. */eta: string;+ /** The licence of the weights it trains on (the LoRA inherits it), shown as information. */+ licence: string;+ /** Those weights allow selling outputs: true, false (non-commercial) or null (a revenue tier decides). */+ commercial: boolean | null;}-/** The families, in the order the Train dialog shows them; `lead` is the model a trained element is shown for. */-export const TRAINING_FAMILIES: Record<TrainingFamily, { name: string; base: string; lead: string; models: string[] }> = {+export interface FamilyInfo {+ /** What the dialog calls it: the models a trained LoRA runs on. */+ name: string;+ /** The base model the LoRA is trained on. */+ base: string;+ /** A Fuobe Original's family (Fuobe Soul, Soul HD): shown first; the others are under "More models". */+ original: boolean;+ /** The model a trained element opens on, per engine (an Original's is the same model on both). */+ lead: Partial<Record<Engine, string>>;+ /** Every model a LoRA of this family runs on (on the engines each runs on). */+ models: string[];+ /** fal's trainer for this base: the family's licence is the licence of the weights it trains. */+ trainer: string;+}++/**+ * The families, in the order the Train dialog shows them: Fuobe's Originals first, then every other base a hosted+ * trainer or AI-Toolkit trains, on the models of that base Fuobe runs (both engines where it has them).+ */+export const TRAINING_FAMILIES: Record<TrainingFamily, FamilyInfo> = {"z-image-turbo": {name: "Fuobe Soul and Soul Cinema",base: "Z-Image Turbo",- lead: "fuobe-soul",+ original: true,+ lead: { open: "fuobe-soul", cloud: "fuobe-soul" },models: ["fuobe-soul", "fuobe-soul-cinema", "oss-z-image-turbo", "z-image-turbo-cloud"],+ trainer: "fal-ai/z-image-turbo-trainer-v2",},"qwen-image-2512": {name: "Fuobe Soul HD",base: "Qwen-Image 2512",- lead: "fuobe-soul-hd",+ original: true,+ lead: { open: "fuobe-soul-hd", cloud: "fuobe-soul-hd" },models: ["fuobe-soul-hd", "oss-qwen-image", "oss-qwen-image-lightning", "qwen-image-2512-cloud"],+ trainer: "fal-ai/qwen-image-2512-trainer",+ },+ "flux1-dev": {+ name: "FLUX.1 [dev] and Krea [dev]",+ base: "FLUX.1 [dev]",+ original: false,+ lead: { open: "oss-flux1-dev", cloud: "flux-1-dev-lora-cloud" },+ models: ["oss-flux1-dev", "oss-flux1-krea", "flux-1-dev-lora-cloud", "flux-1-krea-lora-cloud"],+ trainer: "fal-ai/flux-lora-portrait-trainer",+ },+ "flux2-dev": {+ name: "FLUX.2 [dev]",+ base: "FLUX.2 [dev]",+ original: false,+ lead: { open: "oss-flux2-dev", cloud: "flux-2-dev-lora-cloud" },+ models: ["oss-flux2-dev", "oss-flux2-dev-turbo", "flux-2-dev-lora-cloud"],+ trainer: "fal-ai/flux-2-trainer-v2",+ },+ "flux2-klein-4b": {+ name: "FLUX.2 [klein] 4B",+ base: "FLUX.2 [klein] 4B",+ original: false,+ lead: { cloud: "flux-2-klein-4b-cloud" },+ models: ["flux-2-klein-4b-cloud"],+ trainer: "fal-ai/flux-2-klein-4b-base-trainer",+ },+ "flux2-klein-9b": {+ name: "FLUX.2 [klein] 9B",+ base: "FLUX.2 [klein] 9B",+ original: false,+ lead: { cloud: "flux-2-klein-9b-lora-cloud" },+ models: ["flux-2-klein-9b-lora-cloud"],+ trainer: "fal-ai/flux-2-klein-9b-base-trainer",+ },+ "krea-2": {+ name: "Krea 2",+ base: "Krea 2",+ original: false,+ lead: { cloud: "krea-2-turbo-lora-cloud" },+ models: ["krea-2-turbo-lora-cloud"],+ trainer: "fal-ai/krea-2-trainer",},};+export const TRAINING_FAMILY_IDS = Object.keys(TRAINING_FAMILIES) as TrainingFamily[];++/** The model a family's LoRA is recorded for, and a trained element opens on: the engine's own lead, else the other's. */+export function familyLead(f: TrainingFamily, engine?: Engine): string {+ const lead = TRAINING_FAMILIES[f].lead;+ return (engine && lead[engine]) || lead.cloud || lead.open || "";+}+/** Higgsfield's character flow, as limits (research §3.4): 20+ photos recommended, 80 at most on the web. */export const SOUL_ID_PHOTOS = { min: 5, recommended: 20, max: 80, minSide: 512 } as const;@@ -128,6 +209,18 @@ export const SOUL_ID_COPY = {const trainers = new Map(HOSTED_TRAINERS.map((t) => [t.id, t]));export const getTrainer = (id: string | undefined): HostedTrainer | undefined => (id ? trainers.get(id) : undefined);+/** The licence of a family's base weights (its fal trainer's), as information. */+export function familyLicence(f: TrainingFamily): { licence: string; commercial: boolean | null } {+ const tr = getTrainer(TRAINING_FAMILIES[f].trainer);+ return { licence: tr?.licence ?? "", commercial: tr?.commercial ?? null };+}++/** How the licence reads next to a price: "Apache-2.0 · commercial use", "… · non-commercial weights", "… · check its revenue tiers". */+export function licenceNote(l: { licence: string; commercial: boolean | null }): string {+ const use = l.commercial === true ? "commercial use" : l.commercial === false ? "non-commercial weights" : "check its revenue tiers";+ return l.licence ? `${l.licence} · ${use}` : use;+}+/** What fal bills for this many steps on this trainer (its per-step price above its minimum), in US dollars. */export function trainerCost(trainer: Pick<HostedTrainer, "usdPerStep" | "minBilledSteps"> | undefined, steps: number): number | null {if (!trainer?.usdPerStep) return null;@@ -137,22 +230,29 @@ export function trainerCost(trainer: Pick<HostedTrainer, "usdPerStep" | "minBillconst usd = (n: number) => `$${n.toFixed(2)}`;const thousands = (n: number) => n.toLocaleString("en-US");-function target(t: Omit<TrainingTarget, "modelIds" | "price" | "costUsd" | "minImages">): TrainingTarget {+function target(t: Omit<TrainingTarget, "modelIds" | "price" | "costUsd" | "minImages" | "licence" | "commercial">): TrainingTarget {const cost = t.provider === "fal" ? trainerCost(getTrainer(t.trainer), t.steps) : 0;if (cost === null) throw new Error(`${t.id}: its trainer ${t.trainer} has no price (run pnpm gen:catalog)`);+ const tr = getTrainer(t.trainer);return {...t,modelIds: TRAINING_FAMILIES[t.family].models,minImages: SOUL_ID_PHOTOS.min,costUsd: cost,price: cost === 0 ? "Free" : `≈ ${usd(cost)} (${thousands(t.steps)} steps)`,+ ...(tr ? { licence: tr.licence, commercial: tr.commercial } : familyLicence(t.family)),};}+const LOCAL = "Nothing leaves your machine.";+const TO_FAL = "Your photos go to fal for the training.";+/**- * Where a Soul ID trains (research §3.3, §4.5, plan O3). Z-Image Turbo: AI-Toolkit with ostris's training adapter v2 on- * the user's GPU, or fal's Z-Image Turbo trainer v2 (2,000 steps at 5e-4). A style (a moodboard) on the cloud trains on- * fal's Z-Image trainer with training_type style. Fuobe Soul HD: fal's Qwen-Image 2512 trainer.+ * Where a Soul ID trains (research §3.3, §4.5, plan O3), family by family. Fuobe Soul (Z-Image Turbo): AI-Toolkit+ * with ostris's training adapter v2 on the user's GPU, or fal's Z-Image Turbo trainer v2 (2,000 steps at 5e-4); a+ * style (a moodboard) in the cloud trains on fal's Z-Image trainer with training_type style. Fuobe Soul HD: fal's+ * Qwen-Image 2512 trainer, or AI-Toolkit. The other bases train on their fal trainer at its own defaults (steps,+ * learning rate), and on AI-Toolkit where it supports the base and Fuobe runs it on the open engine.*/export const TRAINING_TARGETS: TrainingTarget[] = [target({@@ -163,7 +263,7 @@ export const TRAINING_TARGETS: TrainingTarget[] = [family: "z-image-turbo",kinds: ["subject", "style"],steps: 2000,- description: "AI-Toolkit on your own GPU (24 GB), with ostris's Z-Image Turbo training adapter. Nothing leaves your machine.",+ description: `AI-Toolkit on your own GPU (24 GB), with ostris's Z-Image Turbo training adapter. ${LOCAL}`,eta: "~30–60 min on a 24 GB GPU",}),target({@@ -176,7 +276,7 @@ export const TRAINING_TARGETS: TrainingTarget[] = [trainer: "fal-ai/z-image-turbo-trainer-v2",steps: 2000,learningRate: 0.0005,- description: "fal's Z-Image Turbo trainer. Your photos go to fal for the training.",+ description: `fal's Z-Image Turbo trainer. ${TO_FAL}`,eta: "~10 min",}),target({@@ -192,19 +292,124 @@ export const TRAINING_TARGETS: TrainingTarget[] = [description: "fal's Z-Image trainer in style mode: the look, not the subjects. Your images go to fal for the training.",eta: "~15–30 min",}),+ target({+ id: "aitk-qwen-2512",+ name: "Your GPU",+ engine: "open",+ provider: "ai-toolkit",+ family: "qwen-image-2512",+ kinds: ["subject", "style"],+ steps: 2000,+ description: `AI-Toolkit on your own GPU (32 GB; 20B weights in 8-bit). ${LOCAL}`,+ eta: "~1–2 h on a 32 GB GPU",+ }),target({id: "fal-qwen-2512",name: "Cloud",engine: "cloud",provider: "fal",family: "qwen-image-2512",- kinds: ["subject"],+ kinds: ["subject", "style"],trainer: "fal-ai/qwen-image-2512-trainer",steps: 1000,learningRate: 0.0005,- description: "fal's Qwen-Image 2512 trainer, for Fuobe Soul HD (clean lettering). Your photos go to fal for the training.",+ description: `fal's Qwen-Image 2512 trainer, for Fuobe Soul HD (clean lettering). ${TO_FAL}`,+ eta: "~10–20 min",+ }),+ target({+ id: "aitk-flux1-dev",+ name: "Your GPU",+ engine: "open",+ provider: "ai-toolkit",+ family: "flux1-dev",+ kinds: ["subject", "style"],+ steps: 2000,+ description: `AI-Toolkit on your own GPU (24 GB, 8-bit). Needs a Hugging Face token with FLUX.1 [dev]'s licence accepted. ${LOCAL}`,+ eta: "~1–2 h on a 24 GB GPU",+ }),+ target({+ id: "fal-flux1-portrait",+ name: "Cloud",+ engine: "cloud",+ provider: "fal",+ family: "flux1-dev",+ kinds: ["subject"],+ trainer: "fal-ai/flux-lora-portrait-trainer",+ steps: 2500,+ description: `fal's FLUX portrait trainer: it crops to the face and trains at several sizes. ${TO_FAL}`,+ eta: "~20–30 min",+ }),+ target({+ id: "aitk-flux2-dev",+ name: "Your GPU",+ engine: "open",+ provider: "ai-toolkit",+ family: "flux2-dev",+ kinds: ["subject", "style"],+ steps: 2000,+ description: `AI-Toolkit on your own GPU (32B weights: 48 GB, or 24 GB in 8-bit with offloading, slower). Needs a Hugging Face token with FLUX.2 [dev]'s licence accepted. ${LOCAL}`,+ eta: "~2–4 h on a 48 GB GPU",+ }),+ target({+ id: "fal-flux2-dev",+ name: "Cloud",+ engine: "cloud",+ provider: "fal",+ family: "flux2-dev",+ kinds: ["subject", "style"],+ trainer: "fal-ai/flux-2-trainer-v2",+ steps: 1000,+ description: `fal's FLUX.2 [dev] trainer. ${TO_FAL}`,+ eta: "~20–40 min",+ }),+ target({+ id: "aitk-flux2-klein-4b",+ name: "Your GPU",+ engine: "open",+ provider: "ai-toolkit",+ family: "flux2-klein-4b",+ kinds: ["subject", "style"],+ steps: 2000,+ description: `AI-Toolkit on your own GPU (16 GB), on the FLUX.2 [klein] 4B base; Fuobe sends the LoRA to fal when a run uses it. ${LOCAL}`,+ eta: "~30–60 min on a 16 GB GPU",+ }),+ target({+ id: "fal-flux2-klein-4b",+ name: "Cloud",+ engine: "cloud",+ provider: "fal",+ family: "flux2-klein-4b",+ kinds: ["subject", "style"],+ trainer: "fal-ai/flux-2-klein-4b-base-trainer",+ steps: 1000,+ description: `fal's FLUX.2 [klein] 4B base trainer. ${TO_FAL}`,eta: "~10–20 min",}),+ target({+ id: "fal-flux2-klein-9b",+ name: "Cloud",+ engine: "cloud",+ provider: "fal",+ family: "flux2-klein-9b",+ kinds: ["subject", "style"],+ trainer: "fal-ai/flux-2-klein-9b-base-trainer",+ steps: 1000,+ description: `fal's FLUX.2 [klein] 9B base trainer. ${TO_FAL}`,+ eta: "~15–30 min",+ }),+ target({+ id: "fal-krea-2",+ name: "Cloud",+ engine: "cloud",+ provider: "fal",+ family: "krea-2",+ kinds: ["subject", "style"],+ trainer: "fal-ai/krea-2-trainer",+ steps: 1000,+ extra: { resolution: 1024 },+ description: `fal's Krea 2 trainer, at 1024 px. ${TO_FAL}`,+ eta: "~15–30 min",+ }),];export const getTrainingTarget = (id: string) => TRAINING_TARGETS.find((t) => t.id === id);@@ -244,7 +449,7 @@ export function photoTips(photos: { key: string; width?: number; height?: number/** The family a model's LoRAs belong to (undefined for a model no Soul ID applies to). */export function familyOfModel(modelId: string): TrainingFamily | undefined {- return (Object.keys(TRAINING_FAMILIES) as TrainingFamily[]).find((f) => TRAINING_FAMILIES[f].models.includes(modelId));+ return TRAINING_FAMILY_IDS.find((f) => TRAINING_FAMILIES[f].models.includes(modelId));}/** A trained LoRA's family: recorded since O3; read from the model it was trained for before that. */@@ -308,28 +513,97 @@ const clampField = (f: TrainerField | undefined, v: number) => (f ? Math.min(f.m/*** The request a hosted trainer gets: the dataset zip in its data field, then only the fields its schema has (steps- * within its limits, the caption every photo shares, the learning rate, training_type for a style).+ * within its limits, the caption every photo shares, the trigger for trainers that take one, the learning rate,+ * and the target's own fields such as training_type for a style).*/-export function falTrainingInput(t: TrainingTarget, zipUrl: string, caption: string): Record<string, unknown> {+export function falTrainingInput(t: TrainingTarget, zipUrl: string, caption: string, trigger?: string): Record<string, unknown> {const tr = getTrainer(t.trainer);if (!tr) throw new Error(`${t.id} has no hosted trainer`);const f = tr.fields;const body: Record<string, unknown> = { [tr.dataField]: zipUrl };if (f.steps) body.steps = clampField(f.steps, t.steps);if (f.default_caption) body.default_caption = caption;+ if (trigger && f.trigger_phrase) body.trigger_phrase = trigger;+ else if (trigger && f.trigger_word) body.trigger_word = trigger;if (f.learning_rate && t.learningRate !== undefined) body.learning_rate = t.learningRate;- for (const [k, v] of Object.entries(t.extra ?? {})) if (f[k] && (!f[k].enum || f[k].enum.includes(v))) body[k] = v;+ for (const [k, v] of Object.entries(t.extra ?? {})) if (f[k] && (!f[k].enum || f[k].enum.includes(v as string | number))) body[k] = v;return body;}+/** The trained LoRA's URL in a hosted trainer's response: the trainer's own LoRA field first. */+export function trainedLoraUrl(t: Pick<TrainingTarget, "trainer">, out: Record<string, unknown>): string | undefined {+ const fields = [...(getTrainer(t.trainer)?.loraOutput ?? []), "diffusers_lora_file", "lora_file"];+ for (const k of fields) {+ const url = (out[k] as { url?: unknown } | undefined)?.url;+ if (typeof url === "string" && url) return url;+ }+ return undefined;+}+/**- * AI-Toolkit job config for a Z-Image Turbo LoRA (research §4.5: ostris's training adapter v2, rank 16–32,- * 1,500–2,500 steps). A larger photo set gets rank 32 (more to learn); a style (a moodboard) gets fewer steps and- * samples of new scenes in the look, instead of portraits of the person.+ * The AI-Toolkit model and sample settings per base (its supported models and example configs, read 2026-10-27:+ * arch names from extensions_built_in/diffusion_models; FLUX.1 and Qwen-Image from config/examples). Z-Image Turbo+ * trains with ostris's training adapter v2 (research §4.5); the gated FLUX [dev] repos need an HF token.*/-export function aiToolkitJob(opts: { name: string; trigger: string; datasetFolder: string; outputFolder: string; steps?: number; kind?: "character" | "style"; photos?: number }) {+const AITK_MODELS: Partial<Record<TrainingFamily, { model: Record<string, unknown>; guidance: number; sampleSteps: number }>> = {+ "z-image-turbo": {+ model: {+ name_or_path: "Tongyi-MAI/Z-Image-Turbo",+ arch: "zimage:turbo",+ assistant_lora_path: "ostris/zimage_turbo_training_adapter/zimage_turbo_training_adapter_v2.safetensors",+ quantize: true,+ qtype: "qfloat8",+ quantize_te: true,+ qtype_te: "qfloat8",+ low_vram: true,+ },+ guidance: 1,+ sampleSteps: 9,+ },+ "qwen-image-2512": {+ model: { name_or_path: "Qwen/Qwen-Image-2512", arch: "qwen_image", quantize: true, qtype: "qfloat8", quantize_te: true, qtype_te: "qfloat8", low_vram: true },+ guidance: 3,+ sampleSteps: 25,+ },+ "flux1-dev": {+ model: { name_or_path: "black-forest-labs/FLUX.1-dev", arch: "flux", quantize: true, low_vram: true },+ guidance: 4,+ sampleSteps: 20,+ },+ "flux2-dev": {+ model: { name_or_path: "black-forest-labs/FLUX.2-dev", arch: "flux2", quantize: true, qtype: "qfloat8", quantize_te: true, qtype_te: "qfloat8", low_vram: true },+ guidance: 4,+ sampleSteps: 25,+ },+ "flux2-klein-4b": {+ model: { name_or_path: "black-forest-labs/FLUX.2-klein-base-4B", arch: "flux2_klein_4b", quantize: true, qtype: "qfloat8", quantize_te: true, qtype_te: "qfloat8", low_vram: true },+ guidance: 4,+ sampleSteps: 25,+ },+};++/** The bases AI-Toolkit trains for Fuobe (the training kit's choices). */+export const AITK_FAMILIES = Object.keys(AITK_MODELS) as TrainingFamily[];++/**+ * AI-Toolkit job config for a LoRA on a family's base (research §4.5 for Z-Image Turbo: ostris's training adapter v2,+ * rank 16–32, 1,500–2,500 steps). A larger photo set gets rank 32 (more to learn); a style (a moodboard) gets fewer+ * steps and samples of new scenes in the look, instead of portraits of the person.+ */+export function aiToolkitJob(opts: {+ name: string;+ trigger: string;+ datasetFolder: string;+ outputFolder: string;+ steps?: number;+ kind?: "character" | "style";+ photos?: number;+ family?: TrainingFamily;+}) {const style = opts.kind === "style";const rank = !style && (opts.photos ?? 0) >= SOUL_ID_PHOTOS.recommended ? 32 : 16;+ const base = AITK_MODELS[opts.family ?? "z-image-turbo"];+ if (!base) throw new Error(`AI-Toolkit doesn't train ${TRAINING_FAMILIES[opts.family!].base} for Fuobe: train it in the cloud`);return {job: "extension",config: {@@ -361,16 +635,7 @@ export function aiToolkitJob(opts: { name: string; trigger: string; datasetFoldesteps: opts.steps ?? (style ? 1500 : 2000),timestep_type: "weighted",},- model: {- name_or_path: "Tongyi-MAI/Z-Image-Turbo",- arch: "zimage:turbo",- assistant_lora_path: "ostris/zimage_turbo_training_adapter/zimage_turbo_training_adapter_v2.safetensors",- quantize: true,- qtype: "qfloat8",- quantize_te: true,- qtype_te: "qfloat8",- low_vram: true,- },+ model: base.model,sample: {sampler: "flowmatch",sample_every: 500,@@ -382,8 +647,8 @@ export function aiToolkitJob(opts: { name: string; trigger: string; datasetFolde? [`a city street at night, ${opts.trigger} style`, `a bowl of fruit on a wooden table, ${opts.trigger} style`, `a portrait of a woman in a garden, ${opts.trigger} style`]: [`photo of ${opts.trigger}, close-up portrait, natural window light`, `${opts.trigger} walking in a neon-lit street at night, full body`],neg: "",- guidance_scale: 1,- sample_steps: 9,+ guidance_scale: base.guidance,+ sample_steps: base.sampleSteps,},},],diff --git a/src/server/moodboards.ts b/src/server/moodboards.tsindex 4aa58219..d9b08deb 100644--- a/src/server/moodboards.ts+++ b/src/server/moodboards.ts@@ -192,16 +192,19 @@ export function deleteMoodboard(id: string): boolean {/** The model a trained board's look runs on. */const STYLE_MODEL = "fuobe-soul";+/** A trained board is a Fuobe look: it trains on Fuobe Soul's base (Z-Image Turbo), on the GPU or in the cloud. */+const lookTargets = () => targetsFor("style").filter((t) => t.modelIds.includes(STYLE_MODEL));+/** The style trainings a board can run on (AI-Toolkit on the user's GPU, fal in the cloud), with what stops each. */export function moodboardTrainingTargets() {- return describeTargets(targetsFor("style"));+ return describeTargets(lookTargets());}/** The style training a board runs when none is named: the engine mode's, else the board's own engine. */function defaultStyleTarget(m: Moodboard): TrainingTarget {const mode = engineMode();const engine = mode === "both" ? m.engine : mode;- return targetsFor("style").find((t) => t.engine === engine) ?? targetsFor("style")[0];+ return lookTargets().find((t) => t.engine === engine) ?? lookTargets()[0];}/**@@ -214,7 +217,7 @@ export function trainMoodboard(id: string, targetId?: string): Moodboard {if (!m) throw new Error("Moodboard not found");if (m.status !== "complete") throw new Error("This moodboard is still training. Try again once it is ready.");const target = targetId ? getTrainingTarget(targetId) : defaultStyleTarget(m);- if (!target || !target.kinds.includes("style")) throw new Error("Pick a style training");+ if (!target || !lookTargets().includes(target)) throw new Error("Pick a style training for Fuobe Soul");// Say what's missing (a key, an AI-Toolkit URL, the engine mode) before making the style element, so a refusal leaves nothing behind.const blocker = trainingBlocker(target);if (blocker && !demoTraining(target)) throw new Error(blocker);diff --git a/src/server/training.ts b/src/server/training.tsindex 2f2f9530..ba9f5700 100644--- a/src/server/training.ts+++ b/src/server/training.ts@@ -7,14 +7,17 @@ import {aiToolkitJob,datasetName,falTrainingInput,+ familyLead,+ familyLicence,familyOfModel,- getTrainer,getTrainingTarget,+ licenceNote,needsConsent,photosBlocker,SOUL_ID_COPY,SOUL_ID_PHOTOS,TRAINING_FAMILIES,+ trainedLoraUrl,trainingCaption,trainingKind,triggerFor,@@ -147,11 +150,11 @@ export function demoTraining(t: TrainingTarget): boolean {return demo === "on" || (!!why && demo !== "off");}-/** The targets as the API lists them: each with what stops it and whether it would run as a demo. */+/** The targets as the API lists them: each with what stops it and whether it would run as a demo (its licence is information). */export const describeTargets = (targets: TrainingTarget[]) =>targets.map((t) => {const demo = demoTraining(t);- return { ...t, blocker: demo ? null : trainingBlocker(t), demo, licence: getTrainer(t.trainer)?.licence ?? "Apache-2.0" };+ return { ...t, blocker: demo ? null : trainingBlocker(t), demo };});const isAudio = (r: string) => /\.(wav|mp3|ogg|flac|m4a|webm)$/i.test(r);@@ -284,7 +287,7 @@ async function submit(id: string, el: StudioElement, t: TrainingTarget, trigger:const { files, caption } = await dataset(el, trigger, images);update(id, { message: `Uploading ${images.length} photos` });const zipUrl = await falProvider.prepareFile(zip(files), "application/zip", "dataset.zip");- const res = (await falFetch(falQueueUrl(t.trainer!), { method: "POST", body: JSON.stringify(falTrainingInput(t, zipUrl, caption)) })) as {+ const res = (await falFetch(falQueueUrl(t.trainer!), { method: "POST", body: JSON.stringify(falTrainingInput(t, zipUrl, caption, trigger)) })) as {request_id: string;status_url: string;response_url: string;@@ -306,7 +309,16 @@ async function submit(id: string, el: StudioElement, t: TrainingTarget, trigger:fs.mkdirSync(folder, { recursive: true });for (const f of files) fs.writeFileSync(path.join(folder, f.name), f.data);const name = `fuobe_${el.handle.toLowerCase()}_${id.slice(0, 6)}`.replace(/[^a-z0-9_]/g, "_");- const job = aiToolkitJob({ name, trigger, datasetFolder: folder, outputFolder: path.join(root, "output"), kind: el.kind === "style" ? "style" : "character", steps: t.steps, photos: images.length });+ const job = aiToolkitJob({+ name,+ trigger,+ datasetFolder: folder,+ outputFolder: path.join(root, "output"),+ kind: el.kind === "style" ? "style" : "character",+ steps: t.steps,+ photos: images.length,+ family: t.family,+ });const created = await aitk("/api/jobs", { method: "POST", body: JSON.stringify({ name, gpu_ids: "0", job_config: job }) });const jobId = String(created.id);await aitk(`/api/jobs/${jobId}/start`);@@ -344,7 +356,7 @@ export async function pollTrainings(): Promise<void> {function trainedLora(r: Row, t: TrainingTarget, file: string, fields: Partial<ElementLora>): ElementLora {return {engine: t.engine,- modelId: TRAINING_FAMILIES[t.family].lead,+ modelId: familyLead(t.family, t.engine),family: t.family,target: t.id,file,@@ -381,8 +393,8 @@ async function pollOne(r: Row) {update(r.id, { progress: step ? Number(step[1]) / Number(step[2]) : r.progress, message: s.status === "IN_QUEUE" ? "In fal's queue" : (last ?? "Training") });return;}- const out = (await falFetch(meta.responseUrl!)) as { diffusers_lora_file?: { url: string }; lora_file?: { url: string } };- const url = out.diffusers_lora_file?.url ?? out.lora_file?.url;+ const out = (await falFetch(meta.responseUrl!)) as Record<string, unknown>;+ const url = trainedLoraUrl(t, out);if (!url) return fail(r.id, r.element_id, `No LoRA in fal's response: ${JSON.stringify(out).slice(0, 200)}`);// Fuobe keeps its own copy (fal's storage isn't forever): open runs copy it into ComfyUI, cloud runs send it again// once fal's copy is old. fal's URL serves cloud runs until then.@@ -443,7 +455,7 @@ function done(r: Row, message: string | null = null) {// ---------------------------------------------------------------------------// Download kit for training anywhere (AI-Toolkit CLI)-export async function trainingKit(elementId: string): Promise<{ name: string; data: Buffer }> {+export async function trainingKit(elementId: string, family: TrainingFamily = "z-image-turbo"): Promise<{ name: string; data: Buffer }> {const el = getElement(elementId);if (!el) throw new Error("Element not found");const images = photosOf(el);@@ -451,23 +463,25 @@ export async function trainingKit(elementId: string): Promise<{ name: string; daconst trigger = triggerFor(el.handle);const { files } = await dataset(el, trigger, images);const name = `fuobe_${el.handle.toLowerCase()}`.replace(/[^a-z0-9_]/g, "_");- const job = aiToolkitJob({ name, trigger, datasetFolder: "./dataset", outputFolder: "./output", kind: el.kind === "style" ? "style" : "character", photos: images.length });+ const job = aiToolkitJob({ name, trigger, datasetFolder: "./dataset", outputFolder: "./output", kind: el.kind === "style" ? "style" : "character", photos: images.length, family });+ const fam = TRAINING_FAMILIES[family];const file = `fuobe/${el.handle.toLowerCase().replace(/[^a-z0-9_-]/g, "") || "element"}.safetensors`;- const readme = `# Train ${el.name} with AI-Toolkit+ const readme = `# Train ${el.name} with AI-Toolkit (${fam.base})-1. Install AI-Toolkit: https://github.com/ostris/ai-toolkit (24 GB GPU recommended)+1. Install AI-Toolkit: https://github.com/ostris/ai-toolkit (see its README for the GPU ${fam.base} needs)2. Unzip this kit next to it and run:python run.py ${name}.yaml3. Copy the newest file from ./output/${name}/*.safetensors to ComfyUI/models/loras/${file}-4. In Fuobe, open ${el.name} → Train → "Train anywhere" and attach that file name.+4. In Fuobe, open ${el.name} → Train → "Train anywhere", pick ${fam.base} and attach that file name.-Trigger word: ${trigger} — Fuobe adds it to the prompt whenever you @${el.handle} on Fuobe Soul, Soul Cinema or-Z-Image Turbo. Train only on photos you have the right to use${el.kind === "character" ? ", of a person who agreed to it" : ""}.+Trigger word: ${trigger} — Fuobe adds it to the prompt whenever you @${el.handle} on ${fam.name}.+Licence of the base weights: ${licenceNote(familyLicence(family))}.+Train only on photos you have the right to use${el.kind === "character" ? ", of a person who agreed to it" : ""}.`;return {- name: `${name}-training-kit.zip`,+ name: `${name}-${family}-training-kit.zip`,// JSON is valid YAML, so AI-Toolkit reads the config as-is.data: zip([...files.map((f) => ({ name: `dataset/${f.name}`, data: f.data })),@@ -478,8 +492,8 @@ Z-Image Turbo. Train only on photos you have the right to use${el.kind === "char}/**- * Register a Z-Image Turbo LoRA trained elsewhere (already in ComfyUI/models/loras). When the LoRA folder is on this- * machine, Fuobe keeps a copy too, so cloud runs can use it.+ * Register a LoRA trained elsewhere (already in ComfyUI/models/loras) for its family (Z-Image Turbo unless it says+ * which). When the LoRA folder is on this machine, Fuobe keeps a copy too, so cloud runs can use it.*/export async function attachLora(elementId: string, input: { file: string; trigger: string; family?: TrainingFamily }) {const file = input.file.trim().replace(/^\/+/, "");@@ -501,7 +515,7 @@ export async function attachLora(elementId: string, input: { file: string; trigg}addIdentity(elementId, {engine: "open",- modelId: TRAINING_FAMILIES[family].lead,+ modelId: familyLead(family, "open"),family,file,trigger: input.trigger.trim(),diff --git a/tests/soul-id-runtime.test.ts b/tests/soul-id-runtime.test.tsindex c367f772..9cb9ea2f 100644--- a/tests/soul-id-runtime.test.ts+++ b/tests/soul-id-runtime.test.ts@@ -116,6 +116,17 @@ describe("starting a Soul ID training", () => {expect(listTrainings(el.id)[0]).toMatchObject({ status: "running", costUsd: 1.7, family: "z-image-turbo", photos: 6 });db().prepare("UPDATE trainings SET status = 'failed' WHERE id = ?").run(t.id);});++ it("trains on a non-commercial base too (licences are information): FLUX's portrait trainer gets images_data_url and the trigger", async () => {+ routes["https://queue.fal.run/fal-ai/flux-lora-portrait-trainer"] = () => json({ request_id: "req-f", status_url: "https://queue.fal.test/s/f", response_url: "https://queue.fal.test/r/f" });+ const el = character(6);+ const t = startTraining(el.id, "fal-flux1-portrait", { consent: true });+ await wait(() => listTrainings(el.id)[0].status === "running");+ const body = JSON.parse(calls.find((c) => c.url.includes("flux-lora-portrait-trainer"))!.body!);+ expect(body).toEqual({ images_data_url: expect.stringMatching(/dataset\.zip$/), steps: 2500, trigger_phrase: t.trigger });+ expect(listTrainings(el.id)[0]).toMatchObject({ costUsd: 6, family: "flux1-dev" });+ db().prepare("UPDATE trainings SET status = 'failed' WHERE id = ?").run(t.id);+ });});describe("a finished training", () => {@@ -162,6 +173,18 @@ describe("a finished training", () => {expect(getElement(el.id)!.loras.map((x) => x.family)).toEqual(["qwen-image-2512", "z-image-turbo"]);});+ it("reads Krea 2's LoRA from lora_file and records it for Krea 2's hosted LoRA model", async () => {+ routes["https://queue.fal.test/s/k"] = () => json({ status: "COMPLETED" });+ routes["https://queue.fal.test/r/k"] = () => json({ lora_file: { url: "https://v3.fal.media/files/krea.safetensors" }, config_file: { url: "https://v3.fal.media/files/c.json" } });+ routes["https://v3.fal.media/files/krea.safetensors"] = () => new Response(Buffer.from("krea"), { headers: { "content-length": "4" } });+ const { el } = running({ target: "fal-krea-2", provider: "fal", externalId: "req-k", meta: { statusUrl: "https://queue.fal.test/s/k", responseUrl: "https://queue.fal.test/r/k", family: "krea-2" } });+ await pollTrainings();+ const l = getElement(el.id)!.loras[0];+ expect(l).toMatchObject({ family: "krea-2", modelId: "krea-2-turbo-lora-cloud", url: "https://v3.fal.media/files/krea.safetensors" });+ expect(identityFor([l], getModel("krea-2-turbo-lora-cloud")!)).toBe(l);+ expect(identityFor([l], onEngine(getModel("fuobe-soul")!, "cloud"))).toBeUndefined();+ });+it("copies an AI-Toolkit LoRA into ComfyUI's folder and keeps Fuobe's copy, so the cloud can use it too", async () => {const out = path.join(dir, "aitk-out", "maya_000002000.safetensors");fs.mkdirSync(path.dirname(out), { recursive: true });@@ -229,6 +252,15 @@ describe("training anywhere", () => {expect(names).toContain("dataset/001.png");expect(names).toContain("dataset/005.txt");expect(names).toContain("README.md");+ // Another base: FLUX.1 [dev]'s config, and its licence in the README.+ const flux = await trainingKit(el.id, "flux1-dev");+ expect(flux.name).toMatch(/-flux1-dev-training-kit\.zip$/);+ const fluxFile = path.join(dir, flux.name);+ fs.writeFileSync(fluxFile, flux.data);+ const read = (name: string) => execFileSync("python3", ["-I", "-c", "import sys,zipfile;print(zipfile.ZipFile(sys.argv[1]).read(sys.argv[2]).decode())", fluxFile, name]).toString();+ const yaml = names.find((n) => n.endsWith(".yaml"))!;+ expect(JSON.parse(read(yaml)).config.process[0].model).toMatchObject({ arch: "flux", name_or_path: "black-forest-labs/FLUX.1-dev" });+ expect(read("README.md")).toMatch(/FLUX\.1 \[dev\] Non-Commercial License · non-commercial weights/);});it("attaches a LoRA trained elsewhere for the family, keeping a copy when ComfyUI's folder is here", async () => {@@ -240,5 +272,11 @@ describe("training anywhere", () => {await attachLora(el.id, { file: "mine/maya.safetensors", trigger: "mayafz" });expect(getElement(el.id)!.loras[0]).toMatchObject({ engine: "open", modelId: "fuobe-soul", family: "z-image-turbo", own: true });await expect(attachLora(el.id, { file: "../x.safetensors", trigger: "" })).rejects.toThrow(/file name/);+ // A FLUX.1 [dev] LoRA sits beside it and runs on FLUX.1 [dev] and Krea [dev] on the GPU, and in the cloud from Fuobe's copy.+ await attachLora(el.id, { file: "mine/maya.safetensors", trigger: "mayafz", family: "flux1-dev" });+ const flux = getElement(el.id)!.loras.find((l) => l.family === "flux1-dev")!;+ expect(flux).toMatchObject({ modelId: "oss-flux1-dev", own: true });+ expect(identityFor([flux], getModel("oss-flux1-krea")!)).toBe(flux);+ expect(identityFor([flux], getModel("flux-1-dev-lora-cloud")!)).toBe(flux);});});diff --git a/tests/training.test.ts b/tests/training.test.tsindex 375f8af7..53dae93e 100644--- a/tests/training.test.ts+++ b/tests/training.test.ts@@ -10,8 +10,11 @@ import { planGeneration } from "@/lib/catalog/plan";import { HOSTED_TRAINERS } from "@/lib/catalog/trainers.generated";import {aiToolkitJob,+ AITK_FAMILIES,datasetName,falTrainingInput,+ familyLead,+ familyOfModel,getTrainer,getTrainingTarget,identityFor,@@ -19,9 +22,12 @@ import {needsConsent,photosBlocker,photoTips,+ licenceNote,targetsFor,+ trainedLoraUrl,trainerCost,TRAINING_FAMILIES,+ TRAINING_FAMILY_IDS,TRAINING_TARGETS,triggerFor,usableOn,@@ -52,20 +58,44 @@ describe("Fuobe Soul ID targets (build plan O3)", () => {expect(getTrainingTarget("fal-z-image")!.modelIds).toEqual(expect.arrayContaining(["fuobe-soul", "fuobe-soul-cinema"]));expect(getTrainingTarget("aitk-z-image")!.modelIds).toEqual(expect.arrayContaining(["fuobe-soul", "fuobe-soul-cinema"]));expect(getTrainingTarget("fal-qwen-2512")!.modelIds).toContain("fuobe-soul-hd");- // The family's lead model is an Original on both engines.- for (const f of Object.values(TRAINING_FAMILIES)) {- const lead = getModel(f.lead)!;- expect(runsOn(lead, "open") && runsOn(lead, "cloud")).toBe(true);+ // An Original family's lead model is one model on both engines; another base leads with its own model per engine.+ for (const f of TRAINING_FAMILY_IDS) {+ const fam = TRAINING_FAMILIES[f];+ for (const [engine, id] of Object.entries(fam.lead)) {+ const lead = getModel(id)!;+ expect(lead, `${f} → ${id}`).toBeDefined();+ expect(runsOn(lead, engine as "open" | "cloud"), `${f} leads with ${id} on ${engine}`).toBe(true);+ expect(fam.models).toContain(id);+ }+ if (fam.original) expect(runsOn(getModel(familyLead(f))!, "open") && runsOn(getModel(familyLead(f))!, "cloud")).toBe(true);+ // Every model of a family belongs to it alone, and every one can carry a LoRA there.+ for (const id of fam.models) expect(familyOfModel(id)).toBe(f);}+ expect(familyLead("flux1-dev", "open")).toBe("oss-flux1-dev");+ expect(familyLead("flux1-dev", "cloud")).toBe("flux-1-dev-lora-cloud");+ expect(familyLead("krea-2", "open")).toBe("krea-2-turbo-lora-cloud");});- it("trains only on commercial weights, at fal's price for the steps (research §3.3)", () => {+ it("trains on every base fal or AI-Toolkit trains: licences are information, never a gate", () => {+ const families = new Set(TRAINING_TARGETS.map((t) => t.family));+ expect([...families]).toEqual(TRAINING_FAMILY_IDS);for (const t of TRAINING_TARGETS.filter((x) => x.provider === "fal")) {const tr = getTrainer(t.trainer)!;expect(tr, t.id).toBeDefined();- expect(tr.commercial).toBe(true);- expect(tr.licence).toBe("Apache-2.0");+ expect(t).toMatchObject({ licence: tr.licence, commercial: tr.commercial });}+ // Non-commercial and revenue-tier weights are offered, with their licence on the target (the admin decides in Settings).+ expect(getTrainingTarget("fal-flux2-dev")).toMatchObject({ commercial: false, licence: "FLUX [dev] Non-Commercial License" });+ expect(getTrainingTarget("aitk-flux1-dev")).toMatchObject({ commercial: false, licence: "FLUX.1 [dev] Non-Commercial License", price: "Free" });+ expect(getTrainingTarget("fal-flux2-klein-9b")!.commercial).toBe(false);+ expect(getTrainingTarget("fal-krea-2")!.commercial).toBeNull();+ expect(getTrainingTarget("aitk-z-image")).toMatchObject({ licence: "Apache-2.0", commercial: true });+ expect(licenceNote(getTrainingTarget("fal-flux2-dev")!)).toBe("FLUX [dev] Non-Commercial License · non-commercial weights");+ expect(licenceNote(getTrainingTarget("fal-krea-2")!)).toMatch(/revenue tiers$/);+ expect(licenceNote(getTrainingTarget("fal-z-image")!)).toBe("Apache-2.0 · commercial use");+ });++ it("prices every cloud training at fal's price for its steps (research §3.3)", () => {// $0.85 per 1,000 steps: the default 2,000-step run is $1.70 (research §4.5).expect(getTrainingTarget("fal-z-image")).toMatchObject({ steps: 2000, learningRate: 0.0005, costUsd: 1.7, price: "≈ $1.70 (2,000 steps)" });expect(getTrainingTarget("fal-qwen-2512")).toMatchObject({ steps: 1000, costUsd: 1.5 });@@ -73,11 +103,35 @@ describe("Fuobe Soul ID targets (build plan O3)", () => {expect(getTrainingTarget("aitk-z-image")).toMatchObject({ price: "Free", costUsd: 0 });// fal's floors: 500 billed steps on Z-Image Turbo v2.expect(trainerCost(getTrainer("fal-ai/z-image-turbo-trainer-v2"), 100)).toBe(0.43);+ // The other bases at their trainer's own defaults: FLUX portrait $2.40 per 1,000 (at least $2.40), FLUX.2 [dev]+ // $0.0064 a step, klein 4B $0.005, klein 9B $0.0043, Krea 2 $0.003.+ expect(getTrainingTarget("fal-flux1-portrait")).toMatchObject({ steps: 2500, costUsd: 6 });+ expect(trainerCost(getTrainer("fal-ai/flux-lora-portrait-trainer"), 300)).toBe(2.4);+ expect(getTrainingTarget("fal-flux2-dev")).toMatchObject({ steps: 1000, costUsd: 6.4 });+ expect(getTrainingTarget("fal-flux2-klein-4b")).toMatchObject({ costUsd: 5 });+ expect(getTrainingTarget("fal-flux2-klein-9b")).toMatchObject({ costUsd: 4.3 });+ expect(getTrainingTarget("fal-krea-2")).toMatchObject({ costUsd: 3, price: "≈ $3.00 (1,000 steps)" });+ for (const t of TRAINING_TARGETS) expect(t.price).toBe(t.provider === "ai-toolkit" ? "Free" : `≈ $${t.costUsd.toFixed(2)} (${t.steps.toLocaleString("en-US")} steps)`);});it("offers subject trainings to characters and style trainings to styles, consent for people only", () => {- expect(targetsFor("character").map((t) => t.id)).toEqual(["aitk-z-image", "fal-z-image", "fal-qwen-2512"]);- expect(targetsFor("style").map((t) => t.id)).toEqual(["aitk-z-image", "fal-z-image-style"]);+ expect(targetsFor("character").map((t) => t.id)).toEqual([+ "aitk-z-image",+ "fal-z-image",+ "aitk-qwen-2512",+ "fal-qwen-2512",+ "aitk-flux1-dev",+ "fal-flux1-portrait",+ "aitk-flux2-dev",+ "fal-flux2-dev",+ "aitk-flux2-klein-4b",+ "fal-flux2-klein-4b",+ "fal-flux2-klein-9b",+ "fal-krea-2",+ ]);+ // The portrait trainer crops to a face: no style on it. Fuobe Soul's style trains on fal's Z-Image trainer.+ expect(targetsFor("style").map((t) => t.id)).not.toContain("fal-flux1-portrait");+ expect(targetsFor("style").map((t) => t.id).slice(0, 2)).toEqual(["aitk-z-image", "fal-z-image-style"]);expect(targetsFor("voice")).toEqual([]);expect(needsConsent("character")).toBe(true);expect(needsConsent("style")).toBe(false);@@ -103,6 +157,10 @@ describe("Fuobe Soul ID targets (build plan O3)", () => {learning_rate: 0.0005,});expect(falTrainingInput(getTrainingTarget("fal-z-image-style")!, "z", "mayafz style")).toEqual({ image_data_url: "z", steps: 1500, default_caption: "mayafz style", training_type: "style" });+ // Trainers that take the zip in images_data_url and a trigger phrase instead of a default caption.+ expect(falTrainingInput(getTrainingTarget("fal-flux1-portrait")!, "z", "photo of mayafz", "mayafz")).toEqual({ images_data_url: "z", steps: 2500, trigger_phrase: "mayafz" });+ expect(falTrainingInput(getTrainingTarget("fal-krea-2")!, "z", "photo of mayafz", "mayafz")).toEqual({ images_data_url: "z", steps: 1000, trigger_phrase: "mayafz", resolution: 1024 });+ expect(falTrainingInput(getTrainingTarget("fal-flux2-dev")!, "z", "photo of mayafz", "mayafz")).toEqual({ image_data_url: "z", steps: 1000, default_caption: "photo of mayafz" });expect(datasetName(0, "jpg")).toBe("001.jpg");expect(datasetName(11, "txt")).toBe("012.txt");});@@ -120,6 +178,33 @@ describe("Fuobe Soul ID targets (build plan O3)", () => {expect(aiToolkitJob({ name: "x", trigger: "t", datasetFolder: "/d", outputFolder: "/o", kind: "style", photos: 30 }).config.process[0]).toMatchObject({ network: { linear: 16 }, train: { steps: 1500 } });});+ it("writes AI-Toolkit jobs for each base it trains, with AI-Toolkit's arch names", () => {+ const arch = (family: (typeof AITK_FAMILIES)[number]) => aiToolkitJob({ name: "x", trigger: "t", datasetFolder: "/d", outputFolder: "/o", family }).config.process[0];+ expect(arch("qwen-image-2512").model).toMatchObject({ name_or_path: "Qwen/Qwen-Image-2512", arch: "qwen_image" });+ expect(arch("flux1-dev").model).toMatchObject({ name_or_path: "black-forest-labs/FLUX.1-dev", arch: "flux" });+ expect(arch("flux1-dev").sample).toMatchObject({ guidance_scale: 4, sample_steps: 20 });+ expect(arch("flux2-dev").model).toMatchObject({ arch: "flux2" });+ expect(arch("flux2-klein-4b").model).toMatchObject({ name_or_path: "black-forest-labs/FLUX.2-klein-base-4B", arch: "flux2_klein_4b" });+ // Every GPU target trains a base AI-Toolkit has a config for; the cloud-only bases say so.+ for (const t of TRAINING_TARGETS.filter((x) => x.provider === "ai-toolkit")) expect(AITK_FAMILIES).toContain(t.family);+ expect(() => aiToolkitJob({ name: "x", trigger: "t", datasetFolder: "/d", outputFolder: "/o", family: "krea-2" })).toThrow(/train it in the cloud/);+ });++ it("reads the LoRA from the field each trainer returns it in", () => {+ expect(trainedLoraUrl(getTrainingTarget("fal-krea-2")!, { lora_file: { url: "k" }, config_file: { url: "c" } })).toBe("k");+ expect(trainedLoraUrl(getTrainingTarget("fal-z-image")!, { diffusers_lora_file: { url: "z" }, config_file: { url: "c" } })).toBe("z");+ expect(trainedLoraUrl(getTrainingTarget("fal-z-image")!, { config_file: { url: "c" } })).toBeUndefined();+ });++ it("sends a trained LoRA on the FLUX, klein and Krea models' hosted LoRA routes", () => {+ for (const id of ["flux-1-dev-lora-cloud", "flux-1-krea-lora-cloud", "flux-2-dev-lora-cloud", "flux-2-klein-9b-lora-cloud", "krea-2-turbo-lora-cloud"]) {+ const route = getModel(id)!.routes[0];+ expect(route.map?.loras, id).toMatchObject({ shape: "items", key: "loras" });+ const body = buildPayload(route.map!, { prompt: "x", loras: [{ file: "fuobe/m.safetensors", url: "https://x/m.safetensors", strength: 0.9 }] });+ expect(body.loras, id).toEqual([{ path: "https://x/m.safetensors", scale: 0.9 }]);+ }+ });+it("switches hosted Z-Image to its LoRA endpoint only when a LoRA URL is present", () => {const route = getModel("z-image-turbo-cloud")!.routes[0];expect(route.loraEndpoint).toBe("fal-ai/z-image/turbo/lora");@@ -142,10 +227,15 @@ describe("gen-trainers.py", () => {execFileSync("python3", ["scripts/gen-trainers.py"], { cwd: ROOT });expect(fs.readFileSync(file, "utf8")).toBe(before);});- it("keeps the non-commercial trainers flagged (never a Soul ID route)", () => {- expect(HOSTED_TRAINERS.find((t) => t.id === "fal-ai/flux-2-klein-9b-base-trainer")?.commercial).toBe(false);+ it("records every fal trainer with its licence as data (non-commercial ones too) and where its LoRA comes back", () => {+ expect(HOSTED_TRAINERS.find((t) => t.id === "fal-ai/flux-2-klein-9b-base-trainer")).toMatchObject({ commercial: false, loraOutput: ["diffusers_lora_file"] });+ expect(HOSTED_TRAINERS.find((t) => t.id === "fal-ai/krea-2-trainer")).toMatchObject({ commercial: null, dataField: "images_data_url", loraOutput: ["lora_file"] });+ // Wan 2.2's image trainer returns two LoRAs (low and high noise); the video trainers learn from clips.+ expect(HOSTED_TRAINERS.find((t) => t.id === "fal-ai/wan-22-image-trainer")!.loraOutput).toEqual(["diffusers_lora_file", "high_noise_lora"]);+ expect(HOSTED_TRAINERS.filter((t) => t.media === "video").map((t) => t.id)).toContain("fal-ai/ltx23-trainer-v2/i2v");const used = new Set(TRAINING_TARGETS.map((t) => t.trainer).filter(Boolean));- expect(HOSTED_TRAINERS.filter((t) => used.has(t.id)).every((t) => t.commercial)).toBe(true);+ expect(HOSTED_TRAINERS.filter((t) => used.has(t.id)).some((t) => t.commercial === false)).toBe(true);+ for (const t of HOSTED_TRAINERS.filter((x) => used.has(x.id))) expect(t.loraOutput.length, t.id).toBeGreaterThan(0);});});