Skip to content
EN

接入介绍

pika 本身无 api, 跟 GPTs 一样是通过逆向得来, 支持 文生视频 图生视频 计费是按次数,一次一个视频

创建视频任务

curl 'https://{basl_url}/pika/generate'
-H 'Content-Type: application/json'
-H 'Authorization: Bearer sk-你的key'
--data '{"pikaffect":"","promptText":"moving","model":"1.5","options":{"aspectRatio":1.7777777777777777,"frameRate":24,"camera":{},"parameters":{"guidanceScale":12,"motion":1,"negativePrompt":""},"extend":false}}'

请求体

{
"pikaffect": "",
"promptText": "moving",
"model": "1.5",
"options": {
"aspectRatio": 1.7777777777777777,
"frameRate": 24,
"camera": {},
"parameters": {
"guidanceScale": 12,
"motion": 1,
"negativePrompt": ""
},
"extend": false
},
"image": ""
}

关键字段说明

字段 类型 说明 pikaffect string 官方视频效果,可以留空 当配置上效果后有配音Levitate Decapitate Eye-pop Ta-da Deflate Crumble Dissolve Squish Inflate Melt Crush Cake-ify Explode 后续官方可能还会增加 promptText string 提示词 image string 存在就必须有值,可以是 base64 或者图片 url model string 模型版本 1.5 2.0 options object 视频设置 options.aspectRatio number 宽高比例 如果是图片这个要去掉 options.parameters.negativePrompt string 不出现的物体

返回体

返回的 id 我们称之为 taskId 在后面的步骤中用到

{
"id": "c1d16f47-16c2-4798-8733-5ed9903885cc"
}

查看任务状态

curl 'https://{basl_url}//pika/feed/{id}'
-H 'Authorization: Bearer sk-你的key'

返回体

{
"id": "66e0818e-05fb-454e-b246-a6f253e9ffbf",
"promptText": "Plane fly",
"videos": [
{
"id": "66e0818e-05fb-454e-b246-a6f253e9ffbf",
"status": "finished",
"seed": 3183047765,
"resultUrl": "https://cdn.pika.art/v1/66e0818e-05fb-454e-b246-a6f253e9ffbf/Plane_fly_seed3183047765.mp4",
"sharingUrl": "https://cdn.pika.art/v1/66e0818e-05fb-454e-b246-a6f253e9ffbf/Plane_fly_seed3183047765_share.mp4",
"videoPoster": "https://cdn.pika.art/v1/66e0818e-05fb-454e-b246-a6f253e9ffbf/poster.jpg",
"imageThumb": "https://cdn.pika.art/v1/66e0818e-05fb-454e-b246-a6f253e9ffbf/thumbnail.jpg",
"duration": 5,
"error": "",
"progress": 100
}
]
}

返回关键字段说明

字段 类型 说明 id string 任务 id promptText string 提示词 videos array 视频数组 videos[].id string 视频 id videos[].status string 视频状态 finished 为完成 error 为错误 videos[].seed number 视频种子 videos[].resultUrl string 视频地址 videos[].videoPoster string 封面图片 videos[].sharingUrl string 视频分享地址 videos[].error string 当状态为error 有错误说明 videos[].progress number 进度

ingredient:多图创建视频任务

注意请求体内不能带 image ingredient 是一个图片数组 可以是 url 也可以是 base64 ingredients-mode 为 precise 精确模式 或者 creative 创意模式 model 必须为 2.0 请求体

{
"pikaffect": "",
"model": "2.0",
"promptText": "pick it",
"options": {
"aspectRatio": 1.7777777777777777,
"frameRate": 24,
"camera": {},
"parameters": {
"guidanceScale": 12,
"motion": 1,
"negativePrompt": ""
},
"extend": false,
"ingredients-mode": "precise"
},
"ingredient": [
"https://www.openai-hk.com/res/img/open.png",
"https://cos.aitutu.cc/gpts/o1-all.jpg"
]
}