https://robot.aiwetalk.com/robot/api/chat
POST
Authorization
: Bearer <ApiKey>
Content-Type
: application/json
请求体为 JSON 格式:
字段 | 类型 | 必填 | 说明 |
---|---|---|---|
clientid |
string | 是 | 客户端 ID,用于标识用户 |
from |
int | 是 | 请求来源(见下表“请求来源”说明) |
ip |
string | 是 | 用户的 IP 地址 |
sendtype |
string | 是 | 发送类型,0 表示 AI 自动应答 |
messages |
array | 是 | 用户发送的消息数组 |
值 | 说明 |
---|---|
0 | PC 端 |
1 | 微信咨询 |
2 | 手机 APP |
3 | 手机网页 |
4 | 顺网 400 电话 |
5 | QQ 咨询 |
6 | 支付宝 |
7 | 微博 |
8 | 抖音 |
9 | 企业微信 |
响应为 JSON 格式:
字段 | 类型 | 说明 |
---|---|---|
id |
int | 消息 ID |
object |
string | 消息类型,通常为 chat.completion |
created |
int | 创建时间(时间戳) |
message |
object | 消息内容 |
message.role |
string | 消息角色(如 assistant ) |
message.content |
string | AI 返回的内容 |
请求代码
POST https://robot.aiwetalk.com/robot/api/chat
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"clientid": "wm-TFkBgAA3--D-9r-ndK-8w95hv7uPw",
"from": 0,
"ip": "127.0.0.1",
"sendtype": "0",
"messages": [
{
"role": "user",
"content": "Say this is a test!"
}
]
}
响应代码
[
{
"id": 123,
"object": "chat.completion",
"created": 121212,
"message": {
"role": "assistant",
"content": "\n\nThis is a test!"
}
}
]