API 调用文档

接口详情

接口地址: 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 用户发送的消息数组

请求来源

说明
0PC 端
1微信咨询
2手机 APP
3手机网页
4顺网 400 电话
5QQ 咨询
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!"
        }
    }
]