Prerequisites

You need to install the requests library.

pip install requests

Set the MODELS_LAB_API_KEY environment variable.

export MODELS_LAB_API_KEY=****

Example

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

cookbook/tools/models_labs_tools.py
from phi.agent import Agent
from phi.tools.models_labs import ModelsLabs

# Create an Agent with the ModelsLabs tool
agent = Agent(tools=[ModelsLabs()], name="ModelsLabs Agent")

agent.print_response("Generate a video of a beautiful sunset over the ocean", markdown=True)

Toolkit Params

ParameterTypeDefaultDescription
api_keystrNoneThe ModelsLab API key for authentication
urlstr"https://modelslab.com/api/v6/video/text2video"The API endpoint URL
namestr"models_labs"The name of the tool

Toolkit Functions

FunctionDescription
generate_videoGenerates a video based on a text prompt

Information