In this comprehensive tutorial, we dive deep into creating a powerful AI image generation system using N8N, leveraging Flux models from Black Forest Labs, Claude's prompt engineering, and Replicate's API.
Key Components
- Sub-Workflow 1: Image Prompt Generator
- Sub-Workflow 2: Replicate Image Generation
- Workflow: Complete Blog Post Generation
Code Snippets and Workflows
Sub-Workflow 1: Image Prompt Generator
Generare a prompt to generate a blog post poster image about this news. Focus on the main subject of the news and the topic. Also include in the prompt, in needed, the writing of the main subject.
RULES:
- Reply only with the prompt
CONTEXT:
{{ $json.context }}
Sub-Workflow 2: Replicate Image Generation
Prompt Sanitization Code
return {
"parsed_prompt": JSON.stringify($input.first().json.prompt)
};
Replicate API Request URL
https://api.replicate.com/v1/models/black-forest-labs/{{ $json.model }}/predictions
