Queue OpenAI-compatible LLM chat requests with PostgreSQL and a local GPU
Ready for 3.0What this workflow does
This workflow has 36 nodes and runs manually, when you click “Execute workflow” (plus 4 other triggers). Along the way it connects Postgres.
How it runs
Trigger: Manually, when you click “Execute workflow” (plus 4 other triggers).
- Init Queue Table in PostgreSQL (Postgres): run a query
- Set Model Discovery Params (Edit Fields (Set)): sets 1 field: configuredModelIds
- Set Chat Gateway Parameters (Edit Fields (Set)): sets 3 fields: waitPollSeconds, waitMaxAttempts, jobMaxAttempts
- Verify Task ID (Code): runs custom JavaScript code
- Set GPU Dispatcher Params (Edit Fields (Set)): sets 4 fields: upstreamChatCompletionsUrl, upstreamTimeoutMs, leaseMinutes…
- Execute Setup Code (Code): runs custom JavaScript code
- Display Configured Models (Code): runs custom JavaScript code
- Process Chat Request (Code): runs custom JavaScript code
- Check Valid Task ID (If): checks a condition and branches into true / false
- Handle Expired Task Leases (Postgres): run a query
…plus 20 more steps. See the full node list below.
Services it uses
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.
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (11)
- Manual Trigger
n8n-nodes-base.manualTrigger - Postgres
n8n-nodes-base.postgres - Code
n8n-nodes-base.code - Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - Switch
n8n-nodes-base.switch - Respond to Webhook
n8n-nodes-base.respondToWebhook - If
n8n-nodes-base.if - Schedule Trigger
n8n-nodes-base.scheduleTrigger - HTTP Request
n8n-nodes-base.httpRequest - No Operation, do nothing
n8n-nodes-base.noOp
From the author
Quick overview An n8n-first, durable FIFO gateway for a local OpenAI-compatible language model. It accepts ordinary Chat Completions requests, queues them in PostgreSQL, runs one inference at a time, and supports human retrieval commands, automatic waiting by…