custom-litellm

LiteLLM chat models, embeddings, credentials, and tool-calling AI agent nodes for n8n

Documentation

n8n LiteLLM custom nodes

Community nodes for using a LiteLLM proxy with n8n AI workflows.

Nodes

  • LiteLLM Chat Model — supplies a LangChain chat model to any compatible n8n AI chain or agent. Models can be selected from the proxy's /models endpoint or entered directly by ID.
  • LiteLLM Embeddings — supplies an embeddings model to vector-store nodes, with the same list and direct-ID selector.
  • LiteLLM Agent — tool-calling agent with primary and fallback AI Model, Tool, Memory, and Output Parser connectors. Its output is compatible with n8n's AI Agent ({ "output": "..." }).
  • LiteLLM API credential — stores the proxy URL, key, organization, and LiteLLM team.

Install

Build and install the package in the same environment as self-hosted n8n:

npm install
npm run build
npm pack
npm install ./n8n-nodes-custom-litellm-0.4.2.tgz

Restart n8n after installation. Community nodes are supported on self-hosted n8n.

Configure

  1. Create a Lite LLM credential.
  2. Enter the proxy URL including /v1, for example http://litellm:4000/v1.
  3. Enter a LiteLLM master key or virtual key.
  4. Add LiteLLM Chat Model, then select a model returned by the proxy or choose By ID and enter a model alias directly.
  5. Connect it to LiteLLM Agent or a built-in n8n AI chain. Connect any built-in n8n Tool and Memory sub-nodes to the agent.

The agent uses OpenAI-compatible tool calls exposed by LiteLLM. The selected model must support tool/function calling when tools are connected.

The Embeddings node removes the OpenAI SDK's automatic encoding_format request parameter so
providers such as Gemini embeddings work without enabling LiteLLM's global drop_params setting.

Fallback model

Enable Fallback Model on the LiteLLM Agent and connect a second Chat Model to the new
Fallback Model input. The agent always tries the primary model first and only invokes the
fallback when the primary model call fails. When tools are connected, both models must support
tool/function calling.

Reasoning and thinking

The Chat Model's options include:

  • Reasoning Effort — sends LiteLLM's reasoning_effort parameter. Available values include none, minimal, low, medium, high, extra high, and maximum.
  • Thinking Mode — sends a thinking object with enabled or disabled state.
  • Thinking Budget Tokens — controls thinking.budget_tokens when thinking is enabled.

Leave these options at Not Set for models that do not support them. Provider support and accepted effort values vary by model. Some Anthropic thinking models require a temperature of 1.

If a reverse proxy returns 403 Your request was blocked, edit the User Agent field in the
Lite LLM credential. The node overrides the OpenAI SDK user agent by default because some
Cloudflare/WAF configurations block SDK-identifying request headers.

Compatibility notes

  • Requires Node.js 20.15 or newer.
  • Designed for current n8n 2.x and the n8n AI cluster-node connection API.
  • The agent supports model, tool, memory, and output-parser connectors.
  • LiteLLM-specific request fields can be supplied using Extra Body on the chat model.

License

MIT

Discussion