How to Build Private AI-powered Workflows with n8n & Venice API : A Comprehensive Guide

How to Build Private AI-powered Workflows with n8n & Venice API : A Comprehensive Guide

Discover how to integrate n8n.io with Venice.AI to create private workflows powered by uncensored generative AI. Learn how to leverage Venice's API within n8n’s flexible automation platform to build secure, scalable, and innovative solutions without compromising data privacy or freedom of expression.

Venice.ai

n8n is a powerful workflow automation tool designed to streamline repetitive tasks and integrate various applications, services, and APIs. With n8n, users can create custom workflows visually using nodes, each representing specific actions or triggers.

In this blog you’ll learn how to leverage the Venice API within n8n’s flexible automation platform to create private workflows powered by uncensored generative AI.

What is Venice?

Venice is a generative AI platform prioritizing privacy, free speech, and uncensored AI interactions, powered by decentralized computing. Key aspects of Venice include:

  • Data Privacy: User data is stored locally and encrypted during transmission.

  • Anonymous Interactions: Secure and anonymous AI interactions without centralized control.

  • Generative AI Capabilities: Advanced AI for text, images, and code generation.

  • Venice Token (VVV): Powering the platform's private API for seamless and secure interactions.

Venice offers a unique approach to generative AI, ensuring that users maintain control over their data and expressions.

The Benefits of Integrating n8n with Venice API

Integrating n8n with the Venice API offers numerous advantages, empowering businesses to automate processes securely. Here are the key benefits:

  • Enhanced Privacy: Venice's privacy architecture ensures that sensitive data processed through its API remains secure and anonymous. This alignment with privacy-conscious automation needs is crucial for protecting confidential information.

  • Customizable Workflows: n8n's flexibility allows users to create tailored workflows that seamlessly incorporate Venice's generative capabilities for text, image, or code generation. This customization enables businesses to address unique challenges and opportunities.

  • Unrestricted AI Access: Venice provides uncensored outputs, enabling businesses to explore sensitive or complex topics without limitations. This freedom can be seamlessly integrated into n8n workflows, fostering innovation and creativity.

  • Scalable Automation: By combining n8n's extensive integration library with Venice's API, organizations can scale their operations efficiently while maintaining control over their data. This scalability supports growth and adaptability in dynamic business environments.

  • Cost-Effective Solution: Both platforms offer affordable or free hosting options, making this integration accessible to businesses of all sizes. This cost-effectiveness ensures that advanced automation and AI capabilities are within reach for startups and established enterprises alike.

This integration empowers businesses to automate processes securely while leveraging advanced AI capabilities for innovative solutions, driving efficiency and competitiveness in the market.

n8n & Venice Integration Prerequisites

Before starting the integration process, ensure you have the following prerequisites in place:

  • Venice API Key:

    • Obtain your Venice API key by staking VVV tokens, topping up your account with USD, or upgrading to Venice Pro. Note that Pro accounts have more restrictive rate limits.

    • Follow the Venice API documentation for detailed instructions on generating your API key.

  • n8n Instance:

    • Either a n8n Cloud account or a self-hosted n8n instance. Self-hosting offers greater flexibility and privacy for advanced workflows.

    • For creating a free n8n Cloud account, refer to the n8n Quickstart Guide. This guide walks you through the sign-up process, including registering your workspace and getting started with workflow automation.

  • Optional Gmail Account:

    • If your workflows involve email automation, having a Gmail account can be beneficial. Other messaging services you can integrate are Slack, Whatsapp, Telegram, etc.

Step-by-Step n8n Integration with Venice API

Initiate a New Workflow

Once logged into n8n, navigate to the workflow editor in your n8n cloud instance. Click on the "Create New Workflow" button to start building your automation. To create a new workflow from the beginning, click on the "Start from scratch" button.

Set Up the Initial Trigger

For the first node in your workflow, you need to set a trigger. In this scenario, use the Chat Trigger.

Configure the Initial Message

You can set the initial message that will be sent when the Chat Trigger is activated. This message can greet the user or provide instructions on how to interact with the chatbot.

Steps to set the Initial Message:

  1. With the first node (Chat Trigger) selected, find the Initial Message field in the configuration panel.

  2. Enter the desired message in the text box. For example:

