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!
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…
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!
I have seen this. In the starter edition you don’t have access to “Variables”. You would need to be on the Pro plan or higher. This is why the message is strange for the starter edition. It turns out that this error as-is can be seen if the credential references a variable from the credentials. Can you confirm that you do not have something like this:
You will have to actually type out the key. If you don’t have the above expression, just try to type in an incorrect key (fixed mode, not expression) to see what happens. Try to get different error message because you should not get this error in the starter edition when not using variables.
If you’re seeing it still, create a new basic workflow with just a chat trigger, Agent and OpenAI model attached. Please let me know what the error message is with that setup. If no errors, continue to add the other transitions to build up to what you had.
Hi @KhemOptimal appreciate your response.
Due to the huuuuuge amount of time the support people tool to answer my questions and the fact that they could not solve the issue, I asked for a full refund and canceled my account.
I am an expert n8n user and the solutions you and the support team offer me are very basic and do not address the underlying technical issue I was experiencing.
I have a docker n8n community instance, i also have a n8n pro in my work, and access to n8n en prem community. On all environments the workflow and credentials worked well the only place where this didn’t work on the n8n starter paid environment.
On the faulty n8n instance the chat node worked and the ai agent with model didn’t (see image).
My assumption is a corruption of an element in the backend DB of the instance, that a normal support people don’t have the tools to troubleshoot…