openai_chat_complete() for quick, single-turn chat interactions. Use this when you need
a straightforward question-and-answer interaction without the complexity of managing message arrays.
Samples
Quick question
Get a response to a simple question:Specify a model
Use a different GPT model:Arguments
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
message | TEXT | - | ✔ | The user message/question |
api_key | TEXT | NULL | ✖ | OpenAI API key. If not provided, uses ai.openai_api_key setting |
api_key_name | TEXT | NULL | ✖ | Name of the secret containing the API key |
model | TEXT | 'gpt-4o-mini' | ✖ | The OpenAI model to use |
client_config | JSONB | NULL | ✖ | Advanced client configuration options |
Returns
TEXT: The text response from the model.
Related functions
openai_chat_complete(): full-featured chat completion with message history