跳转到内容

数据结构

接口的请求和响应里出现的对象。各个接口的页面从这里引用它们。

账号。一个 API 密钥属于一个账号,带着密钥的请求以这个账号的身份执行。

字段 类型 说明
id 字符串 账号的标识
username 字符串 登录网页用的用户名
name 字符串 使用者的姓名
organization 字符串 使用者所在的单位
role 字符串 member 是普通账号,admin 是管理员
state 字符串 active 是启用,disabled 是停用。停用的账号的登录和密钥都被拒绝
duration_quota_seconds 整数 或 null 视频时长的配额:这个账号总共能发布多少秒的视频,不按时间重置。null 表示不限
duration_used_seconds 数字 已经用掉的秒数:这个账号的轮次发布的各个版本的时长之和
rate_limit_per_minute 整数 这个账号每分钟能发的请求数
running_round_limit 整数 这个账号能同时执行的轮次数。超出的轮次保持排队,等这个账号有一轮结束后自动开始
created_at 时间 账号创建的时间
{
"id": "account-2b7e4d19c8a34f6b9e0d5a1c7f3b8e26",
"username": "school01",
"name": "张老师",
"organization": "第一中学",
"role": "member",
"state": "active",
"duration_quota_seconds": 36000,
"duration_used_seconds": 412.5,
"rate_limit_per_minute": 600,
"running_round_limit": 4,
"created_at": "2026-09-01T02:00:00Z"
}

视频:一条讲解视频,连同它的参考资料、轮次和版本。

字段 类型 说明
id 字符串 视频的标识
title 字符串 视频的标题
state 字符串 由轮次推出:没有轮次时是 draft;有轮次在执行时是 running;否则有轮次在排队时是 queued;否则是最新一轮的结果 succeeded、failed 或 canceled
file_count 整数 已上传的文件数
latest_round 轮次 或 null 最后创建的那一轮,还没有轮次时为 null
current_version 版本 或 null 最后发布的那个版本,还没有版本时为 null
version_count 整数 已发布的版本数
created_at 时间 视频创建的时间
updated_at 时间 视频最近一次变化的时间
{
"id": "video-3f9c1a7b2e4d4c6f8a0b9d1e5c7f3a21",
"title": "勾股定理",
"state": "succeeded",
"file_count": 1,
"latest_round": {
"id": "round-5d2a8c41e7b94f0d9a3b6c1e8f2d7a90",
"sequence": 1,
"kind": "initial",
"state": "succeeded",
"failure_reason": null,
"instruction": "给八年级学生讲勾股定理的证明,五分钟左右",
"target_version_id": null,
"target_time_seconds": null,
"file_ids": [
"file-91c4e2b7a6d84f3e8b5a0c7d2e9f1a63"
],
"retry_of_round_id": null,
"summary": "已做出一条 3 分 18 秒的讲解视频,用拼图法证明了勾股定理。",
"version_id": "version-a47c9e1b5d3f4a2e8c6b0d9f1e3a5c72",
"created_at": "2026-11-20T06:30:00Z",
"started_at": "2026-11-20T06:30:04Z",
"finished_at": "2026-11-20T06:52:41Z",
"deadline_at": "2026-11-20T07:30:04Z",
"cancel_requested_at": null
},
"current_version": {
"id": "version-a47c9e1b5d3f4a2e8c6b0d9f1e3a5c72",
"sequence": 1,
"round_id": "round-5d2a8c41e7b94f0d9a3b6c1e8f2d7a90",
"duration_seconds": 198.4,
"preview_url": "https://preview.example.com/v/3f9c1a7b2e4d/index.html",
"mp4_state": "none",
"mp4_size_bytes": null,
"created_at": "2026-11-20T06:52:41Z"
},
"version_count": 1,
"created_at": "2026-11-20T06:27:30Z",
"updated_at": "2026-11-20T06:52:41Z"
}

轮次:一条视频上的一轮工作。第一轮制作视频,之后的每一轮按修改意见给出一个新的版本。同一条视频的轮次按 sequence 的顺序逐个执行。

