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

# Grok Imagine 1.5 動画生成

>  - 非同期処理モード、タスクIDを返して後続のクエリに使用
- 高品質AI動画生成、テキストから動画・画像から動画に対応
- 柔軟なアスペクト比と画質オプション 

<Info>
  **モデル名互換のお知らせ**：本エンドポイントはエイリアス `grok-imagine-1.5-video-ext` にも対応しており、`grok-imagine-1.5-video-apimart` と同等です。両者は互換的に使用でき、効果は同一です。
</Info>

<RequestExample>
  ```bash cURL theme={null}
  # model には "grok-imagine-1.5-video-apimart" を指定でき、エイリアス "grok-imagine-1.5-video-ext" にも対応しています
  curl --request POST \
    --url https://api.apimart.ai/v1/videos/generations \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "grok-imagine-1.5-video-apimart",
      "prompt": "ビーチを走る犬、晴天、スローモーション",
      "size": "16:9",
      "duration": 6,
      "resolution": "720p"
    }'
  ```

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

  url = "https://api.apimart.ai/v1/videos/generations"

  payload = {
      "model": "grok-imagine-1.5-video-apimart",
      "prompt": "ビーチを走る犬、晴天、スローモーション",
      "size": "16:9",
      "duration": 6,
      "resolution": "720p"
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://api.apimart.ai/v1/videos/generations";

  const payload = {
    model: "grok-imagine-1.5-video-apimart",
    prompt: "ビーチを走る犬、晴天、スローモーション",
    size: "16:9",
    duration: 6,
    resolution: "720p"
  };

  const headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": [
      {
        "task_id": "task_01JNXXXXXXXXXXXXXXXXXX",
        "status": "submitted"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "リクエストパラメータが無効です",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "認証に失敗しました。APIキーを確認してください",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "残高が不足しています。チャージしてから再度お試しください",
      "type": "payment_required"
    }
  }
  ```

  ```json 403 theme={null}
  {
    "error": {
      "code": 403,
      "message": "アクセスが禁止されています。このリソースへのアクセス権限がありません",
      "type": "permission_error"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "リクエストが多すぎます。しばらくしてから再度お試しください",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "サーバー内部エラー、しばらくしてから再度お試しください",
      "type": "server_error"
    }
  }
  ```

  ```json 502 theme={null}
  {
    "error": {
      "code": 502,
      "message": "ゲートウェイエラー、サーバーが一時的に利用できません",
      "type": "bad_gateway"
    }
  }
  ```
</ResponseExample>

## 認証

<ParamField header="Authorization" type="string" required>
  すべてのAPIはBearer Token認証が必要です

  APIキーの取得：

  [APIキー管理ページ](https://apimart.ai/keys)にアクセスしてAPIキーを取得してください

  リクエストヘッダーに追加：

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

## リクエストパラメータ

<ParamField body="model" type="string" default="grok-imagine-1.5-video-apimart" required>
  動画生成モデル名

  対応モデル：

  * `grok-imagine-1.5-video-apimart` - Grok 動画生成（エイリアス `grok-imagine-1.5-video-ext` に対応）

  例：`"grok-imagine-1.5-video-apimart"`

  <Note>
    旧バージョンの呼び出しとの互換性のため、エイリアス `grok-imagine-1.5-video-ext`（`grok-imagine-1.5-video-apimart` に対応）は引き続き正常に使用できます。
  </Note>
</ParamField>

<ParamField body="prompt" type="string" required>
  動画内容の説明、多言語対応
</ParamField>

<ParamField body="size" type="string" default="16:9">
  動画サイズ

  オプション：

  * `16:9` - 横長（デフォルト）
  * `9:16` - 縦長
  * `1:1` - 正方形
  * `3:2` - 横長
  * `2:3` - 縦長
</ParamField>

<ParamField body="duration" type="integer" default={6}>
  動画の長さ（秒）

  範囲：6〜15（最短6秒、最長15秒）

  **⚠️ 注意：** 純粋な数値を入力してください（例：`6`）。引用符を付けるとエラーが発生します
</ParamField>

<ParamField body="resolution" type="string" default="480p">
  動画品質

  オプション：

  * `480p` - 標準画質（デフォルト）
  * `720p` - 高画質
</ParamField>

<ParamField body="image_urls" type="string[]">
  参照画像のURLリスト

  **制限：**

  * 最大 7 枚の画像
  * 公開アクセス可能なURLである必要があります
  * base64 形式はサポートされていません

  <Tip>参照画像をアップロードすると、アスペクト比は自動的に参照画像のアスペクト比に合わせられます。</Tip>
</ParamField>

## Response

<ResponseField name="code" type="integer">
  レスポンスステータスコード
</ResponseField>

<ResponseField name="data" type="object[]">
  レスポンスデータ配列

  <Expandable title="プロパティ">
    <ResponseField name="task_id" type="string">
      タスク一意識別子
    </ResponseField>

    <ResponseField name="status" type="string">
      タスクステータス

      * `submitted` - 送信済み
    </ResponseField>
  </Expandable>
</ResponseField>

<Note>
  **タスク結果の確認**

  動画生成は非同期タスクです。送信後、`task_id` が返されます。[タスクステータス取得](/ja/api-reference/tasks/status)エンドポイントを使用して、生成の進捗と結果を確認してください。
</Note>

## 使用シーン

### シーン 1：テキストから動画生成

```json theme={null}
{
  "model": "grok-imagine-1.5-video-apimart",
  "prompt": "ビーチを走る犬、晴天、スローモーション",
  "size": "16:9",
  "duration": 6
}
```

### シーン 2：画像から動画生成

```json theme={null}
{
  "model": "grok-imagine-1.5-video-apimart",
  "prompt": "シーンに自然なダイナミック効果を追加する",
  "image_urls": ["https://example.com/start.png"],
  "size": "16:9",
  "duration": 10,
  "resolution": "720p"
}
```
