AIN. - AnythingLLM AI

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIN. - AnythingLLM AI

AIN.SaveKey

Previous Top Next


MiniRobotLanguage (MRL)

 

AIN.SaveKey
Save AnythingLLM API Key Encrypted to a File

 

Intention

 

SaveKey Command: Secure Your API Key
 
The AIN.SaveKey Command is an essential tool for developers working with AnythingLLM.

It acts as a secure vault, allowing you to store your API key in an encrypted file.

This enhances security and simplifies key usage across multiple scripts.

It�s part of the AIN - AnythingLLM AI suite.

 

What is the SaveKey Command?

 

This Command saves the AnythingLLM API key in an encrypted file, defaulting to ?exeloc\AIN_License_Key.dat if no path is specified.

It ensures the key is securely stored and reusable without exposing it in plain text.

 

Why Do You Need It?

 

Using the SaveKey Command is advisable for:

Security: Reduces the risk of unintentional key exposure.

Convenience: Provides a method to reuse the key across scripts.

Automation: Streamlines setup for long-running processes.

 

How to Use the SaveKey Command?

 

Invoke AIN.SaveKey with your API key as the primary argument.

Optionally, specify a file path for storage; otherwise, it defaults to ?exeloc\AIN_License_Key.dat in the script or executable directory.

 

Example Usage

 

' Save the key to the default file "AIN_License_Key.dat"

$$KEY=your_api_key_here

AIN.SaveKey|$$KEY

DBP.API Key Saved to ?exeloc\AIN_License_Key.dat

 

Saves the API key securely at the default location.

 

Illustration

 

+--------------------+

� Save API Key � � � �

+--------------------�

� AIN_License_Key.dat�

+--------------------+

Encrypts and stores the API key in a file.

 

Syntax

 

AIN.SaveKey|P1[|P2]

 

Parameter Explanation

 

P1 - (Required) The AnythingLLM API key to save.

P2 - (Optional) File path for the encrypted key; defaults to ?exeloc\AIN_License_Key.dat if omitted.

 

Example

 

' Save the key to a custom file path

$$KEY=your_api_key_here

AIN.SaveKey|$$KEY|C:\Keys\MyAINKey.dat

DBP.Key saved to C:\Keys\MyAINKey.dat

ENR.

 

Remarks

 

- Typically used after AIN.SetKey to persist the key.

- The encrypted file is named AIN_License_Key.dat by default for easy identification.

 

Limitations

 

- Requires write access to the specified or default file location.

- Encryption protects against casual access, but advanced users with SPR tools may decrypt it.

 

Security Considerations

 

- Avoid distributing the encrypted file, as it could be decrypted by someone with sufficient expertise.

- Consider using a backend service to manage the key securely, keeping it off client systems.

 

See also:

 

? AIN.SetKey

? AIN.GetKey

? Key Management