Skip to content

文本补全 ​

POST /v1/completions 基于提示词创建传统文本补全。

请求参数 ​

参数类型必填说明
modelstring是模型 ID。
promptstring 或 string 数组是补全提示词。
max_tokensinteger否最大生成 Token 数。
temperaturenumber否采样温度。
top_pnumber否核采样参数。
ninteger否生成数量。
streamboolean否是否流式响应。
stopstring 或 string 数组否停止序列。
suffixstring否补全后缀。
echoboolean否是否回显提示词。

示例 ​

bash
curl -X POST "https://one.gloscai.com/v1/completions" \
  -H "Authorization: Bearer sk-xxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-3.5-turbo-instruct",
    "prompt": "写一个产品发布标题"
  }'

响应 ​

响应通常包含 choices[].text、choices[].finish_reason 和 usage。