OpenAI model in AI Agent is failing in n8n Cloud Starter Edition

OpenAI model in AI Agent is failing in n8n Cloud Starter Edition

The error message I am getting when running a common AI Agent node with OpenAI model is:

The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: ‘My API Key’ }).

You can see in the image 3 flows:
a) AI Agent with Claude → works!
b) OpenAI chat node → works!
c) AI Agent with OpenAI → fails (with same credentials as the OpenAi chat node)

BTW - when running the same flow with the same credentials in n8n.io enterprise edition it works perfectly.

Does anyone has suffered the same error?
Appreciate your help. Thanks!

My environment:

  • n8n version: 1.121.3 (Cloud) - Starter Edition
  • Running n8n via: n8n cloud (n8n.io)
1 Like

Can you try to remove open AI credentials and then add it again and see if it works or not?

Hi @appunitsai , I removed all OpenAI credentials, added them again and nothing. You can see that in the same workflow the same credential works well with chat and fails with Ai Agent model mode… weird…
I also updated the n8n to the latest version… also didn’t help…

Im suffer from the same issue as well

Hi Dan, Finally after 3 days waiting a HUMAN from the n8n support team contacted me… hopefully he’ll find a solution to this. I’ll update here. Cheers!