API Configuration: Setting Up All Required Keys
Complete guide to configuring API keys for Clawra's features. Setup xAI Grok Imagine for selfies, fal.ai for image processing, and messaging platform tokens.
Required API Keys
Overview of all APIs needed for Clawra's functionality
xAI API Key
For AI selfie generation using Grok Imagine
fal.ai API Key
Fast API access to xAI Grok Imagine
Platform Tokens
Discord, Telegram, WhatsApp, etc.
xAI API Key Setup
💡 Purpose
Powers Clawra's AI selfie generation feature using xAI Grok Imagine model. This is the core AI engine that generates contextual photos when you request selfies from Clawra.
Where to Get Your xAI API Key:
- Visit x.ai official website
- Sign up for an account or log in
- Navigate to API section or developer dashboard
- Generate or copy your API key
- Keep it secure — you'll need it for configuration
Learn More:
xAI Grok Imagine API Documentation
Important Notes:
- Required for selfie generation feature
- May have associated costs depending on usage
- Works in conjunction with fal.ai for fast processing
fal.ai API Key Setup
💡 Purpose
Provides fast, reliable API access to xAI Grok Imagine. fal.ai is the infrastructure layer that connects Clawra to xAI's image generation capabilities.
Where to Get Your fal.ai API Key:
- Visit fal.ai official website
- Create an account or log in
- Access your API dashboard
- Generate a new API key
- Copy and securely store your key
Learn More:
fal.ai xAI Grok Imagine Integration
How It Works with xAI:
fal.ai provides the fast API infrastructure that connects Clawra to xAI's Grok Imagine model. When you request a selfie, Clawra uses fal.ai's API to generate images through xAI. This combination ensures:
- Fast image generation response times
- Reliable API infrastructure
- Consistent selfie appearance using reference images
- Context-aware scene generation
Discord Bot Token Setup
Where to Get Your Discord Bot Token:
- Go to Discord Developer Portal
- Click "New Application" to create a new app
- Give your application a name (e.g., "Clawra")
- Navigate to the "Bot" section in the left sidebar
- Click "Add Bot" to create a bot for your application
- Click "Reset Token" to generate a bot token
- Important: Copy the token immediately — you won't see it again!
Required Bot Permissions:
To function properly, your Clawra bot needs these permissions:
- Read Messages/View Channels — To see your messages
- Send Messages — To respond to you
- Embed Links — For rich content in messages
- Attach Files — To send selfie images
Telegram Bot Token Setup
Where to Get Your Telegram Bot Token:
- Open Telegram and search for @BotFather
- Start a chat with BotFather (it's an official Telegram bot)
- Send the command
/newbot - BotFather will ask you to choose a name for your bot
- Then choose a username (must end in 'bot', e.g., "ClawraBot")
- BotFather will send you your API token
- Copy and securely store this token
💡 Tips for Telegram Setup
- Choose a recognizable username for your Clawra bot
- Keep the API token secret and secure
- You can always change your bot's details later through BotFather
.env File Configuration
Add your API keys to Clawra's configuration file
Creating Your .env File
Clawra uses a .env file to store API keys securely. Follow these steps:
- Navigate to your Clawra directory
- Look for a file named
.env.example - Copy it:
cp .env.example .env - Edit the
.envfile with your API keys
Add your API keys like this:
XAI_API_KEY=your_xai_api_key_here
# fal.ai API Key (fast API access to xAI)
FAL_API_KEY=your_fal_api_key_here
# Discord Bot Token (if using Discord)
DISCORD_TOKEN=your_discord_bot_token_here
# Telegram Bot Token (if using Telegram)
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
# WhatsApp Token (if using WhatsApp)
WHATSAPP_TOKEN=your_whatsapp_token_here
# Slack Token (if using Slack)
SLACK_TOKEN=your_slack_token_here
# Signal Token (if using Signal)
SIGNAL_TOKEN=your_signal_token_here
# Microsoft Teams Token (if using Teams)
TEAMS_TOKEN=your_teams_token_here
Note: Only include the tokens for platforms you're using. Replace the placeholder text with your actual API keys.
Security Best Practices
Keep your API keys and Clawra installation secure
🔒 Security Guidelines
- Never commit .env to git: The .env file should be in .gitignore
- Keep tokens secret: Don't share your API keys publicly
- Rotate keys regularly: Change API keys periodically for better security
- Monitor usage: Check API dashboards for unusual activity
- Use environment variables: Never hardcode API keys in source code
- Secure your system: Ensure your machine has proper security measures
💾 Backup Your Keys
Store copies of your API keys in a secure, encrypted password manager. This ensures you can recover them if needed.
🔄 Key Rotation
Periodically generate new API keys and update your .env file. This is a security best practice for all API usage.
Testing Your API Keys
After configuring your API keys, test that everything works:
- Start Clawra with
npm startoryarn start - Check for any error messages in the console
- Send a message to Clawra on your chosen platform
- Verify Clawra responds
- Test selfie generation by saying "I want to see you"
✅ Success Indicators
- No API key errors in the console
- Clawra responds to messages
- Selfies generate successfully (if xAI and fal.ai keys are configured)
Common API Issues & Solutions
Troubleshooting API configuration problems
❌ "Invalid API Key" Error
Solution: Verify the API key is correctly copied without extra spaces. Check that the key hasn't expired or been revoked.
❌ Selfie Generation Fails
Solution: Ensure both xAI and fal.ai API keys are configured. Selfie generation requires both services.
❌ Bot Won't Start
Solution: Check that .env file exists and contains valid tokens. Verify OpenClaw is running first.
❌ Platform Connection Issues
Solution: Verify bot token is correct and bot has necessary permissions. Check platform-specific setup guides.
API Configuration Complete!
Your API keys are now configured. Next, set up your chosen messaging platform.
Platform Setup Guide →