Skip to main content

LLM Workflow Architecture

29/04/2026

Two specialized workflows handle all LLM interactions:

  • LLM Call: Encapsulates the logic of calling an LLM model. The Chat Model node is provider-specific; changing providers means changing only this node. It supports a primary/fallback model pattern and structured output validation.

  • Utils - Calculate LLM usage: Fetches execution details via the n8n API, parses them for AI agent requests, and extracts and summarizes token usage. This is called at the end of post-processing to generate the TOKEN_USAGE_DETAILS SSE message.

The LLM Call workflow is used to encapsulate the logic of calling an LLM model.

image13.png

Since the XYZ Chat Model is provider-specific, changing the provider can only be manually done here by modifying the main and fallback model modes.

The Utils - Calculate LLM usage workflow is a utility used with LLM Call to calculate token usage.