Automating Your openclaw Setup with the CLI
I hate clicking through setup wizards when I am trying to automate my environment. It is frustrating to run a command and have it hang because it is waiting for me to pick an option or paste a key. If you are building scripts to set up your dev machine or a new environment, you need a way to skip the chatty parts and just get the work done.
What You’ll Need
Section titled “What You’ll Need”- The
openclawCLI installed on your machine. - API keys for your chosen provider (such as Anthropic, Gemini, or Moonshot).
Quick Start
Section titled “Quick Start”To get started without the interactive prompts, use the --non-interactive flag. I recommend this baseline example for a local setup using Anthropic:
openclaw onboard --non-interactive \ --mode local \ --auth-choice apiKey \ --anthropic-api-key "$ANTHROPIC_API_KEY" \ --gateway-port 18789 \ --gateway-bind loopback \ --install-daemon \ --daemon-runtime node \ --skip-skillsIf you want a machine-readable summary of the setup, you can add the --json flag to the command.
Using Other Providers
Section titled “Using Other Providers”If you use a different provider, you just need to swap the --auth-choice and the specific API key flag. Here are two common examples:
Gemini Setup
openclaw onboard --non-interactive \ --mode local \ --auth-choice gemini-api-key \ --gemini-api-key "$GEMINI_API_KEY" \ --gateway-port 18789 \ --gateway-bind loopbackCloudflare AI Gateway Setup
openclaw onboard --non-interactive \ --mode local \ --auth-choice cloudflare-ai-gateway-api-key \ --cloudflare-ai-gateway-account-id "your-account-id" \ --cloudflare-ai-gateway-gateway-id "your-gateway-id" \ --cloudflare-ai-gateway-api-key "$CLOUDFLARE_AI_GATEWAY_API_KEY" \ --gateway-port 18789 \ --gateway-bind loopbackAdding New Agents
Section titled “Adding New Agents”You can also script the creation of separate agents. Use the openclaw agents add <name> command with the --workspace and --non-interactive flags to avoid the setup wizard:
openclaw agents add work \ --workspace ~/.openclaw/workspace-work \ --model openai/gpt-5.2 \ --bind whatsapp:biz \ --non-interactive \ --jsonTroubleshooting
Section titled “Troubleshooting”I have seen developers run into issues where the CLI still waits for input even after adding the --json flag. Keep in mind that --json does not mean the command is non-interactive. You must always include the --non-interactive flag (and usually --workspace) if you are running these commands in a script.
If you run into other specific configuration blocks, you can ask the AI Setup Assistant for help.
What’s Next
Section titled “What’s Next”OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.