Skip to main content
POST
/
v1
/
chat
/
completions
sora-2 (image to video)
curl --request POST \
  --url https://api.example.com/v1/chat/completions
This endpoint provides chat mode functionality.
curl -X POST "https://gptproto.com/v1/chat/completions" \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "sora-2",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "video of a girl dancing"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://oss.heyoos.com/ai-draw/material/land-part1-default.png"
          }
        }
      ]
    }
  ],
  "stream": true
}'
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}

Parameters

ParameterTypeRequiredDefaultDescription
modelstring✅ Yessora-2The model to use for the request. sora-2
messagesarray✅ Yes-Array of message objects for the conversation * role:user,The role of the message. * role:assistant,The role of the message. * role:system,The role of the message.
contentarray✅ Yes-text , image_url
textstring✅ Yes-* type:text,The positive prompt for the generation. * type:image_url,Optional image reference that guides generation.
image_urlobject✅ Yes-* type:image_url,The URL of the image to use for the generation.
streamboolean❌ NofalseWhether to stream the response

Response

{
    "choices": [
        {
            "delta": {
                "content": "> ✅ Video generated successfully, [click here](https://oss.heyoos.com/sora/XXXXX83.mp4) to view video~~~\n\n",
                "role": "assistant"
            },
            "index": 0
        }
    ],
    "created": 0,
    "id": "39a5d-xxxxx",
    "model": "sora-2",
    "object": "chat.completion.chunk"
}

F&Q

Q: How to control the video duration? A: Can control the duration. you need to add a duration flag in the prompt, such as’ duration: 5 seconds’. Sora-2 supports videos of up to 15 seconds.