|
<< Click to Display Table of Contents >> Navigation: »No topics above this level« AIN. - AnythingLLM AI |
MiniRobotLanguage (MRL)
AIN.SetKey
Set the API Key for AnythingLLM
Intention
SetKey Command: Configure API Authentication
The SetKey command sets the API key required for authenticating requests to the AnythingLLM system.
This key is essential for secure communication with the AnythingLLM API, enabling operations like workspace management and chat execution.
It’s part of the AIN - AnythingLLM AI suite.
This command configures the API key that will be used in subsequent API requests, typically included in the request headers for authentication.
It does not return a value but sets a global or session-specific key for use by other AIN commands.
Setting the API key is critical for:
•Authentication: Ensure secure access to the AnythingLLM API.
•Setup: Prepare the system for API-dependent commands like AIN.ExecuteOpenAIChat.
•Flexibility: Allow dynamic key changes within a script.
Provide the API key as a parameter to configure authentication for all subsequent API calls.
This key is typically obtained from the AnythingLLM instance settings.
Example Usage
AIN.SetKey|my-api-key-123
AIN.ListWorkspaces|$$API
DBP.Workspaces: $$API
This sets the API key to "my-api-key-123" before listing workspaces.
Illustration
┌───────────────┐
│ API Key │
├───────────────┤
│ "my-api-key" │
└──────┬────────┘
│
┌──────▼────────┐
│ Authenticated │
│ API Calls │
└───────────────┘
Setting the key enables authenticated API interactions.
Syntax
AIN.SetKey|P1
AIN.SKY|P1
Parameter Explanation
P1 - (Required) The API key to set for authentication.
Example
AIN.SKY|abc123xyz
AIN.ExecuteOpenAIChat|my-workspace|Hello!
ENR.
Remarks
- Overwrites any previously set API key in the current session.
- Does not validate the key; invalid keys will cause subsequent API calls to fail.
Limitations
- Limited to 1 parameter; excess parameters trigger an error.
- Requires a valid key from the AnythingLLM instance for successful API operations.
See also: