AIG. - AI Google Gemini Integration

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIG. - Google AI > 1. Key Management >

AIG. - AI Google Gemini Integration

AIG.SaveKey

Previous Top Next


MiniRobotLanguage (MRL)

 

AIG.Save Key
Save Google Generative AI API Key Encrypted to a File

 

Intention

 

SaveKey Command: Securing Your API Key
 
The SaveKey Command provides a secure method to store your Google Generative AI API key in an encrypted file.

This enhances security and simplifies key management across your scripts.

It�s part of the API Key Management suite within AIG.

 

What is the SaveKey Command?

 

The SaveKey Command encrypts your Google API key and saves it to a specified file or a default location.

It takes your API key as the first parameter and an optional file path as the second. If no path is provided, it defaults to ?exeloc\AIG_License_Key.dat.

 

Why Do You Need It?

 

Using the SaveKey Command is critical for:

Security: Encrypts your API key to prevent accidental exposure.

Convenience: Allows reuse of the key across multiple scripts without hardcoding.

Management: Centralizes key storage for easy updates or retrieval.

 

How to Use the SaveKey Command?

 

Invoke this Command with your Google API key to encrypt and save it.

Optionally specify a file path; otherwise, it uses the default location relative to your script or executable directory.

 

Example Usage

 

' Save the Google API key to the default file

$$KEY=your-google-api-key-here

AIG.Save Key|$$KEY

DBP.Key saved to: ?exeloc\AIG_License_Key.dat

 

' Save the key to a custom file path

AIG.Save Key|$$KEY|C:\MyKeys\GoogleKey.dat

 

The first example saves to the default ?exeloc\AIG_License_Key.dat, while the second specifies a custom location.

 

Illustration

 

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

� File Path � � � � � � � � � �

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

� ?exeloc\AIG_License_Key.dat �

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

Default file path when no custom path is specified.

 

Syntax

 

AIG.SaveKey|P1[|P2]

AIG.Save Key|P1[|P2]

 

Parameter Explanation

 

P1 - The Google Generative AI API key to be encrypted and saved.

P2 - (Optional) The file path where the encrypted key will be stored. If omitted, defaults to ?exeloc\AIG_License_Key.dat.

 

Example

 

' Save a fictional Google API key for demonstration

$$KEY=gsk-xyz1234567890abcdef

AIG.Save Key|$$KEY

ENR.

 

Remarks

 

- The API key must be valid for the Google Generative AI API.

- Use AIG.Set Key with 'from_File' to load the saved key.

 

Limitations

 

- Encryption provides basic protection; advanced threats may require additional safeguards.

- The default file path depends on the executable location (?exeloc).

 

See also:

 

? AIG.Set Key

? AIG.Ask