Skip to main content
To run the Python examples here, install aixplain 0.2.48, the last release that includes SDK v1: pip install aixplain==0.2.48 (Python 3.9 or later).
Version: v1.0

aixplain.v1.decorators.api_key_checker

API key validation decorator for aiXplain SDK.

check_api_key​

def check_api_key(method)

[view_source]

Decorator to verify that an API key is set before executing the method.

This decorator uses the centralized API key validation logic from config.py to ensure consistent behavior across the entire SDK.

Arguments:

  • method callable - The method to be decorated.

Returns:

  • callable - The wrapped method that includes API key verification.

Raises:

  • Exception - If neither TEAM_API_KEY nor AIXPLAIN_API_KEY is set.

Example:

@check_api_key
def my_api_method():
# Method implementation
pass