> ## 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.

# Sora動画を作成

> <ul><li>OpenAI互換の動画生成エンドポイントです。</li><li>参考ドキュメント: 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=日差しのある庭を走る小さな子猫、映画的、高精細' \
    --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": "日差しのある庭を走る小さな子猫、映画的、高精細",
      "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", "日差しのある庭を走る小さな子猫、映画的、高精細");
  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>
  すべてのエンドポイントで Bearer Token 認証が必要です。

  リクエストヘッダーに追加します:

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

## Body

<ParamField body="model" type="string" default="sora-2">
  モデル/スタイルID

  例:`sora-2`
</ParamField>

<ParamField body="prompt" type="string">
  テキストプロンプト

  例:`宇宙飛行士が立ち上がって歩き去った`
</ParamField>

<ParamField body="image" type="string">
  画像入力（URLまたはBase64）

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

<ParamField body="duration" type="number">
  動画の長さ（秒）

  例:`5`
</ParamField>

<ParamField body="width" type="integer">
  動画の幅

  例:`1280`
</ParamField>

<ParamField body="height" type="integer">
  動画の高さ

  例:`720`
</ParamField>

<ParamField body="fps" type="integer">
  動画フレームレート

  例:`30`
</ParamField>

<ParamField body="seed" type="integer">
  ランダムシード

  例:`20231234`
</ParamField>

<ParamField body="n" type="integer">
  生成する動画数

  例:`1`
</ParamField>

<ParamField body="response_format" type="string">
  レスポンス形式

  例:`url`
</ParamField>

<ParamField body="user" type="string">
  ユーザー識別子

  例:`user-1234`
</ParamField>

<ParamField body="metadata" type="object">
  拡張パラメーター（negative\_prompt、style、quality\_level など）
</ParamField>

## Response

<ResponseField name="id" type="string">
  動画ID
</ResponseField>

<ResponseField name="object" type="string">
  オブジェクトタイプ
</ResponseField>

<ResponseField name="model" type="string" default="sora-2">
  使用モデル

  例:`sora-2`
</ResponseField>

<ResponseField name="status" type="string">
  タスク状態
</ResponseField>

<ResponseField name="progress" type="integer">
  進捗率
</ResponseField>

<ResponseField name="created_at" type="integer">
  作成タイムスタンプ
</ResponseField>

<ResponseField name="seconds" type="string">
  動画の長さ
</ResponseField>

<ResponseField name="completed_at" type="integer">
  完了タイムスタンプ
</ResponseField>

<ResponseField name="expires_at" type="integer">
  有効期限タイムスタンプ
</ResponseField>

<ResponseField name="size" type="string">
  動画サイズ
</ResponseField>

<ResponseField name="error" type="object">
  OpenAI動画エラー情報

  <ResponseField name="error.message" type="string">
    エラーメッセージ
  </ResponseField>

  <ResponseField name="error.code" type="string">
    エラーコード
  </ResponseField>
</ResponseField>

<ResponseField name="metadata" type="object">
  追加メタデータ
</ResponseField>
