Connect n8n to TrustedRails
n8n is a workflow-automation tool with built-in AI nodes. Those nodes speak the OpenAI API, so you can point them at TrustedRails with a custom Base URL on the OpenAI credential and run your automations on open-source models.
You'll connect through the AI Agent node and its OpenAI Chat Model sub-node. (The standalone OpenAI app node is best avoided here — its v2 has a known runtime issue with custom base URLs.)
Prerequisites
Section titled “Prerequisites”- A TrustedRails API key (starts with
tr-prx-). See Create a TrustedRails API Key. - A running n8n instance (n8n Cloud or self-hosted).
Create the OpenAI credential
Section titled “Create the OpenAI credential”- In the left sidebar, click the Create button at the top and choose Credential (or open Credentials from the sidebar and click Add credential).
- In the Add new credential search box, type
OpenAI, select OpenAI (theOpenAi APItype), and click Continue. - Fill in:
- API Key — your TrustedRails key (
tr-prx-…) - Base URL —
https://proxy.trustedrails.com/v1 - Organization ID — leave blank
- API Key — your TrustedRails key (
- Save. n8n runs a credential test against the Base URL; a green check means it reached TrustedRails.
Add the model to a workflow
Section titled “Add the model to a workflow”- In a workflow, add an AI Agent node (or any AI chain node).
- On its Chat Model input, add the OpenAI Chat Model sub-node and select the credential you just created.
- Open the Model dropdown — n8n loads the list from TrustedRails's
/v1/models. Pickmoonshotai/Kimi-K2.6(recommended) orMiniMaxAI/MiniMax-M2.7(see Supported Models). - Turn off the
Use Responses APItoggle on the OpenAI Chat Model node. It is on by default and routes requests to OpenAI's Responses API endpoint, which TrustedRails does not serve — leaving it on fails with a "resource not found" (404) error at runtime. With it off, the node uses the standard chat-completions endpoint.
Verify
Section titled “Verify”Run the workflow (or use the Chat trigger / Test workflow) and send a message. A reply from the AI Agent confirms n8n is reaching TrustedRails through your key.
Troubleshooting
Section titled “Troubleshooting”- "The resource you are requesting could not be found" (404) at runtime — the OpenAI Chat Model node's Use Responses API toggle is on (the default); turn it off so the node calls the chat-completions endpoint TrustedRails serves. Also prefer the AI Agent + OpenAI Chat Model node over the standalone OpenAI app node (its v2 has a separate custom-base-URL runtime bug).
- 401 / invalid API key — wrong or paused key. Create a fresh one from Create a TrustedRails API Key.
- Model list empty or model errors — pick an id TrustedRails actually serves:
moonshotai/Kimi-K2.6orMiniMaxAI/MiniMax-M2.7(see Supported Models). - Visible
<think>reasoning in the output — reasoning models such asMiniMaxAI/MiniMax-M2.7emit their thinking inline, which n8n shows verbatim. Usemoonshotai/Kimi-K2.6for clean output.