AIC. - Artificial Intelligence Command

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIC. - Artificial Intelligence Command > AI - Set Parameters >

AIC. - Artificial Intelligence Command

AIC.Save Key

Previous Top Next


MiniRobotLanguage (MRL)

 

AIC.Save Key
Save OpenAI-API Key encrypted to a file

 

clip0584

 

Intention

 

The AIC.Save Key Command is an essential tool for developers venturing into the world of OpenAI.
It acts as a secure vault, allowing you to store your API Key in an encrypted format within a file.

This not only bolsters security but also streamlines the process of utilizing the key across various scripts.

 

Utilizing the Save Key Command

 

To employ the `Save Key Command`, you need to invoke the AIC.Save_Key function.

Pass your API Key as the primary argument.

Additionally, you can specify a file path to determine where the encrypted key should be stored, while this optional.

 

AIC.Save_Key <YOUR_API_KEY>[|OPTIONAL_FILE_PATH]

 

In the event that a file path is not specified, the command will default to saving the file in the directory where the script or executable is situated.

The default path is "?exeloc\AIC_License_Key.dat"

 

Default Naming Convention and Location

 

The encrypted file is conventionally named `AIC_License_Key.dat`.

This standard naming practice ensures easy identification.
If a file path is omitted, the file will be created in the directory denoted by `?exeloc\`, which corresponds to the location of the script or executable.

 

The Significance of the Save Key Command

 

Using the `Save Key Command` to store the API Key in an encrypted file is highly advisable. This approach significantly reduces the risk of unintentional exposure and provides a convenient method for reusing the key in different scripts.

 

Wrapping Up

 

The `Save Key Command` is a powerful and indispensable tool for safeguarding your API Key. By storing it in an encrypted file, you ensure its protection and facilitate its use across your OpenAI projects.

 

 

' Script 1: Save the Key to the file "AIC_License_Key.dat".

 

IMPORTANT: This API-Key is a phantasy API-Key it must be replaced with your API-Key.

$$KEY=sk-abcdefghijklmnopqrstuvwxyz123456

 

' Here we save the Keyfile at the default path, that is:

' ?exeloc\AIC_License_Key.dat

AIC.Save_Key|$$KEY

ENR.

 

 

' Script 2; Using the crypted API-Keyfile

' Test if we are online, AI-Commands will only work if you are online.

NOL.

GTO.enx

EIF.

 

' Set OpenAI API-Key from the saved File

AIC.SetKey|from_File

 

' Set Model

AIC.SetModel_Completion|4

 

' Set Model-Temperature

AIC.Set_Temperature|0

 

' Set Max-Tokens (Possible lenght of answer, depending on the Model up to 2000 Tokens which is about ~6000 characters)

' The more Tokens you use the more you need to pay.

AIC.SetMax_Token|25

 

' Ask Question and receive answer to $$RET

AIC.Ask_Completion|Wieviel Uhr ist es?|$$RET

DBP.$$RET

 

:enx

ENR.

 

 

Syntax

 

 

AIC.SaveKey|P1[|P2]

AIC.Svk|P1[|P2]

 

 

Parameter Explanation

P1 - See here Open AI API-Key

P2 - opt. Filepath for the API-Key to save

 

 

Example

 

'*****************************************************

' EXAMPLE 1: AIC.-Commands

'*****************************************************

' Script 1: Save the Key to the file "AIC_License_Key.dat".

 

IMPORTANT: This API-Key is a phantasy API-Key it must be replaced with your API-Key.

$$KEY=sk-abcdefghijklmnopqrstuvwxyz123456

 

' Here we save the Keyfile at the default path, that is:

' ?exeloc\AIC_License_Key.dat

AIC.Save_Key|$$KEY

ENR.

 

 

Remarks

-

 

Limitations:

 

# 🌟 Safeguarding Your API Key: A Knight's Guide to OpenAI's Treasure 🌟

 

Greetings, Noble Coder! 🛡️

 

Embarking on a quest through the enchanted forests of OpenAI?

Before you mount your steed, there’s a sacred artifact you must secure - the illustrious API Key.

This key is not just a string of characters; it’s the heart of your adventure, the magic that unlocks the kingdom’s secrets.

 

🔐 **The Enchanted Encryption** 🔐

 

Ah, you seek to protect your treasure by locking it within an enchanted file.

Wise as it may seem, remember, even the mightiest spells have their counters. The encryption wards off common thieves, but against a sorcerer with the dark SPR arts, it may falter.

 

🚫 **Guard Your Treasure Chest** 🚫

 

Distributing your encrypted key is akin to leaving your treasure chest in the dragon’s lair. Any rogue with an SPR spellbook can break the enchantment.

The treasure within - your API Key - is bound to your very essence, your account. In the wrong hands, it can unleash storms and deplete your resources.

 

🔮 **Set Magical Boundaries** 🔮

 

Fear not, for there is a spell to shield your treasure further.

Within the hallowed halls of OpenAI’s website, you can weave a spell to set limits on your API Key’s powers.

This incantation ensures that even if your key is seized, its magic is bound, and the havoc it can wreak is contained.

 

🛡️ **The Knight’s Code** 🛡️

 

1. **Guard the Key**: Never let your API Key, even if enchanted in a file, sail on uncharted waters.

 

2. **Summon Guardians**: Create a mystical barrier through a backend service. Let this guardian use the API Key in the shadows, far from prying eyes.

 

3. **Eternal Vigilance**: Watch over your domain. Keep an eagle’s eye on the usage of your API Key.

 

4. **Weave Protective Spells**: Visit OpenAI’s sacred grounds and set limits upon your API Key.

Bind it, so its magic doesn’t turn against the kingdom.

 

Remember, brave knight, with great power comes great responsibility.

Your API Key is the magic that courses through the veins of your quests.

Guard it, protect it, and let it guide you through countless adventures in the realm of OpenAI.

 

Onward, to glory! 🚀

 

 

See also:

 

  Set_Key