ChatGPT different results via API vs Chat

Hello!

I might be running into a common issue but I haven’t been able to find a solution through search, or maybe my search skills are just poor.

The responses I get from OpenAI GPT through the API’s does not match what I get with the web-based chat client. This is regardless of version, let’s just say 5.1, but it really doesn’t matter it’s the same issue for all versions, I’ve been brute forcing and the behavior is the same across all GPT API versions I’ve tested.

A specific example of a task, not limited to this, but just an example, is sending OpenAI a web server configuration file which contains syntax errors and then receiving back a corrected and fixed configuration file. This works flawlessly and instantly with chat gpt. I have tried countless variations of service agents prompts and model versions through the gpt API’s in n8n and I just cannot get back the response I want, which is the response that the web chat produces.

Has anyone else run into this issue with LLM API’s and if so how do you approach solving this issue?

Any help would be greatly appreciated, it’s a frustrating wall I’ve run into. :frowning:

Hey @astring ! Welcome to n8n community.

Have you tried to to set sampling temperature option for the ai agent node?

The lower the value is, likely more deterministic will be…

i f you expect that most responses should be aligned with your criteria.

2 Likes

Oh, ok, so I took your suggestion and learned how to control temperature. After talking to chat gpt further I set Temperature to 0 and also Top P to 1. It actually worked! Using gpt 4.1 mini and seeing corrected configuration files come back finally.

Thank you!

I’ve run into similar differences between API outputs and the web client, so you’re not alone. The web interface uses extra system-level instructions and context you don’t see, which is why it often feels “smarter.” Re-creating that in n8n usually means adding clearer system prompts and stricter formatting rules. I once tested an online tool that claims to convert robotic AI text into natural writing, but it often over-edited and wasn’t reliable. Tuning prompts has worked far better than using add-on tools.

It often happens, yes.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.