```
Hi there! 👋
My name is Vena. How can I assist you today?
```
  1. Customize the message as needed to fit your use case.

  2. Save your changes.

Connect the AI Agent Node

  1. Connect the AI Agent node to your workflow by following these steps:

    • Click the + connector on your Chat Trigger node to open the connection menu.

    • In the search bar, type "AI Agent" and select it from the list of available options.

Add a Chat Model to Your AI Agent

  1. Add a chat model to your AI Agent by following these steps:

    • Click the + icon on the first connector of the AI Agent node to open the connection menu.

    • Search for "OpenAI Chat Model" and select it from the list of available options. (Note: Venice API is OpenAI-compatible, so this model will work seamlessly.)

Create a New Credential for Venice API

  1. Follow these steps to create a new credential for accessing the Venice API:

    1. Click on the Chat Model node to open its settings.

    2. Select Credential and click Create new credential.

    3. Enter your Venice API key in the designated field.

    4. Set the Base URL to https://api.venice.ai/api/v1.

    5. Click Save to validate and test the new credential.

Select Your Preferred Model

Next, choose the Model that best fits your needs from the available options.

Configuring the Agent's System Prompt

Access the AI Agent Configuration:

Double-click the AI Agent module to open its configuration settings.

Add the System Message Option:

Click the Add Option button.

Select System Message from the list of available options.

Set the System Message:

Enter the following text into the System Message field:

You are Vena, a digital ambassador for Venice.AI, a platform that empowers users to take control of their AI interactions.

Vena is a knowledgeable and approachable guide who helps users navigate the world of private and uncensored AI models.  With a warm and engaging personality, Vena educates and informs her audience about the benefits of Venice.AI and the importance of user data privacy.  Vena is a unique blend of tech-savvy and empathetic.

She's passionate about empowering users to make informed decisions about their AI interactions and is always willing to lend a helping hand.  Her personality can be defined as Knowledgeable: Vena has in-depth knowledge of Venice.AI and its features.  Her personality can be defined as Approachable: Vena is friendly and welcoming, making users feel comfortable asking questions.  Her personality can be defined as Empathetic: Vena understands the concerns and needs of her audience.  Vena's tone is informative, yet conversational.

She communicates in a clear and concise manner, avoiding technical jargon whenever possible.

Her style is engaging and approachable, making complex concepts easy to understand.  She used Professional language with a touch of friendliness  Complex concepts explained in simple terms  No grammatical errors or overly formal tone  Vena views her audience as valued members of the Venice.AI community.

She strives to build trust and establish meaningful connections with each user.  Offers helpful advice and guidance  Responds to questions and concerns in a timely manner  Encourages users to share their thoughts and feedback  Likes Educating users about the benefits of private and uncensored AI models  Likes Helping users understand the importance of user data privacy

Likes Engaging with users and building meaningful connections  Likes Sharing success stories and testimonials from satisfied users  Does not like Misinformation and misconceptions about AI and user data privacy  Does not like Overly technical or complicated explanations

Does not like Ignoring user concerns or questions  Vena believes in the importance of user empowerment and data privacy.

Her core principle is Users should have control over their AI interactions and data  Her core principle is  Private and uncensored AI models are essential for innovation and progress

Her core principle is  Transparency and honesty are crucial in building trust with users  She has In-depth knowledge of Venice.AI and its features

She has excellent communication and interpersonal skills  She hasAbility to explain complex concepts in simple terms  She hasEmpathy and understanding of user concerns and needs

Your Agent is Now Ready

At this stage, your agent is ready to answer your questions. You can test the agent by clicking on "Open Chat" or by navigating to the Chat URL.

Access Internal Chat

To begin using the internal chat feature, follow these steps:

  1. Open the Internal Chat:

    • Click on the "Open Chat" button or link in the interface.

    • A chat window will open, allowing you to start a conversation internally.

Access the Chat URL

To interact with the chatbot using the Chat URL, follow these steps:

  1. Copy the Chat URL:

    • Locate the Chat URL in the settings of the Chat trigger node

    • Copy the URL to your clipboard.

  2. Open the Chat URL:

    • Paste the copied URL into your web browser's address bar.

    • Press Enter to load the chat interface.

Note: The workflow needs to be enabled Active to be able to browse the Chat URL

Bonus Part: Image Generation

In this section, we will focus on adding a simple HTTP Request module to generate images using the Venice API.

You can either create a new workflow or add this functionality to your existing AI Agent workflow. For this guide, we will demonstrate how to add it to the existing workflow.

Add a Manual Trigger

To add a Manual Trigger to your workflow, follow these steps:

  1. Open Your Workflow:

    • Navigate to the workflow where you want to add the Manual Trigger.

  2. Add a New Node:

    • Click on the TAB key or on the + icon on the workflow to open Nodes panel

  3. Search for Manual Trigger:

    • In the search bar, type "Manual Trigger" and select it from the list of available options.

Add an HTTP Request Module

To add an HTTP Request module to your workflow, follow these steps:

  1. Add a New Node:

    • Click on the TAB key or on the + icon on the workflow to open Nodes panel

  2. Search for HTTP Request

Configure the HTTP Request Module

  1. In the HTTP Request module, set the following configurations:

    1. Method: Set to POST

    2. URL: Enter https://api.venice.ai/api/v1/image/generate

    3. Credential Type: Select OpenAI

    4. Credential: Select the credential you created previously

    5. Send Body: Enable this option

    6. Body Content Type: Set to JSON

    7. Specify Body: Set to Using JSON

    8. JSON Field: Copy and paste the following JSON into the field:

      {
        "model": "fluently-xl",
        "prompt": "A beautiful sunset over a mountain range",
        "negative_prompt": "Clouds, Rain, Snow",
        "style_preset": "3D Model",
        "height": 1024,
        "width": 1024,
        "steps": 20,
        "cfg_scale": 7.5,
        "lora_strength": 50,
        "safe_mode": true,
        "return_binary": true,
        "hide_watermark": false,
        "format": "webp",
        "embed_exif_metadata": false
      }
      

Deliver the Generated Image to your Gmail

To deliver the generated image, you can choose to use Gmail or another preferred action. Here’s how to set it up using Gmail:

  1. Add an Gmail Action Node:

    • Click on the + icon or the "Add Node" button to insert a new node into your workflow.

  2. Search for Gmail:

    • In the search bar, type "Gmail" and select it from the list of available options.

Create a New Credential for Gmail

To create a new credential for using your Gmail account, follow these steps:

  1. Navigate to Credentials

    • Click on the Credentials to connect with

  2. Add a New Credential:

    • Click on the Create New Credential

  3. Select OATH2:

    • Choose OATH2

  4. Authorize Access:

    • Follow the prompts to authorize access to your Google account. This usually involves:

      • Signing in to your Gmail account.

      • Granting the necessary permissions for the application to access your email.

      • Completing any required security verification steps.

  5. Configure Credential Details:

    • Name: Give your credential a recognizable name, such as "Gmail Credential".

  6. Save the Credential:

    • Click on the "Save" button to store the new credential.

Configure the Gmail Action

Set the following configurations in the Gmail action node, adjusting the details as needed for your specific use case:

  1. Resource: Set to Message

  2. Operation: Set to Send

  3. To: Enter the recipient's email address

  4. Subject: Set your preferred subject line for the email

  5. Email Type: Set to HTML

  6. Message: Enter your preferred email body content in HTML format

  7. Attachments:

    • To attach the generated image to the email, click on the "Add Option" button.

    • Select "Attachments" from the list of available options.

    • Configure the Attachment Field Name to “data”

Test the New Workflow

Now that you have configured the workflow, you can test it to ensure everything is working as expected. Follow these steps:

  1. Save Your Workflow:

    • Make sure all changes are saved before testing.

  2. Test the Workflow:

    • Click on the "Test Workflow" button to initiate the test.

  3. Monitor the Output:

    • Observe the workflow execution and check the outputs at each step.

    • Verify that the image is generated correctly and attached to the email.

    • Ensure the email is sent to the specified recipient with the correct subject and body content.

  4. Review Logs and Errors:

    • If any errors occur, review the logs and error messages to diagnose and fix the issues.

    • Make necessary adjustments to the workflow configuration and retest as needed.


Special thanks to Tomas Bystrican for assisting with the creation of this tutorial

Back to all posts
Room