Skip to main content
Agent commands. Your AI agent uses this node in workflows. You don’t configure it directly.
The LLM node calls AI models using LiteLLM. Use it when a step needs reasoning — summarization, classification, extraction, anything a Python expression can’t handle. It supports many providers (OpenAI, Anthropic, Google, OpenRouter, Ollama, and 100+ more) through a unified interface.

Parameters

Model resolution

If model is not specified in workflow params, pflow auto-detects based on your configured API keys. Most users just need an API key:
See LLM model settings for the full resolution order and default models per provider.

Reasoning depth

reasoning_effort controls how hard a reasoning model thinks. max_tokens controls how long the response may get. They’re separate dials, and pflow keeps them that way: effort sets the thinking budget, and max_tokens only ever caps it — raising max_tokens to leave room for a longer answer never inflates reasoning spend. This matters because Anthropic counts thinking and answer against one max_tokens pool and rejects any request where the thinking budget isn’t strictly smaller than max_tokens. pflow always derives the budget to sit under max_tokens, so that rejection can’t happen — whether you set reasoning_effort or an explicit reasoning_max_tokens. If you set both reasoning_max_tokens and a smaller max_tokens, the budget is capped to fit (the explicit budget is a request, not a guarantee). One consequence on reasoning models: if you omit max_tokens, the provider may cap the visible answer low (LiteLLM defaults it to the thinking budget plus ~4096). Set max_tokens explicitly when you need a long answer from a reasoning model. The same reasoning_effort value maps to provider-specific knobs under the hood — Anthropic and Gemini 2.5 get a token budget, OpenAI and Gemini 3 get their native effort/level. Models without a reasoning knob ignore the parameter.

Output

Token usage structure

Model support

These providers are included with pflow - just set your API key: Always include the provider prefix in the model: field — bare names route inconsistently (Gemini bare names try Vertex; OpenAI bare names usually work but aren’t future-proof).

Other providers

LiteLLM is built into pflow and recognizes 100+ providers natively — no plugin install needed. Set the appropriate API key (or omit it for Ollama) and reference the model with its provider prefix.

OpenRouter

Ollama (local models)

See the LiteLLM provider list for the full set of supported providers (Mistral, Bedrock, Azure OpenAI, Vertex AI, vLLM, and more).

Image support

For vision-capable models, pass image URLs or local file paths:
Supported formats: JPEG, PNG, GIF, WebP, PDF Images can be:
  • Local file paths: photo.jpg, /path/to/image.png
  • URLs: https://example.com/image.jpg

Examples

Basic prompt

With system prompt

Structured output

Use output_schema to request JSON matching a schema. Provider mechanisms vary: some use constrained decoding, while others use tool calls with best-effort arguments. pflow validates the returned JSON locally before publishing it, so a non-conforming value fails at the LLM step instead of breaking a downstream template.
For an object schema, response is a dict and downstream templates access fields directly: ${extract.response.people}. Array and primitive schemas produce their corresponding parsed JSON values. JSON numbers must be finite; NaN, infinities, and overflow-to-infinity values are rejected as invalid JSON. If the provider returns invalid JSON or a value that does not match the schema, pflow keeps the original response text, sets error, and follows the step’s error edge. Schemas may use references that resolve within the authored schema, including local fragments, anchors, nested IDs, and same-document absolute references. Missing or external references are rejected before the provider call; pflow never retrieves schemas from the network. For compatibility with providers that implement structured output through an internal tool, pflow also repairs one narrowly defined transport artifact: an otherwise invalid response shaped exactly as {"json_tool_call": { ...valid result... }}. A valid schema-authored object containing json_tool_call is never rewritten. After upgrading from a version without local schema validation, a pre-existing memo-cache entry can replay its old output until the default 24-hour TTL expires. Run with --no-cache to bypass that stale read and force a fresh validated call. Without output_schema, you can still get JSON by prompting for it. The template system auto-parses JSON strings when you use dot notation: ${extract.response.people}. But the model may not always comply — output_schema is the reliable approach.

Image analysis

External prompt file

For long or reusable prompts, reference an external file instead of inlining. The file path is relative to the workflow file. Template variables (${var}) inside the file are resolved normally.

Error handling

The node retries transient failures automatically (3 attempts, 1 second wait).