n8n-nodes-aimedia-ai

Multi-provider AI Chat Model for n8n with sequential failover + retry. Any OpenAI-compatible provider (OpenAI, DeepSeek, NVIDIA, OpenRouter, Groq, ...), one credential per slot.


Keywords
n8n-community-node-package, n8n, ai, langchain, chat-model, failover, openai, deepseek, nvidia, openrouter, llm
License
MIT
Install
npm install n8n-nodes-aimedia-ai@0.20.0

Documentation

n8n-nodes-aimedia-ai

AIMEDIA AI Chat Model — a multi-provider AI Chat Model for n8n with sequential failover + retry.

It plugs into an AI Agent like any Chat Model, but holds up to 3 provider slots. Providers are tried in order: if provider 1 errors OR returns an empty response → its retries → provider 2 → provider 3. The first non-empty response wins.

Works with any OpenAI-compatible endpoint — OpenAI, DeepSeek, NVIDIA NIM, OpenRouter, Groq, Together, Mistral, local LLMs, etc. Each slot has its own credential, so you can even use two different OpenAI accounts in slot 1 and slot 2.

This package ships two nodes:

  • AIMEDIA AI Chat Model — up to 3 provider slots with sequential failover.
  • AIMEDIA AI Chat Model (Single) — a single DeepSeek model (one deepSeekApi credential, no provider selector) with a built-in retry count + retry delay (seconds). Like the classic DeepSeek community node, but robust. The Base URL comes from the credential, so you can point it at api.deepseek.com or a DeepSeek-compatible proxy. Use this when you don't need failover, just a clean single model.

Why?

  • Reliability — automatic failover across providers/keys; an empty response is treated as a failure (not silently returned).
  • Robust — depends only on @langchain/core (a peer dep n8n always ships) + raw fetch to /chat/completions. It does not bundle @langchain/openai, so it doesn't break on n8n updates the way some community model nodes do.
  • Observable — the node's OUTPUT panel shows response.generations, tokenUsage, and an aimedia report (which slot answered, request count, retries, errors), and the node turns green — just like the official chat-model nodes.

Features

  • ✅ Sequential failover across 1–3 providers
  • Per-slot credential (independent) — e.g. 2 OpenAI keys + 1 DeepSeek
  • Live model dropdown — fetched from each credential's Base URL (/models), plus a free-text "By ID" mode
  • ✅ Per-slot retry count + delay
  • Empty response = failure → moves to the next provider
  • Thinking control — Enabled sends thinking:{type:'enabled'} + reasoning_effort:'high'|'max' so the model reasons in reasoning_content and makes proper tool calls (no "inner voice" leaking into the message); Disabled sends nothing (fastest)
  • Tool calling (AI Agent tools) supported
  • ✅ Automatic DeepSeek reasoning_content injection + tool-message sanitization (fixes the tool must follow tool_calls 400)

Install

Settings → Community Nodes → Installn8n-nodes-aimedia-ai

Usage

  1. Add AIMEDIA AI Chat Model to your AI Agent's Chat Model input.
  2. For each Credential at the top (Provider 1 / 2 / 3), set the API Key and Base URL (the Base URL decides the provider). Provider 1 is required; 2 and 3 are optional.
  3. Pick a Model for each active slot (list is fetched live from that credential's endpoint).
  4. Optionally set retries, delay, thinking, temperature, etc.

Slots 2 and 3 activate automatically once their credential and model are set.

Example

Slot Base URL Model
Provider 1 https://api.openai.com/v1 gpt-4o-mini
Provider 2 https://api.openai.com/v1 (2nd account) gpt-4o
Provider 3 https://api.deepseek.com/v1 deepseek-chat

License

MIT © AIMEDIA