manage.py add_api_key
This module is used to add an api key to an llm_client.
- class smarter.apps.llm_client.management.commands.add_api_key.Command(*args, **kwargs)[source]
Bases:
SmarterCommandManagement command for associating an API key with an llm_client.
This command allows administrators to link an existing API key to a specific llm_client instance within a Smarter account. The command requires the account number, the API key ID (UUID format), and the llm_client’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 llm_client by its name within the account.
Associates the API key with the llm_client, 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 llm_client authentication and access control in multi-tenant environments.