1.请求地址:https://gpt.bcwhkj.cn/api/v2.Gptliu/search
2.请求方式: POST
3.body格式:json
4.请求内容(sse 流式请求,输出效果较好,响应速度快)(非流式请求,可不加stream这一行):
{
"messages" : [{"role":"user","content":"你是谁?"}],
"model": "gpt-3.5-turbo",
"stream":true //非SSE流式请求,这一行可不加
}
5.请求头
{
"Content-Type": application/json,
"Authorization": "Bearer 这段中文换成你自己的TOKEN(注意前面有个英文空格需保留)"
}
说明:
token获取方式:访问公众号《冰橙文化科技》进入菜单冰橙GPT后,访问右上角 / 个人(首次访问免费赠送10000字符,可通过充值增加字符数)可查看 token
SSE流式请求与非流式请求的区别:
流式POST请求:内容将进行逐家响应和返回,响应速度快。
普通POST请求:将等待OPENAI的CHATGPT官方接口全部内容都响应完成后,服务器这边才会将内容将通过接口回复给前端,速度较慢。
也可通过微信扫以下图片进入:

5.响应体格式:json
6.响应内容(非流式请求时的响应内容):
{
"id": "chatcmpl-77dQj73rIl0GJyTpAH4QlcSnhOFKp",
"object": "chat.completion",
"created": 1682054221,
"model": "gpt-3.5-turbo-0301",
"usage": {
"prompt_tokens": 13,
"completion_tokens": 30,
"total_tokens": 43
},
"choices": [
{
"message": {
"role": "assistant",
"content": "我是一个人工智能语言模型,可以根据用户提供的输入进行回答和交流。"
},
"finish_reason": "stop",
"index": 0
}
]
}
6.响应内容(流式请求时的响应内容):
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"role":"assistant"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"我"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"是"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"一个"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"AI"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"语"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"言"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"模"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"型"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":","},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"专"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"门"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"用"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"来"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"回"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"答"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"问题"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"和"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"提"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"供"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"帮"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"助"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"的"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"。"},"index":0,"finish_reason":null}]}
data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{},"index":0,"finish_reason":"stop"}]}
data: [DONE]

GPT接口:流式请求与非流式请求在AI交互中的差异
3001

被折叠的 条评论
为什么被折叠?



