{
"id": "cmpl_example",
"object": "text_completion",
"created": 1700000000,
"model": "YOUR_MODEL_ID",
"choices": [
{
"index": 0,
"text": " explain completion states.",
"finish_reason": "stop"
}
]
}API 参考
创建文本补全
prompt 请求、text 输出及 SSE 完成字段。
{
"id": "cmpl_example",
"object": "text_completion",
"created": 1700000000,
"model": "YOUR_MODEL_ID",
"choices": [
{
"index": 0,
"text": " explain completion states.",
"finish_reason": "stop"
}
]
}POST /v1/completions
发送明确模型和文本 prompt,可用 stream 选择 SSE。本规范限定单条文本、单个输出。
响应读取 choices[].text;流式也使用 text。finish_reason=stop 才是本例接受的完成结果;length / content_filter 不是完整答案。模型能力、可选参数保留和额外字段依渠道而定。见完整指南与示例。
Read in English