create_api_key

This module provides a Django management command to create a new API key for a user and account.

Classes

Command

Implements the logic for the manage.py create_api_key command.

Command-line Arguments

–account_numberstr, optional

The Smarter account number to which the user belongs. Format: ####-####-####

–usernamestr, optional

The username of the API key owner.

–descriptionstr, optional

Optional brief text description for the API key.

Functionality

  • Finds the specified user and account using the provided arguments.

  • Creates a new API key (auth token) for the given user profile.

  • Outputs the API key value and relevant information. Warns that the key is only shown once.

  • Displays instructions for associating the API key with an LLMClient.

Usage Example

python manage.py create_api_key –account_number=1234-5678-9012 –username=myuser –description=”integration key”

class smarter.apps.account.management.commands.create_api_key.Command(*args, **kwargs)[source]

Bases: SmarterCommand

Django manage.py create_user command.

This command is used to create a new user for an account.

add_arguments(parser)[source]

Add arguments to the command.

handle(*args, **options)[source]

Create the superuser account.