|
<< 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.Set Key
Set DeepSeek API Key
Intention
SetKey Command: Unlocking DeepSeek’s AI Capabilities
The SetKey command is your gateway to harnessing the power of DeepSeek’s AI services within your scripts. It authenticates your access to the DeepSeek API, enabling features like AID.Ask and AID.AskT. Without this key, your scripts cannot connect to DeepSeek’s cloud-based infrastructure.
This command offers flexible options to set the API key directly or load it from a file, balancing convenience with security for your automation workflows.
It’s a foundational part of the AID - DeepSeek API suite.
The SetKey command configures the global AID_Key variable, which stores your DeepSeek API key. This key is required for all API interactions, authenticating your requests to DeepSeek’s servers.
It supports multiple methods to set the key:
•Directly specify the key as text within the script.
•Load it from an encrypted file (e.g., created by AID.Save Key).
•Load it from a plain text file for shared or portable use.
The API key is essential because DeepSeek’s AI processing occurs remotely in their cloud infrastructure, not locally on your machine. This key:
•Authenticates your identity and authorizes access to DeepSeek’s services.
•Tracks usage for billing (e.g., $0.27/M input tokens for deepseek-chat).
•Ensures secure communication with DeepSeek’s API endpoints.
To acquire your DeepSeek API key:
?Visit platform.deepseek.com and sign up or log in.
?Navigate to the API section under your account settings.
?Generate a new API key (e.g., sk-ds1234567890abcdef).
?Copy and store it securely—it’s your key to DeepSeek’s AI power!
The command offers three primary usage options, each suited to different scenarios:
Embed the API key directly in your script for quick setup (not recommended for shared scripts due to security risks).
' IMPORTANT: This is a fictional API key; replace it with your own!
$$KEY=sk-ds1234567890abcdef
' Test online connectivity
NOL.
GTO.enx
EIF.
' Set DeepSeek API Key
AID.Set Key|$$KEY
' Configure model and ask a question
AID.Set Model|deepseek-chat
AID.Ask|What’s the weather like today?|$$RES
DBP.$$RES
:enx
ENR.
Load the key from an encrypted file (preferred for security). The default file is AID_License_Key.dat in ?exeloc\AID_Folder\, created via AID.Save Key.
' Script 1: Save the key to an encrypted file
$$KEY=sk-ds1234567890abcdef
AID.Save Key|$$KEY
ENR.
' Script 2: Load the encrypted key
NOL.
GTO.enx
EIF.
AID.Set Key|fromFile
AID.Set Model|deepseek-reasoner
AID.Ask|Solve 2x + 3 = 7|$$RES
DBP.$$RES
:enx
ENR.
Load the key from a plain text file (useful for sharing executables with users who provide their own keys). Default file is AID_License_Key.txt in ?exeloc\AID_Folder\.
' Create AID_License_Key.txt with your key using a text editor
' Then use this script:
NOL.
GTO.enx
EIF.
AID.Set Key|fromFile|?exeloc\AID_Folder\AID_License_Key.txt
AID.Ask|Hello, how are you?|$$RES
DBP.$$RES
:enx
ENR.
Syntax
AID.SetKey|P1[|P2]
AID.Set Key|P1[|P2]
Parameter Explanation
P1 - The API key source. Options are:
•Direct key (e.g., sk-ds1234567890abcdef) - Sets the key directly.
•fromFile - Loads an encrypted key from AID_License_Key.dat or a specified path in P2.
•fromFile with P2 as a text file - Loads a key from a text file (e.g., AID_License_Key.txt).
P2 - (Optional) Path to the key file (encrypted or text). If omitted, defaults to ?exeloc\AID_Folder\AID_License_Key.dat for encrypted files.
Example
' Example: Combining all methods
$$KEY=sk-ds1234567890abcdef
AID.Set Key|$$KEY
AID.Save Key|$$KEY
AID.Set Key|fromFile
AID.Ask|What time is it?|$$RET
DBP.$$RET
ENR.
Remarks
Your DeepSeek API key is a sensitive credential tied to your account and billing. Misuse can lead to unauthorized access or unexpected costs (e.g., $1.10/M output tokens for deepseek-chat).
Encryption Limitations: Encrypted files (.dat) use a basic scheme without a password. Anyone with the Smart Package Robot can potentially decrypt it. For stronger security, use GUT. and GEC. with a user-entered password.
Avoid Distribution: Never include your key (even encrypted) in shared scripts or executables. Use a backend service or let users provide their own keys via text files.
Monitor Usage: Check your DeepSeek dashboard regularly for unusual activity and set usage limits at platform.deepseek.com.
Limitations
- Requires an internet connection to validate the key with DeepSeek’s servers.
- Invalid keys or file paths trigger an error (%IC_ER_PA or %IC_ER_File).
See also: