f
This commit is contained in:
@@ -6,7 +6,7 @@ description: SSE 流式输出接入说明
|
||||
|
||||
# 流式调用
|
||||
|
||||
在请求体中设置 `"stream": true`,服务端以 SSE 形式返回增量内容。
|
||||
在请求体中设置 `"stream": true`,服务端以 SSE 形式返回增量内容。协议与 OpenAI 流式兼容;HTTP 基础见 [HTTP API](/docs/guides/http_api)。
|
||||
|
||||
## cURL
|
||||
|
||||
@@ -14,14 +14,14 @@ description: SSE 流式输出接入说明
|
||||
curl https://api.haiyushuke.com/v1/chat/completions \
|
||||
-H "Authorization: Bearer YOUR_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"model":"gpt-4o-mini","stream":true,"messages":[{"role":"user","content":"写一首四句诗"}]}'
|
||||
-d '{"model":"deepseek-chat","stream":true,"messages":[{"role":"user","content":"写一首四句诗"}]}'
|
||||
```
|
||||
|
||||
## OpenAI SDK(Node)
|
||||
|
||||
```ts
|
||||
const stream = await client.chat.completions.create({
|
||||
model: "gpt-4o-mini",
|
||||
model: "deepseek-chat",
|
||||
stream: true,
|
||||
messages: [{ role: "user", content: "你好" }],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user