DLT. - DeepL Translate

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > DLT. - DeepL-Translate >

DLT. - DeepL Translate

DLT.SetKey

Previous Top Next


MiniRobotLanguage (MRL)

 

DLT.SetKey
Set DeepL.com-API Key

 

clip0686

 

Intention

 

SetKey Command: Initiating Your Script with a License Key
 
Before diving into the world of AI scripting, it's essential to set the stage with the DLT.SetKey command.

This command is the golden ticket that grants you access to the plethora of AI functionalities offered by DeepL.com.

Let's break down how to use it effectively.

 

  What is the DLT.SetKey Command?

 

The DLT.SetKey command is the first command you need to include at the beginning of your script.

It's like the key to a treasure chest; without it, you can't unlock the AI translation capabilities you're after.

 

Why Do You Need It?

You might be wondering why there's a need for such a key.
The reason is that the AI functionalities you are looking to use are not processed locally on your computer.

Instead, they are handled remotely in the high-powered DeepL.com Cloud.
This License Key ensures that you have the proper authorization to access these cloud-based services.

 

  How to Obtain the License Key?

To get your hands on this key, you'll need to visit (click the Button)

.

 
Once there, follow the instructions to register and obtain the License Key.
Keep this key safe, as you'll need it every time you want to use DeepL.com's services.

 

  How to Use the DLT.SetKey Command?

Once you have your License Key, it's time to put it to use.
At the very start of your script, include the DLT.SetKey command followed by your License Key.
This will authenticate your script with DeepL.com's cloud services.

On the long run you may prefer the second Option (see below) that will encrypt your key into a file and use this file.

 

 

The DLT.Set_Key-Command has multiple Usage Options.

 

1. You can directly set the Key in the Script.

Here is a Sample Script that shows how this is done.

 

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

$$KEY=f6e3519f-b8e7-5082-0a95-2a847e4134bf:fx

 

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

NOL.

 GTO.enx

EIF.

 

' Set DeepL.com API-Key

DLT.SetKey|$$KEY

 

' Ask Question and receive answer to $$RET

$$TXT=Your Text

DLT.translate text|$$TXT|$$RET|en|de

DBP.$$RET

 

:enx

ENR.

 

2. You can use a saved, encrypted Key, that is stored in the project-folder.

This is the preferred way because this is more save for your key.

The default name for this saved Key is "DLT_License_Key.dat"

If no path is given, the file is created at "?exeloc\" that is the folder where the Script/the executable resides.

This key-file can be created using the AIC.Save_Key|$$KEY[|$$FIL] Command.

 

 

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

 

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

$$KEY=f6e3519f-b8e7-5082-0a95-2a847e4134bf:fx

 

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

' ?exeloc\DLT_License_Key.dat

DLT.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 DeepL.com API-Key from the saved File

DLT.SetKey|from_File

 

' Ask Question and receive answer to $$RET

$$TXT=Your Text

DLT.translate text|$$TXT|$$RET|en|de

DBP.$$RET

 

:enx

ENR.

 

3. You can use a Textfile, that contains your Key.

This is way to go, if you make an Executable that you want to share with the public or other people.

To give them the Option to use your SPR-Script together with their own API-Key, you can offer this Option.

 

The default name for this saved Key in a Textfile is "DLT_License_Key.txt"

If no path is given in P2, the file should be located in "?exeloc\" that is the folder where the Script/the executable resides.

This key-file can be created using any Texteditor (or CTF.-Command).

 

 

' Script 3: Using the API-Keyfile with the API-Key as Text

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

NOL.

GTO.enx

EIF.

 

' Set DeepL.com API-Key from the saved File

DLT.SetKey|from Text

 

' Ask Question and receive answer to $$RET

$$TXT=Your Text

DLT.translate text|$$TXT|$$RET|en|de

DBP.$$RET

 

:enx

ENR.

 

 

Syntax

 

 

DLT.SetKey|P1[|P2]

DLT.Set_Key|P1[|P2]

 

 

Parameter Explanation

P1 - Can be directly an DeepL-API-Key or:

      from File - if given as P1, there should be a encrypted Keyfile with the name "AIC_License_Key.dat" at ?exeloc\ or if specified, at Path P2. This file can only be created using the AIC.Save Key - Command.

      from Text - if given as P1, there should be a Textfile that contains the API-Key with the name "AIC_License_Key.txt" at ?exeloc\ or if specified, at Path P2. This file can be created using any Text-Editor.

      Load Any Key - if given as P1, the command will load any available API-Key.

 

P2 - opt. if specified this is the Path (and filename) of the Keyfile to use with the two options above. It can be either a Crypted or a Textfile. The System will decide with the Extension ".txt" or ".dat" how it is loaded.

 

Example

 

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

' EXAMPLE 1: DLT.-Commands

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

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

$$KEY=f6e3519f-b4e7-5082-0a95-2a847e4134bf:fx

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

NOL.

GTO.enx

EIF.

 

' Set DeepL.com API-Key

DLT.SetKey|$$KEY

 

' Ask Question and receive answer to $$RET

$$TXT=Your Text

DLT.translate text|$$TXT|$$RET|en|de

DBP.$$RET

 

:enx

ENR.

 

 

Remarks

 

A Word of Caution: Safeguarding Your API Key 🚨

 

Dear Valued User,

 

🔒 This Encryption is Not Impenetrable 🔒

 

Even if your API Key is encrypted within a file, the Decryption is hereby done without a Password, means anybody can decrypt it if he has the SPR at hand.

It's akin to a treasure locked in a chest.

The chest provides an added layer of security and invisibility, but should it fall into the hands of a pirate with the SPR and Knowledge, the treasure can be plundered.

You may ask: "Why did we not use a Password?"

The answer is simple, even then you would need to provide that Password in Cleartext in the code, because the SPR needs to decrypt the keyfile anyway.
So there would be no advantage. In case you want to enter the Password each time and have an unbreakable Encrytion, you can instead do something using the GUT. and the GEC.-Command.

 

🚫 Do Not Distribute the Key, Even Encrypted 🚫

 

Distributing executables or scripts along with the file containing your encrypted API Key is akin to sending your treasure chest out to sea on an unmanned ship. Anyone who gets hold of this file and has access to an SPR (Script Processing Runtime) can potentially decrypt and misuse your API Key.

 

💡 Why is This a Big Deal? 💡

 

Your API Key is not just a string; it's your identity and access within the DeepL.com realm. It's linked to your account, your resources, and your privileges. In the wrong hands, it can be used to access services and consume quotas associated with your account. This can have both financial and security implications.

 

🛡️ What Should You Do? 🛡️

 

Never Distribute the Key: Do not include your API Key, even if encrypted, in any files or executables that you distribute.

 

Access Control: If your application requires the use of the API Key, consider implementing a backend service that your application can call. The service can then use the API Key server-side, where it's not exposed to the end-user.

 

Vigilance: Regularly monitor the usage of your API Key and be vigilant for any unauthorized or unexpected activity.

 

Set Usage Limits: Visit the DeepL.com website and access your account settings. Here, you can set limits on the usage of your API Key. This is a wise precaution to ensure that even if the unthinkable happens, the potential damage is contained. It's like setting a magical barrier around your treasure chest!

 

Remember, with great power comes great responsibility. Your API Key is a powerful tool; wield it wisely and guard it well.

 

Safe coding!

 

Limitations:

 

-

 

 

See also: