> ## Documentation Index
> Fetch the complete documentation index at: https://learn.workflow.dog/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat

> Send a prompt, files, and optional instructions to an OpenAI model.

The **Chat** action sends a single prompt to an OpenAI model. Use it for
free-form text generation, questions about images or PDFs, web-assisted
research, and responses that must match a JSON schema.

<Note>
  Chat is stateless: each run sends the current prompt, system prompt, and
  files. It does not remember earlier workflow runs or previous Chat actions.
</Note>

## Quick start

<Steps>
  <Step title="Connect an OpenAI account">
    Add an OpenAI account when the node asks for a **Third-party account**. The
    account must contain a valid OpenAI API key.
  </Step>

  <Step title="Provide a prompt">
    Connect a string to **Prompt**, or set a fixed value on the node. Include all
    of the context the model needs for this run.
  </Step>

  <Step title="Choose a model">
    **GPT-5.1** is selected by default. Standard models expose web search and
    temperature controls; reasoning models expose reasoning effort instead.
  </Step>

  <Step title="Use the response">
    Connect **Response** to the next action. If you enable structured output,
    connect properties from **Structured Response** instead.
  </Step>
</Steps>

## Inputs

| Input                   | Type           | Required  | Description                                                                                        |
| ----------------------- | -------------- | --------- | -------------------------------------------------------------------------------------------------- |
| **Third-party account** | OpenAI account | Yes       | The OpenAI API key used to make the request.                                                       |
| **Prompt**              | String         | Yes       | The user message sent to the model.                                                                |
| **Model**               | Model          | Yes       | The model that handles the request. Defaults to **GPT-5.1**.                                       |
| **System Prompt**       | String         | No        | Instructions that define the model's role, constraints, or response style.                         |
| **Files**               | List of files  | No        | Images or PDFs sent with the prompt. Add more file inputs when the model needs multiple documents. |
| **Structured Output**   | Boolean        | No        | Replaces the text response with an object that follows a JSON schema. Defaults to off.             |
| **JSON Schema**         | String         | Sometimes | Required when **Structured Output** is enabled. The schema's outer type must be `object`.          |

### Model controls

<Tabs>
  <Tab title="Standard models">
    Standard models support:

    * **Web Search** — Lets the model search the web before answering. Defaults
      to off.
    * **Temperature** — Controls how varied the response can be, from `0`
      (more focused) to `2` (more varied). Defaults to `1`.

    Available models:

    * GPT-5.1
    * GPT-5 Nano
    * GPT-5 Mini
    * GPT-5
    * GPT-4.1 Mini
    * GPT-4.1
    * GPT-4o Mini
    * GPT-4o
  </Tab>

  <Tab title="Reasoning models">
    Reasoning models replace web search and temperature with
    **Reasoning Effort**:

    * `low` — Faster responses for straightforward tasks. This is the default.
    * `medium` — More reasoning for tasks with several constraints.
    * `high` — The most reasoning for difficult analysis.

    Available models:

    * o4-mini
    * o3
    * o3-mini
  </Tab>
</Tabs>

<Tip>
  If model-specific controls disappear after you change models, the node has
  switched control sets. Standard and reasoning controls are mutually exclusive.
</Tip>

## Outputs

<Tabs>
  <Tab title="Text output">
    When **Structured Output** is off, the node has one output:

    | Output       | Type   | Description                      |
    | ------------ | ------ | -------------------------------- |
    | **Response** | String | The model's complete text reply. |
  </Tab>

  <Tab title="Structured output">
    When **Structured Output** is on, **Response** is replaced by:

    | Output                  | Type   | Description                                 |
    | ----------------------- | ------ | ------------------------------------------- |
    | **Structured Response** | Object | The parsed object described by your schema. |

    You can expose schema properties as individual outputs, then connect only
    the values a later action needs.
  </Tab>
</Tabs>

## Return structured data

Structured output is useful when later actions need predictable fields instead
of prose. For example, this schema turns a support message into a summary,
priority, and category:

```json theme={null}
{
  "type": "object",
  "properties": {
    "summary": {
      "type": "string",
      "description": "A one-sentence summary of the request"
    },
    "priority": {
      "type": "string",
      "enum": ["low", "normal", "high"]
    },
    "category": {
      "type": "string",
      "enum": ["billing", "bug", "question"]
    }
  },
  "required": ["summary", "priority", "category"],
  "additionalProperties": false
}
```

<Steps>
  <Step title="Enable structured output">
    Turn on **Structured Output**. The **JSON Schema** input and **Structured
    Response** output appear, while the text **Response** output is removed.
  </Step>

  <Step title="Add the schema">
    Paste a valid JSON schema into **JSON Schema**. It must parse as JSON and
    contain an outer `type` of `object` with a `properties` map.
  </Step>

  <Step title="Expose the fields you need">
    Use **Add detected properties to output** on the node to add `summary`,
    `priority`, and `category` as connectable properties.
  </Step>

  <Step title="Connect downstream actions">
    Route `priority` into conditional logic, store `category`, or send `summary`
    in a notification without parsing a text response.
  </Step>
</Steps>

<Warning>
  Enabling structured output changes the node's output from **Response** to
  **Structured Response**. Check downstream connections when you toggle this
  setting on an existing workflow.
</Warning>

## Work with files

Add one **Files** item for each image or PDF the model should inspect. Every
file is sent in the same user message as the prompt.

Good prompts state what to do with the attachments:

```text theme={null}
Compare the attached invoices. Return the vendor, invoice number, due date,
and total for each document. Flag any duplicate invoice numbers.
```

When structured output is enabled, describe the expected fields in the schema
instead of asking the model to invent a response format in the prompt.

## Example: triage a support request

Use Chat in the middle of a workflow to turn an incoming message into fields
that other actions can route:

```text theme={null}
New support message
  → OpenAI: Chat
  → Choose Value by Case (category)
  → Send to the matching support queue
```

Configure the node with:

* **Prompt** — The incoming subject and message body.
* **System Prompt** — `Classify the request using only the supplied message.`
* **Structured Output** — On.
* **JSON Schema** — The support-triage schema above.

The routing action can use `category` directly, while notifications and logs
can use `summary` and `priority`.

## Troubleshooting

<AccordionGroup>
  <Accordion title="The JSON schema is rejected">
    Check that the value is valid JSON, the outer `type` is `object`, and
    `properties` is an object. JSON does not allow comments or trailing commas.
  </Accordion>

  <Accordion title="I cannot find web search or temperature">
    You selected a reasoning model. Choose a standard model to use **Web Search**
    or **Temperature**.
  </Accordion>

  <Accordion title="The response output disappeared">
    **Structured Output** is enabled. The node now returns **Structured Response**
    instead of **Response**.
  </Accordion>

  <Accordion title="The model lacks context from an earlier run">
    Chat does not preserve conversation history. Include the required history
    in the current prompt or load it from another action before Chat runs.
  </Accordion>
</AccordionGroup>
