Process multiple requests in FIFO using OpenAI Batch API and Supabase/Postgres
Ready for 3.0What this workflow does
This workflow has 16 nodes and runs manually, when you click “Execute workflow” (plus 1 other trigger). Along the way it connects Supabase and Postgres. It also calls api.openai.com over HTTP.
How it runs
Trigger: Manually, when you click “Execute workflow” (plus 1 other trigger).
- Convert to batch requests in .jsonl (Code): runs custom JavaScript code
- Get the earliest uncompleted batch (Postgres): select
- Call Files API (HTTP Request): calls api.openai.com (POST)
- Call Batch API to retrieve batch object (HTTP Request): calls an HTTP API
- Call Batch API (HTTP Request): calls api.openai.com (POST)
- If: checks a condition and branches into true / false
- Create a row in batch table (Supabase): uses Supabase
- Download .jsonl result (HTTP Request): calls an HTTP API
- Update status (Supabase): update
- .jsonl to base (Extract from File): extracts data from a file (binary to propery)
…plus 2 more steps. See the full node list below.
Services it uses
HTTP calls to: api.openai.com
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (9)
- HTTP Request
n8n-nodes-base.httpRequest - Manual Trigger
n8n-nodes-base.manualTrigger - If
n8n-nodes-base.if - Code
n8n-nodes-base.code - Extract from File
n8n-nodes-base.extractFromFile - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Supabase
n8n-nodes-base.supabase - Postgres
n8n-nodes-base.postgres - No Operation, do nothing
n8n-nodes-base.noOp
From the author
How it works You provide a list of prompts and a system instruction, the workflow batches them into a single OpenAI Batch API request. The batch job is tracked in a Supabase openaibatches table. A cron job polls OpenAI every 5 minutes, and once the batch…