openai_gpt()

Send a prompt to OpenAI's GPT chat models through a configured OpenAI integration and get the text response back.

Syntax

openai_gpt(connection, prompt, model?)

Parameters

Name Type Required Description
connection string yes Name of the OpenAI integration connection.
prompt string yes The prompt to send.
model string no Model name. Defaults to gpt-4o-mini.

Returns

The model's text response as a string.

Example

$summary = openai_gpt("OpenAI",
    "Summarize this support ticket in one sentence:\n\n" . $record["body"]);

record_update("tickets", $record["_meta"]["id"], ["summary" => $summary]);

Example output

"Customer cannot log in after the latest password reset and needs account recovery."

Notes

  • Configure the OpenAI connection (API key) under your account's integrations first.
  • For a configured Assistant (with its own instructions/tools), use openai_assistant().

See also: openai_assistant(), Integrations