LoomCycle Chat Model icon

LoomCycle Chat Model

Route the AI Agent's LLM calls through loomcycle's gateway (provider routing, auth, retry, per-user quotas)

LoomCycle Chat Model

AI-generated

Summary

Supplies a LangChain chat model to an n8n AI Agent's Chat Model slot that routes all LLM calls through a loomcycle gateway (POST /v1/_llm/chat), with optional provider, model, tier and per-user pinning.

Inputs

  • provider — Provider pin (e.g. anthropic, openai, deepseek, ollama). Empty lets loomcycle's resolver choose. Must match a provider in your loomcycle.yaml.
  • model — Model ID pin. Empty lets the resolver pick within the provider (or globally if Provider is also empty).
  • tier — Operator-defined tier label for resolver dispatch policy. Empty uses the resolver's default tier.
  • userId — User ID for per-user quota tracking and audit scoping. Falls back to the credential's Default User ID, then to anonymous.
  • userTier — Per-user tier overlay. Takes precedence over Tier. Falls back to the credential's default user tier.
  • maxTokens — Maximum tokens generated per call. Default 4096, range 1–200000.
  • temperature — Sampling temperature from 0 to 2. The default -1 omits it from the request so the provider default applies.
  • streaming — Enables token-by-token streaming (default true). Disable for consumers that expect a single non-streaming response.

Output shape

A LangChain BaseChatModel instance on the AiLanguageModel output ("Model"), consumed by an AI Agent or other AI node. It is not regular item data. Each call returns an AI message with text, tool calls, token usage, and provider, model and stop-reason metadata.

Requires the loomCycleApi credential (base URL, bearer token, optional default user ID and tier). Tool calling is supported through bindTools, with tool schemas converted to the gateway format. Errors have bearer tokens and API keys redacted. The node cannot run as a standalone workflow step: execute() throws an error. Gateway error frames during streaming are thrown as errors.

Examples

Example 1: Route an AI Agent's LLM calls to a specific Anthropic model through loomcycle

Provider=anthropic, Model=, Max Tokens=4096, Streaming on. Connect to the AI Agent's Chat Model input.

Example 2: Per-user quota tracking on a premium tier

User ID set to an expression for the end user, User Tier=premium, Provider and Model left empty so the resolver chooses.

Example 3: Deterministic output for an older agent mode

Temperature=0, Streaming off, Max Tokens=1024.

Links

Discussion