Chat Completion

perplexity.chat_completion
ActionAI & modelsconnection required

Calls the Perplexity API with the connection's credentials.

Run a full multi-turn conversation through Perplexity Sonar and return the answer with its citations and search results.

Connection

Required
Yes — the node will not save without one
Auth type
API key
Providers
Perplexity
Secret shape
{"api_key": "…"}
Config it needs
base_url, default_model
Resolved by
config.connection_id, else node.connection_id

Configuration

14 fields, 1 required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.

FieldTypeRequiredDefaultConstraintsExample
messages
The conversation as a JSON array of {role, content} objects, in order.
arrayYes—array of object[{"content":"Summarise today's AI news.","role":"user"}]
model
Sonar model to run: sonar, sonar-pro, sonar-reasoning, sonar-reasoning-pro or sonar-deep-research. Falls back to the connection's default model, then sonar.
stringNosonar—sonar
search_mode
Which corpus Perplexity searches: web (the whole web), academic (scholarly papers) or sec (SEC filings). Defaults to web.
stringNo—one of "web", "academic", "sec"—
search_domain_filter
Domains to restrict the search to, as a JSON array or a comma-separated list. Prefix a domain with '-' to exclude it instead.
arrayNo—array of string["arxiv.org","-reddit.com"]
search_recency_filter
Only use sources published within this window, counted back from now.
stringNo—one of "hour", "day", "week", "month", "year"—
search_after_date_filter
Only use sources published on or after this date, written as MM/DD/YYYY.
stringNo——01/01/2026
search_before_date_filter
Only use sources published on or before this date, written as MM/DD/YYYY.
stringNo——12/31/2026
search_context_size
How much web context to retrieve before answering; larger costs more and answers more thoroughly. Sent as web_search_options.search_context_size.
stringNo—one of "low", "medium", "high"—
return_related_questions
Ask Perplexity to suggest follow-up questions alongside the answer.
booleanNofalse——
return_images
Include image results from the sources alongside the answer.
booleanNofalse——
max_tokens
Cap on the tokens generated in the answer. Leave blank for the model default.
numberNo—≥ 1—
temperature
Sampling randomness, from 0 (deterministic) to 2 (most varied).
numberNo0.20–2—
top_p
Nucleus sampling threshold between 0 and 1; leave blank to use the model default.
numberNo—0–1—
response_format
Structured-output request, e.g. {"type": "json_schema", "json_schema": {"schema": {...}}}. Sent through to Perplexity unchanged.
objectNo———

Example configuration

Every value below is the contract’s own example or default — nothing invented.

{
  "messages": [
    {
      "content": "Summarise today's AI news.",
      "role": "user"
    }
  ],
  "model": "sonar",
  "return_images": false,
  "return_related_questions": false,
  "search_after_date_filter": "01/01/2026",
  "search_before_date_filter": "12/31/2026",
  "search_domain_filter": [
    "arxiv.org",
    "-reddit.com"
  ],
  "temperature": 0.2
}

Output

One shape.

result

FieldTypeExample
content
The assistant's answer text.
string—
citations
Source URLs the answer is grounded in, in citation order.
array—
search_results
The sources behind the citations, each with a title, url, date and last_updated.
array—
related_questions
Suggested follow-up questions, when asked for.
array—
images
Image results from the sources, when asked for.
array—
id
Perplexity's identifier for this completion.
string—
model
The model that actually answered.
string—
finish_reason
Why generation stopped, e.g. stop or length.
string—
usage
Token counts and the cost breakdown Perplexity billed.
object—
raw
The untouched response body, for anything not shaped above.
object—
{
  "citations": [],
  "content": "",
  "finish_reason": "",
  "id": "",
  "images": [],
  "model": "",
  "raw": {},
  "related_questions": [],
  "search_results": [],
  "usage": {}
}

See Chat Completion run in a workflow.

In a technical demo we add the Perplexity connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.