younifyd
Menu

Ai Chat

AI Chat

POST/ai/chat

Use it in a workflow

  1. Add a step and choose the Directus connector.
  2. Pick the Ai Chat action (under AI).
  3. Fill in the fields below, then reference the result from later steps as {{aiChat.response.data}}.

Request

Request body

Enter the body as JSON in the step's Body field.

providerstringrequired

AI provider to use.

One ofopenaianthropicgoogleopenai-compatible

modelstringrequired

Model ID for the selected provider.

messagesarray<object>required

Conversation history. Must contain at least one message.

toolsarray<oneOf>required

List of tools available to the model. Each entry is either a built-in tool name string or a custom tool definition object.

toolApprovalsobject

Per-tool approval mode.

contextobject

Contextual information for the session.

attachmentsarray<object>

Up to 10 context attachments (items, visual elements, or prompts).

pageobject4 fields

Current page context from the Data Studio.

json
{
  "provider": "openai",
  "model": "string",
  "messages": [
    {}
  ],
  "tools": [
    null
  ],
  "toolApprovals": {},
  "context": {
    "attachments": [
      {}
    ],
    "page": {
      "path": "string",
      "collection": "string",
      "item": null,
      "module": "string"
    }
  }
}

Response

Returns 200 with a string. Read it in later steps with {{aiChat.response.data.<field>}}.

Need more? See the Directus guide for connection setup and behaviour shared by every action.

Was this page helpful?