manage.py add_api_key
This module is used to add an api key to an llmclient.
- class smarter.apps.llmclient.management.commands.add_api_key.Command(*args, **kwargs)[source]
Bases:
SmarterCommandManagement command for associating an API key with an llmclient.
This command allows administrators to link an existing API key to a specific llmclient instance within a Smarter account. The command requires the account number, the API key ID (UUID format), and the llmclient’s name (typically its subdomain).
- The command performs the following steps:
Retrieves the API key using the provided key ID.
Locates the account using the specified account number.
Finds the llmclient by its name within the account.
Associates the API key with the llmclient, creating the relationship if it does not already exist.
Outputs a success message indicating whether the association was newly created or already existed.
This is useful for managing llmclient authentication and access control in multi-tenant environments.