# n8n

n8n's OpenAI credential takes a custom base URL. Set it once, and the AI Agent, Basic LLM Chain and other nodes can use NezhaGate models.

> https://nezhagate.com/en/docs/integrations/n8n

Written against n8n 2.42

## 1. Create an OpenAI credential

1. **Credentials** → **Add credential** → **OpenAI**.

2. Enter your NezhaGate key in **API Key** and `https://nezhagate.com/v1` in **Base URL**; leave Organization ID empty.

3. Save. n8n reads the model list once to test the connection; that is not billed.

Base URL`https://nezhagate.com/v1`

## 2. Pick the model in the OpenAI Chat Model node

- **Model** → **From List** lists every NezhaGate model, so pick a chat model; or choose **ID** and type one, such as `gpt-5.5`.

- **Use Responses API** is on by default and sends requests to `/v1/responses`, where NezhaGate serves the GPT models only. Switch it off for any other model; for GPT models either setting works.

- Keep **Built-in Tools** (Web Search, File Search, Code Interpreter) off; they are OpenAI-hosted features.

- The **OpenAI** app node's **Message a Model** always uses `/v1/responses`, so it works with GPT models only; use the OpenAI Chat Model node for the others.

## Claude (optional)

Create an **Anthropic** credential with `https://nezhagate.com/anthropic` in **Base URL** and the same API key, then pick a Claude model in the Anthropic Chat Model node.

## Test

Build a **Chat Trigger** → **AI Agent** → **OpenAI Chat Model** workflow, click **Open chat** and send a message.

## Troubleshooting

**The credential test fails**

404 means the base URL lacks `/v1` or is wrong (it should be `https://nezhagate.com/v1`); 401 means the key is wrong.

**A model returns 400, 404 or 503**

Most likely **Use Responses API** is on with a non-GPT model. Switch it off.

**The agent does not call tools, or JSON output has no effect**

Not every model supports tool calls or JSON output; pick one that does (see each model's API doc).
