ModelsLabs

Prerequisites

You need to install the requests library.

1uv pip install requests

Set the MODELS_LAB_API_KEY environment variable.

1export MODELS_LAB_API_KEY=****

Example

The following agent will use ModelsLabs to generate a video based on a text prompt.

1from kern.agent import Agent
2from kern.tools.models_labs import ModelsLabsTools
3
4# Create an Agent with the ModelsLabs tool
5agent = Agent(tools=[ModelsLabsTools()], name="ModelsLabs Agent")
6
7agent.print_response("Generate a video of a beautiful sunset over the ocean", markdown=True)

Toolkit Params

ParameterTypeDefaultDescription
api_keystrNoneThe ModelsLab API key for authentication
wait_for_completionboolFalseWhether to wait for the video to be ready
add_to_etaint15Time to add to the ETA to account for the time it takes to fetch the video
max_wait_timeint60Maximum time to wait for the video to be ready
file_typestr"mp4"The type of file to generate

Toolkit Functions

FunctionDescription
generate_mediaGenerates a video or gif based on a text prompt

Developer Resources