第一步:鉴权

每次请求使用 Authorization: Bearer YOUR_API_KEY,将占位符替换为青云TOP API Key,保留 Bearer 后的空格。无需先调用登录接口。

第二步:调用模型

向 POST https://top.qingyuntop.ai/v1/responses 提交 JSON,设置 Content-Type: application/json。必填 model 和非空 input;时长使用 seconds,尺寸使用 size。模型与图片规则见输入与参数。

代码示例

cURL 使用 Bash 语法;Python 需要 requests;Node.js 使用 22+,含 import 的示例保存为 .mjs。

curl --fail-with-body -N --max-time 1800 "https://top.qingyuntop.ai/v1/responses" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model":"sora-2","input":"镜头从云层下降到海边灯塔。","seconds":8,"size":"1280x720","stream":true,"background":false}'

常见事件有 response.created、response.in_progress、response.output_text.delta、response.completed,失败或观察超时可能是 response.failed 或 response.incomplete。完成后仍需用 metadata.task_id 下载视频。