> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elkapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Sora Video

> <ul><li>OpenAI-compatible video generation endpoint.</li><li>Reference documentation: https://platform.openai.com/docs/api-reference/videos/create</li></ul>

<RequestExample>
  ```bash cURL theme={null} theme={null}
  curl --request POST \
    --url 'https://api.elkapi.com/v1/videos' \
    --header 'Authorization: Bearer <token>' \
    --form 'model=sora-2' \
    --form 'prompt=A small kitten running through a sunny garden, cinematic, highly detailed' \
    --form 'image=https://example.com/image.png' \
    --form 'duration=5' \
    --form 'width=1280' \
    --form 'height=720' \
    --form 'fps=30' \
    --form 'seed=12345' \
    --form 'n=1' \
    --form 'response_format=json' \
    --form 'user=user-1234' \
    --form 'metadata=[object Object]'
  ```

  ```python Python theme={null} theme={null}
  import requests

  url = "https://api.elkapi.com/v1/videos"
  headers = {
      "Authorization": "Bearer <token>"
  }
  files = {
  }
  data = {
      "model": "sora-2",
      "prompt": "A small kitten running through a sunny garden, cinematic, highly detailed",
      "image": "https://example.com/image.png",
      "duration": "5",
      "width": "1280",
      "height": "720",
      "fps": "30",
      "seed": "12345",
      "n": "1",
      "response_format": "json",
      "user": "user-1234",
      "metadata": "[object Object]",
  }

  response = requests.request("POST", url, headers=headers, data=data, files=files)
  print(response.text)
  ```

  ```javascript JavaScript theme={null} theme={null}
  const url = "https://api.elkapi.com/v1/videos";

  const headers = {
    "Authorization": "Bearer <token>"
  };
  const form = new FormData();
  form.append("model", "sora-2");
  form.append("prompt", "A small kitten running through a sunny garden, cinematic, highly detailed");
  form.append("image", "https://example.com/image.png");
  form.append("duration", "5");
  form.append("width", "1280");
  form.append("height", "720");
  form.append("fps", "30");
  form.append("seed", "12345");
  form.append("n", "1");
  form.append("response_format", "json");
  form.append("user", "user-1234");
  form.append("metadata", "[object Object]");

  const response = await fetch(url, {
    method: "POST",
    headers,
    body: form
  });

  console.log(await response.text());
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null} theme={null}
  {
    "id": "id",
    "object": "object",
    "model": "sora-2",
    "status": "status",
    "progress": 1,
    "created_at": 1,
    "seconds": "seconds",
    "completed_at": 1,
    "expires_at": 1,
    "size": "1024x1024",
    "error": {
      "message": "message",
      "code": "code"
    },
    "metadata": {}
  }
  ```

  ```json 400 theme={null} theme={null}
  {
    "error": {
      "message": "message",
      "type": "type",
      "param": "param",
      "code": "code"
    }
  }
  ```
</ResponseExample>

## Authorizations

<ParamField header="Authorization" type="string" required>
  All endpoints require Bearer Token authentication.

  Add it to the request headers:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Body

<ParamField body="model" type="string" default="sora-2">
  Model/style ID

  Example: `sora-2`
</ParamField>

<ParamField body="prompt" type="string">
  Text prompt

  Example: `The astronaut stands up and walks away`
</ParamField>

<ParamField body="image" type="string">
  Image input (URL or Base64)

  Example: `https://example.com/image.jpg`
</ParamField>

<ParamField body="duration" type="number">
  Video duration (seconds)

  Example: `5`
</ParamField>

<ParamField body="width" type="integer">
  Video width

  Example: `1280`
</ParamField>

<ParamField body="height" type="integer">
  Video height

  Example: `720`
</ParamField>

<ParamField body="fps" type="integer">
  Video frame rate

  Example: `30`
</ParamField>

<ParamField body="seed" type="integer">
  Random seed

  Example: `20231234`
</ParamField>

<ParamField body="n" type="integer">
  Number of videos to generate

  Example: `1`
</ParamField>

<ParamField body="response_format" type="string">
  Response format

  Example: `url`
</ParamField>

<ParamField body="user" type="string">
  User identifier

  Example: `user-1234`
</ParamField>

<ParamField body="metadata" type="object">
  Additional parameters (such as negative\_prompt, style, quality\_level)
</ParamField>

## Response

<ResponseField name="id" type="string">
  Video ID
</ResponseField>

<ResponseField name="object" type="string">
  Object type
</ResponseField>

<ResponseField name="model" type="string" default="sora-2">
  Model used

  Example: `sora-2`
</ResponseField>

<ResponseField name="status" type="string">
  Task status
</ResponseField>

<ResponseField name="progress" type="integer">
  Progress percentage
</ResponseField>

<ResponseField name="created_at" type="integer">
  Creation timestamp
</ResponseField>

<ResponseField name="seconds" type="string">
  Video duration
</ResponseField>

<ResponseField name="completed_at" type="integer">
  Completion timestamp
</ResponseField>

<ResponseField name="expires_at" type="integer">
  Expiration timestamp
</ResponseField>

<ResponseField name="size" type="string">
  Video size
</ResponseField>

<ResponseField name="error" type="object">
  OpenAI video error information

  <ResponseField name="error.message" type="string">
    Error message
  </ResponseField>

  <ResponseField name="error.code" type="string">
    Error code
  </ResponseField>
</ResponseField>

<ResponseField name="metadata" type="object">
  Additional metadata
</ResponseField>
