stream: true。PipeLLM 返回与 OpenAI 相同形状的 SSE。
stream: true,或 Gemini 的 :streamGenerateContent)。视频生成是异步的,不会走流式,请轮询 GET /v2/videos/{id}。
非流式响应结构见 Chat Completions。Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
边生成边接收对话 token。
stream: true。PipeLLM 返回与 OpenAI 相同形状的 SSE。
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PIPELLM_API_KEY"],
base_url="https://api.pipellm.ai/v1",
)
stream = client.chat.completions.create(
model="gpt-5",
stream=True,
messages=[{"role": "user", "content": "从 1 数到 5。"}],
)
for chunk in stream:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="", flush=True)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.PIPELLM_API_KEY,
baseURL: "https://api.pipellm.ai/v1",
});
const stream = await client.chat.completions.create({
model: "gpt-5",
stream: true,
messages: [{ role: "user", content: "从 1 数到 5。" }],
});
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta?.content;
if (delta) process.stdout.write(delta);
}
curl https://api.pipellm.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $PIPELLM_API_KEY" \
-N \
-d '{
"model": "gpt-5",
"stream": true,
"messages": [{"role": "user", "content": "从 1 数到 5。"}]
}'
stream: true,或 Gemini 的 :streamGenerateContent)。视频生成是异步的,不会走流式,请轮询 GET /v2/videos/{id}。
非流式响应结构见 Chat Completions。此页面对您有帮助吗?