Create Message
Authorizations
Path parameters
thread_idstringRequired
The ID of the thread to create a message for.
Body
rolestring · enumRequiredPossible values:
The role of the entity that is creating the message. Allowed values include:
user
: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.assistant
: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.
contentone ofRequired
stringOptional
The text contents of the message.
metadataobject | nullableOptional
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. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.
Responses
200
OK
application/json
post
curl https://api.portkey.ai/v1/threads/thread_abc123/messages \
-H "Content-Type: application/json" \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H "x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY" \
-H "OpenAI-Beta: assistants=v2" \
-d '{
"role": "user",
"content": "How does AI work? Explain it in simple terms."
}'
200
OK
{
"id": "text",
"object": "thread.message",
"created_at": 1,
"thread_id": "text",
"status": "in_progress",
"incomplete_details": {
"reason": "content_filter"
},
"completed_at": 1,
"incomplete_at": 1,
"role": "user",
"content": [
{
"type": "image_file",
"image_file": {
"file_id": "text",
"detail": "auto"
}
}
],
"assistant_id": "text",
"run_id": "text",
"attachments": [
{
"file_id": "text",
"tools": [
{
"type": "code_interpreter"
}
]
}
],
"metadata": {}
}
Last updated
Was this helpful?