How do I call Leiolai from an n8n workflow?

Use an n8n HTTP Request node to send a Chat Completions request to Leiolai. Configure a Bearer credential, send model and messages as JSON, and pass choices[0].message.content to the next node.

Which node sends the request?

Add an n8n HTTP Request node with method POST and URL https://api.leiolai.com/v1/chat/completions. Attach a Bearer credential containing your Leiolai key, set Content-Type to application/json, and send the model and messages in the JSON body.

Where should I put the API key?

Create a generic Bearer credential and use your Leiolai key as the token. Attach that credential to the HTTP Request node. Keep the key out of the node’s visible JSON body and exported examples.

Create and protect the key

What JSON body should the node send?

Send model: leiolai-1, a messages array containing the user’s prompt, and stream: false for a single JSON result. A Private-only key can omit mode. An unrestricted key needs mode: private or mode: non-private in the body.

How do I use data from an earlier node?

Map an earlier n8n node’s value into the user message sent to Leiolai. State the transformation the workflow needs, such as turning meeting notes into action items. Keep the instruction and source material clearly separated in the prompt.

Which response value goes to the next node?

The Leiolai answer returned to n8n is in choices[0].message.content. Pass that value to the next step that needs the answer. Handle a failed request before looking for a successful response’s choices array.

Can the workflow request a JSON schema?

Leiolai Chat Completions supports response_format for JSON objects or schema-valid JSON. Use a schema when the next node expects named fields. Parse the successful JSON content and map those fields into the following node.

Define the required output structure

How can I estimate workflow API costs?

Estimate n8n requests to Leiolai using each request’s input and output tokens and the selected mode-and-effort rate. A workflow that runs repeatedly should also use an account or key budget appropriate to the expected volume.

Estimate a request’s cost

What should the workflow do after an API error?

After a Leiolai API error, branch the n8n workflow on the error or stop the affected step with the returned code. Authentication, budget, invalid-field, and temporary errors require different actions. Honor Retry-After for rate limits and use bounded retries for temporary failures.

Handle the error that occurred