For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sample appsIntegrationsDiscordPlaygroundDevEx repo
GuidesSDK ReferenceAPI Reference
GuidesSDK ReferenceAPI Reference
  • Python SDK
    • The TwelveLabs class
    • Manage indexes
    • Upload content
    • Index content
    • Manage videos
    • Manage entities
    • Search
    • Create embeddings v2
    • Create embeddings v1
    • Analyze and segment videos
  • Node.js SDK
    • The TwelveLabs class
    • Manage indexes
    • Upload content
    • Index content
    • Manage videos
    • Manage entities
    • Search
    • Create embeddings v2
    • Create embeddings v1
    • Analyze and segment videos
LogoLogo
Sample appsIntegrationsDiscordPlaygroundDevEx repo
On this page
  • Methods
  • The initializer
  • Parameters
  • Return value
Python SDK

The TwelveLabs class

Was this page helpful?
Previous

Manage indexes

Next
Built with

The TwelveLabs class is the main entry point for the SDK. It initializes the client and provides access to resources for uploading videos, managing indexes, performing searches, creating embeddings, and analyzing videos.

Methods

The initializer

Description: The constructor creates a new instance of the TwelveLabs class.

Function signature and example:

1def __init__(
2 self,
3 *,
4 api_key: typing.Optional[str] = None,
5 **kwargs,
6)

Parameters

NameTypeRequiredDescription
api_keytyping.Optional[str]YesYour TwelveLabs API key. If not provided, the TWELVE_LABS_API_KEY environment variable will be used.
**kwargsdictNoAdditional parameters to pass to the base client. You can pass a variable named timeout of type float to set the request timeout in seconds. The default timeout is 600 seconds, unless you use a custom httpx client. For long-running endpoints (embed or analyze with large inputs), pass a higher value. For fast-fail behavior, pass a lower value, or override per call via request_options={"timeout_in_seconds": N}.

Return value

None. This method initializes the instance.