Skip to main content
This guide provides instructions for integrating n8n with the Truefoundry AI Gateway.

What is n8n?

n8n is a powerful workflow automation platform that connects systems and automates tasks through a visual, node-based interface. It enables users to create complex automation workflows that integrate hundreds of different services and tools, including AI capabilities.

Key Features of n8n

  • Visual Workflow Editor: Create automation workflows using a drag-and-drop interface with visual connections between nodes, making complex integrations accessible without coding
  • 500+ Integrations: Connect to hundreds of popular services including databases, APIs, cloud platforms, and productivity tools through pre-built nodes
  • Conditional Logic: Build sophisticated workflows with IF/ELSE conditions, switches, and loops to handle complex business logic and decision-making
  • Webhook Support: Trigger workflows instantly through webhooks and HTTP requests, enabling real-time automation and seamless integration with external systems

Prerequisites

Before integrating n8n with TrueFoundry, ensure you have:
  1. TrueFoundry Account: Create a Truefoundry account with atleast one model provider configured
  2. n8n Account: Set up an n8n account using either the open-source version for self-hosting or the cloud version

Integration Steps

This guide assumes you have an active n8n account and have obtained your TrueFoundry AI Gateway base URL.

Step 1: Generate Your TrueFoundry Access Token

Step 1: Configure n8n Credentials

  1. Navigate to your n8n dashboard and go to Create Workflow > Create Credential:
n8n dashboard showing how to create a new credential
  1. Click Create Credential and search for your model provider from the list.
  2. Select OpenAI from the available credential types.

Step 2: Configure OpenAI Credentials with TrueFoundry

Configure the OpenAI credentials with your TrueFoundry details:
n8n OpenAI credential configuration form with TrueFoundry settings
Fill in the following details:
  • Base URL: You will get the base URL from the unified code snippet in our playground
TrueFoundry playground showing unified code snippet with base URL

Get Base URL from Unified Code Snippet

Click Save to store your credentials. The models will be automatically fetched and listed.

Step 3: Create Your First AI Workflow

  1. Navigate to Overview and click Create Workflow:
  2. Choose Test a simple AI Agent example or Start from scratch to begin building your workflow.

Step 4: Build Your Workflow with AI Components

  1. In the workflow editor, add nodes to create your automation. Start with a trigger and add an LLM chain node:
  2. Configure the OpenAI Chat Model node:
    • Select your TrueFoundry credentials from the dropdown
    • Choose your model from the dropdown list - all available models from your TrueFoundry account will be automatically listed here
n8n OpenAI Chat Model configuration showing model selection dropdown with all available models from TrueFoundry
Note: With the /models endpoint support, you no longer need to manually enter model IDs. All models configured in your TrueFoundry account will be automatically available in the dropdown.

Step 5: Test Your Integration

  1. Save your workflow and execute it to test the integration:
n8s ui showing successful execution of an n8n workflow with TrueFoundry integration
  1. Monitor the execution logs to ensure your AI calls are working correctly through TrueFoundry’s gateway.

Enterprise Features

When using n8n with TrueFoundry, you automatically gain access to enterprise-grade features:

Cost Management & Tracking

  • Budget Controls: Set spending limits for different teams or projects
  • Usage Analytics: Track AI costs across all your n8n workflows
  • Cost Attribution: Monitor expenses by workflow, team, or department
  • Real-time Metrics: Monitor performance, costs, and usage patterns
  • Custom Metadata: Tag workflows for detailed analytics
TrueFoundry dashboard showing cost monitoring and analytics for AI usage

Security & Compliance

  • Access Controls and Rate Limit: Manage who can use which AI models in workflows
  • Audit Logging: Complete logs of all AI interactions for compliance
  • Data Protection: Built-in guardrails to prevent sensitive data exposure
 TrueFoundry request logs showing audit trail of AI interactions

Reliability Features

  • Fallback Models: Automatically switch to backup models if primary fails
  • Load Balancing: Distribute requests across multiple model providers

Advanced Configuration

Multi-Model Workflows

  • Configure different models for different workflow steps
  • Use conditional routing based on input complexity
  • Implement model selection logic based on cost and performance requirements

Team Collaboration

  • Set up shared credentials for team access
  • Implement workflow versioning and change management
  • Use environment-specific configurations for development vs. production

Enterprise Integration

  • Integrate with your organization’s SSO system through TrueFoundry
  • Set up department-specific cost centers and budgets
  • Implement compliance monitoring for regulated industries