Hi all ![]()
I’m stuck on an HTTP Request node calling the OpenAI Chat Completions API, and after a lot of debugging I’m not sure what I’m missing. Hoping someone can sanity-check this.
What I’m trying to do
I’m building a workflow that:
- Pulls SERP data (DataForSEO)
- Formats it into a valid OpenAI messages array
- Sends it to OpenAI via an HTTP Request node (/v1/chat/completions)
- Parses the response downstream
Current behaviour
The OpenAI node fails with:
Bad request – please check your parameters
invalid model ID
This happens even though:
messages is a valid array
The payload is valid JSON
The model is set to gpt-4.1
Workflow details
n8n version: n8n Cloud v2.1.4
HTTP Request node: Method: POST
URL: https://api.openai.com/v1/chat/completions
Authentication: Header Auth (OpenAI API key)
Body Content Type: JSON
Specify Body: Using fields below
Body parameters
model: gpt-4.1 (string, not expression)
temperature: 0.2
messages: ={{ $json.messages }} (Expression mode)
Upstream payload (confirmed output)
The previous node (“Format AI Payload”) outputs:
{
“model”: “gpt-4.1”,
“temperature”: 0.2,
“messages”: [
{
“role”: “system”,
“content”: “You are an SEO content analyst. Return only JSON.”
},
{
“role”: “user”,
“content”: “{ “h1”: “football boots”, “url”: “https://www.abc.com”, “results”: […] }”
}
]
}
In the Expression editor, the messages field clearly evaluates to:
[Array:
{ role: “system”, content: “…” },
{ role: “user”, content: “…” }
]
So it is not being stringified as [object Object].
What I’ve already tried
Different models:
gpt-4.1
gpt-4.1-mini
Hard-coding the model value (not using expressions)
Verifying messages is an array via the Expression editor
Ensuring messages.content is always a string
Rebuilding the HTTP Request node from scratch
Running the same payload successfully via curl outside n8n
Still get the same error in n8n.