n8n is a workflow automation platform that connects systems and automates tasks with AI capabilities. TrueFoundry integrates seamlessly with n8n, providing enterprise-grade AI features including cost tracking, security guardrails, and access controls. TrueFoundry’s AI Gateway routes all LLM calls through the Gateway to ensure your automation workflows are secure, compliant, and cost-effective.

Prerequisites

Before integrating n8n with TrueFoundry, ensure you have the following:
  1. Authentication Token: Create a Personal Access Token in TrueFoundry by following the instructions in Generating Tokens. This token will authenticate your n8n workflows to the TrueFoundry Gateway.
  2. Gateway Base URL: Locate your TrueFoundry Gateway base URL, which follows the format <control plane url>/api/llm. The control plane URL is where your TrueFoundry dashboard is hosted (e.g., https://company.truefoundry.cloud/api/llm).
  3. n8n Account: Set up an n8n account using either the open-source version for self-hosting or the cloud version.
  4. Model Access: Ensure you have access to the AI models you want to use through TrueFoundry’s model catalog.

Integration Steps

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

Step 1: Generate Your TrueFoundry Access Token

  1. Navigate to your TrueFoundry dashboard and go to Access Management.
  2. Click New Personal Access Token to create a new token:
  1. Copy and securely store your Personal Access Token - you’ll need this for n8n configuration.

Step 2: Configure n8n Credentials

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

Step 3: Configure OpenAI Credentials with TrueFoundry

Configure the OpenAI credentials with your TrueFoundry details:
Fill in the following details:
  • API Key: Enter your TrueFoundry Personal Access Token
  • Base URL: Enter your TrueFoundry Gateway base URL (e.g., https://internal.devtest.truefoundry.tech/api/llm/api/inference/openai). You will get this from the unified code snippet
Important Note: You may see a “Couldn’t connect with these settings” error message. This is expected and normal behavior because n8n tries to fetch the models list from the /models endpoint, which TrueFoundry doesn’t expose in the same way as OpenAI. Your credentials are still saved correctly and will work in your workflows.
Click Save to store your credentials.

Step 4: 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 5: 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 By ID for model selection
    • Enter your model ID from TrueFoundry’s model catalog

Step 6: Get Model ID from TrueFoundry

  1. Navigate to your TrueFoundry playground to get the correct model identifier:
  1. Copy the model ID (e.g., openai-main/gpt-4o) and paste it into your n8n workflow configuration.

Step 7: Test Your Integration

  1. Save your workflow and execute it to test the 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

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

Reliability Features

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

Troubleshooting

Common Issues

Credential Connection Error
  • This error is expected when saving OpenAI credentials with TrueFoundry
  • Your credentials are still saved and will work correctly
  • The error occurs because n8n cannot fetch the models list from TrueFoundry’s endpoint
Model Not Found
  • Ensure you’ve copied the correct model ID from TrueFoundry dashboard
  • Verify the model is available in your TrueFoundry account
  • Check that your access token has permissions for the model
Authentication Failed
  • Verify your Personal Access Token is correct and active
  • Ensure the base URL matches your TrueFoundry instance
  • Check that your token has sufficient permissions
Workflow Execution Errors
  • Check the execution logs for detailed error messages
  • Verify your model configuration and parameters
  • Ensure your TrueFoundry account has sufficient quota

Getting Help

For additional support:
  • Check the TrueFoundry documentation for detailed guides
  • Contact your TrueFoundry administrator for enterprise features
  • Refer to n8n’s documentation for workflow-specific questions
  • Monitor TrueFoundry’s analytics dashboard for debugging insights

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
Your n8n workflows now benefit from TrueFoundry’s enterprise AI infrastructure, providing the reliability, security, and cost control needed for production deployments.