字段 类型 说明
id 字符串 轮次的标识
sequence 整数 这一轮在所属视频的轮次里的序号,从 1 开始
kind 字符串 initial 是制作视频,revision 是按修改意见修改,retry 是把失败或被取消的一轮重做一次
state 字符串 queued 是排队,running 是执行中。succeeded、failed、canceled 是结束后的三种结果,到达之后不再变化。一轮是 succeeded,当且仅当它发布了一个版本
failure_reason 字符串 或 null 这一轮失败的原因:timed_out 是超过了最晚完成时间,execution_error 是执行出错,interrupted 是执行被中断,no_version 是执行结束但没有发布版本。state 不是 failed 时为 null
instruction 字符串 调用方为这一轮写的视频要求或修改意见
target_version_id 字符串 或 null 修改意见所针对的版本的标识。第一轮没有可以针对的版本,为 null
target_time_seconds 数字 或 null 修改意见指向的时刻:从所针对的版本的开头算起的秒数。意见针对整条视频时为 null
file_ids 字符串的数组 归入这一轮的文件的标识
retry_of_round_id 字符串 或 null 被这一轮重做的那一轮的标识。只有 kind 是 retry 时有值
summary 字符串 或 null 系统为这一轮写的一句说明,供人阅读。没有写时为 null。其中的公式用 LaTeX 写。程序要知道一轮怎样结束,应读 state 和 failure_reason
version_id 字符串 或 null 这一轮发布的版本的标识,没有发布版本时为 null
created_at 时间 这一轮创建的时间
started_at 时间 或 null 这一轮开始执行的时间,还没有开始时为 null
finished_at 时间 或 null 这一轮结束的时间,还没有结束时为 null
deadline_at 时间 或 null 最晚完成时间:这一轮到这个时间还没有结束,就以 timed_out 失败。还没有开始执行时为 null
cancel_requested_at 时间 或 null 调用方请求取消一个执行中的轮次的时间。这一轮稍后变为 canceled。没有请求取消时为 null
{
"id": "round-5d2a8c41e7b94f0d9a3b6c1e8f2d7a90",
"sequence": 1,
"kind": "initial",
"state": "succeeded",
"failure_reason": null,
"instruction": "给八年级学生讲勾股定理的证明,五分钟左右",
"target_version_id": null,
"target_time_seconds": null,
"file_ids": [
"file-91c4e2b7a6d84f3e8b5a0c7d2e9f1a63"
],
"retry_of_round_id": null,
"summary": "已做出一条 3 分 18 秒的讲解视频,用拼图法证明了勾股定理。",
"version_id": "version-a47c9e1b5d3f4a2e8c6b0d9f1e3a5c72",
"created_at": "2026-11-20T06:30:00Z",
"started_at": "2026-11-20T06:30:04Z",
"finished_at": "2026-11-20T06:52:41Z",
"deadline_at": "2026-11-20T07:30:04Z",
"cancel_requested_at": null
}

版本:一轮发布的一条完整的视频。版本发布之后不再变化,只有 mp4_state 和 mp4_size_bytes 会变。

字段 类型 说明
id 字符串 版本的标识
sequence 整数 这个版本在所属视频的版本里的序号,从 1 开始
round_id 字符串 发布这个版本的轮次的标识
duration_seconds 数字 视频的时长,单位是秒
preview_url 字符串 这个版本的播放页的地址。它是公开的:拿到地址的人不需要登录就能观看。地址在视频被删除之前一直有效
mp4_state 字符串 这个版本的 MP4 文件的状态:none 是没有请求过,rendering 是正在生成,ready 是可以下载,failed 是上一次生成没有成功,可以再请求一次
mp4_size_bytes 整数 或 null MP4 文件的字节数。只有 mp4_state 是 ready 时有值
created_at 时间 版本发布的时间
{
"id": "version-a47c9e1b5d3f4a2e8c6b0d9f1e3a5c72",
"sequence": 1,
"round_id": "round-5d2a8c41e7b94f0d9a3b6c1e8f2d7a90",
"duration_seconds": 198.4,
"preview_url": "https://preview.example.com/v/3f9c1a7b2e4d/index.html",
"mp4_state": "none",
"mp4_size_bytes": null,
"created_at": "2026-11-20T06:52:41Z"
}

调用方上传到一条视频里的参考资料。

字段 类型 说明
id 字符串 文件的标识
filename 字符串 文件名
size_bytes 整数 文件内容的字节数
content_type 字符串 文件的媒体类型
state 字符串 pending 表示已登记、内容还没有确认传完,uploaded 表示内容已经确认到达
round_id 字符串 或 null 这个文件被归入的轮次的标识,还没有归入任何轮次时为 null
created_at 时间 文件登记的时间
{
"id": "file-91c4e2b7a6d84f3e8b5a0c7d2e9f1a63",
"filename": "勾股定理.pdf",
"size_bytes": 1234567,
"content_type": "application/pdf",
"state": "uploaded",
"round_id": null,
"created_at": "2026-11-20T06:28:00Z"
}

上传地址:把一个文件的内容发到哪里、怎样发。调用方按它发一个请求,请求体是文件的内容。地址属于存储,发往它的请求不带 API 密钥。

