Message API
Last updated
Was this helpful?
Last updated
Was this helpful?
Messages are individual pieces of communication within a Thread, sent either by the user or the Assistant, helping to maintain the flow and context of the conversation.
This page provides API schemas for the following methods:
After each API schema, you'll find a short example demonstrating how to correctly call the described method in code using the OpenAI SDK.
Note that the method names in the API schema and the SDK often differ. Accordingly, when calling these methods via the REST API, you should use the names from the API schema, while for calls through the OpenAI SDK, use the names from the examples.
https://api.aimlapi.com/threads/{threadId}/messages
https://api.aimlapi.com/threads/{threadId}/messages
https://api.aimlapi.com/threads/{threadId}/messages/{messageId}
https://api.aimlapi.com/threads/{threadId}/messages/{messageId}
https://api.aimlapi.com/threads/{threadId}/messages/{messageId}
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
Filter messages by the run ID that generated them
The role of the entity that is creating the message
user
, assistant
The text contents of the message
An array of content parts with a defined type, each can be of type text or images can be passed with image_url or image_file
A list of files attached to the message, and the tools they should be added to.
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.