Security Overview
AgentClaw takes API key security seriously. All environment variables, including API keys, are:
- Encrypted at rest using AES-256-GCM encryption
- Never logged in plain text
- Transmitted securely over HTTPS
- Isolated per instance - each agent has its own encrypted storage
How to Add API Keys
Method 1: During Instance Creation
- Navigate to
/dashboard/instances/new - Fill out the instance configuration form
- In the "Environment Variables" section, click "Add Variable"
- Enter the variable name (e.g.,
OPENAI_API_KEY) - Paste your API key in the value field
- Click "Create Instance"
Method 2: Update Existing Instance
- Go to your instance details page
- Click the "Configuration" tab
- In the "Environment Variables" section, click "Add Variable"
- Enter the variable name and value
- Click "Save Changes"
- Restart your instance for changes to take effect
Common API Key Variables
AI Providers
OPENAI_API_KEY- Your OpenAI API keyANTHROPIC_API_KEY- Your Anthropic API keyOPENROUTER_API_KEY- Your OpenRouter API key
Messaging Platforms
TELEGRAM_BOT_TOKEN- Your Telegram bot token from @BotFatherDISCORD_BOT_TOKEN- Your Discord bot tokenWHATSAPP_API_KEY- Your WhatsApp Business API key
Optional Configuration
AI_MODEL- Specify the AI model to use (e.g.,gpt-4,claude-4.5-sonnet)SYSTEM_PROMPT- Custom system prompt for your agentMAX_TOKENS- Maximum response length
Best Practices
- Never share API keys: Keep your keys private and never commit them to version control
- Use separate keys: Create separate API keys for development and production
- Rotate regularly: Change your API keys periodically for security
- Monitor usage: Check your AI provider's dashboard for unexpected usage
- Set spending limits: Configure budget alerts in your AI provider account
Viewing and Editing Keys
For security reasons, API key values are never displayed after being saved. You can see the variable names but not the actual values.
To update an API key:
- Go to the Configuration tab
- Find the variable you want to update
- Click the "Edit" button
- Enter the new value
- Save and restart your instance
Deleting API Keys
To remove an API key:
- Navigate to your instance configuration
- Find the variable you want to delete
- Click the "Delete" button
- Confirm the deletion
- Restart your instance
Deleted keys are permanently removed from our encrypted storage.
Troubleshooting
Instance won't start after adding keys
- Check the logs for authentication errors
- Verify your API key is correct (no extra spaces or characters)
- Ensure your API key has the correct permissions
API key not working
- Make sure you restarted the instance after updating
- Check if your API key has sufficient credits/quota
- Verify the variable name matches what OpenClaw expects
Next Steps
- Learn where to get OpenAI API keys
- Learn where to get Anthropic API keys
- Read the full environment variables guide