Skip to content

Setup

The Modulos class is used to initialize a client for interacting with the Modulos AI API.

Initialization

python
modulos = Modulos(api_key=None)

Parameters

  • api_key (str, optional): Your Modulos API key. If not provided, the class will attempt to retrieve it from the MODULOS_API_KEY environment variable.

Usage

  1. With API key as a parameter:
python
modulos = Modulos(api_key="your_api_key_here")
  1. Using environment variable:
python
#Set the environment variable first
os.environ["MODULOS_API_KEY"] = "your_api_key_here"
modulos = Modulos()

Notes

  • If no API key is provided and it's not set in the environment variables, a ModulosError will be raised.
  • The base_url parameter allows you to specify a custom API endpoint if needed.