Quickstart

📣

Important

The 1.3 version of the API includes significant improvements but also introduces breaking changes. If you are using v1.2, refer to the Migration guide page for a detailed list of changes, migration instructions, and code examples.

This guide demonstrates building a production-ready video understanding service using a three-step process:

  1. Create an index​
  2. ​Upload video​s
  3. Perform downstream tasks.

The following diagram illustrates the steps in this guide:

Each step is composed of a single API call.

Start building

Explore these quickstart notebooks containing complete, executable code that you can customize and extend:

CapabilityDescriptionTry it
SearchFind specific moments in your videos using text or image queries.Open In Colab
GenerateGenerate summaries and open-ended texts based on your videos.Open In Colab
EmbedCreate multimodal embeddings.Open In Colab

Prerequisites

  • This guide assumes you're familiar with the concepts that are described on the Platform overview page.

  • Before you begin, sign up for a free account, or if you already have one, sign in.

  • You have an API key. To retrieve your API key, navigate to the API Key page and log in with your credentials. Then, select the Copy icon to the right of your API key to copy it to your clipboard.

  • The videos you wish to upload must meet the following requirements:

    • Video resolution: Must be at least 480x360 or 360x480, and not exceed 4K.
    • Video and audio formats: The video files you wish to upload must be encoded in the video and audio formats listed on the FFmpeg Formats Documentation page. For videos in other formats, contact us at [email protected].
    • Duration: For Marengo, it must be between 4 seconds and 2 hours (7,200s). For Pegasus, it must be between 4 seconds and 30 minutes (1800s). In a future release, the maximum duration for Pegasus will be 2 hours (7,200 seconds).
    • File size: Must not exceed 2 GB.
      If you require different options, contact us at [email protected].
    • Audio track: If the audio model option is selected, the video you are uploading must contain an audio track.
  • Depending on the programming language you are using, install the Twelve Labs SDK by entering one of the following commands:

    pip install twelvelabs
    
    yarn add twelvelabs-js
    

Procedure

You can interact with the platform using one of the available SDKs or an HTTP client like requests or axios. This section demonstrates how to use the SDKs, the recommended approach for most scenarios.

Follow the steps in one of the guides below, depending on what task you want to complete: