Conduct Agent Q&A Dialogue (OpenAI Protocol)
POST/v1/aibot/openai/chat/completions
Conduct Agent Q&A Dialogue (OpenAI Protocol)
Request
- application/json
Body
required
- Array [
- ]
Agent ID
messages object[]required
Messages
Role of historical information
Content of historical information
Whether to return in stream mode
Responses
- x-stream:false
- x-stream:true
- default
When the Agent dialogue is successful, non-streaming return
Response Headers
X-Request-Id string
Request ID
- application/json
- Schema
- Example (from schema)
Schema
- Array [
- ]
Conversation record ID
Interface type
Conversation timestamp
Agent ID
choices undefined[]
choices
index
message object
Message type
Message content
Conversation end flag; 'continue' indicates the conversation is ongoing, 'stop' indicates the conversation has ended
usage object
token usage
Indicates the number of tokens in the prompt, remains unchanged across multiple responses
Total tokens in the response. In streaming responses, represents the cumulative total of all completion tokens up to now, continues to accumulate across multiple responses
Represents the 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
}
}
When the Agent dialogue is successful, streaming return
- application/json
- Schema
- Example (from schema)
Schema
- Array [
- ]
Conversation record ID
Interface type
Conversation timestamp
Agent ID
choices undefined[]
choices
index
delta object
Message type
Message content
Conversation end flag; 'continue' indicates the conversation is ongoing, 'stop' indicates the conversation has ended
usage object
token usage
Indicates the number of tokens in the prompt, remains unchanged across multiple responses
Total tokens in the response. In streaming responses, represents the cumulative total of all completion tokens up to now, continues to accumulate across multiple responses
Represents the 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 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"
}