|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AID. - DeepSeek > !Key Management > AID. - Artificial Intelligence DeepSeek Utility |
MiniRobotLanguage (MRL)
AID.Save_Key
Save DeepSeek API Key to a File
Intention
SaveKey Command: Storing the DeepSeek API Key
The Save_Key command securely stores your DeepSeek API key in a file, optionally at a custom path, for reuse across scripts.
This enhances security by keeping the key out of plain text in scripts and simplifies key management.
It’s part of the AID - DeepSeek API suite.
The Save_Key command saves the DeepSeek API key to a file using the AID_Save_Key function, with an optional file path parameter.
If no path is specified, it defaults to a location relative to AID_Folder, typically ?exeloc\AID_Folder\.
Saving the API key to a file is essential for:
•Security: Reduces the risk of exposing the key in script source code.
•Convenience: Allows reuse across multiple scripts without re-entering the key.
•Management: Centralizes key storage for easy updates or backups.
Provide the API key as the first parameter and an optional file path as the second parameter.
The key must be at least 5 characters long, and the path (if provided) must be at least 3 characters to be valid.
If no path is specified, the key is saved in AID_Folder, which defaults to ?exeloc\AID_Folder\.
Example Usage
' Save the key to the default location
AID.Save_Key|sk-deepseek123456789
DBP.API Key saved to default file
' Save the key to a custom path
AID.Save_Key|sk-deepseek123456789|C:\Keys\deepseek.key
DBP.API Key saved to custom file
The key is saved to the specified file or the default location if no path is provided.
Illustration
┌────────────────────┐
│ API Key Storage │
├────────────────────┤
│ ?exeloc\AID_Folder\│
│ or Custom Path │
└────────────────────┘
Saving the DeepSeek API key to a file.
Syntax
AID.SaveKey|P1[|P2]
AID.Save Key|P1[|P2]
Parameter Explanation
P1 - The DeepSeek API key to save (minimum 5 characters).
P2 - (Optional) The file path where the key will be saved (minimum 3 characters). If omitted, defaults to AID_Folder.
Example
' Save a fictional DeepSeek API key to the default location
AID.Save_Key|sk-deepseek123456789
DBP.Key saved to ?exeloc\AID_Folder\
' Save to a custom path
AID.Save_Key|sk-deepseek123456789|C:\Keys\deepseek.key
DBP.Key saved to C:\Keys\deepseek.key
ENR.
Remarks
- The key must be at least 5 characters, or an error occurs (see IF LEN(S01)<5 THEN GOTO ero).
- The default folder can be customized using AID.Set_Folder.
Limitations
- The command requires 1 or 2 parameters; fewer or more will trigger an error (IF R01>3 OR R01<2 THEN GOTO ero).
- No encryption is explicitly mentioned in the code; security depends on external implementation.
See also: