Skip to content
Back to feed

November 5, 2026 · TwelveLabs

TwelveLabs SDKs 1.3.8 change Responses API types, removing usage for billing

Version 1.3.8 of the Python and Node.js SDKs changes the types for the Responses API. Upgrading can require changes to your code, depending on the version that you have installed. The API is unchanged. Follow these steps to upgrade.

Check the installed version of the SDK

Note the version. You need it after the upgrade.

Python SDK

pip show twelvelabs

Node.js SDK

npm ls twelvelabs-js

Upgrade the SDK

Install the latest version of the SDK:

Python SDK

pip install --upgrade twelvelabs

Node.js SDK

npm install twelvelabs-js@latest

Update your code

Select the tab for your previous version of the SDK.

1.3.6 or earlier

SDK type changes (breaking change)

The usage field is removed. This change affects you if your code reads the usage field or uses the ResponseUsage type. To find the cost of a response, read the billing field. It contains the amount and the currency. It does not contain token counts.

Python

Before:

Python

usage = response.usage
print(usage.input_tokens, usage.output_tokens)

After:

Python

billing = response.billing
print(billing.amount, billing.currency)

Node.js

Before:

Node.js

const usage = response.usage;
console.log(usage?.inputTokens, usage?.outputTokens);

After:

Node.js

const billing = response.billing;
console.log(billing?.amount, billing?.currency);

The keepalive stream event type is removed. This change affects you if your code uses the ResponseStreamKeepAliveEvent type. Remove the code that handles it.

The status field of an output item is an optional string. This change affects you if your code reads the status field and assumes that it has a value.

Other SDK type changes

  • The type field of ResponseOutputItem is a string. The SDK still exports ResponseOutputItemType with the values message, function_call, and function_call_output.
  • The type field of ResponseAnnotation is a string. The SDK still exports ResponseAnnotationType with the values video_citation, image_citation, and collection_citation. The platform also returns the url_citation value.
  • An output item with the jockey:web_search type contains the details of the search in the action field. The response stream includes the jockey:web_search.in_progress, jockey:web_search.searching, and jockey:web_search.completed events. The response contains these items and events only when the request sets the include parameter to ["intermediate_outputs"].

1.3.7

SDK type changes (breaking change)

ResponseOutputItem is one type, not a union. This change affects you if your code uses a variant of ResponseOutputItem. Use ResponseOutputItem instead, and read the type field to tell output items apart.

Python

The SDK no longer includes these types:

  • ResponseOutputItem_Message
  • ResponseOutputItem_FunctionCall
  • ResponseOutputItem_FunctionCallOutput
  • ResponseOutputItem_JockeyWebSearch

Before:

Python

from twelvelabs import ResponseOutputItem_Message

for item in response.output:
    if isinstance(item, ResponseOutputItem_Message):
        print(item.content)

After:

Python

for item in response.output:
    if item.type == "message":
        print(item.content)

Node.js

The SDK no longer includes these types:

  • ResponseOutputItem.Message
  • ResponseOutputItem.FunctionCall
  • ResponseOutputItem.FunctionCallOutput
  • ResponseOutputItem.JockeyWebSearch

Before:

Node.js

import { TwelvelabsApi } from "twelvelabs-js";

function printMessage(item: TwelvelabsApi.ResponseOutputItem.Message) {
  console.log(item.content);
}

After:

Node.js

import { TwelvelabsApi } from "twelvelabs-js";

function printMessage(item: TwelvelabsApi.ResponseOutputItem) {
  if (item.type === "message") {
    console.log(item.content);
  }
}

The status field of an output item is an optional string. This change affects you if your code reads the status field and assumes that it has a value.

More information

For details, see the Create a response page in the API Reference section, or the SDK reference for Python and Node.js.

Latest TwelveLabs API changes

All TwelveLabs API changes