v2026.6.4
All Bundles
Bundle OpenAI API client. Supports Chat Completions (GPT-4o, o1, etc.), Embeddings, Image Generation (DALL-E), and function/tool calling. Set OPENAI_API_KEY environment variable before use. Compile with -lib openai.

Message

Create messages within threads

Inherits: EndPoint

Operations

Create # function

Loads a message

function : Create(role:String, content:String, thread:API.OpenAI.Thread, token:String) ~ API.OpenAI.Message

Parameters

NameTypeDescription
roleStringrole of the entity that is creating the message
contentStringcontent of the message.
threadThreadthread associated with message
tokenStringAPI token

Return

TypeDescription
Messageloaded Message

Create # function

Create a message.

function : Create(role:String, content:String, thread:API.OpenAI.Thread, files:Vector<API.OpenAI.File>, token:String) ~ API.OpenAI.Message

Parameters

NameTypeDescription
roleStringrole of the entity that is creating the message
contentStringcontent of the message.
threadThreadthread associated with message
filesVector<APIOpenAIFile>list to attach to the message
tokenStringAPI token

Return

TypeDescription
Messagenewly created message

GetContents #

Get the content of the message

method : public : GetContents() ~ Contents

Return

TypeDescription
Contentslist of messages with roles

GetCreatedAt #

Unix timestamp (in seconds) of when the object instance was created

method : public : GetCreatedAt() ~ Int

Return

TypeDescription
Inttime with the object instance was created

GetId #

Get object instance API ID

method : public : GetId() ~ String

Return

TypeDescription
Stringinstance ID

GetObject #

Get the object type

method : public : GetObject() ~ String

Return

TypeDescription
Stringobject type

GetRole #

Get the role of the entity that is creating the message

method : public : GetRole() ~ String

Return

TypeDescription
Stringrole of the entity that is creating the message

GetThreadId #

Get the ID of the thread associated with message

method : public : GetThreadId() ~ String

Return

TypeDescription
Stringthread ID

ListMessages # function

Loads a messages associated with thread

function : ListMessages(thread:API.OpenAI.Thread, token:String) ~ Vector<API.OpenAI.Message>

Parameters

NameTypeDescription
threadThreadthread associated with message
tokenStringAPI token

Return

TypeDescription
Vector<APIOpenAIMessage>messages associated with thread

Load # function

Loads a message

function : Load(id:String, thread:API.OpenAI.Thread, token:String) ~ API.OpenAI.Message

Parameters

NameTypeDescription
idStringmessage ID
threadThreadthread associated with message
tokenStringAPI token

Return

TypeDescription
Messageloaded Message

ToString #

String representation of the object

method : public : ToString() ~ String

Return

TypeDescription
Stringstring representation