Appearance
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 theMODULOS_API_KEY
environment variable.
Usage
- With API key as a parameter:
python
modulos = Modulos(api_key="your_api_key_here")
- 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.