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

# 動画を作成

> 非同期動画生成ジョブを作成します。ジョブが終端状態になるまで、返された`polling_url`を20秒ごとにポーリングしてください。

ワークスペースのプレビュー機能へのアクセスが必要です。設定、Webhook、結果の処理については、[動画とバッチのジョブ](../../guides/async-video-and-batch.mdx)を参照してください。


## OpenAPI

````yaml ja/openapi/v1/openapi.localized.yaml POST /videos
openapi: 3.0.3
info:
  title: Phaseo Gateway API
  description: OpenAI互換のエンドポイントを通じて、さまざまなAIモデルにアクセスするためのゲートウェイAPI。
  version: 1.0.0
  contact:
    name: Phaseo
    url: https://phaseo.app
    email: danielbutler500@gmail.com
servers:
  - url: https://api.phaseo.app/v1
    description: グローバルルーティング
security:
  - BearerAuth: []
tags:
  - name: Gateway
    description: Core Phaseo Gateway operations.
paths:
  /videos:
    post:
      tags:
        - Gateway
      summary: 動画を作成
      description: 非同期動画生成ジョブを作成します。ジョブが終端状態になるまで、返された`polling_url`を20秒ごとにポーリングしてください。
      operationId: createVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoGenerationRequest'
      responses:
        '202':
          description: 動画のレスポンス
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoGenerationResponse'
components:
  schemas:
    VideoGenerationRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
        prompt:
          type: string
        duration:
          type: integer
          description: 希望する長さ（秒）。プロバイダー／モデルにより異なります。
        input_video_duration:
          type: number
          format: double
          minimum: 0
          maximum: 3600
          exclusiveMinimum: true
          description: 入力元動画の長さ（秒）。プロバイダーが生成出力とは別に入力元動画の長さを課金する場合に必須です。
        input_audio_duration:
          type: number
          format: double
          minimum: 2
          maximum: 20
          description: >-
            プロバイダーの許容範囲検証に使う、申告された入力元音声の長さ（秒）。確定した使用量を報告しないプロバイダーは、対応する入力長の上限で課金する場合があります。
        size:
          type: string
          description: 明示的な寸法（例：1280x720）。resolutionやaspect_ratioとは併用できません。
        resolution:
          type: string
          description: 480p、720p、1080p、1K、2K、4K。aspect_ratioと併用できます。sizeとは併用できません。
        aspect_ratio:
          type: string
          description: 16:9、9:16、1:1などのアスペクト比。resolutionと併用できます。sizeとは併用できません。
        seed:
          type: integer
        sample_count:
          type: integer
          minimum: 1
          maximum: 4
        negative_prompt:
          type: string
        generate_audio:
          type: boolean
        enhance_prompt:
          type: boolean
        compression_quality:
          type: integer
        person_generation:
          type: string
        resize_mode:
          type: string
        input_references:
          type: array
          description: >-
            生成の条件となるHTTPSの画像、音声、動画入力。対応する種類、役割、数、組み合わせは選択モデルに依存します。ジョブ送信前にGET
            /videos/modelsを確認してください。このスキーマに含まれない単数形の互換エイリアスinput_referenceは、multipart画像、またはfile_idとimage_urlのいずれか1つだけを含むオブジェクトを受け付けます。対応はプロバイダーに依存します。
          items:
            $ref: '#/components/schemas/VideoInputReference'
        frame_images:
          type: array
          minItems: 1
          maxItems: 2
          description: >-
            最初／最後のフレームのHTTPS画像。各frame_typeは1回だけ指定できます。input_referenceやinput_referencesのフレーム役割を追加で指定しないでください。
          items:
            type: object
            additionalProperties: false
            required:
              - type
              - frame_type
              - image_url
            properties:
              type:
                type: string
                enum:
                  - image_url
              frame_type:
                type: string
                enum:
                  - first_frame
                  - last_frame
              image_url:
                type: object
                required:
                  - url
                properties:
                  url:
                    type: string
                    format: uri
        provider_params:
          type: object
          additionalProperties: true
          description: プロバイダー固有の拡張のみ。リクエスト全体のパススルーと、重複するルーティング、プロンプト、コールバック、課金フィールドは拒否されます。
        provider_options:
          type: object
          additionalProperties:
            type: object
            additionalProperties: true
          description: >-
            正規プロバイダーID（例：atlascloud、byteplus）で指定する拡張。選択したプロバイダーのオプションのみ転送されます。provider_paramsとは併用できません。ルーティング、プロンプト、コールバック、長さ、解像度、出力数には検証済みの最上位フィールドを使用してください。
        output:
          $ref: '#/components/schemas/VideoOutputConfig'
        webhook:
          type: object
          required:
            - endpoint_id
          additionalProperties: false
          properties:
            endpoint_id:
              type: string
              description: >-
                ワークスペース管理の有効なWebhookエンドポイント。暗号化され、ローテーション可能な署名シークレットは動画ジョブのメタデータに保存されません。
            events:
              type: array
              description: >-
                任意のイベント購読。汎用job.*イベント、または対応するvideo.*イベント（例：video.status_changed、video.progress、video.completed）を使用します。省略時はjob.status_changedと終端のjob.*イベントが使用されます。進捗コールバックにはjob.progressまたはvideo.progressを明示してください。指定する場合、少なくとも1つは動画ジョブに有効なイベントである必要があります。他種のイベントのみのリストや不正なリストは拒否されます。
              items:
                type: string
        provider:
          $ref: '#/components/schemas/ProviderRoutingOptions'
    VideoGenerationResponse:
      type: object
      properties:
        id:
          type: string
        polling_url:
          type: string
        websocket_url:
          type: string
          format: uri
          description: 非同期ジョブの正規化されたライフサイクル更新を購読するWebSocket URL。
        model:
          type: string
        request_id:
          type: string
        session_id:
          type: string
        status:
          type: string
          enum:
            - queued
            - processing
            - completed
            - failed
            - cancelled
            - expired
        lifecycle_status:
          type: string
          enum:
            - pending
            - running
            - completed
            - failed
            - cancelled
            - expired
          description: ポーリング、WebSocket、Webhookの利用側向けに正規化された非同期ライフサイクル状態。
        cancel_url:
          type: string
          format: uri
          nullable: true
          description: 互換性のために予約されています。現在は常にnullです。
        output_access:
          type: string
          enum:
            - bytes
            - signed_url
            - both
        generation_id:
          type: string
          nullable: true
        native_video_id:
          type: string
          nullable: true
          description: ゲートウェイが所有するIDと異なる場合の、プロバイダー固有の動画／ジョブID。
        created_at:
          oneOf:
            - type: integer
            - type: string
        started_at:
          nullable: true
          oneOf:
            - type: integer
            - type: string
        completed_at:
          nullable: true
          oneOf:
            - type: integer
            - type: string
        object:
          type: string
          example: video
        poll_after_seconds:
          type: integer
          example: 20
        provider:
          type: string
        seconds:
          type: number
        size:
          type: string
        audio:
          type: boolean
        content_url:
          type: string
          description: output_accessにbytesが含まれる場合に存在します（認証が必要なエンドポイント）。
        download_url:
          type: string
          nullable: true
          description: 状態がcompletedの場合の、直接ダウンロード用のファーストパーティ署名付きURL。
        expires_at:
          type: integer
          nullable: true
          description: 署名付きdownload_urlが失効するUnixタイムスタンプ（秒）。
        progress:
          type: integer
          nullable: true
        progress_source:
          type: string
        asset:
          type: object
          nullable: true
          properties:
            id:
              type: string
            mime_type:
              type: string
            bytes:
              type: integer
            sha256:
              type: string
            width:
              type: integer
            height:
              type: integer
            duration_seconds:
              type: number
        outputs:
          type: array
          items:
            $ref: '#/components/schemas/VideoOutput'
        billing:
          $ref: '#/components/schemas/VideoBillingSummary'
        webhook:
          $ref: '#/components/schemas/AsyncWebhookPublicState'
        next_webhook_retry_at:
          type: string
          nullable: true
          description: ユーザーWebhookの次回再試行のISOタイムスタンプ（キューに登録されている場合）。
        last_webhook_progress:
          type: number
          nullable: true
          description: Webhookの利用側に最後に送信した大まかな進捗区分。
        last_webhook_progress_at:
          type: string
          nullable: true
          description: 直近のWebhook進捗区分が送信されたISOタイムスタンプ。
        last_webhook_dispatched_at:
          type: string
          nullable: true
          description: 直近のWebhook送信試行のISOタイムスタンプ。
        usage:
          type: object
          properties:
            cost:
              type: number
            is_byok:
              type: boolean
          additionalProperties: true
        error:
          nullable: true
    VideoInputReference:
      description: >-
        型を指定したHTTPSメディア入力。画像にはimage_url、音声や動画にはmedia_urlを使用します。役割はモデルによる入力の使用方法を表し、対応はプロバイダーとモデルで異なります。
      oneOf:
        - type: object
          required:
            - type
            - image_url
          properties:
            type:
              type: string
              enum:
                - image_url
            role:
              type: string
              description: 選択モデルによるこの画像の想定用途。
              enum:
                - first_frame
                - last_frame
                - reference
                - source
                - mask
            reference_type:
              type: string
            image_url:
              type: object
              required:
                - url
              properties:
                url:
                  type: string
                  format: uri
                  description: 公開アクセス可能なHTTPS画像URL。
        - type: object
          required:
            - type
            - media_url
          properties:
            type:
              type: string
              enum:
                - video_url
                - audio_url
            role:
              type: string
              description: 選択モデルによるこの音声または動画の想定用途。
              enum:
                - first_frame
                - last_frame
                - reference
                - source
                - mask
            reference_type:
              type: string
            media_url:
              type: object
              required:
                - url
              properties:
                url:
                  type: string
                  format: uri
                  description: 公開アクセス可能なHTTPS音声または動画URL。
    VideoOutputConfig:
      type: object
      properties:
        access:
          type: string
          enum:
            - bytes
            - signed_url
            - both
          default: both
          description: bytes=認証付きcontent_urlのみ、signed_url=署名付きダウンロードリンクのみ、both=両方を含めます。
    ProviderRoutingOptions:
      type: object
      description: ゲートウェイでの選択に使用するプロバイダーのルーティング設定。
      properties:
        order:
          type: array
          items:
            type: string
        only:
          type: array
          items:
            type: string
        ignore:
          type: array
          items:
            type: string
        include_alpha:
          type: boolean
          description: ルーティングに alpha プロバイダーを含める（既定ではオフ）。
        allow_fallbacks:
          type: boolean
          nullable: true
          description: 失敗後に別の対象プロバイダーへフォールバックすることを許可します。
        require_parameters:
          type: boolean
          nullable: true
          description: ルーティング前に、要求されたパラメーターにプロバイダーが対応していることを必須にします。
        required_execution_region:
          type: string
          nullable: true
          description: 指定された実行リージョンに対応するプロバイダーにルーティングを限定します。
        required_data_region:
          type: string
          nullable: true
          description: 指定されたデータリージョンに対応するプロバイダーにルーティングを限定します。
        require_zero_data_retention:
          type: boolean
          nullable: true
          description: ゼロデータ保持に対応するプロバイダーにルーティングを限定します。
        data_collection:
          type: string
          nullable: true
          enum:
            - allow
            - deny
        zdr:
          type: boolean
          nullable: true
        enforce_distillable_text:
          type: boolean
          nullable: true
        quantizations:
          type: array
          nullable: true
          items:
            type: string
        sort:
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
          description: このリクエストのプロバイダーを、価格、レイテンシ、スループットなどで並べ替えます。
        max_price:
          type: object
          properties:
            prompt:
              oneOf:
                - type: number
                - type: string
            completion:
              oneOf:
                - type: number
                - type: string
            image:
              oneOf:
                - type: number
                - type: string
            audio:
              oneOf:
                - type: number
                - type: string
            request:
              oneOf:
                - type: number
                - type: string
        preferred_min_throughput:
          oneOf:
            - type: number
            - type: object
              additionalProperties:
                type: number
        preferred_max_latency:
          oneOf:
            - type: number
            - type: object
              additionalProperties:
                type: number
    VideoOutput:
      type: object
      properties:
        index:
          type: integer
        mime_type:
          type: string
        bytes_available:
          type: boolean
        content_url:
          type: string
          description: output_accessにbytesが含まれる場合に存在します。
        download_url:
          type: string
          description: この出力用のファーストパーティ署名付きURL。
        expires_at:
          type: integer
          description: この出力URLが失効するUnixタイムスタンプ（秒）。
    VideoBillingSummary:
      type: object
      properties:
        currency:
          type: string
        estimated_provider_cost:
          type: string
          nullable: true
        estimated_user_cost:
          type: string
          nullable: true
        settled_provider_cost:
          type: string
          nullable: true
        settled_user_cost:
          type: string
          nullable: true
        state:
          type: string
          enum:
            - pending
            - estimated
            - settled
            - void
        billable:
          type: boolean
        total_nanos:
          type: integer
          nullable: true
        estimated_nanos:
          type: integer
          nullable: true
        reserved_nanos:
          type: integer
          nullable: true
        reservation_id:
          type: string
          nullable: true
        reservation_status:
          type: string
          nullable: true
        charge_reason:
          type: string
          nullable: true
        charged:
          type: boolean
          nullable: true
        billed_at:
          type: string
      additionalProperties: true
    AsyncWebhookPublicState:
      type: object
      description: >-
        機密情報を除去した非同期Webhook設定と配信状態。シークレットは返されません。`has_secret`は署名付き配信が有効かを示します。署名付き配信にはx-phaseo-signature、x-phaseo-timestamp、x-phaseo-event-id、x-phaseo-event-type、x-phaseo-delivery-key、x-phaseo-attempt、x-phaseo-max-attemptsヘッダーが含まれます。
      properties:
        url:
          type: string
          format: uri
          nullable: true
        events:
          type: array
          items:
            type: string
        has_secret:
          type: boolean
        delivery:
          $ref: '#/components/schemas/AsyncWebhookDeliverySummary'
        attempts:
          type: array
          items:
            $ref: '#/components/schemas/AsyncWebhookDeliveryAttempt'
    AsyncWebhookDeliverySummary:
      type: object
      description: ゲートウェイ管理の非同期Webhookの公開配信サマリー。ジョブの実行状態とWebhook配信の正常性を区別するために使用します。
      properties:
        total_attempts:
          type: integer
          description: このジョブで記録された配信試行の総数。
        delivered_events:
          type: integer
          description: 配信済み状態に達した配信キーの数。
        delivered_event_types:
          type: array
          description: 少なくとも1回配信された配信キー。
          items:
            type: string
          example:
            - video.completed
        pending_retries:
          type: integer
          description: 現在再試行が予定されている配信キーの数。
        next_retry_at:
          type: string
          nullable: true
          description: 次の予定された再試行のISOタイムスタンプ（存在する場合）。
        last_attempt_at:
          type: string
          nullable: true
          description: 直近の配信試行のISOタイムスタンプ。
        last_attempt_status:
          type: string
          nullable: true
          enum:
            - delivered
            - scheduled_retry
            - failed_permanently
          description: 直近の配信試行の結果。
        last_response_status:
          type: integer
          nullable: true
          description: Webhookの送信先が返したHTTPステータス（取得できる場合）。
        last_delivered_at:
          type: string
          nullable: true
          description: 直近の成功した配信のISOタイムスタンプ。
        last_failure_at:
          type: string
          nullable: true
          description: 直近の失敗した、または再試行中の試行のISOタイムスタンプ。
        last_error_message:
          type: string
          nullable: true
          description: 直近の配信エラーメッセージ（取得できる場合）。
    AsyncWebhookDeliveryAttempt:
      type: object
      description: ゲートウェイ管理の非同期Webhookの最近の配信試行。
      properties:
        id:
          type: string
          description: 監査とデバッグ用の安定した試行識別子。
        delivery_key:
          type: string
          description: このイベント配信用の冪等性キー。
          example: video.completed
        event_type:
          type: string
          description: Webhookの送信先に配信されたイベントの種類。
          example: video.completed
        status:
          type: string
          enum:
            - delivered
            - scheduled_retry
            - failed_permanently
        attempt_number:
          type: integer
          description: この配信キーの1から始まる試行番号。
        max_attempts:
          type: integer
          description: 配信を恒久的な失敗としてマークするまでの最大試行回数。
        tried_at:
          type: string
          description: この試行を行ったISOタイムスタンプ。
        delivered_at:
          type: string
          nullable: true
          description: この試行が正常に配信されたISOタイムスタンプ。
        next_retry_at:
          type: string
          nullable: true
          description: この試行後の次回再試行のISOタイムスタンプ（予定されている場合）。
        response_status:
          type: integer
          nullable: true
          description: Webhookの送信先が返したHTTPステータス（取得できる場合）。
        error_message:
          type: string
          nullable: true
          description: 配信エラーメッセージ（取得できる場合）。
        response_body_preview:
          type: string
          nullable: true
          description: Webhookの送信先からのレスポンス本文の、機密情報を伏せたプレビュー。
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Bearer トークンによる認証

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.