openapi: 3.0.3
info:
  title: FishAudio 图片/视频对口型
  version: 1.0.0
  description: >-
    Import this file into a private Coze cloud plugin. It creates and queries
    asynchronous media synchronization jobs. Every user supplies their own Fish
    Audio API key through the Authorization tool parameter.
servers:
  - url: https://fishaudio.org
paths:
  /api/open/v1/media/lip-sync/jobs:
    post:
      operationId: create_media_sync
      summary: Create an asynchronous media synchronization job
      description: >-
        Create one job from directly downloadable video and audio URLs. Save
        data.id and do not create another job while polling.
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMediaSyncRequest'
      responses:
        '200':
          description: Job created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateMediaSyncResponse'
        '400':
          $ref: '#/components/responses/ErrorResponse'
        '401':
          $ref: '#/components/responses/ErrorResponse'
        '402':
          $ref: '#/components/responses/ErrorResponse'
        '403':
          $ref: '#/components/responses/ErrorResponse'
        '422':
          $ref: '#/components/responses/ErrorResponse'
        '500':
          $ref: '#/components/responses/ErrorResponse'
  /api/open/v1/media/lip-sync/jobs/{jobId}:
    get:
      operationId: get_media_sync_job
      summary: Query a media synchronization job
      description: >-
        Query the original job ID. Polling does not create or charge for another job.
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - name: jobId
          in: path
          required: true
          description: The data.id returned by create_media_sync.
          schema:
            type: string
      responses:
        '200':
          description: Job status returned successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMediaSyncResponse'
        '400':
          $ref: '#/components/responses/ErrorResponse'
        '401':
          $ref: '#/components/responses/ErrorResponse'
        '403':
          $ref: '#/components/responses/ErrorResponse'
        '404':
          $ref: '#/components/responses/ErrorResponse'
        '500':
          $ref: '#/components/responses/ErrorResponse'
components:
  parameters:
    Authorization:
      name: Authorization
      in: header
      required: true
      description: Customer Fish Audio API key in the format Bearer YOUR_API_KEY.
      schema:
        type: string
      example: Bearer YOUR_FISH_AUDIO_API_KEY
  schemas:
    CreateMediaSyncRequest:
      type: object
      required:
        - video_url
        - audio_url
      properties:
        video_url:
          type: string
          format: uri
          description: Customer-owned or authorized video URL downloadable by Fish Audio.
        audio_url:
          type: string
          format: uri
          description: Customer-owned or authorized audio URL downloadable by Fish Audio.
        model:
          type: string
          nullable: true
          description: Optional model identifier. Usually omit it to use the current default.
        video_extension:
          type: boolean
          default: false
          description: >-
            Keep false to bill the shorter video/audio input. Set true only when
            the video should be extended to the audio duration.
    CreateMediaSyncResponse:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
        message:
          type: string
        data:
          type: object
          required:
            - id
            - status
            - created_at
            - credits_used
            - billing_duration_seconds
            - video_duration_seconds
            - audio_duration_seconds
            - billing_rule
            - quota_remaining
          properties:
            id:
              type: string
              description: Save this value as jobId for subsequent queries.
            status:
              type: string
              enum:
                - pending
                - processing
                - completed
                - failed
            created_at:
              type: string
            credits_used:
              type: number
            billing_duration_seconds:
              type: integer
              description: Whole billable seconds after rounding up.
            video_duration_seconds:
              type: number
              nullable: true
            audio_duration_seconds:
              type: number
            billing_rule:
              type: string
              enum:
                - shorter_input_rounded_up
                - audio_rounded_up
            quota_remaining:
              type: number
    GetMediaSyncResponse:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
        message:
          type: string
        data:
          type: object
          required:
            - id
            - status
            - progress
          properties:
            id:
              type: string
            status:
              type: string
              enum:
                - pending
                - processing
                - completed
                - failed
            progress:
              type: number
              minimum: 0
              maximum: 100
            result_url:
              type: string
              format: uri
              nullable: true
            error_message:
              type: string
              nullable: true
            credits_used:
              type: number
            created_at:
              type: string
            updated_at:
              type: string
            completed_at:
              type: string
              nullable: true
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
        message:
          type: string
        requestId:
          type: string
      additionalProperties: true
  responses:
    ErrorResponse:
      description: Fish Audio API error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
