Start Agent conversation (OpenAI protocol)
POST/v1/aibot/openai/chat/completions
Start Agent conversation (OpenAI protocol)
Request
- application/json
Body
required
- Array [
- ]
Agent ID
messages object[]required
Messages
Role in the conversation history
Content of the conversation history
Whether to return streaming responses
Responses
- x-stream:false
- x-stream:true
- default
Returned when the Agent conversation succeeds with non-streaming response
Response Headers
X-Request-Id string
Request ID
- application/json
- Schema
- Example (from schema)
Schema
- Array [
- ]
Conversation record ID
API type
Conversation timestamp
Agent ID
choices undefined[]
choices
index
message object
Message role
Message content
Conversation termination flag; continue means not finished, stop means finished
usage object
Token usage
Number of prompt tokens; remains constant across multiple responses
Total completion tokens. In streaming responses, this accumulates across chunks.
Sum of prompt_tokens and completion_tokens
{
"id": "record-427d3652",
"object": "chat.completion",
"created": "1726030224",
"model": "bot-xxxx",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello"
},
"finish_reason": "continue"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 20,
"total_tokens": 0
}
}
Returned when the Agent conversation succeeds with streaming response
- application/json
- Schema
- Example (from schema)
Schema
- Array [
- ]
Conversation record ID
API type
Conversation timestamp
Agent ID
choices undefined[]
choices
index
delta object
Message role
Message content
Conversation termination flag; continue means not finished, stop means finished
usage object
Token usage
Number of prompt tokens; remains constant across multiple responses
Total completion tokens. In streaming responses, this accumulates across chunks.
Sum of prompt_tokens and completion_tokens
{
"id": "record-427d3652",
"object": "chat.completion",
"created": "1726030224",
"model": "bot-xxxx",
"choices": [
{
"index": 0,
"delta": {
"role": "assistant",
"content": "Hello"
},
"finish_reason": "continue"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 20,
"total_tokens": 0
}
}
Returned when the Agent conversation fails
- application/json
- Schema
- Example (from schema)
Schema
Error code
Error message
Request ID
{
"code": "INVALID_CREDENTIALS",
"message": "Credentials are invalid",
"requestId": "6360ba4b-f672-434b-9dee-35686a5589a4"
}