通知!Sora2最近调整了一波规则,需要绑定手机验证,GrsAi已经完全解决了该问题,提高了视频成功率!
{
"Content-Type": "application/json",
"Authorization": "Bearer apikey"
}


{
"model": "sora-2",
"prompt": "提示词" #引用角色在这里@id}

{
"id": "f44bcf50-f2d0-4c26-a467-26f2014a771b",
"results": [{
"url": "https://example.com/example.mp4",
"removeWatermark": true,
"pid": "s_xxxxxxxxxxxxxxx"
}],
"progress": 100,
"status": "succeeded"}
// 请求示例const response = await fetch('https://grsai.dakka.com.cn/v1/video/sora-video', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer apikey'
},
body: JSON.stringify({
"model": "sora-2",
"prompt": "A cute cartoon cat playing with a ball of yarn on a sunny day",
"aspectRatio": "16:9",
"duration": 10,
"size": "small"
})});
{
"url": "角色视频URL或Base64",
"timestamps": "0,3"}


// 1. 上传角色const uploadResponse = await fetch('https://grsai.dakka.com.cn/v1/video/sora-upload-character', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer apikey'
},
body: JSON.stringify({
"url": "https://example.com/cartoon-cat.mp4",
"timestamps": "0,3"
})});const characterData = await uploadResponse.json();const characterId = characterData.results[0].character_id; // 例如:"cartoon_cat_001"// 2. 使用角色生成视频const videoResponse = await fetch('https://grsai.dakka.com.cn/v1/video/sora-video', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer apikey'
},
body: JSON.stringify({
"model": "sora-2",
"prompt": `A ${characterId} exploring a magical forest with glowing mushrooms`,
"aspectRatio": "16:9"
})});
{
"pid": "s_xxxxxxxxxxxxxxx",
"timestamps": "0,3"}


// 假设已有一个生成的视频,pid为"s_6964a407c1fc819198458b8abf2b9cdf"// 1. 从视频中创建角色const createCharResponse = await fetch('https://grsai.dakka.com.cn/v1/video/sora-create-character', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer apikey'
},
body: JSON.stringify({
"pid": "s_6964a407c1fc819198458b8abf2b9cdf",
"timestamps": "2,5" // 提取第2-5秒的角色
})});const newCharacter = await createCharResponse.json();const newCharacterId = newCharacter.results[0].character_id;// 2. 使用新创建的角色生成新视频const newVideoResponse = await fetch('https://grsai.dakka.com.cn/v1/video/sora-video', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer apikey'
},
body: JSON.stringify({
"model": "sora-2",
"prompt": `The @${newCharacterId} is now attending a grand feast in a castle`,#@角色id "aspectRatio": "16:9"
})});
const resultResponse = await fetch('https://grsai.dakka.com.cn/v1/draw/result', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer apikey'
},
body: JSON.stringify({
"id": "任务ID"
})});




来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70048307/viewspace-3107733/ ,如需转载,请注明出处,否则将追究法律责任。