Runs
API Reference
返回线程运行列表,代表线程内的单独执行或交互。
路径参数
threadIdstring必填
响应
201成功
application/json
get
/threads/{threadId}/runsGET /threads/{threadId}/runs HTTP/1.1
Host: api.aimlapi.com
Accept: */*
201成功
[
{
"id": "text",
"assistant_id": "text",
"cancelled_at": 1,
"completed_at": 1,
"created_at": 1,
"expires_at": 1,
"failed_at": 1,
"incomplete_details": {
"reason": "max_completion_tokens"
},
"instructions": "text",
"last_error": {
"code": "server_error",
"message": "text"
},
"max_completion_tokens": 1,
"max_prompt_tokens": 1,
"metadata": null,
"model": "text",
"object": "thread.run",
"parallel_tool_calls": true,
"required_action": {
"submit_tool_outputs": {
"tool_calls": []
},
"type": "submit_tool_outputs"
},
"response_format": null,
"started_at": 1,
"status": "queued",
"thread_id": "text",
"tool_choice": null,
"tools": [],
"truncation_strategy": {
"type": "auto",
"last_messages": 1
},
"usage": {
"completion_tokens": 1,
"prompt_tokens": 1,
"total_tokens": 1
},
"temperature": 1,
"top_p": 1
}
]创建一个新的线程运行,在线程上下文中执行任务或交互。
路径参数
threadIdstring必填
请求体
assistant_idstring必填
streamboolean可选
metadataobject可选
响应
201成功
application/json
post
/threads/{threadId}/runsPOST /threads/{threadId}/runs HTTP/1.1
Host: api.aimlapi.com
Content-Type: application/json
Accept: */*
Content-Length: 51
{
"assistant_id": "text",
"stream": true,
"metadata": {}
}201成功
{
"id": "text",
"assistant_id": "text",
"cancelled_at": 1,
"completed_at": 1,
"created_at": 1,
"expires_at": 1,
"failed_at": 1,
"incomplete_details": {
"reason": "max_completion_tokens"
},
"instructions": "text",
"last_error": {
"code": "server_error",
"message": "text"
},
"max_completion_tokens": 1,
"max_prompt_tokens": 1,
"metadata": null,
"model": "text",
"object": "thread.run",
"parallel_tool_calls": true,
"required_action": {
"submit_tool_outputs": {
"tool_calls": []
},
"type": "submit_tool_outputs"
},
"response_format": null,
"started_at": 1,
"status": "queued",
"thread_id": "text",
"tool_choice": null,
"tools": [],
"truncation_strategy": {
"type": "auto",
"last_messages": 1
},
"usage": {
"completion_tokens": 1,
"prompt_tokens": 1,
"total_tokens": 1
},
"temperature": 1,
"top_p": 1
}Updates the details of a thread run, modifying its status or context.
路径参数
threadIdstring必填
runIdstring必填
请求体
metadataobject可选
响应
200成功
application/json
post
/threads/{threadId}/runs/{runId}POST /threads/{threadId}/runs/{runId} HTTP/1.1
Host: api.aimlapi.com
Content-Type: application/json
Accept: */*
Content-Length: 15
{
"metadata": {}
}200成功
{
"id": "text",
"assistant_id": "text",
"cancelled_at": 1,
"completed_at": 1,
"created_at": 1,
"expires_at": 1,
"failed_at": 1,
"incomplete_details": {
"reason": "max_completion_tokens"
},
"instructions": "text",
"last_error": {
"code": "server_error",
"message": "text"
},
"max_completion_tokens": 1,
"max_prompt_tokens": 1,
"metadata": null,
"model": "text",
"object": "thread.run",
"parallel_tool_calls": true,
"required_action": {
"submit_tool_outputs": {
"tool_calls": []
},
"type": "submit_tool_outputs"
},
"response_format": null,
"started_at": 1,
"status": "queued",
"thread_id": "text",
"tool_choice": null,
"tools": [],
"truncation_strategy": {
"type": "auto",
"last_messages": 1
},
"usage": {
"completion_tokens": 1,
"prompt_tokens": 1,
"total_tokens": 1
},
"temperature": 1,
"top_p": 1
}Retrieves a single thread run by its ID, providing access to its execution details.
路径参数
threadIdstring必填
runIdstring必填
响应
200成功
application/json
get
/threads/{threadId}/runs/{runId}GET /threads/{threadId}/runs/{runId} HTTP/1.1
Host: api.aimlapi.com
Accept: */*
200成功
{
"id": "text",
"assistant_id": "text",
"cancelled_at": 1,
"completed_at": 1,
"created_at": 1,
"expires_at": 1,
"failed_at": 1,
"incomplete_details": {
"reason": "max_completion_tokens"
},
"instructions": "text",
"last_error": {
"code": "server_error",
"message": "text"
},
"max_completion_tokens": 1,
"max_prompt_tokens": 1,
"metadata": null,
"model": "text",
"object": "thread.run",
"parallel_tool_calls": true,
"required_action": {
"submit_tool_outputs": {
"tool_calls": []
},
"type": "submit_tool_outputs"
},
"response_format": null,
"started_at": 1,
"status": "queued",
"thread_id": "text",
"tool_choice": null,
"tools": [],
"truncation_strategy": {
"type": "auto",
"last_messages": 1
},
"usage": {
"completion_tokens": 1,
"prompt_tokens": 1,
"total_tokens": 1
},
"temperature": 1,
"top_p": 1
}最后更新于