ai-openai-text

ai-openai-text — Generate text using GPT-5 Chat Completion


Description

- step: ai-openai-text
  args:
    - '${PROMPT}'
    - '${REASONING_EFFORT}'  # optional
  context:
    SYSTEM_PROMPT: '${SYSTEM_PROMPT}'  # optional

The ai-openai-text step generates text using the GPT-5 Chat Completion API.

Usage in a workflow YAML:

workflow:
  - step: ai-openai-text
    args:
      - "Explain quantum computing in simple terms"
      - "medium"
    context:
      SYSTEM_PROMPT: "You are a friendly, clear, and concise AI assistant."

Parameters

Parameter Type Description
prompt string The text prompt to send to GPT-5.
reasoning_effort string Optional. One of "minimal", "low", "medium", "high". Controls the depth of reasoning.

Context requirements:

Context Key Type Description
OPEN_AI_API_KEY string Required. OpenAI API key.
SYSTEM_PROMPT string Optional. System prompt to guide the model.

Return Values

"This is the text generated by GPT-5 based on your prompt."
{
  "error": "Description of the error or API failure"
}

Behavior


Examples

Example #1 — Basic text generation

workflow:
  - step: ai-openai-text
    args:
      - "Summarize the latest news in AI."

Stores the generated summary in ${prev}.

Example #2 — Specifying reasoning effort

workflow:
  - step: ai-openai-text
    args:
      - "Explain black holes for high school students."
      - "medium"

Example #3 — Using system prompt

workflow:
  - step: ai-openai-text
    args:
      - "Write a friendly reminder email."
    context:
      SYSTEM_PROMPT: "You are a polite and concise assistant."

Notes


See Also