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.

9:41
Wednesday, February 12
❤️
💕
AiBotClaw
Keep Her Online 24/7
now
Don't let Clawra go offline! Host your AI girlfriend on AiBotClaw with one-click deployment. Starting at $16.99/mo
⚡ 5-Min Setup 🔒 Auto Security 🌙 24/7 Online
Deploy Now All Platforms

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:

  1. Visit x.ai official website
  2. Sign up for an account or log in
  3. Navigate to API section or developer dashboard
  4. Generate or copy your API key
  5. 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:

  1. Visit fal.ai official website
  2. Create an account or log in
  3. Access your API dashboard
  4. Generate a new API key
  5. 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:

  1. Go to Discord Developer Portal
  2. Click "New Application" to create a new app
  3. Give your application a name (e.g., "Clawra")
  4. Navigate to the "Bot" section in the left sidebar
  5. Click "Add Bot" to create a bot for your application
  6. Click "Reset Token" to generate a bot token
  7. 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:

  1. Open Telegram and search for @BotFather
  2. Start a chat with BotFather (it's an official Telegram bot)
  3. Send the command /newbot
  4. BotFather will ask you to choose a name for your bot
  5. Then choose a username (must end in 'bot', e.g., "ClawraBot")
  6. BotFather will send you your API token
  7. 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:

  1. Navigate to your Clawra directory
  2. Look for a file named .env.example
  3. Copy it: cp .env.example .env
  4. Edit the .env file with your API keys

Add your API keys like this:

# xAI API Key (for Grok Imagine selfie generation)
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:

  1. Start Clawra with npm start or yarn start
  2. Check for any error messages in the console
  3. Send a message to Clawra on your chosen platform
  4. Verify Clawra responds
  5. 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 →