{ "name": "Generate a chat answer in n8n with AceDataCloud", "nodes": [ { "parameters": {}, "id": "e8b9d998-a119-426b-aa8a-47f71848f5a1", "name": "Start a manual test", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ 240, 300 ] }, { "parameters": { "assignments": { "assignments": [ { "id": "aa1895bb-3ab4-4517-acfd-c28e7eb7e0c2", "name": "prompt", "value": "Explain in one sentence what n8n automates.", "type": "string" }, { "id": "925408cb-5050-48da-a889-fd9e2ed2e45a", "name": "model", "value": "gpt-4o-mini", "type": "string" } ] }, "options": {} }, "id": "0aed7632-a0df-47a9-924d-8850b1613260", "name": "Set prompt and model", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 460, 300 ] }, { "parameters": { "method": "POST", "url": "https://api.acedata.cloud/openai/chat/completions", "authentication": "genericCredentialType", "genericAuthType": "httpBearerAuth", "sendBody": true, "contentType": "json", "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ model: $json.model, messages: [{ role: 'user', content: $json.prompt }], stream: false, max_tokens: 80 }) }}", "options": { "timeout": 120000 } }, "id": "534f922e-7b7c-46da-a9ef-51701db9d73b", "name": "AceDataCloud chat", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.3, "position": [ 700, 300 ] }, { "parameters": { "assignments": { "assignments": [ { "id": "0e230e10-c56e-4c61-b6a8-005b50b6d8a6", "name": "answer", "value": "={{ $json.choices[0].message.content }}", "type": "string" }, { "id": "e68ed73e-2bd8-4a3d-ae6b-5b44c2c6b548", "name": "response_id", "value": "={{ $json.id }}", "type": "string" }, { "id": "cb3c099d-18af-40da-aa45-95b3e6386f50", "name": "model", "value": "={{ $json.model }}", "type": "string" }, { "id": "95388d32-8c2b-4bbc-a782-0d65cc6e3515", "name": "prompt_tokens", "value": "={{ $json.usage.prompt_tokens }}", "type": "number" }, { "id": "eb9baa52-f565-4a29-80f1-9846cc305328", "name": "completion_tokens", "value": "={{ $json.usage.completion_tokens }}", "type": "number" }, { "id": "b2fae8eb-8ec9-49bb-9154-e3f3e31598e7", "name": "total_tokens", "value": "={{ $json.usage.total_tokens }}", "type": "number" } ] }, "options": {} }, "id": "f8be90b4-ae1c-4b5a-94b6-4635603695fe", "name": "Read answer and usage", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 940, 300 ] }, { "parameters": { "content": "### How it works\nThis workflow sends one short prompt to AceDataCloud Chat Completions and turns the response into fields that later n8n steps can use. A manual trigger starts a single test. Edit Fields holds the prompt and model, HTTP Request makes a non-streaming call using an encrypted n8n Bearer Auth credential, and the final Edit Fields node exposes the answer, response ID, model, and token counts. Only built-in n8n nodes are used. The workflow is inactive after import.\n\n### Setup\n1. Open [AceDataCloud Applications](https://platform.acedata.cloud/console/applications?utm_source=opensource&utm_medium=referral&utm_campaign=evergreen&utm_content=n8n_template_chat_api_key). Sign in or register, initialize the General application if it is missing, and copy its API Key or create a separately named key in Keys / Manage Keys. Check expiry, usage limits, Chat Completions access, current model pricing, and balance. A platform-... account-management token is not a generation key.\n2. Open AceDataCloud chat and connect a Bearer Auth credential. Enter the token without the Bearer prefix.\n3. Save the workflow, edit the prompt and model, then execute once. Inspect the final output and the matching AceDataCloud usage record before adding a schedule or webhook.\n\n### Customization tips\nReplace the manual trigger with your own source and map its text into prompt. The example limits output to 80 tokens. Automatic retries are off because a timed-out POST may have completed and been charged. Review execution-data retention before sending sensitive prompts.", "height": 500, "width": 500, "color": 1 }, "id": "e57dc6fb-489f-45bd-99ea-555596493622", "name": "Workflow overview", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -320, -180 ] }, { "parameters": { "content": "## 1. Prepare input\nRun one manual test. Set the prompt and choose a supported chat model in Edit Fields.", "height": 350, "width": 450, "color": 7 }, "id": "2d618d1f-3387-4e3f-92fc-b363097c455d", "name": "Prepare input", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 210, 125 ] }, { "parameters": { "content": "## 2. Call and inspect\nThe HTTP node uses your Bearer credential. The final node exposes the answer, response ID, and token counts.", "height": 350, "width": 530, "color": 7 }, "id": "c923ec28-75a3-41ba-911b-5f38fbca5596", "name": "Call and inspect", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 680, 125 ] } ], "connections": { "Set prompt and model": { "main": [ [ { "node": "AceDataCloud chat", "type": "main", "index": 0 } ] ] }, "AceDataCloud chat": { "main": [ [ { "node": "Read answer and usage", "type": "main", "index": 0 } ] ] }, "Start a manual test": { "main": [ [ { "node": "Set prompt and model", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": { "executionOrder": "v1" }, "pinData": {}, "tags": [] }