Skip to content

😀 Chat 对话

http
WEBSOCKET wss://api.chatnio.net/chat

说明

在开始对话前, 需要先发送鉴权参数结构, 之后即可发送对话参数结构, 并接收流式输出的响应参数

鉴权参数

NameTypeDescription
token*StringAPI Key
id*String对话 ID (新对话时为 -1)

对话参数

NameTypeDescription
message*String消息
model*String模型
webString是否开启联网(默认关闭
typeStringchat 对话 / stop 暂停输出 / restart 重新回答

流响应结构

json
{
    "message": " how", // chunk message
    "quota": 0.02, // quota usage
    "end": false // output status
}

连接示例

json
WEBSOCKET wss://api.chatnio.net/chat

> SEND {"token":"sk-...","id":-1} 
> SEND {"type": "chat", "message": "hi", "web": false, "model": "gpt-4", "ignore_context": false} 
< RECV {"quota": 0, "keyword": "", "message": "Hello", "end": false}
< RECV {"quota": 0.0034000003, "keyword": "", "message": "!", "end": false}
< RECV {"quota": 0.0034000003, "keyword": "", "message": "", "end": true}

LightXi Inc. All Rights Reserved