openapi: 3.0.3
servers:
  - url: https://prod.api.market/api/v1/magicapi/wan-text-to-video
info:
  title: "Wan2.1 Text to Video API [Models: 14b] [Vid:480p/720p] AI"
  description: Produce dynamic short videos from text or imagesperfect for social,
    marketing, and creative projects.
  version: 1.0.2
tags:
  - name: TextToVideo
    description: Operations related to text‑to‑video generation
  - name: artificial-intelligence
    description: Operations related to artificial-intelligence
  - name: image
    description: Operations related to image
  - name: video
    description: Operations related to video
  - name: image-to-video
    description: Operations related to image-to-video
  - name: text-to-video
    description: Operations related to text-to-video
paths:
  /text-to-video/run:
    post:
      tags:
        - TextToVideo
      summary: Submit a text prompt and optional parameters to generate a video
      operationId: runTextToVideo
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RunRequest"
            examples:
              textToVideoRunExample:
                summary: Example request
                value:
                  input:
                    model: 1.3b
                    frames: 81
                    prompt: Elephants flying in sky in a group
                    lora_url: https://huggingface.co/motimalu/wan-flat-color-v2/resolve/main/wan_flat_color_v2.safetensors
                    aspect_ratio: 16:9
                    sample_shift: 8
                    resolution: 480p
                    sample_steps: 30
                    negative_prompt: ""
                    lora_strength_clip: 1
                    sample_guide_scale: 5
                    lora_strength_model: 1
      responses:
        "200":
          description: Successfully queued video generation request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RunResponse"
              examples:
                textToVideoRunResponseExample:
                  summary: Example response
                  value:
                    id: 87af6765-9887-4a87-ab96-7f4d2b4a02fe-u1
                    status: IN_QUEUE
        "400":
          description: Bad Request - invalid input
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    parameters:
      - &a1
        description: API.market API Key
        in: header
        name: x-api-market-key
        value: Please Login/Signup to get an API Key
        required: true
        schema:
          type: string
  /text-to-video/status/{id}:
    get:
      tags:
        - TextToVideo
      summary: Retrieve the status and result of a submitted text‑to‑video generation
        request
      operationId: getTextToVideoStatus
      security:
        - bearerAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: The unique identifier of the generation request
      responses:
        "200":
          description: Successful retrieval of generation status and/or output
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StatusResponse"
              examples:
                textToVideoStatusResponseExample:
                  summary: Example completed response
                  value:
                    delayTime: 1118
                    executionTime: 1398169
                    id: 87af6765-9887-4a87-ab96-7f4d2b4a02fe-u1
                    output:
                      completed_at: 2025-03-18T16:52:30.048710+00:00
                      created_at: null
                      id: null
                      input:
                        prompt: Persian ginger rolling & cooking rotis and parathas in Indian Kitchen.
                          Animated video
                        frames: 81
                        model: 14b
                        aspect_ratio: 16:9
                        resolution: 720p
                        sample_shift: 8
                        sample_steps: 30
                        sample_guide_scale: 5
                        negative_prompt: ""
                        lora_url: https://huggingface.co/motimalu/wan-flat-color-v2/resolve/main/wan_flat_color_v2.safetensors
                        lora_strength_model: 1
                        lora_strength_clip: 1
                        fast_mode: Balanced
                        seed: null
                      metrics:
                        predict_time: 1397.867959
                      output:
                        - https://blog.api.market/wp-content/uploads/2025/04/20250422_212751_4b23fb13.mp4
                      started_at: 2025-03-18T16:29:12.180751+00:00
                      status: succeeded
                      version: null
                    status: COMPLETED
                    workerId: iiqyolie8t7vts
        "400":
          description: Bad Request - invalid input
        "401":
          description: Unauthorized
        "404":
          description: Resource not found
        "500":
          description: Internal server error
    parameters:
      - *a1
