Use native/internal web search tool supported by OpenAI models

Describe the problem/error/question

n8n is the GOAT! Just started yesterday :victory_hand:

Q: How can I use the internal tool capabilities of OpenAI’s models, e.g. GPT 4.1?

Note: I’m not talking about connecting a tool to the agent node.

I’m talking about the tool that gets activated when including it in the API request, i.e. the one that gets included here (see the tools property).

const response = await client.responses.create({
    model: "gpt-4.1",
    tools: [ { type: "web_search_preview" } ],
    input: "What was a positive news story from today?",
});

This can be include easily in OpenAI’s API playground as well. Note the Web Search in the menu below:

Here’s n8n’s chat model window. I’ve been looking at all options, but none allows me to include internal tools.

Why does it matter?

For most tasks, OpenAI’s simple web search tool is enough. There’s no need to connect to any third-party APIs and it’s probably also cheaper and less complex.

Plus it’s a lower latency, as it’s internal to the model.

Am I searching in the wrong place, or is this not supported on purpose?

I’d appreciate any infos and hints on how to make this work.

And if it’s not supported on purpose, I’d love to hear the design decision behind this – especially because it’s the OpenAI Chat Model and not a Generic Chat Model.

Background & Community Demand

There’s already a thread by @abierbaum: Any way to use OpenAI Chat Model with default open AI tool: web_search_preview.

Unfortunately, this thread was auto-closed due to inactivity.

It would be great to have an expert/architect opinion on this. OpenAI (and other) models are getting better by the day. It would be a shame not to take full advantage of their native functionalities.

Cheers!
Robert

Information on your n8n setup

  • n8n version: 1.100.1
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own, main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Arch Linux, kernel 6.15.2

Hi there, i think you need to use the AI Agent Node, and then connect all the tools that you want, for example for searching the web you can use serpAPI or tavily for it

something like this

Hey @roberthangu hope all is well and welcome to the community.

I see you are looking for a way to use chatgpt internal tools. I hope they will come to be a part of the n8n soon, until then you can always use http request node and send any such request directly to openai via their api.

3 Likes

I’ve actually been trying to set this up with no luck. Can you help me with any more details on your http node?

Sure thing, here you go

This is how it looks like. For the “Authentication” field make sure you’ve already saved your OpenAI credentials in n8n, then you just reference them there from the drop-down.

Once that’s done you just pass the body as JSON further down in the “body” field.

Yess!! That’s genius, haha!

I think when you switch from the coding world to no-code, you intentionally try switching off your brain to not think in code anymore.

So you forget that at the end of the day, no-code tools essentially just connect with APIs, too :joy:

Cheers for your help!!