Use this technical n8n workflow template to create an API adapter that seamlessly integrates the cutting-edge OpenAI Responses API with existing n8n LLM and AI Agent nodes, handling both streaming and standard responses.
Download this n8n workflow template and start using it instantly.
n8n Automation Specialists who need immediate access to the latest OpenAI API features.
Developers implementing complex AI Agent workflows in n8n.
Users looking for advanced examples of n8n code node scripting and webhook configuration.
Anyone needing an n8n solution to bridge API compatibility gaps.
When integrating new APIs, compatibility challenges often arise, especially with rapidly evolving AI services like OpenAI. The newer OpenAI Responses API, while powerful and supporting multimodal use cases, has a response structure fundamentally different from older Langchain-compatible models. This complex n8n workflow acts as an API adapter, using n8n's robust webhook and code capabilities to translate requests and responses in real-time.
By configuring a custom OpenAI credential within your n8n LLM or AI Agent n8n node to point to the webhooks of this n8n template, you can effectively trick the older n8n agent infrastructure into communicating with the new Responses API. This provides a crucial workaround for advanced users who require the new API features immediately without waiting for official n8n node support, maximizing the potential of their existing n8n workflow designs.
This technical n8n workflow is designed around two primary webhook endpoints that mimic the standard OpenAI API structure:
/n8n-responses-api/models): This n8n trigger handles GET requests requesting a list of available models. It executes an HTTP request to the actual OpenAI /v1/models endpoint and responds directly to the requester, ensuring the agent system sees the expected model list./n8n-responses-api/chat/completions): This is the core adapter endpoint, activated by a POST n8n trigger. When an n8n node (like an LLM or Agent node) sends a request here:Remap to Response API Schema code node transforms the incoming standard chat completion request JSON into the format required by the OpenAI Responses API (specifically formatting the messages array into the input structure).OpenAI Responses API n8n node sends this transformed request to the actual OpenAI Responses API (/v1/responses).Is Agent? If n8n node checks the original request's stream parameter to determine the required response format.Format Stream Response code node parses the Server-Sent Events (SSE) response and generates the necessary chunked SSE format compatible with the n8n Langchain Agent, sent via the Text Response n8n node.Format Completion Response code node structures the JSON output to match the standard OpenAI chat.completion schema, sent via the JSON Response n8n node.An example flow is also included demonstrating how an AI Agent n8n node uses this custom configuration after being activated by a When chat message received n8n trigger.
To utilize this advanced n8n workflow, follow these setup steps:
https://n8nurl>/webhook/n8n-responses-api . Webhook (n8n-nodes-base.webhook): Used as the primary n8n trigger for two endpoints: /models (GET) and /chat/completions (POST). These define the entry points for the adapted API.
HTTP Request (n8n-nodes-base.httpRequest): Two instances are used: one to retrieve the list of OpenAI Models and a second, critical instance that posts the transformed payload to the external OpenAI Responses API.
Remap to Response API Schema (n8n-nodes-base.code): This vital custom code n8n node translates the incoming request body (messages array) into the expected input array structure for the new Responses API, utilizing custom JavaScript functions for content transformation.
Is Agent? (n8n-nodes-base.if): An important flow control n8n node that branches the n8n workflow based on whether the original request specified streaming (stream: true).
Format Completion Response / Format Stream Response (n8n-nodes-base.code): These two code n8n nodes handle the complex task of re-shaping the Responses API output back into a format (either standard JSON or SSE text stream) that the requesting n8n LLM node can understand and parse.
Respond to Webhook (n8n-nodes-base.respondToWebhook): Used in three locations (Models Response, JSON Response, Text Response) to send the final, correctly formatted data back to the originating n8n agent or LLM n8n node.
Deploy a powerful n8n workflow featuring an AI Agent powered by GPT-4 and DALL-E. Use this n8n automation to generate custom logos, style guides, and gradient backgrounds on demand via a chat interface.

Automate OpenAI DALL-E image editing using a custom n8n workflow. Trigger edits with a prompt and source image, then convert the Base64 output back to a file using an n8n node.

Automate company profile enrichment. This n8n workflow scrapes website content, uses the OpenAI n8n node for data classification (B2B, industry, value prop), and updates Google Sheets automatically. Find more n8n templates.

Explore advanced AI capabilities with this n8n workflow. It includes ChatGPT, Davinci, Whisper, and DALLE-2 examples for summarization, translation, image generation, and programmatic API calls.


Freelance consultant based in the UK specialising in AI-powered automations. I work with select clients tackling their most challenging projects. For business enquiries, send me an email at [email protected] LinkedIn: https://www.linkedin.com/in/jimleuk/ X/Twitter: https://x.com/jimle_uk







































