{ "kind": "open-flow-workflow", "version": 1, "name": "Generate a FLUX Image to Google Drive", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_77bbfdc018213005": { "name": "Choose image settings", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "prompt" }, { "jsonSchema": { "type": "integer", "minimum": 1 }, "nullable": false, "handle": "width" }, { "jsonSchema": { "type": "integer", "minimum": 1 }, "nullable": false, "handle": "height" }, { "jsonSchema": { "type": "integer", "minimum": 1 }, "nullable": false, "handle": "steps" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "guidance" } ] }, "n_a37ab110865cedc0": { "inputs": { "prompt": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_77bbfdc018213005", "output": "prompt" } ] }, "width": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_77bbfdc018213005", "output": "width" } ] }, "height": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_77bbfdc018213005", "output": "height" } ] }, "steps": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_77bbfdc018213005", "output": "steps" } ] }, "guidance": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_77bbfdc018213005", "output": "guidance" } ] } }, "name": "Prepare the FLUX request", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "prompt" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "width" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "height" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "steps" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "guidance" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": { "description": "A raw fal property value." }, "description": "The raw fal object payload." }, "nullable": false, "handle": "input" } ], "name": "Prepare the FLUX request", "moduleId": "n_03d7c2fdc5b657aa", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_2a8e7332b62d721c": { "inputs": { "modelId": { "kind": "value", "value": "fal-ai/flux/dev" }, "input": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a37ab110865cedc0", "output": "input" } ] } }, "name": "Submit the image job", "kind": "task", "task": { "inputs": [ { "description": "The model identifier, such as fal-ai/flux/schnell.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The model identifier, such as fal-ai/flux/schnell." }, "nullable": false, "handle": "modelId" }, { "description": "The raw fal object payload.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "A raw fal property value." }, "description": "The raw fal object payload." }, "nullable": false, "handle": "input" }, { "description": "An optional URL fal calls with the final result.", "jsonSchema": { "type": "string", "format": "uri", "description": "An optional URL fal calls with the final result." }, "nullable": true, "handle": "webhookUrl", "value": null } ], "outputs": [ { "description": "The queue request identifier.", "jsonSchema": { "type": "string", "description": "The queue request identifier." }, "nullable": false, "handle": "requestId" }, { "description": "The initial queue status.", "jsonSchema": { "type": "string", "description": "The initial queue status." }, "nullable": false, "handle": "status" }, { "description": "The initial queue position when available.", "jsonSchema": { "type": [ "integer", "null" ], "description": "The initial queue position when available." }, "nullable": true, "handle": "queuePosition" }, { "description": "The exact URL used to poll request status.", "jsonSchema": { "type": "string", "description": "The exact URL used to poll request status." }, "nullable": false, "handle": "statusUrl" }, { "description": "The exact URL used to fetch the result.", "jsonSchema": { "type": "string", "description": "The exact URL used to fetch the result." }, "nullable": false, "handle": "responseUrl" }, { "description": "The exact URL used to cancel the request.", "jsonSchema": { "type": "string", "description": "The exact URL used to cancel the request." }, "nullable": false, "handle": "cancelUrl" } ], "name": "Submit the image job", "executor": { "kind": "connector", "action": "fal_ai.submit_queue_request" } } }, "n_bbdffeff1287d17c": { "inputs": { "statusUrl": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2a8e7332b62d721c", "output": "statusUrl" } ] }, "responseUrl": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2a8e7332b62d721c", "output": "responseUrl" } ] } }, "name": "Check fal queue URLs", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "description": "The exact URL used to poll request status." }, "nullable": false, "handle": "statusUrl" }, { "jsonSchema": { "type": "string", "description": "The exact URL used to fetch the result." }, "nullable": false, "handle": "responseUrl" } ], "outputs": [ { "jsonSchema": { "type": "string", "format": "uri", "description": "The exact status URL returned by submit_queue_request." }, "nullable": false, "handle": "statusUrl" }, { "jsonSchema": { "type": "string", "format": "uri", "description": "The exact response URL returned by submit_queue_request." }, "nullable": false, "handle": "responseUrl" } ], "name": "Check fal queue URLs", "moduleId": "n_6cf5a78d7b487a18", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_deee46e65dbc7e9a": { "inputs": {}, "name": "Wait three seconds", "kind": "wait", "inputDefinitions": [], "prompt": "Wait three seconds", "autoContinue": { "kind": "after", "durationMs": 3000 } }, "n_f7f0bb019c8e6e48": { "inputs": { "statusUrl": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_bbdffeff1287d17c", "output": "statusUrl" } ] } }, "name": "Check the job status", "kind": "task", "task": { "inputs": [ { "description": "The exact status URL returned by submit_queue_request.", "jsonSchema": { "type": "string", "format": "uri", "description": "The exact status URL returned by submit_queue_request." }, "nullable": false, "handle": "statusUrl" }, { "description": "Set to 1 to include logs in the response.", "jsonSchema": { "type": "integer", "minimum": 0, "maximum": 1, "description": "Set to 1 to include logs in the response." }, "nullable": true, "handle": "logs", "value": null } ], "outputs": [ { "description": "The current queue status.", "jsonSchema": { "type": "string", "description": "The current queue status." }, "nullable": false, "handle": "status" }, { "description": "The URL for fetching the final queued response.", "jsonSchema": { "type": [ "string", "null" ], "description": "The URL for fetching the final queued response." }, "nullable": true, "handle": "responseUrl" }, { "description": "The current queue position when the request is still queued.", "jsonSchema": { "type": [ "integer", "null" ], "description": "The current queue position when the request is still queued." }, "nullable": true, "handle": "queuePosition" }, { "description": "The queue processing logs.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string", "description": "The log message text." }, "level": { "type": "string", "description": "The log severity level." }, "source": { "type": "string", "description": "The log source identifier." }, "timestamp": { "type": "string", "description": "The log timestamp in ISO 8601 format." } }, "required": [ "message", "level", "source", "timestamp" ], "additionalProperties": false, "description": "A queue log entry." }, "description": "The queue processing logs." }, "nullable": true, "handle": "logs" } ], "name": "Check the job status", "executor": { "kind": "connector", "action": "fal_ai.queue_get_status" } } }, "n_c885da2193f18130": { "inputs": { "status": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f7f0bb019c8e6e48", "output": "status" } ] } }, "name": "Check completion", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "description": "The current queue status." }, "nullable": false, "handle": "status" } ], "outputs": [ { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "done" } ], "name": "Check completion", "moduleId": "n_d3ac6086cbc5b026", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_50ad0d34300101b6": { "inputs": {}, "name": "Image ready", "kind": "condition", "matchMode": "first", "cases": [ { "output": "pending", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_c885da2193f18130", "output": "done" } }, "operator": "==", "right": { "kind": "value", "value": false } } ] } ] } ] }, "n_a914b76504e9181c": { "inputs": { "responseUrl": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_bbdffeff1287d17c", "output": "responseUrl" } ] } }, "name": "Get the generated image", "kind": "task", "task": { "inputs": [ { "description": "The exact response URL returned by submit_queue_request.", "jsonSchema": { "type": "string", "format": "uri", "description": "The exact response URL returned by submit_queue_request." }, "nullable": false, "handle": "responseUrl" } ], "outputs": [ { "description": "The completed request status.", "jsonSchema": { "type": "string", "description": "The completed request status." }, "nullable": false, "handle": "status" }, { "description": "The raw fal object payload.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "A raw fal property value." }, "description": "The raw fal object payload." }, "nullable": false, "handle": "response" } ], "name": "Get the generated image", "executor": { "kind": "connector", "action": "fal_ai.get_queue_request_result" } } }, "n_51419ad14b42f220": { "inputs": { "response": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a914b76504e9181c", "output": "response" } ] } }, "name": "Download the complete image", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": { "description": "A raw fal property value." }, "description": "The raw fal object payload." }, "nullable": false, "handle": "response" } ], "outputs": [ { "jsonSchema": { "type": "string", "minLength": 1, "description": "The name of the file." }, "nullable": false, "handle": "name" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The MIME type of the file." }, "nullable": false, "handle": "mimeType" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "Connector media upload content encoded as a Base64 string." }, "nullable": false, "handle": "contentBase64" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "bytes" } ], "name": "Download the complete image", "moduleId": "n_4c03dc72a5c670ee", "capabilities": [ { "kind": "http", "hosts": [ "v3.fal.media" ] } ] } }, "n_c63919efba0e2c2c": { "inputs": { "name": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_51419ad14b42f220", "output": "name" } ] }, "mimeType": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_51419ad14b42f220", "output": "mimeType" } ] }, "contentBase64": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_51419ad14b42f220", "output": "contentBase64" } ] }, "parents": { "kind": "value", "value": [ "YOUR_OUTPUT_FOLDER_ID" ] } }, "name": "Save the image to Drive", "kind": "task", "task": { "inputs": [ { "description": "The name of the file.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The name of the file." }, "nullable": true, "handle": "name", "value": null }, { "description": "The MIME type of the file.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The MIME type of the file." }, "nullable": true, "handle": "mimeType", "value": null }, { "description": "A short description of the file.", "jsonSchema": { "type": "string", "minLength": 1, "description": "A short description of the file." }, "nullable": true, "handle": "description", "value": null }, { "description": "A list of parent folder IDs to place the file in.", "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1, "description": "Schema for nonEmptyString." }, "minItems": 1, "description": "A list of parent folder IDs to place the file in." }, "nullable": true, "handle": "parents", "value": null }, { "description": "Whether the user has starred the file.", "jsonSchema": { "type": "boolean", "description": "Whether the user has starred the file." }, "nullable": true, "handle": "starred", "value": null }, { "description": "A collection of arbitrary key-value pairs which are private to the requesting app.", "jsonSchema": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "A collection of arbitrary key-value pairs which are private to the requesting app." }, "nullable": true, "handle": "appProperties", "value": null }, { "description": "A collection of arbitrary key-value pairs which are visible to all apps.", "jsonSchema": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "A collection of arbitrary key-value pairs which are visible to all apps." }, "nullable": true, "handle": "properties", "value": null }, { "description": "Connector media upload content encoded as a Base64 string.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Connector media upload content encoded as a Base64 string." }, "nullable": true, "handle": "contentBase64", "value": null }, { "description": "Connector text media upload content.", "jsonSchema": { "type": "string", "description": "Connector text media upload content." }, "nullable": true, "handle": "text", "value": null } ], "outputs": [ { "description": "The unique identifier of the file.", "jsonSchema": { "type": "string", "description": "The unique identifier of the file." }, "nullable": false, "handle": "id" }, { "description": "The name of the file.", "jsonSchema": { "type": "string", "description": "The name of the file." }, "nullable": false, "handle": "name" }, { "description": "The MIME type of the file.", "jsonSchema": { "type": "string", "description": "The MIME type of the file." }, "nullable": false, "handle": "mimeType" }, { "description": "A link for opening the file in a relevant Google editor or viewer in a browser.", "jsonSchema": { "type": [ "string", "null" ], "description": "A link for opening the file in a relevant Google editor or viewer in a browser." }, "nullable": true, "handle": "webViewLink" }, { "description": "The time at which the file was created (RFC 3339 date-time).", "jsonSchema": { "type": [ "string", "null" ], "description": "The time at which the file was created (RFC 3339 date-time)." }, "nullable": true, "handle": "createdTime" }, { "description": "The last time the file was modified by anyone (RFC 3339 date-time).", "jsonSchema": { "type": [ "string", "null" ], "description": "The last time the file was modified by anyone (RFC 3339 date-time)." }, "nullable": true, "handle": "modifiedTime" }, { "description": "The size of the file's content in bytes.", "jsonSchema": { "type": [ "integer", "null" ], "description": "The size of the file's content in bytes." }, "nullable": true, "handle": "sizeBytes" }, { "description": "The ID of the shared drive the file belongs to.", "jsonSchema": { "type": [ "string", "null" ], "description": "The ID of the shared drive the file belongs to." }, "nullable": true, "handle": "driveId" }, { "description": "The IDs of the parent folders containing the file.", "jsonSchema": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "The IDs of the parent folders containing the file." }, "nullable": true, "handle": "parents" }, { "description": "The owners of the file.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "displayName": { "type": [ "string", "null" ], "description": "The display name of the owner." }, "emailAddress": { "type": [ "string", "null" ], "description": "The email address of the owner." }, "permissionId": { "type": [ "string", "null" ], "description": "The permission ID of the owner." }, "photoLink": { "type": [ "string", "null" ], "description": "A link to the owner's profile photo." } }, "required": [ "displayName", "emailAddress", "permissionId", "photoLink" ], "additionalProperties": false, "description": "Schema for driveOwnerSchema." }, "description": "The owners of the file." }, "nullable": true, "handle": "owners" }, { "description": "Whether the file has been shared.", "jsonSchema": { "type": "boolean", "description": "Whether the file has been shared." }, "nullable": true, "handle": "shared" }, { "description": "Whether the user has starred the file.", "jsonSchema": { "type": "boolean", "description": "Whether the user has starred the file." }, "nullable": true, "handle": "starred" }, { "description": "Whether the file has been trashed.", "jsonSchema": { "type": "boolean", "description": "Whether the file has been trashed." }, "nullable": true, "handle": "trashed" }, { "description": "Whether the authenticated user owns the file.", "jsonSchema": { "type": "boolean", "description": "Whether the authenticated user owns the file." }, "nullable": true, "handle": "ownedByMe" }, { "description": "The projected Drive capabilities for the authenticated user.", "jsonSchema": { "type": "object", "properties": { "canShare": { "type": "boolean", "description": "Whether the authenticated user may modify sharing settings." } }, "required": [ "canShare" ], "additionalProperties": false, "description": "The projected Drive capabilities for the authenticated user." }, "nullable": true, "handle": "capabilities" } ], "name": "Save the image to Drive", "executor": { "kind": "connector", "action": "googledrive.files.create" } } }, "n_aaa2b4f18c2a9de2": { "inputs": { "id": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c63919efba0e2c2c", "output": "id" } ] }, "name": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c63919efba0e2c2c", "output": "name" } ] }, "mimeType": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c63919efba0e2c2c", "output": "mimeType" } ] }, "bytes": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_51419ad14b42f220", "output": "bytes" } ] } }, "name": "Confirm the Drive image", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "description": "The unique identifier of the file." }, "nullable": false, "handle": "id" }, { "jsonSchema": { "type": "string", "description": "The name of the file." }, "nullable": false, "handle": "name" }, { "jsonSchema": { "type": "string", "description": "The MIME type of the file." }, "nullable": false, "handle": "mimeType" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "bytes" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "result" } ], "name": "Confirm the Drive image", "moduleId": "n_082659fd0d70be1e", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_ae90a089bf16521b": { "name": "Saved image", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "result" } ], "outputMappings": { "result": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_aaa2b4f18c2a9de2", "output": "result" } ] } } } }, "edges": [ { "source": "n_77bbfdc018213005", "target": "n_a37ab110865cedc0" }, { "source": "n_a37ab110865cedc0", "target": "n_2a8e7332b62d721c" }, { "source": "n_2a8e7332b62d721c", "target": "n_bbdffeff1287d17c" }, { "source": "n_bbdffeff1287d17c", "target": "n_deee46e65dbc7e9a" }, { "source": "n_deee46e65dbc7e9a", "target": "n_f7f0bb019c8e6e48", "sourceHandle": "continue" }, { "source": "n_f7f0bb019c8e6e48", "target": "n_c885da2193f18130" }, { "source": "n_c885da2193f18130", "target": "n_50ad0d34300101b6" }, { "source": "n_50ad0d34300101b6", "target": "n_deee46e65dbc7e9a", "sourceHandle": "pending" }, { "source": "n_50ad0d34300101b6", "target": "n_a914b76504e9181c", "sourceHandle": "otherwise" }, { "source": "n_a914b76504e9181c", "target": "n_51419ad14b42f220" }, { "source": "n_51419ad14b42f220", "target": "n_c63919efba0e2c2c" }, { "source": "n_c63919efba0e2c2c", "target": "n_aaa2b4f18c2a9de2" }, { "source": "n_aaa2b4f18c2a9de2", "target": "n_ae90a089bf16521b" } ] } }, "modules": { "n_03d7c2fdc5b657aa": { "name": "Prepare the FLUX request", "imports": [], "source": "export default function input({prompt,width,height,steps,guidance}){if(typeof prompt!=='string'||!prompt.trim()||![width,height,steps].every(Number.isSafeInteger)||width<1||height<1||steps<1||typeof guidance!=='number'||!Number.isFinite(guidance))throw new Error('Provide a prompt and valid generation settings');return{input:{prompt,image_size:{width,height},num_inference_steps:steps,guidance_scale:guidance,num_images:1,enable_safety_checker:true}};}\n" }, "n_6cf5a78d7b487a18": { "name": "Check fal queue URLs", "imports": [], "source": "export default function urls({statusUrl,responseUrl}){for(const u of [statusUrl,responseUrl]){if(typeof u!=='string'||!u.startsWith('https://queue.fal.run/'))throw new Error('Invalid fal queue URL');}return{statusUrl,responseUrl};}\n" }, "n_d3ac6086cbc5b026": { "name": "Check completion", "imports": [], "source": "export default function status({status}){if(status==='COMPLETED')return{done:true};if(status==='IN_QUEUE'||status==='IN_PROGRESS')return{done:false};throw new Error('Generation stopped with an unexpected status');}\n" }, "n_4c03dc72a5c670ee": { "name": "Download the complete image", "imports": [], "source": "import{Buffer}from'node:buffer';export default async function image({response},context){const item=response?.images?.[0];if(!item||typeof item.url!=='string'||!item.url.startsWith('https://'))throw new Error('fal did not return an image URL');const r=await context.fetch(item.url,{method:'GET'});if(!r.ok)throw new Error('Image download failed');const b=new Uint8Array(await r.arrayBuffer());if(!b.length||typeof item.file_size==='number'&&b.length!==item.file_size)throw new Error('Incomplete image');const mime=typeof item.content_type==='string'?item.content_type:r.headers.get('content-type');if(typeof mime!=='string'||!mime.startsWith('image/'))throw new Error('Unexpected image type');const path=new URL(item.url).pathname,segment=path.split('/').pop(),name=segment?decodeURIComponent(segment):'generated-image';return{name,mimeType:mime,contentBase64:Buffer.from(b).toString('base64'),bytes:b.length};}\n" }, "n_082659fd0d70be1e": { "name": "Confirm the Drive image", "imports": [], "source": "export default function receipt({id,name,mimeType,bytes}){if(typeof id!=='string'||!id||typeof name!=='string'||!name||typeof mimeType!=='string'||!mimeType.startsWith('image/'))throw new Error('Drive did not confirm the image; inspect before replaying');return{result:{id,name,mimeType,bytes}};}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }