- 冰橙API概述
- 身份验证/获取token
- 文生文 对话生成
- 文生图 图像生成
- 文生音 音频生成
- 向量数据
- 其它
- 公众号服务接口
- 隐私政策
对话生成 GPT3.5 流式
POST
https://yewu.bcwhkj.cn/v1/chat/completions
💡
注:GPT3.5所有模型将强制指向gpt-3.5-turbo,即最新模型
📌
token获取方式:#
请求参数
Header 参数
Content-Type
string
固定值
默认值:
application/json
Authorization
string
可选
默认值:
Bearer token
Body 参数application/json
messages
array [object {2}]
必需
role
enum<string>
必需
枚举值:
systemuserassistant
默认值:
user
content
string
提问的内容
model
enum<string>
必需
枚举值:
gpt-3.5-turbo-0125gpt-3.5-turbogpt-3.5-turbo-16kgpt-4ogpt-4-turbo
默认值:
gpt-3.5-turbo-0613
stream
boolean
是否启用流式
默认值:
false
max_tokens
integer
回复的最大内容长度
默认值:
4000
示例
{
"messages": [
{
"role": "system",
"content": "你是一个能干的助手."
},
{
"role": "user",
"content": "谁赢得了2020年的世界职业棒球大赛?"
},
{
"role": "assistant",
"content": "洛杉矶道奇队在2020年赢得了世界职业棒球大赛冠军."
},
{
"role": "user",
"content": "它在哪里举办的?"
}
],
"model": "gpt-3.5-turbo",
"stream": true
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://yewu.bcwhkj.cn/v1/chat/completions' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{
"messages": [
{"role": "system", "content": "你是一个能干的助手."},
{"role": "user", "content": "谁赢得了2020年的世界职业棒球大赛?"},
{"role": "assistant", "content": "洛杉矶道奇队在2020年赢得了世界职业棒球大赛冠军."},
{"role": "user", "content": "它在哪里举办的?"}
],
"model": "gpt-3.5-turbo",
"stream": true
}'
返回响应
🟢200成功
application/json
Body
string
可选
示例
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"202"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"0"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"年"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"的"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"世"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"界"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"职"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"业"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"棒"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"球"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"大"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"赛"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"在"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"美"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"国"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"佛"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"罗"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"里"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"达"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"州"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"的"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"奥"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"兰"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"多"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"市"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"的"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"球"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"场"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"进行"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"比"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"赛"},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{"content":"."},"finish_reason":null}]}
data: {"id":"chatcmpl-7t2nkF9H01VMm6qAuSF7wxtK0lVXE","object":"chat.completion.chunk","created":1693353164,"model":"gpt-3.5-turbo-0613","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]
修改于 2025-02-21 11:21:38