Skip to main content
Illustration by Annie Ruygt of some little characters walking along To deploy OpenClaw to Fly.io, download the deploy package and run the script. It handles everything — app creation, volumes, secrets, and deployment. Download Deploy Package
You’ll need flyctl installed, a Fly.io account (free trial works), and an LLM API key (Anthropic, OpenAI, Google Gemini, OpenRouter, Moonshot AI, or MiniMax).

What is OpenClaw?

OpenClaw is an open-source AI agent gateway that lets you run a persistent AI assistant reachable from anywhere — Discord, Telegram, Slack, or your local CLI. It manages conversations, tool use, and connections across multiple channels through a single gateway process.

How it works

The deploy package sets up a wrapper server that manages the OpenClaw gateway and provides a browser-based setup wizard:
All state lives on a persistent volume mounted at /data, so your configuration, conversation history, and installed tools survive restarts and redeployments. The script will prompt you for:
  1. App name — defaults to openclaw-XXXX (random suffix). This becomes your URL: https://your-app-name.fly.dev
  2. Region — where to run your Machine (defaults to iad / Virginia). Pick one close to you for lower latency. See Fly.io regions for the full list.
  3. Setup password — protects the /setup wizard from the internet. Pick something strong.
  4. LLM provider — choose from Anthropic, OpenAI, Google Gemini, OpenRouter, Moonshot AI, or MiniMax
  5. LLM API key — the key for your chosen provider
  6. Channel tokens (optional) — Discord bot token, Telegram bot token, or Slack bot + app tokens if you want to connect chat channels
The script then creates a Fly app, provisions a persistent volume, sets your credentials as encrypted Fly secrets, and builds and deploys the Docker image on Fly’s remote builders. The first deploy takes a few minutes. Your credentials never leave your machine — they go directly to Fly.io via flyctl.

Post-deploy setup

Once deployment completes, the script prints your app details:

Setup wizard

Visit https://your-app-name.fly.dev/setup in your browser. Log in with any username and the setup password you chose. From the wizard you can:
  • Change your LLM provider and API key
  • Add or update Discord, Telegram, and Slack channel connections
  • Edit the raw OpenClaw config file
  • Run debug commands against the gateway
  • Export and import configuration backups
  • Approve device pairing requests

Connect your local CLI

If you have OpenClaw installed locally, point it at your remote gateway:
This lets you use the openclaw CLI on your laptop while the gateway runs on Fly.io, keeping conversations and state persistent even when your laptop is closed.

Configuration

Secrets

All sensitive values are stored as Fly secrets, encrypted at rest and injected as environment variables at boot. They are never visible in logs, config files, or the Fly dashboard. To update a secret after deployment:
The Machine restarts automatically when secrets change.

VM sizing

The default configuration uses a shared-cpu-2x Machine with 4 GB RAM, which costs roughly $20–25/month when running continuously. With auto-stop enabled (the default), you only pay for time the Machine is actually running. To adjust resources:

Persistent storage

OpenClaw stores all state on a Fly Volume mounted at /data. This includes:
  • openclaw.json — gateway configuration
  • Conversation history and context
  • Installed tools and plugins
  • npm/pnpm caches for user-installed packages
The default volume size is 1 GB. To extend it:

Useful commands

Troubleshooting

“SETUP_PASSWORD is not set” The setup password secret is missing. Set it:
Out of memory / crashes Increase the Machine’s memory:
Gateway won’t start Visit /setup in your browser and check the debug console for errors. Common causes: invalid API key, missing config file, or a corrupted state directory. Lock file errors If the gateway didn’t shut down cleanly, stale lock files can prevent it from starting:
Need to start fresh Use the “Reset” button in the setup wizard to clear the config and re-run onboarding, or SSH in and remove the config:

Supported LLM providers

You can switch providers at any time through the setup wizard — no redeployment needed.