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

  1. Open Settings → Community nodes

    You need to be the instance owner. See n8n's installation guide if the section isn't there.

  2. 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.

  3. Or install it manually

    On a self-hosted instance you can skip the GUI and install into n8n's custom nodes directory:

    bash
    cd ~/.n8n/nodes
    npm install n8n-nodes-stac

    Restart n8n afterwards.

Create the credential

The package ships one credential type, Stac API, shared by every node in it.

FieldValue
API KeyA key from your stack's API keys page. Stored encrypted by n8n and never shown again after saving
Base URLhttps://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.

Add it to a workflow

  1. Add an AI root node

    An AI Agent is the usual starting point, but any node with a Model input works.

  2. Connect Stac Chat Model to its Model input

    Search for "Stac" in the node panel — it's listed under Language Models → Chat Models.

  3. 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.

ParameterDefaultNotes
Model—Required. Loaded from your plan; can also be set with an expression
Sampling Temperature0.70–2. Lower is more deterministic
Maximum Number of Tokens2048Upper bound on generated tokens. The API clamps to its own floor and ceiling — see Chat completions
Timeout120000Milliseconds. Under saturation Stac degrades speed rather than failing, so a tight timeout cuts off responses that would have arrived
Max Retries2Retries 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-workflow and @n8n/ai-node-sdk are peer dependencies, so the process keeps a single @langchain/core instance 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.

  1. Check the requirements

    You need a recent self-hosted n8n version with support for the instance-ai module, and a sandbox running — required for the Assistant to execute what it builds. See n8n's setup docs for sandbox options.

  2. Set the instance's environment variables

    The same key from the table above works here — no need to create another one.

    bash
    N8N_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>
  3. Restart the instance

    The module only loads at n8n boot.

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.
  • 429 on 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_ENABLED isn't set to false, 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:

  1. In the dashboard, go to API keys.
  2. On the key used by the n8n credential, open ⋮ → Settings.
  3. 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.