Skip to content

Continuous Video Generation

POST https://www.kkiai.com/v1/chat/completions

Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.

Create a completion for the provided prompt and parameters

Official documentation: https://platform.openai.com/docs/api-reference/chat/create

Request Parameters

Authorization

Add the Authorization parameter to the Header, with the value being the Token concatenated after Bearer

Example: Authorization: Bearer ********************

Header Parameters

Parameter NameTypeRequiredDescriptionExample
Content-TypestringRequiredapplication/json
AcceptstringRequiredapplication/json
AuthorizationstringOptionalBearer {{YOUR_API_KEY}}
X-Forwarded-HoststringOptionallocalhost:5173

Body Parameters (application/json)

Parameter NameTypeRequiredDescription
modelenum<string>Required
messagesarray[object]Required
  └ rolestringRequired
  └ contentstringRequired
streambooleanRequired

Request Example

json
{
    "model": "sora-2",
    "messages": [
        {
            "role": "user",
            "content": "Generate a high-definition video of cattle and horses dancing"
        },
        {
            "role": "assistant",
            "content": "```json\n{\n  \"prompt\": \"Generate a high-definition video of cattle and horses dancing\",\n  \"orientation\": \"portrait\"\n}\n```\n\n> ID: `task_01k7dzptgwf2z87wj2c3t36qk0`\n>[Data Preview](https://asyncdata.net/web/task_01k7dzptgwf2z87wj2c3t36qk0) | [Raw Data](https://asyncdata.net/source/task_01k7dzptgwf2z87wj2c3t36qk0)\n> Queuing......\n> Generating.\n\n>🏃‍ Progress 76..\n\n> Generation Complete ✅\n> sid: s_68ec8accd80c8191ae1fc957af78caaa\n\n![https://filesystem.site/cdn/20251013/929d094fcd1844c3ee38be9476fd03.webp](https://filesystem.site/cdn/20251013/929d094fcd1844c3ee38be9476fd03.webp)\n[Play Online▶️](https://filesystem.site/cdn/20251013/5781a601c5ce5e216e914fef119c99.mp4)"
        },
        {
            "role": "user",
            "content": "Make the cattle have a halo on its head and the horse stepping on auspicious clouds"
        }
    ],
    "stream": true
}

cURL Example

bash
curl --location --request POST 'https://www.kkiai.com/v1/chat/completions' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "sora-2",
    "messages": [
        {
            "role": "user",
            "content": "Generate a high-definition video of cattle and horses dancing"
        },
        {
            "role": "assistant",
            "content": "```json\n{\n  \"prompt\": \"Generate a high-definition video of cattle and horses dancing\",\n  \"orientation\": \"portrait\"\n}\n```\n\n> ID: `task_01k7dzptgwf2z87wj2c3t36qk0`\n>[Data Preview](https://asyncdata.net/web/task_01k7dzptgwf2z87wj2c3t36qk0) | [Raw Data](https://asyncdata.net/source/task_01k7dzptgwf2z87wj2c3t36qk0)\n> Queuing......\n> Generating.\n\n>🏃‍ Progress 76..\n\n> Generation Complete ✅\n> sid: s_68ec8accd80c8191ae1fc957af78caaa\n\n![https://filesystem.site/cdn/20251013/929d094fcd1844c3ee38be9476fd03.webp](https://filesystem.site/cdn/20251013/929d094fcd1844c3ee38be9476fd03.webp)\n[Play Online▶️](https://filesystem.site/cdn/20251013/5781a601c5ce5e216e914fef119c99.mp4)"
        },
        {
            "role": "user",
            "content": "Make the cattle have a halo on its head and the horse stepping on auspicious clouds"
        }
    ],
    "stream": true
}'

Response

🟢 200 Success

Response Example

json
data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "role": "assistant",
                "content": ""
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "```"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "json"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "\n"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "{\n"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": " "
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": " \"prompt\""
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": ":"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": " \"Make the cattle have a halo on its head and the horse stepping on auspicious clouds\""
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": ",\n"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": " \"orientation\""
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": ":"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": " \"portrait\""
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": ",\n"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": " \"sid\""
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": ":"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": " \"s_68ec8accd80c8191ae1fc957af78caaa\""
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "\n"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "}\n"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "```"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {},
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "\n\n> ID: `task_01k7e5w9z5f2d91pekrqy59rwc`\n>[Data Preview](https://asyncdata.net/web/task_01k7e5w9z5f2d91pekrqy59rwc) | [Raw Data](https://asyncdata.net/source/task_01k7e5w9z5f2d91pekrqy59rwc)\n> Queuing."
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "."
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "."
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "."
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "."
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "."
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "\n> Generating"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "."
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "\n\n>🏃‍ Progress 36..44..61..69..81..\n\n> Generation Complete ✅\n> sid: s_68eca3f141808191b1fd30fea1b731bd\n\n![https://filesystem.site/cdn/20251013/38e999994cfa666de5e677d2af347f.webp](https://filesystem.site/cdn/20251013/38e999994cfa666de5e677d2af347f.webp)\n[Play Online▶️](https://filesystem.site/cdn/20251013/a7a7930bd01f7f313bbb6ecb234075.mp4)"
            },
            "finish_reason": null
        }
    ]
}

data: {
    "id": "chatcmpl-89C77NMqv7oh6ajWBZful0xBNsJN1",
    "object": "chat.completion.chunk",
    "created": 1760338775,
    "model": "sora-2",
    "choices": [
        {
            "index": 0,
            "delta": {},
            "finish_reason": "stop"
        }
    ]
}

data: [DONE]