字段 类型 说明
method 字符串 请求的方法,例如 PUT
url 字符串 请求的地址
headers 对象 请求必须带上的请求头,名称和值都要原样使用
expires_at 时间 地址失效的时间
{
"method": "PUT",
"url": "https://storage.example.com/uploads/file-3f9c?signature=…",
"headers": {
"Content-Type": "application/pdf"
},
"expires_at": "2026-11-20T07:30:00Z"
}

下载地址:从哪里取一个文件的内容。调用方向它发一个不带 API 密钥的 GET 请求,响应体是文件的内容。

字段 类型 说明
url 字符串 取文件内容的地址
expires_at 时间 地址失效的时间
{
"url": "https://storage.example.com/files/artifact-7b1e?signature=…",
"expires_at": "2026-11-20T07:30:00Z"
}

用量记录。每一轮对应一条。视频被删除之后,它的轮次的用量记录仍然保留。

字段 类型 说明
id 字符串 用量记录的标识
video_id 字符串 这一轮所属的视频的标识
round_id 字符串 这一轮的标识
round_kind 字符串 这一轮的种类:initial、revision 或 retry
api_key_id 字符串 或 null 创建这一轮的请求所带的 API 密钥的标识。这一轮由网页创建或由系统发起时为 null
billed_seconds 数字 或 null 这一轮计入配额的秒数:发布了版本时是这个版本的时长,没有发布版本时是 0,这一轮还没有结束时为 null
started_at 时间 或 null 这一轮开始执行的时间,还没有开始时为 null
finished_at 时间 或 null 这一轮结束的时间,还没有结束时为 null
run_seconds 数字 或 null 这一轮从开始执行到结束的秒数,还没有结束时为 null。它和计入配额的秒数无关
created_at 时间 这一轮创建的时间
{
"id": "usage-c3a91f5e7d2b4a8c9e6f0b1d4a7c2e58",
"video_id": "video-3f9c1a7b2e4d4c6f8a0b9d1e5c7f3a21",
"round_id": "round-5d2a8c41e7b94f0d9a3b6c1e8f2d7a90",
"round_kind": "initial",
"api_key_id": "key-8e1f6b3a9c2d4e7f8a5b0c4d1e6f9a37",
"billed_seconds": 198.4,
"started_at": "2026-11-20T06:30:04Z",
"finished_at": "2026-11-20T06:52:41Z",
"run_seconds": 1357,
"created_at": "2026-11-20T06:30:00Z"
}

账号在一段时间里的用量合计。

字段 类型 说明
round_count 整数 这段时间里创建的轮次数
billed_seconds 数字 这些轮次计入配额的秒数的合计
run_seconds 数字 这些轮次执行所用秒数的合计
by_api_key 密钥的用量合计的数组 按 API 密钥分开的合计
{
"round_count": 12,
"billed_seconds": 1830.6,
"run_seconds": 15240,
"by_api_key": [
{
"round_count": 12,
"billed_seconds": 1830.6,
"run_seconds": 15240,
"api_key_id": "key-8e1f6b3a9c2d4e7f8a5b0c4d1e6f9a37",
"api_key_name": "课程制作"
}
]
}

一个 API 密钥创建的轮次的用量合计。

字段 类型 说明
round_count 整数 这段时间里创建的轮次数
billed_seconds 数字 这些轮次计入配额的秒数的合计
run_seconds 数字 这些轮次执行所用秒数的合计
api_key_id 字符串 或 null API 密钥的标识。null 的这一行是由网页创建或由系统发起的轮次
api_key_name 字符串 或 null API 密钥的名称,api_key_id 为 null 时也是 null

出错时的响应体。格式遵循 RFC 9457,媒体类型是 application/problem+json。

字段 类型 说明
type 字符串 固定为 about:blank。默认是 "about:blank"
title 字符串 状态码的标准英文名称
status 整数 和响应的状态码相同
code 字符串 稳定的英文错误码。程序按它判断出了什么错
detail 字符串 一句可以直接显示给使用者的中文
request_id 字符串 这个请求的标识,和响应头 X-Request-Id 相同。报告问题时请提供它
errors 字段错误的数组 或 null 只在状态码是 422 时出现:逐项列出请求里不合规则的地方
{
"type": "about:blank",
"title": "Conflict",
"status": 409,
"code": "round_not_cancelable",
"detail": "已结束,无法取消",
"request_id": "0f3c2a7e5b914d6f8a1c3e5d7f9b2a4c",
"errors": null
}

请求里不合规则的一处。

字段 类型 说明
field 字符串 这一处在请求里的位置,各级名称用点号连接
message 字符串 这一处违反了什么规则,是一句可以直接显示的中文