Guides
n8n
Use your stack as the language model behind any n8n AI node, through the n8n-nodes-stac community package.
n8n-nodes-stac is a community
node package that adds a Stac Chat Model sub-node to n8n. It plugs into the
Model input of any AI root node — AI Agent, Basic LLM Chain, Question and
Answer Chain — so a workflow runs on your stack instead of a per-token
provider.
The node talks to the same OpenAI-compatible surface as everything else here, so nothing about your stack changes: same key, same base URL, same fixed monthly price no matter how often the workflow fires.
Install the node
Open Settings → Community nodes
You need to be the instance owner. See n8n's installation guide if the section isn't there.
Install n8n-nodes-stac
Click Install a community node, enter the package name, accept the risks prompt, and install. n8n restarts the node registry on its own — no container restart needed.
Or install it manually
On a self-hosted instance you can skip the GUI and install into n8n's custom nodes directory:
bashcd ~/.n8n/nodes npm install n8n-nodes-stacRestart n8n afterwards.
Create the credential
The package ships one credential type, Stac API, shared by every node in it.
| Field | Value |
|---|---|
| API Key | A key from your stack's API keys page. Stored encrypted by n8n and never shown again after saving |
| Base URL | https://api.trystac.com/v1 — leave it unless you were given a dedicated endpoint |
Authentication is a bearer token (Authorization: Bearer <key>), the same as
every other Stac client. The credential's Test button calls
GET /v1/models, so a green test confirms the
key and the base URL in one shot.
Keys are scoped to a single stack. Use a separate key for n8n rather than reusing your application's — that way revoking it doesn't take your product down with it. See Authentication.
Add it to a workflow
Add an AI root node
An AI Agent is the usual starting point, but any node with a
Modelinput works.Connect Stac Chat Model to its Model input
Search for "Stac" in the node panel — it's listed under Language Models → Chat Models.
Pick the model
The Model dropdown is populated at edit time from
GET /v1/models, so it lists exactly what your key can call — for most plans that's a single entry, the model your stack runs.
Parameters
Everything except Model lives under Options and is optional.
The defaults in the table only apply once the option has been added under
Options. An option that was not added is not sent. On node version 0.1.0
this meant the request went out without max_tokens: the server applied its
8000 floor with thinking enabled and a short answer could take minutes, then
die on the gateway timeout. 0.1.1 sends 2048 even without the option.
Timeout and Max Retries still require adding the option; without it the
OpenAI SDK defaults apply (600 s and 2 retries).
| Parameter | Default | Notes |
|---|---|---|
| Model | — | Required. Loaded from your plan; can also be set with an expression |
| Sampling Temperature | 0.7 | 0–2. Lower is more deterministic |
| Maximum Number of Tokens | 2048 | Upper bound on generated tokens. The API clamps to its own floor and ceiling — see Chat completions |
| Timeout | 120000 | Milliseconds. Under saturation Stac degrades speed rather than failing, so a tight timeout cuts off responses that would have arrived |
| Max Retries | 2 | Retries per failed request |
How it plugs into n8n
The node builds the model through supplyModel from @n8n/ai-node-sdk, which
n8n provides at runtime. Two consequences worth knowing:
- No bundled LangChain.
n8n-workflowand@n8n/ai-node-sdkare peer dependencies, so the process keeps a single@langchain/coreinstance instead of two fighting over it. - Executions are traced by n8n itself. Model calls show up in n8n's own logging and tracing view, with prompts and token counts, not just as an opaque HTTP call.
Developed and tested against n8n 2.36.9. Older releases ship earlier versions of that SDK and are untested.
Editor AI Assistant
This is different from the Chat Model node above: it's n8n's native AI Assistant — the feature that builds, runs, and iterates on an entire workflow from a prompt, inside the editor itself, rather than a node inside a workflow you've already built. It also accepts a custom, OpenAI-compatible model provider, so you can point it at your stack.
Preview feature on self-hosted n8n — behavior can change between releases. Unlike the Chat Model node, there's no Model dropdown in the UI: the Assistant assumes whatever model the configured endpoint serves.
Check the requirements
You need a recent self-hosted n8n version with support for the
instance-aimodule, and a sandbox running — required for the Assistant to execute what it builds. See n8n's setup docs for sandbox options.Set the instance's environment variables
The same key from the table above works here — no need to create another one.
bashN8N_ENABLED_MODULES=instance-ai # add to whatever modules are already enabled N8N_INSTANCE_AI_MODEL_URL=https://api.trystac.com/v1 N8N_INSTANCE_AI_MODEL_API_KEY=<the same key from the API keys page>Restart the instance
The module only loads at n8n boot.
Reusing the Chat Model node's key here also reuses its knowledge base setting: if it's Enabled, retrieved context gets injected into the internal instructions the Assistant sends itself while building the workflow, not just into the node's answers inside it.
Troubleshooting
- Model dropdown is empty. The credential can't reach
GET {baseUrl}/models— wrong key, wrong base URL, or the instance has no outbound network access. Run the credential test to see which. 401 invalid_api_key. The key was revoked or belongs to a deleted stack. Generate a new one; see Errors.429on a busy workflow. Rate limits are per key. Give n8n its own key so a retry storm in a workflow doesn't throttle your application.- Node doesn't appear after installing. Check that
N8N_COMMUNITY_PACKAGES_ENABLEDisn't set tofalse, then reload the editor.
Resources
Knowledge base
n8n's agent nodes always send their own system message — the "System
Message" field is pre-filled even if you never touch it. So, to ground answers
in your own documents, the key used here must have the
knowledge base enabled:
- In the dashboard, go to API keys.
- On the key used by the n8n credential, open ⋮ → Settings.
- Turn on Knowledge base and pick Enabled.
A key left on "automatic" — the state of keys created before this setting
existed — never searches the base from n8n, precisely because the node sends
system on every request. The symptom is silent: the model answers as if no
document existed, with no error.
The agent's persona still comes from the node's "System Message" field: the retrieved excerpt is appended after it, not in place of it.
Next steps
- OpenAI compatibility — the surface the node speaks, and what differs from OpenAI.
- Authentication — key format, scoping, rotation.
- Knowledge base — ground workflow answers in your own documents, with no retrieval nodes in the canvas.