components:
  securitySchemes: {}
  schemas:
    RunRequest:
      type: object
      description: Request payload to start a *text‑to‑video* generation job
      properties:
        input:
          type: object
          required:
            - prompt
          properties:
            model:
              type: string
              description: Model version (e.g. 14b)
            frames:
              type: integer
              description: Number of frames to generate
            prompt:
              type: string
              description: Main prompt (**required**)
            lora_url:
              type: string
              format: uri
              description: Optional LoRA checkpoint URL
            aspect_ratio:
              type: string
              description: Aspect ratio (e.g. 16:9)
            sample_shift:
              type: integer
              description: Shift factor for sampling dynamics
            resolution:
              type: string
              description: Video resolution
            sample_steps:
              type: integer
              description: Number of inference steps
            negative_prompt:
              type: string
              description: Negative prompt
            lora_strength_clip:
              type: number
              format: float
              description: LoRA strength on CLIP
            sample_guide_scale:
              type: number
              format: float
              description: Guidance scale
            lora_strength_model:
              type: number
              format: float
              description: LoRA strength on model
      required:
        - input
    RunResponse:
      type: object
      description: Response after successfully queuing a *text‑to‑video* generation request
      properties:
        id:
          type: string
          description: Unique identifier
        status:
          type: string
          description: Queue status
    StatusRequest:
      type: object
      description: Optional request body sent with *text‑to‑video* status request
      properties:
        input:
          type: object
          properties:
            model:
              type: string
            frames:
              type: integer
            prompt:
              type: string
            lora_url:
              type: string
              format: uri
            aspect_ratio:
              type: string
            sample_shift:
              type: integer
            resolution:
              type: string
            sample_steps:
              type: integer
            negative_prompt:
              type: string
            lora_strength_clip:
              type: number
              format: float
            sample_guide_scale:
              type: number
              format: float
            lora_strength_model:
              type: number
              format: float
    StatusResponse:
      type: object
      description: Detailed status response for a *text‑to‑video* request
      properties:
        delayTime:
          type: integer
          description: Queue wait (ms)
        executionTime:
          type: integer
          description: Execution time (ms)
        id:
          type: string
          description: Unique identifier
        output:
          type: object
        status:
          type: string
          description: Overall job status
        workerId:
          type: string
          description: Worker identifier
    ImageToVideoRunRequest:
      type: object
      description: Request payload to start an *image‑to‑video* generation job
      properties:
        input:
          type: object
          required:
            - prompt
            - image_url
          properties:
            model:
              type: string
              description: Model version
            frames:
              type: integer
              description: Number of frames to generate
            prompt:
              type: string
              description: Main prompt (**required**)
            image_url:
              type: string
              format: uri
              description: Source image URL (**required**)
            lora_url:
              type: string
              format: uri
              description: Optional LoRA checkpoint URL
            lora_description:
              type: string
              description: Description of the LoRA effect
            lora_trigger_word:
              type: string
              description: Word that activates the LoRA
            lora_strength_model:
              type: number
              format: float
              description: LoRA strength on model
            lora_strength_clip:
              type: number
              format: float
              description: LoRA strength on CLIP
            aspect_ratio:
              type: string
              description: Aspect ratio (e.g. auto)
            sample_shift:
              type: integer
              description: Shift factor for sampling dynamics
            resolution:
              type: string
              description: Video resolution
            sample_steps:
              type: integer
              description: Number of inference steps
            negative_prompt:
              type: string
              description: Negative prompt
            sample_guide_scale:
              type: number
              format: float
              description: Guidance scale
            auto_improve_prompt:
              type: boolean
              description: Automatically refine the prompt
      required:
        - input
    ImageToVideoRunResponse:
      type: object
      description: Response after successfully queuing an *image‑to‑video* generation
        request
      properties:
        id:
          type: string
          description: Unique identifier
        status:
          type: string
          description: Queue status
    ImageToVideoStatusRequest:
      type: object
      description: Optional request body sent with *image‑to‑video* status request
      properties:
        input:
          type: object
          properties:
            model:
              type: string
            frames:
              type: integer
            prompt:
              type: string
            image_url:
              type: string
              format: uri
            lora_url:
              type: string
              format: uri
            lora_description:
              type: string
            lora_trigger_word:
              type: string
            lora_strength_model:
              type: number
              format: float
            lora_strength_clip:
              type: number
              format: float
            aspect_ratio:
              type: string
            sample_shift:
              type: integer
            resolution:
              type: string
            sample_steps:
              type: integer
            negative_prompt:
              type: string
            sample_guide_scale:
              type: number
              format: float
            auto_improve_prompt:
              type: boolean
    ImageToVideoStatusResponse:
      type: object
      description: Detailed status response for an *image‑to‑video* request
      properties:
        delayTime:
          type: integer
        executionTime:
          type: integer
        id:
          type: string
        status:
          type: string
        workerId:
          type: string
        output:
          type: object
          nullable: true
          properties:
            completed_at:
              type: string
              format: date-time
            created_at:
              type: string
              format: date-time
              nullable: true
            id:
              type: string
              nullable: true
            input:
              type: object
              properties:
                aspect_ratio:
                  type: string
                frames:
                  type: integer
                image_file:
                  type: string
                  nullable: true
                image_url:
                  type: string
                  format: uri
                lora_description:
                  type: string
                lora_trigger_word:
                  type: string
                lora_strength_clip:
                  type: number
                  format: float
                lora_strength_model:
                  type: number
                  format: float
                lora_url:
                  type: string
                  format: uri
                negative_prompt:
                  type: string
                prompt:
                  type: string
                resolution:
                  type: string
                sample_guide_scale:
                  type: number
                  format: float
                sample_steps:
                  type: integer
                seed:
                  type: integer
                  nullable: true
                auto_improve_prompt:
                  type: boolean
            metrics:
              type: object
              properties:
                predict_time:
                  type: number
                  format: float
            output:
              type: array
              items:
                type: string
                format: uri
            started_at:
              type: string
              format: date-time
            status:
              type: string
            version:
              type: string
              nullable: true
security: {}
