OpenAI接口 chat/completions
开发中POST
https://api.openai.com/v1/chat/completions请求参数
Header 参数
Authorization
string
可选
示例值:
Bearer sk-
Content-Type
string
可选
示例值:
application/json
Body 参数application/json
model
string
必需
messages
array [object {2}]
必需
role
string
必需
content
string
必需
示例
{
"model": "gpt-4o",
"messages": [
{
"role": "developer",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Write a haiku about recursion in programming."
}
]
}
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
object {0}
示例
{}
最后修改时间: 10 天前