Skip to main content
PhoneClaw requires several API keys to function properly. This guide walks you through setting up the necessary authentication tokens.

Moondream Authentication

PhoneClaw uses the Moondream API for visual AI capabilities, including screen element detection and image analysis.

Getting Your Moondream Auth Token

  1. Sign up for a Moondream API account at Moondream
  2. Navigate to your API dashboard
  3. Copy your authentication token

Setting Up MOONDREAM_AUTH

You need to add your Moondream authentication token to your project’s Gradle properties.
The MOONDREAM_AUTH token is required for PhoneClaw’s visual AI features to work. Without it, screen element detection will fail.
Create or edit local.properties in your project root:
MOONDREAM_AUTH=your_moondream_auth_token_here
Never commit local.properties to version control. This file should remain local to your development machine.

Option 2: Using gradle.properties

Alternatively, add it to gradle.properties:
MOONDREAM_AUTH=your_moondream_auth_token_here

How It Works

The MOONDREAM_AUTH token is loaded during the build process in app/build.gradle.kts:20-23:
val moondreamAuth = (project.findProperty("MOONDREAM_AUTH") as String?)
    ?.replace("\"", "\\\"")
    ?: ""
buildConfigField("String", "MOONDREAM_AUTH", "\"$moondreamAuth\"")
This makes the token available at runtime via BuildConfig.MOONDREAM_AUTH.

OpenRouter API Key

PhoneClaw uses OpenRouter for AI model access. While the model selection is configurable in the app, you may need an OpenRouter API key for premium models.

Setting Up OpenRouter

  1. Create an account at OpenRouter
  2. Generate an API key from your dashboard
  3. Configure it in your environment or directly in the app
Some models like “Llama 4 Maverick (Free)” don’t require payment, but you still need an OpenRouter account.

Firebase Configuration (Optional)

Firebase is optional but provides cloud features like remote debugging and device management. Firebase can be configured following the Android Studio Firebase setup wizard.

Verifying Your Configuration

After setting up your API keys:
  1. Clean and rebuild your project:
    ./gradlew clean build
    
  2. Check the build output for any configuration warnings
  3. Launch the app - it should initialize without authentication errors

Troubleshooting

If you see build errors about missing MOONDREAM_AUTH:
  1. Verify the property is set in local.properties or gradle.properties
  2. Ensure there are no extra spaces or quotes around the token
  3. Try a clean rebuild: ./gradlew clean build

Token Not Working

  • Verify your Moondream token is still valid
  • Check that the token was copied correctly without any trailing whitespace
  • Ensure your Moondream account has sufficient API credits

Security Best Practices

Never commit API keys to version control!Add these lines to your .gitignore:
local.properties
app/google-services.json
*.env
  • Use local.properties for sensitive credentials
  • Rotate your API keys periodically
  • Never share your authentication tokens
  • Consider using environment variables in CI/CD pipelines

Next Steps