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

# Generate a Video

> Initiates an AI-assisted video generation (up to 10 minutes) using either a text prompt (for script + visuals) or a user-provided script (to skip script generation). Returns a Run ID used to query the status or results of the generation process.

## Base URL

```bash theme={null}
https://longstories.ai/api/v1
```

## Check Styles, Music, Captions...

You can check the styles, music, captions, effects, and other parameters you have available for your video generation at [longstories.ai/resources](https://longstories.ai/resources).

**Note:** Despite the endpoint being named `/short`, this API supports generating videos up to 10 minutes in length.


## OpenAPI

````yaml POST /short
openapi: 3.0.3
info:
  title: Video Generation API
  version: 1.0.0
  description: >-
    Generate AI-powered videos (up to 10 minutes) from text prompts or existing
    scripts.
servers:
  - url: https://longstories.ai/api/v1
    description: Production API Server
security: []
paths:
  /short:
    post:
      summary: Create a Video
      description: >-
        Initiates an AI-assisted video generation (up to 10 minutes) using
        either a text prompt (for script + visuals) or a user-provided script
        (to skip script generation). Returns a Run ID used to query the status
        or results of the generation process.
      operationId: createShortVideo
      requestBody:
        description: >-
          Parameters used to initiate video creation. Provide at least one of
          `prompt` or `script`.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ShortGenerationRequest'
            example:
              prompt: >-
                Tell a heartwarming story about a small bakery that becomes the
                heart of its community
              shortRequestEnhancer: false
              directorNotes: >-
                Warm, cozy lighting with focus on people interacting in the
                bakery
              scriptConfig:
                style: default
                targetLengthInWords: 70
              imageConfig:
                model: flux_schnell
              voiceoverConfig:
                enabled: true
                voiceId: zWDA589rUKXuLnPRDtAG
              captionsConfig:
                captionsEnabled: true
                captionsStyle: tiktok
              effectsConfig:
                transition: fade
                floating: true
              musicConfig:
                musicSlug: gentle_ambient_loop
                enabled: true
                volume: 0.3
                loop: true
              videoConfig:
                enabled: false
                model: luma_ray2
              templateConfig:
                templateId: none
              quality: medium
              aspectRatio: '9:16'
      responses:
        '200':
          description: >-
            Creation request accepted. Returns a generation Run ID used to fetch
            status or results later.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessResponse'
                  - properties:
                      data:
                        $ref: '#/components/schemas/GenerationRunId'
              example:
                data:
                  id: run_abc123
                  projectId: proj_123abc
                requestId: req_123abc
        '400':
          description: >-
            Invalid input or missing required fields. This could happen if
            neither `prompt` nor `script` was provided, or if a field type is
            invalid (e.g., `quality: "ultra"`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                MissingPrompt:
                  summary: Missing prompt or script
                  value:
                    error:
                      code: VAL_MISSING_FIELD
                      message: Either prompt or script is required
                      details: {}
                InvalidValue:
                  summary: Unrecognized quality parameter
                  value:
                    error:
                      code: VAL_INVALID_FORMAT
                      message: Invalid format provided
                      details:
                        field: quality
                        reason: 'Must be one of: high, medium, low'
        '401':
          description: 'Unauthorized: invalid or missing API key in `x-api-key` header.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: AUTH_INVALID_KEY
                  message: Invalid API key provided
                  requestId: req_789ghi
        '402':
          description: Insufficient credits to generate the video.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: BIZ_INSUFFICIENT_CREDITS
                  message: Insufficient credits to perform this operation
                  requestId: req_012jkl
                  details:
                    required: null
                    available: 25
        '429':
          description: Rate limit exceeded (too many requests).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: RATE_TOO_MANY_REQUESTS
                  message: Too many requests, please try again later
                  requestId: req_345mno
                  details:
                    retryAfter: 60
        '500':
          description: >-
            Internal server error or unexpected error encountered during
            generation. Could be a rendering issue, hardware problem, or an
            uncaught exception.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: BIZ_GENERATION_FAILED
                  message: Error during video generation
                  requestId: req_456def
                  details:
                    reason: Resource allocation failed
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ShortGenerationRequest:
      type: object
      oneOf:
        - required:
            - prompt
        - required:
            - script
      properties:
        prompt:
          type: string
          description: >-
            A textual description of what you want your video to depict or
            explain. Used to generate the script, scenes, and voiceover.
            MUTUALLY EXCLUSIVE with 'script' field - only provide one of
            'prompt' or 'script'.
        script:
          type: string
          description: >-
            A fully-written script to skip AI script generation. MUTUALLY
            EXCLUSIVE with 'prompt' field - only provide one of 'prompt' or
            'script'.
        scriptConfig:
          $ref: '#/components/schemas/ScriptConfig'
        directorNotes:
          type: string
          description: >-
            Prompt for the image generation engine. Example: 'Warm lighting' or
            'Make the first image very impactful'
        shortRequestEnhancer:
          type: boolean
          description: >-
            Experimental: if true, we choose a better framework for you and add
            Director Notes if necessary. It doesn't overwrite your settings.
          default: false
        imageConfig:
          $ref: '#/components/schemas/ImageConfig'
        voiceoverConfig:
          $ref: '#/components/schemas/VoiceoverConfig'
        captionsConfig:
          $ref: '#/components/schemas/CaptionsConfig'
        effectsConfig:
          $ref: '#/components/schemas/EffectsConfig'
        musicConfig:
          $ref: '#/components/schemas/MusicConfig'
        videoConfig:
          $ref: '#/components/schemas/VideoConfig'
        templateConfig:
          type: object
          properties:
            templateId:
              type: string
              enum:
                - none
                - longstories
              default: none
              description: >-
                Internal use only - Template identifier for video outro and
                other pre-sets.
          description: Internal use only - Template configuration for LongStories branding.
        quality:
          type: string
          enum:
            - high
            - medium
            - low
          default: medium
          description: >-
            Video resolution & encoding quality. Higher quality takes longer to
            render and results in a larger file size. Note: Different quality
            levels will have different costs in the future, but currently only
            affect file size and visual quality.
        aspectRatio:
          type: string
          enum:
            - '9:16'
            - '16:9'
          description: Video aspect ratio - vertical (9:16) or horizontal (16:9)
          default: '9:16'
    SuccessResponse:
      type: object
      description: Generic success envelope containing data and a request identifier.
      properties:
        data:
          type: object
          description: The primary payload returned by the endpoint (if applicable).
        requestId:
          type: string
          description: >-
            Unique identifier associated with the request for
            debugging/tracking.
      required:
        - data
    GenerationRunId:
      type: object
      description: >-
        Return value for a newly created short generation run. Use these values
        to check progress.
      properties:
        id:
          type: string
          description: >-
            Unique run identifier. Append as `?runId={id}` to `GET /short` to
            fetch status.
        projectId:
          type: string
          description: Unique identifier for the project associated with this generation.
    ErrorResponse:
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: >-
                Short code describing the error type (e.g., VAL_INVALID_FORMAT,
                AUTH_INVALID_KEY).
            message:
              type: string
              description: Human-readable explanation of the error.
            details:
              type: object
              description: >-
                Additional diagnostic info, such as which field is invalid or
                how many credits are needed.
            requestId:
              type: string
              description: >-
                Unique identifier for debugging. Provided in logs for
                cross-reference.
          required:
            - code
            - message
      required:
        - error
    ScriptConfig:
      type: object
      description: >-
        Choose in which Style the script is written, and how long it should be.
        Only works if `script` is not provided. See [this
        page](https://longstories.ai/resources/script-styles) for more
        information.
      properties:
        style:
          type: string
          enum:
            - default
            - no_style
            - engaging_conversational
            - dixit_biography
            - kind_biography
            - hero_journey
            - emotional_story
            - dramatic_reveal
            - heartwarming_stories
            - educational_history
            - news_brief
          default: default
          description: >-
            Sets the tone & voice of the generated script. Examples:
            'storytelling' for narrative or 'educational' for
            facts/instructional tone.
        targetLengthInWords:
          type: integer
          default: 70
          minimum: 1
          maximum: 1500
          description: >-
            Approx. word length of the script. The actual length may vary
            slightly.
    ImageConfig:
      type: object
      description: >-
        Parameters for still-image generation used as video backgrounds or
        scenes.
      properties:
        model:
          type: string
          enum:
            - flux_schnell
            - imagen4_fast
            - flux_pro
            - flux_pro_ultra
            - recraft
            - flux_lora
            - sdxl
            - sdxl_lora
            - bytedance_seedream_v3
            - sd35_large
            - sd35_medium
            - sd35_large_turbo
            - leonardo_flux_precision
            - leonardo_phoenix_quality
            - reve-v1
            - leonardo_phoenix_ultra
            - hidream_fast
            - hidream_dev
            - hidream_full
            - midjourney
            - gpt_image_1
            - imagen4_preview
          default: flux_schnell
          description: >-
            Which image generation model to use. Different models can produce
            different artistic or realistic styles.
        recraftStyle:
          type: string
          enum:
            - any
            - realistic_image
            - digital_illustration
            - realistic_image/b_and_w
            - realistic_image/hard_flash
            - realistic_image/hdr
            - realistic_image/natural_light
            - realistic_image/studio_portrait
            - realistic_image/enterprise
            - realistic_image/motion_blur
            - digital_illustration/pixel_art
            - digital_illustration/hand_drawn
            - digital_illustration/grain
            - digital_illustration/infantile_sketch
            - digital_illustration/2d_art_poster
            - digital_illustration/handmade_3d
            - digital_illustration/hand_drawn_outline
            - digital_illustration/engraving_color
            - digital_illustration/2d_art_poster_2
          description: >-
            If using the 'recraft' model, you can choose a preset style. Ignored
            if `model` is not 'recraft'.
        loraConfig:
          type: object
          description: >-
            Will only be applied if `model` is 'flux_lora' or 'sdxl_lora'.
            Allows more specialized styles.
          properties:
            loraSlug:
              type: string
              enum:
                - ghibsky-comic-book
                - colour-sketches
                - sketch-paint
                - 90s-anime
                - 2000s-crime-thrillers
                - xno-symbol-flux
              description: >-
                Identifier or slug for the LoRA to apply. See possible slugs on
                [LoRA styles](https://longstories.ai/resources/lora-styles) for
                more information.
        leonardoStyle:
          type: string
          enum:
            - NONE
            - THREE_D_RENDER
            - ACRYLIC
            - ANIME_GENERAL
            - BOKEH
            - CINEMATIC
            - CINEMATIC_CONCEPT
            - CREATIVE
            - DYNAMIC
            - FASHION
            - GAME_CONCEPT
            - GRAPHIC_DESIGN_3D
            - GRAPHIC_DESIGN_POP_ART
            - GRAPHIC_DESIGN_VECTOR
            - HDR
            - ILLUSTRATION
            - MACRO
            - MINIMALIST
            - MOODY
            - PORTRAIT
            - PORTRAIT_CINEMATIC
            - PRO_BW_PHOTOGRAPHY
            - PRO_COLOR_PHOTOGRAPHY
            - PRO_FILM_PHOTOGRAPHY
            - PORTRAIT_FASHION
            - RAY_TRACED
            - SKETCH_BW
            - SKETCH_COLOR
            - STOCK_PHOTO
            - VIBRANT
            - WATERCOLOR
          default: NONE
          description: >-
            Optional style preset for Leonardo models (leonardo_flux_precision,
            leonardo_phoenix_quality, leonardo_phoenix_ultra). Ignored for other
            models. Provide the style name (e.g., "CINEMATIC"). Compatibility
            varies per Leonardo model (e.g., ACRYLIC is Flux-only, BOKEH is
            Phoenix-only). Check model compatibility before use.
    VoiceoverConfig:
      type: object
      description: Enables and customizes an AI voiceover for the generated script content.
      properties:
        enabled:
          type: boolean
          default: true
          description: >-
            If false, no voiceover is produced. The final video will be
            music-only (if `musicConfig.enabled`) or silent.
        voiceId:
          type: string
          default: zWDA589rUKXuLnPRDtAG
          description: >-
            Which voice model to use from the AI voice library. E.g.,
            'zWDA589rUKXuLnPRDtAG' is a US male voice. Find all the available
            voices on [this page](https://longstories.ai/resources/voices).
    CaptionsConfig:
      type: object
      description: >-
        Controls visual styling and position of text captions derived from the
        voiceover.
      properties:
        captionsEnabled:
          type: boolean
          default: true
          description: >-
            If true, on-screen text captions are displayed following the
            voiceover text.
        captionsStyle:
          type: string
          enum:
            - default
            - minimal
            - neon
            - cinematic
            - fancy
            - tiktok
            - highlight
            - gradient
            - intellectual
            - vida
            - manuscripts
            - subtitle
            - modern
            - bounce
            - popcorn
            - typewriter
            - handwritten
            - karaoke
            - retro
            - gaming
          default: default
          description: >-
            How the captions appear visually (font, color, styling). See [this
            page](https://longstories.ai/resources/captions-styles) to see
            examples.
        captionsPosition:
          type: string
          enum:
            - top
            - center
            - bottom
          default: bottom
          description: Where to place the captions in the video.
    EffectsConfig:
      type: object
      description: >-
        Controls visual transitions and animations applied between scenes.
        'Random' picks a dynamic effect per scene.
      properties:
        transition:
          type: string
          enum:
            - none
            - fade
            - slide
            - wipe
            - flip
            - zoom-in
            - zoom-out
            - sway-in
            - SpinClockwise
            - SpinCounterClockwise
            - SpinBoomerang
            - PendulumLeft
            - PendulumRight
            - TrainLeft
            - TrainRight
            - FallLeft
            - FallRight
            - FallDown
            - RiseUp
            - RiseLeft
            - RiseRight
            - RiseDown
            - Random
          default: fade
          description: >-
            Visual transition/effect type used for each scene. 'Random' picks a
            dynamic effect per scene.
        floating:
          type: boolean
          default: true
          description: >-
            If true, images in each scene gently float or zoom, adding dynamic
            movement.
    MusicConfig:
      type: object
      description: >-
        Specifies a background music track and how it should be mixed with
        voiceover.
      properties:
        enabled:
          type: boolean
          default: false
          description: If true, a background music track is included behind the voiceover.
        musicSlug:
          type: string
          enum:
            - ''
            - temple_of_treasures
            - gentle_ambient_loop
            - serene_ambience
            - soothing_ambience
            - soothing_ambient_backdrop
            - tranquil_ambience
            - cozy_ambience
            - dreamscape
            - belonging_resonance
            - vivid_memories
            - cinematic_intro
            - cinematic_teaser
            - dramatic_cinematic_score
            - thriller_cinema_trailer
            - fractured_paintings
            - promise_of_tomorrow
            - spooky_orchestral_theme
            - light_upbeat_melody
            - puzzle_time
            - stomping_drums_rhythm
            - stomps_and_claps_rhythm_track
            - news_theme
            - news_report_theme
            - adventurous_intro
            - burlesque_sweetheart
            - highway_nocturne_national_sweetheart
            - haptic_sensation
            - heart_strings_palace
            - sada_trio
            - mozart_piano_concerto_no23
            - wind_on_our_side
            - shadows_in_the_sun
            - native_dreamscape
            - holly_woods_legend
            - sky_king_theme
            - cloud_gentle_ambience
            - majestic_requiem
            - contemplative_ambient_intro
            - quirky_slacker_theme
          default: ''
          description: >-
            The internal identifier of the music track. Must match a known track
            on the server. You can listen to all the songs on [this
            page](https://longstories.ai/resources/music-tracks).
        volume:
          type: number
          minimum: 0
          maximum: 1
          default: 0.3
          description: >-
            Relative loudness of the music track compared to the voiceover. 0 =
            silent, 1 = full.
        loop:
          type: boolean
          default: true
          description: Whether the background track automatically loops when it ends.
    VideoConfig:
      type: object
      description: >-
        Configures video generation for each scene using an image-to-video
        model.
      properties:
        enabled:
          type: boolean
          default: false
          description: >-
            If true, attempts to generate a video clip for each scene instead of
            just using the static image (longer render times, higher cost).
        model:
          type: string
          enum:
            - ltx_video_13b_distilled
            - ltx_video
            - seedance_480p_5s
            - stable_video
            - motion
            - seedance_480p_10s
            - seedance_720p_5s
            - kling_v1_6_std_5s
            - kling_v2_1_std_5s
            - ltx_video_13b_dev
            - seedance_720p_10s
            - skyreels
            - vidu
            - kling_v1_6_std_10s
            - kling_v2_1_std_10s
            - kling_v2_1_pro_5s
            - luma_ray2
            - kling_pro_5s
            - minimax
            - wan_i2v
            - motion_2
            - kling_v2_1_pro_10s
            - wan_pro
            - luma_ray2_hd
            - kling_pro_10s
            - kling_v2_1_master_5s
            - kling_v2_master_5s
            - kling_v2_1_master_10s
            - veo2
            - kling_v2_master_10s
          default: luma_ray2
          description: >-
            Which image-to-video model to use. Affects style, quality, duration
            limits, and cost. See [Video
            Models](https://longstories.ai/resources/video-models) for details.
        videoDirectorNotes:
          type: string
          description: >-
            Optional notes specific to the video generation model, potentially
            influencing motion or style. Ignored by some models.
          nullable: true
        duration:
          type: number
          description: >-
            Target duration in seconds for the generated video clip. Some models
            have fixed durations. Optional.
          nullable: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your API key for authenticating requests. Example: 'x-api-key:
        MY_SECRET_KEY'

````