multikey-llm

n8n AI chat model node that rotates across multiple free API keys (Groq, OpenRouter, Cerebras, Gemini, any OpenAI-compatible) so rate limits never stop your agent.

Package Information

Released: this month
Downloads: 0 weekly / 0 monthly
Latest Version: 0.2.0

Documentation

n8n-nodes-multikey-llm

An AI Chat Model sub-node for n8n (plugs into AI Agent / LLM Chain like "OpenAI Chat Model").
Put many API keys in ONE credential; the node rotates them and skips any key that is rate limited.

Features

  • Multiple keys per credential (one per line): Groq, OpenRouter, Cerebras, Gemini, or any OpenAI-compatible URL
  • Round-robin or sequential key use
  • On 429: key goes on cooldown (uses the provider's retry-after / reset headers) and the next key is used instantly
  • On 401/403: key is disabled for 1 hour; on 5xx/network error: short cooldown
  • Optional fallback models (Groq limits are per model, so this multiplies capacity)
  • If everything is busy it waits up to N seconds for the first key to recover
  • Streaming and tool calling work (rotation happens before the response body is read)
  • Cooldown state is kept in memory, so it is shared by all workflow executions

Build

npm install
npm run build

Install into self-hosted n8n

Option A (npm): npm publish, then n8n > Settings > Community Nodes > Install > n8n-nodes-multikey-llm.

Option B (local tarball):

npm pack                              # creates n8n-nodes-multikey-llm-0.1.0.tgz
mkdir -p ~/.n8n/nodes && cd ~/.n8n/nodes
npm install /path/to/n8n-nodes-multikey-llm-0.1.0.tgz
# restart n8n

Docker: the same, but inside the container at /home/node/.n8n/nodes (mount that folder as a volume so it survives restarts).

If n8n runs with N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true the node can also be used with tool-capable agents (not required for the Chat Model slot).

Usage

  1. Create credential Multi-Key LLM API: choose provider, paste keys one per line.
  2. Add Multi-Key Chat Model to an AI Agent's Model slot, pick a model.
  3. (Optional) Options > Fallback Models, e.g. llama-3.3-70b-versatile, qwen/qwen3-32b.

Notes

  • Each credential covers one provider. For cross-provider fallback, use n8n's agent "Fallback model" option with a second Multi-Key node.
  • Keys from the same provider organization may share one limit; check the provider's terms.

Discussion