Messages
API Reference
Returns a list of messages within a thread, allowing users to view the conversation flow.
路径参数
threadIdstring必填
查询参数
limitnumber可选
orderstring可选
beforestring可选
afterstring可选
响应
200成功
application/json
get
/threads/{threadId}/messagesGET /threads/{threadId}/messages HTTP/1.1
Host: api.aimlapi.com
Accept: */*
200成功
[
{
"id": "text",
"assistant_id": "text",
"attachments": [
{
"file_id": "text",
"tools": []
}
],
"completed_at": 1,
"content": [
{
"text": {
"annotations": [],
"value": "text"
},
"type": "text"
}
],
"created_at": 1,
"incomplete_at": 1,
"incomplete_details": {
"reason": "content_filter"
},
"metadata": null,
"object": "thread.message",
"role": "user",
"run_id": "text",
"status": "in_progress",
"thread_id": "text"
}
]Creates a new message within a thread, contributing to the conversation.
路径参数
threadIdstring必填
请求体
rolestring必填
contentstring必填
metadataobject可选
响应
201成功
application/json
post
/threads/{threadId}/messagesPOST /threads/{threadId}/messages HTTP/1.1
Host: api.aimlapi.com
Content-Type: application/json
Accept: */*
Content-Length: 46
{
"role": "text",
"content": "text",
"metadata": {}
}201成功
{
"id": "text",
"assistant_id": "text",
"attachments": [
{
"file_id": "text",
"tools": []
}
],
"completed_at": 1,
"content": [
{
"text": {
"annotations": [],
"value": "text"
},
"type": "text"
}
],
"created_at": 1,
"incomplete_at": 1,
"incomplete_details": {
"reason": "content_filter"
},
"metadata": null,
"object": "thread.message",
"role": "user",
"run_id": "text",
"status": "in_progress",
"thread_id": "text"
}Retrieves a single message from a thread by its ID.
路径参数
threadIdstring必填
messageIdstring必填
响应
200成功
application/json
get
/threads/{threadId}/messages/{messageId}GET /threads/{threadId}/messages/{messageId} HTTP/1.1
Host: api.aimlapi.com
Accept: */*
200成功
{
"id": "text",
"assistant_id": "text",
"attachments": [
{
"file_id": "text",
"tools": []
}
],
"completed_at": 1,
"content": [
{
"text": {
"annotations": [],
"value": "text"
},
"type": "text"
}
],
"created_at": 1,
"incomplete_at": 1,
"incomplete_details": {
"reason": "content_filter"
},
"metadata": null,
"object": "thread.message",
"role": "user",
"run_id": "text",
"status": "in_progress",
"thread_id": "text"
}Updates an existing message in a thread.
路径参数
threadIdstring必填
messageIdstring必填
请求体
metadataobject可选
响应
200成功
application/json
post
/threads/{threadId}/messages/{messageId}POST /threads/{threadId}/messages/{messageId} HTTP/1.1
Host: api.aimlapi.com
Content-Type: application/json
Accept: */*
Content-Length: 15
{
"metadata": {}
}200成功
{
"id": "text",
"assistant_id": "text",
"attachments": [
{
"file_id": "text",
"tools": []
}
],
"completed_at": 1,
"content": [
{
"text": {
"annotations": [],
"value": "text"
},
"type": "text"
}
],
"created_at": 1,
"incomplete_at": 1,
"incomplete_details": {
"reason": "content_filter"
},
"metadata": null,
"object": "thread.message",
"role": "user",
"run_id": "text",
"status": "in_progress",
"thread_id": "text"
}最后更新于