HenAPI 接口文档
  1. chat格式
HenAPI 接口文档
  • 介绍
  • 常用代码示例
  • 项目说明
  • 导言
  • 身份验证
  • 发出请求
  • 参数详情
  • 音频(Audio)
    • 创建语音
      POST
    • 创建转录
      POST
    • 创建翻译
      POST
  • 聊天(Chat)
    • Chat Completions 对象
    • Chat Completions 对象块
    • 创建 Chat Completions
      POST
  • 自动补全(Completions)
    • Completions 对象
    • 创建 Completions
      POST
  • 嵌入(Embeddings)
    • 嵌入对象
    • 创建嵌入
      POST
  • 微调(Fine-tuning)
    • 微调作业对象
    • 微调作业事件对象
    • 创建微调作业
      POST
    • 列出微调作业
      GET
    • 检索微调作业
      GET
    • 取消微调
      POST
    • 列出微调事件
      GET
  • 图像(Images)
    • README
    • 图像对象
    • 创建图像
    • 创建图片编辑
    • 创建图像变体
  • 模型(Models)
    • 模型对象
    • 列出模型
    • 检索模型
    • 删除微调模型
  • 文件(Files)
    • README
    • 文件对象
    • 列出文件
    • 上传文件
    • 删除文件
    • 检索文件
    • 检索文件内容
  • 审查(Moderations)
    • 调节对象
    • 创建内容审核
  • 助手测试版(AssistantsBeta)
    • 辅助对象
    • 辅助文件对象
    • 创建助手
    • 检索助手
    • 修改助手
    • 删除助手
    • 列出助手
    • 创建辅助文件
    • 检索助手文件
    • 删除辅助文件
    • 列出助手文件
  • 线程数(Threads)
    • 线程对象
    • 创建线程
    • 检索线程
    • 修改线程
    • 删除话题
  • 留言(Messages)
    • 消息对象
    • 消息文件对象
    • 创建消息
    • 检索消息
    • 修改留言
    • 列出消息
    • 检索消息文件
    • 列出消息文件
  • 运行(Runs)
    • 运行对象
    • 运行步骤对象
    • 创建运行
    • 检索运行
    • 修改运行
    • 列表运行
    • 提交工具输出以运行
    • 取消运行
    • 创建线程并运行
    • 检索运行步骤
    • 列出运行步骤
  • 已弃用-音频(Audio)
    • 创建转录
    • 创建翻译
  • 视频模型
    • sora 视频生成
      • 统一视频格式
        • 查询任务
        • 创建视频,带图片 sora-2
        • 创建视频 sora-2
        • 创建视频 sora-2-pro
      • chat格式
        • 创建视频
          POST
        • 连续修改生成视频
          POST
      • OpenAI官方视频格式
        • openai 查询任务
        • openai 下载视频
        • openai 创建视频,带图片
        • openai 创建视频,带图片 私有模式
        • openai 编辑视频
  1. chat格式

创建视频

POST
/v1/chat/completions
给定一个提示,该模型将返回一个或多个预测的完成,并且还可以返回每个位置的替代标记的概率。
为提供的提示和参数创建完成
官方文档:https://platform.openai.com/docs/api-reference/chat/create

请求参数

Header 参数

Body 参数application/json

示例
{
  "model": "sora-2",
  "max_tokens": 1000,
  "messages": [
    {
      "role": "user",
      "content": "an astronaut golden retriever named Sora levitates around an intergalactic pup-themed space station with a tiny jet back that propels him. gorgeous specular lighting and comets fly through the sky, retro-future astro-themed music plays in the background. light glimmers off the dog's eyes. the dog initially propels towards the space station with the doors opening to let him in. the shot then changes. now inside the space station, many tennis balls are flying around in zero gravity. the dog's astronaut helmet opens up so he can grab one. 35mm film, the intricate details and texturing of the dog's hair are clearly visible and the light of the comets shimmers off the fur."
    }
  ],
  "stream": true
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST '/v1/chat/completions' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "sora-2",
  "max_tokens": 1000,
  "messages": [
    {
      "role": "user",
      "content": "an astronaut golden retriever named Sora levitates around an intergalactic pup-themed space station with a tiny jet back that propels him. gorgeous specular lighting and comets fly through the sky, retro-future astro-themed music plays in the background. light glimmers off the dog'\''s eyes. the dog initially propels towards the space station with the doors opening to let him in. the shot then changes. now inside the space station, many tennis balls are flying around in zero gravity. the dog'\''s astronaut helmet opens up so he can grab one. 35mm film, the intricate details and texturing of the dog'\''s hair are clearly visible and the light of the comets shimmers off the fur."
    }
  ],
  "stream": true
}'

返回响应

🟢200OK
application/json
Body

示例
{
    "id": "chatcmpl-123",
    "object": "chat.completion",
    "created": 1677652288,
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "\n\nHello there, how may I assist you today?"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 9,
        "completion_tokens": 12,
        "total_tokens": 21
    }
}
修改于 2025-10-28 13:45:50
上一页
创建视频 sora-2-pro
下一页
连续修改生成视频
Built with