内容完成接口 /v1/completions
/v1/completions
请求参数
Body 参数application/json
No schema defined
示例
{
"model": "text-davinci-003",
"prompt": "Say this is a test"
}
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSON
数据结构
id
string
必需
object
string
必需
created
integer
必需
model
string
使用的模型
choices
array [object {4}]
必需
text
string
响应的内容
index
integer
可选
logprobs
null
可选
finish_reason
string
可选
usage
object
消耗
prompt_tokens
integer
必需
输入的 tokens
completion_tokens
integer
必需
响应的 tokens
total_tokens
integer
必需
总的消耗 tokens, prompt+completion
示例
{
"id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7",
"object": "text_completion",
"created": 1589478378,
"model": "text-davinci-003",
"choices": [
{
"text": "\n\nThis is indeed a test",
"index": 0,
"logprobs": null,
"finish_reason": "length"
}
],
"usage": {
"prompt_tokens": 5,
"completion_tokens": 7,
"total_tokens": 12
}
}
修改于 1 年前