How to Add a Custom ChatGPT Model in AI Agent Workflow in n8n?

I have created a workflow in n8n using the AI Agent node and added OpenAI. However, I want to use my custom ChatGPT model instead of the default OpenAI models. How can I integrate my custom model into the AI Agent workflow in n8n?

If any additional configurations or API settings are needed, please provide guidance.

Hey there! If you’ve created a custom GPT Agent directly on OpenAI’s platform (like an Assistant with specific instructions) and want to use it in n8n, the integration is straightforward. Here’s how:

Step-by-Step Guide to Connect n8n to Your OpenAI Agent:

1. Get Your Agent’s (Assistant) ID from OpenAI

  • Go to the OpenAI Playground or the “Assistants” section in your dashboard.
  • Find your custom Assistant’s ID (e.g., asst_xyz123).

2. Use the “OpenAI” Node in n8n

  • Add the OpenAI node to your workflow.
  • Select the action “Create Thread and Run” (or “Create Assistant” if configuring from scratch).
  • In the Credentials section, add your OpenAI API key.

3. Configure the Node to Use Your Agent

  • In the Assistant ID field, enter your Assistant’s ID (asst_xyz123).
  • Add your Agent’s specific instructions in Instructions (if needed):
    "You are a marketing expert. Always respond in English."  
    

4. Run and Test

  • Add input (e.g., a user query) via a Webhook or Manual Trigger node.
  • Connect everything and execute the workflow.

Example Workflow:

Webhook (User Input) → OpenAI (Create Thread and Run) → Agent’s Response → Output  

Additional Configurations (Optional):

  • Base Model: If your Agent uses a customized base model (e.g., gpt-4-turbo), select it in the Model field.
  • Tools: Enable tools like retrieval or code_interpreter directly in the node’s settings.

Key Tip:

If your Agent uses knowledge files (e.g., PDFs for context), upload them via OpenAI’s API first and reference their IDs in the node (e.g., file_abc123).


Need help finding your Assistant ID or structuring instructions? Share more details! :blush:

Cheers,
Dandy

Example Node Configuration:
(Replace with actual screenshot if possible)

Troubleshooting:

  • Use the HTTP Request Node to debug API calls if responses aren’t as expected.
  • Check OpenAI’s Assistant API Docs for advanced settings.

It doesn’t look like suitable answer.
I need just to understand how importing external library in N8N.
For example, I am going to import ai image generator product to n8n workflow that made by me.
Currently, n8n looks like only support already imported library now. I am going to add my ai product to n8n. But it is not on the list of n8n.
At this time, what is the solution to solve this problem.

Adding to the chain here- for those of us that custom build our own models, is there a way to integrate in n8n? Dandy_Dow answered based on a custom agent built with one of the proprietary LLM models.