メインコンテンツへスキップ
POST
/
v1
/
videos
/
generations
curl --request POST \
  --url https://api.apimart.ai/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "Omni-Flash-Ext",
    "prompt": "a girl is dancing happily in a sunny garden",
    "duration": 10,
    "resolution": "1080p",
    "aspect_ratio": "9:16"
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA"
    }
  ]
}

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.

curl --request POST \
  --url https://api.apimart.ai/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "Omni-Flash-Ext",
    "prompt": "a girl is dancing happily in a sunny garden",
    "duration": 10,
    "resolution": "1080p",
    "aspect_ratio": "9:16"
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA"
    }
  ]
}

認証

Authorization
string
必須
すべてのリクエストで Bearer Token 認証が必要です。API Key の取得:API Key 管理ページ にアクセスして API Key を取得してください。リクエスト時に次のヘッダーを追加します:
Authorization: Bearer YOUR_API_KEY

リクエストパラメータ

model
string
必須
動画生成モデル名。固定値は Omni-Flash-Ext です。
prompt
string
必須
動画内容の説明。シーン、人物、動作、環境、カメラワーク、映像スタイル、音声のヒントを詳しく記述することをおすすめします。例:"a girl is dancing happily in a sunny garden"
duration
integer
デフォルト:"6"
動画時間。単位は秒です。対応値:46810
57 などの値を指定すると invalid_duration エラーが返されます。
resolution
string
デフォルト:"720p"
動画解像度。大文字と小文字は区別されません。対応値:
  • 720p
  • 1080p
  • 4k
その他の解像度を指定すると invalid_resolution エラーが返されます。
aspect_ratio
string
デフォルト:"16:9"
動画のアスペクト比。横向きまたは縦向きの出力を制御します。よく使う値:
  • 16:9 - 横向き
  • 9:16 - 縦向き
デフォルト:16:9
size
string
互換フィールドです。aspect_ratio と同じ意味です。両方を指定する場合は同じ値にしてください。
image_urls
array<url>
参照画像 URL 配列。省略、1 枚、または 3 枚を指定できます:
  • 省略または空配列:テキストから動画
  • 1 枚:単一画像から動画
  • 3 枚:参照画像融合
公開アクセス可能な画像 URL に対応しています。data:image/...;base64,... 形式の Base64 画像にも対応しています。
2 枚画像による始点フレーム + 終点フレームのモードはサポートしていません。2 枚を渡すと unsupported_image_count エラーが返されます。4 枚以上は十分に検証されていないため推奨しません。

レスポンス

code
integer
レスポンスステータスコード。成功時は 200 です。
data
array
タスク配列を返します。

タスク結果の照会

動画生成は非同期タスクです。送信後に task_id が返されます。タスクステータス取得 API を使用して進捗と結果を照会します。
cURL
curl --request GET \
  --url https://api.apimart.ai/v1/tasks/task_01KS1H7ZYSJWH1N779S2FSHTKA \
  --header 'Authorization: Bearer <token>'
送信後 5-10 秒待ってから最初の照会を行い、その後は 5-10 秒ごとにポーリングすることをおすすめします。1 つのタスクは通常約 3-5 分で完了します。

成功結果の例

{
  "code": 200,
  "data": {
    "id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
    "status": "completed",
    "progress": 100,
    "created": 1779246294,
    "completed": 1779246534,
    "actual_time": 240,
    "estimated_time": 600,
    "cost": 0.4,
    "result": {
      "videos": [
        {
          "url": ["https://cdn.example.com/videos/abc.mp4"],
          "expires_at": 1779332760
        }
      ]
    }
  }
}

失敗結果の例

{
  "code": 200,
  "data": {
    "id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
    "status": "failed",
    "progress": 100,
    "created": 1779246294,
    "completed": 1779246534,
    "actual_time": 240,
    "estimated_time": 600,
    "cost": 0,
    "error": {
      "message": "invalid duration 7, must be one of 4/6/8/10",
      "code": "task_failed"
    }
  }
}

ユースケース

シナリオ 1:テキストから動画

{
  "model": "Omni-Flash-Ext",
  "prompt": "a beautiful sunset over the ocean with seagulls flying",
  "duration": 6,
  "resolution": "720p",
  "aspect_ratio": "16:9"
}

シナリオ 2:単一画像から動画

{
  "model": "Omni-Flash-Ext",
  "prompt": "make the character smile and slowly turn around, cinematic camera motion",
  "duration": 6,
  "resolution": "1080p",
  "aspect_ratio": "9:16",
  "image_urls": ["https://example.com/character.jpg"]
}

シナリオ 3:3 枚の参照画像融合

{
  "model": "Omni-Flash-Ext",
  "prompt": "a creative scene combining these elements with smooth camera motion",
  "duration": 10,
  "resolution": "1080p",
  "aspect_ratio": "9:16",
  "image_urls": [
    "https://example.com/scene.jpg",
    "https://example.com/character.jpg",
    "https://example.com/product.jpg"
  ]
}

シナリオ 4:4K ショート動画

{
  "model": "Omni-Flash-Ext",
  "prompt": "close-up of a hummingbird hovering in front of a red flower",
  "duration": 4,
  "resolution": "4k",
  "aspect_ratio": "16:9"
}

エラーコード

HTTPエラータイプ意味対処方法
400invalid_request_errormodelOmni-Flash-Ext ではない、prompt が空、または JSON 形式が不正ですリクエストボディを確認してください
400invalid_durationduration46810 のいずれでもありません対応している動画時間に変更してください
400invalid_resolutionresolution720p1080p4k のいずれでもありません対応している解像度に変更してください
400unsupported_image_countimage_urls の枚数が未対応です。2 枚を渡した場合によく発生します0、1、または 3 枚の画像にしてください
401authentication_errorToken が無効ですBearer Token を確認してください
402payment_required残高不足ですチャージしてから再試行してください
429rate_limit_errorレート制限に達しました同時実行数を下げるか、後で再試行してください
タスクが失敗した場合、タスクステータス API は data.error に失敗理由を返します。よくある原因には、上流の一時的なクォータ不足、コンテンツ審査不通過、上流タイムアウトがあります。