Skip to main content

LLM Node

Sends a prompt to a large language model and returns the reply: summarise an email, classify a ticket, extract fields from free text, translate or draft a reply. Type: llm_node.

For a model that calls your APIs as tools or remembers a conversation, use the AI Agent node.

Providers​

Pick a provider and store its key in an API key credential (the key is encrypted and never appears in output or logs).

providerConnects toAlso needs
openaiOpenAIAPI key
anthropicAnthropic (Claude)API key
azureAzure OpenAIAPI key, base_url (deployment URL), api_version
geminiGoogle Gemini (OpenAI-compatible endpoint)API key
groq, openrouterGroq, OpenRouterAPI key
ollamaOllamaOptional key; base_url defaults to http://localhost:11434/v1
customAny OpenAI-compatible API (vLLM, LM Studio, LiteLLM, an internal LLM service)base_url; optional key
bedrockAWS BedrockAPI key (Bedrock API key), region
vertexGoogle Vertex AIService-account JSON as the credential value, region
zerqThe Zerq AI GatewayA Zerq AI key (see below)

Direct providers are called straight from the workflow: Zerq budgets, guardrails and AI Logs do not apply. Choose Zerq AI Gateway for governed calls: the request goes to this server's AI Gateway with a Zerq AI key, so the key's client must be allowed to use the model, guardrails, budgets, routing, fallbacks and caching apply, and every call is in AI Logs. To set it up, grant the client the models, turn on AI access on one of its profiles, issue an AI key (zk_…), and store it in an API key credential (Access and AI keys).

Nodes saved before the provider option existed have no provider and keep using the Zerq AI Gateway.

Config​

  • provider, credentials_id, model: see above. model is the provider's model name (for example gpt-4o-mini, claude-sonnet-4-5, gemini-2.0-flash, llama3.1); for zerq it is an AI Gateway model and may be empty to use the client's default.
  • base_url, api_version, region: provider-specific (table above). base_url can override any provider's default endpoint.
  • response_format: text (default) or json. With json the node asks for a JSON object and parses the reply into the json output; a reply that is not JSON goes to error (the raw reply is still in text). A reply wrapped in a Markdown code fence is accepted.
  • temperature (0–2) and max_tokens: optional; empty uses the model's defaults.
  • timeout_ms: how long to wait, 1,000–300,000 (default 60,000).

Inputs​

  • system (optional): instructions sent as the system message.
  • prompt: the user message. Objects are sent as compact JSON.
  • messages (optional): a whole conversation, an array of {role, content} (or an expression returning one). When set, system and prompt are ignored.
  • user (optional): an end-user ID, sent to the Zerq AI Gateway (recorded in AI Logs) and OpenAI.

All inputs accept expressions, for example {{ $json['http_trigger_1'].request.body.message }}.

Outputs​

FieldDescription
matched_outputsuccess or error
textThe model's reply
jsonThe parsed reply (response_format: json)
model, providerThe model and provider that answered
usageprompt_tokens, completion_tokens, total_tokens
finish_reasonFor example stop or length
request_idThe provider's response ID, or the AI Gateway request ID (zerq) to find the call in AI Logs
status_code, error_type, errorOn error: the HTTP status, a type such as provider_auth, rate_limited, timeout, provider_error, bad_request, context_length (and for zerq: guardrail_blocked, budget_exceeded, model_not_allowed, upstream_unavailable), and the message

Example: classify a support ticket​

{
"id": "classify",
"type": "llm_node",
"data": {
"config": {
"provider": "openai",
"credentials_id": "<api key credential id>",
"model": "gpt-4o-mini",
"response_format": "json",
"temperature": 0
},
"inputs": {
"system": "Classify the support ticket. Reply as JSON: {\"category\": \"billing|shipping|other\", \"urgent\": true|false}.",
"prompt": "{{ $json['http_trigger_1'].request.body.text }}"
}
}
}

Connect success to a switch_node on {{ $json['classify'].json.category }}, and error to a fallback (for example a default queue or a 502 response).

Guardrail workflows​

A workflow guardrail can use this node as an LLM judge. If, through the Zerq AI Gateway, the judge calls a model whose guardrail runs the same workflow, the calls would loop; nested calls stop after three levels and the node returns error with nested AI calls exceed the limit of 3. Use a direct provider or a model without that guardrail for the judge.

Common pitfalls​

  • provider_auth: the API key is wrong or belongs to another provider.
  • the credential does not hold a Zerq AI key (zerq): the credential must contain a Zerq AI key, not a provider key.
  • model_not_allowed (zerq): grant the model to the key's client (and profile, if it narrows the list).
  • Ollama from a container: localhost is the backend container itself; point base_url at the Ollama host.
  • Streaming is not used; raise timeout_ms or set max_tokens for long replies.