AIO.GetKey

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIO. - OpenRouter AI >

AIO.GetKey

AIO.GetKey

Previous Top Next


MiniRobotLanguage (MRL)

 

AIO.GetKey[|`RET]
Get Current API Key

 

Purpose

 

Retrieves the current OpenRouter API key that is configured for use. This command allows you to verify which API key is active, useful for debugging configuration issues or confirming key rotation.

 

Syntax

 

AIO.GetKey[|`RET]

 

Parameters

 

`RET (optional) - Variable to store the retrieved API key. If omitted, the key may be displayed or returned depending on the calling context.

 

Return Value

 

The current OpenRouter API key as a string. Returns an empty string if no key has been set.

 

Notes

 

- Returns the key as it was set (including "sk-or-v1-" prefix if present)

- Use with caution - API keys are sensitive credentials

- Returns empty string if AIO.Init was called but SetKey was not

- Key is cleared when AIO.Init is called

 

Example

 

' Check if API key is configured

AIO.GetKey|`CurrentKey

 

' Verify key is not empty

IF `CurrentKey = "" THEN

 DBP.Error: API key not set!

END IF

 

Related Commands

 

AIO.SetKey - Set API key

AIO.Init - Initialize AIO system

AIO.GetKeyLimits - Get key usage limits