> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.twelvelabs.io/v1.3/sdk-reference/node-js/the-twelve-labs-class/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.twelvelabs.io/_mcp/server. # The TwelveLabs class > Initialize the Node.js SDK client. The `TwelveLabs` class is the main entry point for the SDK. It initializes the client and provides access to all the resources. # Methods ## The constructor **Description**: The constructor creates a new instance of the TwelveLabs class. **Function signature and example**: **`Function signature`** ```javascript Function signature constructor({ apiKey, timeoutInSeconds }: { apiKey?: string; timeoutInSeconds?: number; }); ``` **`Node.js example`** ```javascript Node.js example const client = new TwelveLabs({ apiKey: "" }); ``` ### Parameters | Name | Type | Required | Description | | :----------------- | :------- | :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `apiKey` | `string` | No | Your TwelveLabs API key. If not provided, the `TWELVE_LABS_API_KEY` environment variable will be used. | | `timeoutInSeconds` | `number` | No | Request timeout in seconds. Defaults to `600`. 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 by passing `{ timeoutInSeconds: N }` as the second argument to any SDK method. | ### Return value Implicitly returns the newly created instance. # Request options Every method accepts an optional final `requestOptions` argument for per-call configuration: ```javascript await client.knowledgeStores.list( {}, { timeoutInSeconds: 30 }, ); ``` The `requestOptions` argument accepts the following fields: | Name | Type | Description | | :----------------- | :----------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `timeoutInSeconds` | `number` | The request timeout, in seconds, for this call. Overrides the client's default timeout of 600 seconds. For long-running endpoints (`embed` or `analyze` with large inputs), pass a higher value. For fast-fail behavior, pass a lower value. | | `maxRetries` | `number` | The number of times to retry the request. Defaults to `2`. | | `abortSignal` | `AbortSignal` | A hook to abort the request. | | `headers` | `Record` | Additional headers to include in the request. | > Initialize the Node.js SDK client.