Set up free flux.schnell AI Image Generator n8n Workflow Template

Max Tkacz20 Sept 202406:19
TLDRThis video walks viewers through setting up a free flux.schnell AI Image Generator workflow using n8n. It explains how to prepare the required accounts (n8n and Hugging Face), configure the workflow template, and manage credentials for Hugging Face and S3 storage via Cloudflare’s R2. The process includes creating buckets, setting permissions, and updating URLs to ensure the workflow runs smoothly. The end result is a functional web form that generates images from user input, demonstrated with examples like a teddy bear holding a gun. While this setup highlights a no-cost, self-hosted workflow, developers who prefer direct integration can leverage the Flux API, which provides streamlined access to Flux’s generation models without the need to configure complex infrastructure.

Takeaways

  • 💻 The Flux model by Black Forest Labs can be used through n8n with a simple web form.
  • 🌐 Setting up the Flux model requires an n8n account (self-hosted or cloud), a Hugging Face account, and a data storage solution.
  • 🔗 The n8n workflow template for Flux can be imported from the template library or copied manually.
  • 🔑 Hugging Face credentials need to be created and added to the n8n workflow for API access.
  • ☁️ Cloudflare’s R2 service is used for free data storage, and a new bucket must be created and configured.
  • ⚙️ The S3 node in n8n needs to be configured with the R2 bucket’s API URL, access key ID, and secret access key.
  • 🌐 The R2 bucket must be made publicly accessible to host images.
  • 📝 The workflow’s response body needs to be updated with the correct URLs for image rendering.
  • 🔄 The workflow must be activated to be live, allowing access to the web form.
  • 🖼️ The form allows users to generate images, like a 'teddy bear holding a gun,' using the Flux model.
  • 🔗 Previous images are displayed on the web page, but this section may be broken initially until images are generated.

Q & A

  • What is the purpose of the flux model by Black Forest Labs?

    -The flux model by Black Forest Labs is an AI Image Generator that can be used to create images based on user input. It is available on some sites but often comes with ads or requires consuming it as an API.

  • What is n8n and how does it help with the flux model?

    -n8n is a workflow automation tool that can consume APIs efficiently. It allows users to set up a workflow template to call the Flux model through a simple web form, making it easier to generate images without dealing with ads or complicated configurations. For teams or developers who want more flexibility and direct integration, the same functionality is available via the Flux API, which provides streamlined programmatic access to Flux’s models for embedding image generation into custom apps, creative pipelines, or automated workflows.

  • What accounts are required to set up the flux model workflow in n8n?

    -You need an n8n account, which can be self-hosted for free or you can use their Cloud product. You also need a Hugging Face account, which is free, and a way to store data. The speaker uses Cloudflare's free R2 account for storage.

  • How do you access the flux generator template in n8n?

    -From your n8n account, open the template library, search for 'flux generator', and click 'use workflow'. If you don't see the 'import template' option, you can copy the template and paste it into a new workflow.

  • What is the significance of the Hugging Face node in the workflow?

    -The Hugging Face node is where you connect your Hugging Face account to the workflow. It requires a token for authentication, which you can create on Hugging Face under the model's inference API section. This token is used to authorize the workflow to use the flux model's API.

  • What are the steps to create a Hugging Face token?

    -Go to the Hugging Face model's inference API page, create a new token, give it a name, and choose the level of access (e.g., full access or just inference API access). Copy the generated token and use it in the n8n workflow's Hugging Face node.

  • What is the role of the S3 node in the workflow?

    -The S3 node is used for storing the generated images. It works with any service that follows the S3 protocol. The speaker uses Cloudflare's R2 product, which is free. You need to create a bucket, set it to be publicly accessible, and then configure the S3 node with the bucket's API URL, access key ID, and secret access key.

  • How do you create a bucket in Cloudflare R2?

    -Log in to your Cloudflare account, go to the R2 section, and create a new bucket. Set the bucket's permissions to allow public access. Then, create an S3 compatibility API link in the bucket's settings to get the access key ID and secret access key needed for the n8n workflow.

  • What changes need to be made to the workflow's response body?

    -You need to update the image URLs in the response body to match your Cloudflare R2 bucket's public URL. This ensures that the images are correctly displayed on the web page returned by the workflow. You also need to update the section that shows recent images to use the correct URL.

  • How do you test the workflow once it's set up?

    -Activate the workflow, which makes it live. The trigger node will then have a production URL. Open this URL in a new tab, fill out the form with a prompt (e.g., 'a teddy bear holding a gun'), and the workflow will generate an image based on that prompt. The image will be displayed on the web page.

Outlines

  • 00:00

    🛠️ Setup: Import Flux workflow, add Hugging Face token & Cloudflare R2 (S3) storage

    This paragraph walks through preparing a reusable workflow template that lets you run the Flux model from Black,Forest Labs via a simple web form. Key points: you need an NN account (self-host or cloud) and a free Hugging Face account, plus an S3-compatible storage (the author uses Cloudflare R2 free tier). Steps covered: open the template library, search for the Flux generator template and import it (or copy/paste the workflow). Then add credentials for two nodes: the Hugging Face inference API and a generic S3 node. For Hugging Face create an inference token, then store it as a credential using the HTTP header name 'Authorization' with the value 'Bearer '. For S3/R2: create a new R2 bucket, enable the R2 dev subdomain to make the bucket publicly accessible for hosting images, copy the S3 API endpoint, and create an R2 API key with object read+write permissions scoped to the bucket. Paste the Access Key ID and Secret Access Key into the S3 credential in the workflow (region is noted as not affecting the endpoint in practice). Update the workflow's bucket name to your new bucket. Finally, edit the workflow's response HTML to replace the image URL base with your public R2 bucket URL (keeping the trailing slash/Setup flux workflowFG part intact) and optionally remove the 'recent images' section if you don't want to display past renders. Save these changes so the workflow is ready.

  • 05:06

    🚀 Launch & Test: Activate the workflow, open the production form, and generate images

    This paragraph explains activating and testing the workflow after configuration. Activate the workflow to make it live; the trigger node exposes a production URL you can open to access the web form. Enter prompts (the example used is 'a teddy bear holding a gun' in a particular visual style) and submit — image generation typically takes ~5–20 seconds depending on load. The author notes that the HTML preview/last-images area may appear broken on the first runs because images must exist before they can be populated, but after the first successful renders the recent-image section will populate and subsequent runs can be refreshed to show updated results. The paragraph closes with an example of trying another prompt (a teddy bear on a roller coaster) and reassures viewers that refreshing will show newly generated images once the storage and HTML are correctly wired up.

Mindmap

Keywords

  • 💡flux model

    The flux model is an AI image generation model created by Black Forest Labs. In the context of the video, it is the core technology that allows users to generate images through a web form. The video demonstrates how to set up a workflow to utilize this model via n8n. For example, the script mentions 'the awesome flux model by black forest Labs' and shows how to integrate it into a workflow so that users can generate images like a 'teddy bear holding a gun'.

  • 💡n8n

    n8n is an open-source workflow automation tool that allows users to create custom workflows to automate tasks. In the video, n8n is used to set up a workflow template that connects to the flux model. The script explains how to import a workflow template into n8n and set it up, such as 'starting from your n8n account, you're going to want to open up the template library'. It is essential for automating the process of generating images using the flux model.

  • 💡Hugging Face

    Hugging Face is a platform that provides a wide range of AI models and tools. In the video, a Hugging Face account is required to access the flux model's API. The script details how to create a new token on Hugging Face to authenticate the API connection, such as 'go over to hugging face and let's say we actually go on the model itself if I click on the inference API here I can actually manage my tokens from here'. This platform is crucial for accessing the flux model's capabilities.

  • 💡API

    API stands for Application Programming Interface, which allows different software applications to communicate with each other. In the video, the flux model is accessed through its API. The script mentions 'consuming APIs is something that n8n does really well' and shows how to set up credentials for the Hugging Face API, such as 'you're going to want to write the word Bearer space enter API key'. The API is the bridge that enables n8n to interact with the flux model.

  • 💡workflow template

    A workflow template in n8n is a pre-defined set of steps or nodes that can be used to automate a specific task. In the video, a workflow template is used to set up the flux model integration. The script explains how to find and use the 'flux generator' template, such as 'from here let's search for flux generator open it and then from here we'll click use workflow'. This template simplifies the setup process for users who want to generate images using the flux model.

  • 💡S3

    S3, or Simple Storage Service, is a cloud storage service provided by Amazon Web Services (AWS). In the video, an S3-compatible service (Cloudflare R2) is used to store generated images. The script details how to create a new bucket and set up credentials for the S3 node in n8n, such as 'this is a generic S3 node it works on the S3 protocol so you don't have to use Amazon S3 here and I'm using Cloudflare because it's completely free'. S3 is used to store and serve the images generated by the flux model.

  • 💡credentials

    Credentials are used to authenticate and authorize access to services or APIs. In the video, credentials are required for both the Hugging Face API and the S3 service. The script shows how to create and configure these credentials, such as 'we got to add our hugging face account you see here the header off is empty and we would create a new credential in here'. Properly set up credentials ensure secure and authorized access to the flux model and storage services.

  • 💡Cloudflare R2

    Cloudflare R2 is a cloud storage service provided by Cloudflare. In the video, it is used as an S3-compatible storage solution to store generated images. The script explains how to create a bucket in R2 and configure its settings, such as 'I'm using Cloudflare because it's completely free there S3 product is called R2'. Cloudflare R2 is chosen for its cost-effectiveness and ease of integration with n8n.

  • 💡web form

    A web form is an interface on a website that allows users to input data. In the video, a web form is used to interact with the flux model and generate images. The script mentions 'lets you use the flux model through a simple web form' and shows how to set up the workflow so that users can input prompts like 'a teddy bear holding a gun' and receive generated images. The web form is the user-friendly interface that makes the image generation process accessible.

  • 💡image generation

    Image generation refers to the process of creating new images using AI models. In the video, the flux model is used for image generation. The script demonstrates how to set up a workflow to generate images based on user input through a web form, such as 'this is going to take some takes 5 six seconds sometimes takes 20 but as you can see we got our Teddy B holding a gun'. Image generation is the primary function of the flux model and the central theme of the video.

Highlights

  • The Flux model by Black Forest Labs is available through n8n workflows.

  • n8n can be self-hosted for free or used via a Cloud product.

  • A Hugging Face account is required to access the Flux model.

  • Data storage options include using Cloudflare's free R2 account.

  • The workflow template allows using the Flux model through a simple web form.

  • The setup process involves importing the template into your n8n account.

  • Errors in the workflow template need to be resolved by adding credentials.

  • Hugging Face credentials must be created and added to the workflow.

  • A new bucket must be created in Cloudflare's R2 for storing images.

  • S3 credentials for the R2 bucket need to be configured in the workflow.

  • The bucket name in the workflow must be updated to match the newly created bucket.

  • The response body of the workflow needs adjustments to display images correctly.

  • The workflow can be activated to generate images through a web form.

  • Generated images are displayed on a web page returned by the workflow.

  • The workflow can be used to generate various images, such as a teddy bear holding a gun.