Skip to content

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.

  • The openclaw CLI installed on your machine.
  • API keys for your chosen provider (such as Anthropic, Gemini, or Moonshot).

To get started without the interactive prompts, use the --non-interactive flag. I recommend this baseline example for a local setup using Anthropic:

Terminal window
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-skills

If you want a machine-readable summary of the setup, you can add the --json flag to the command.

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

Terminal window
openclaw onboard --non-interactive \
--mode local \
--auth-choice gemini-api-key \
--gemini-api-key "$GEMINI_API_KEY" \
--gateway-port 18789 \
--gateway-bind loopback

Cloudflare AI Gateway Setup

Terminal window
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 loopback

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:

Terminal window
openclaw agents add work \
--workspace ~/.openclaw/workspace-work \
--model openai/gpt-5.2 \
--bind whatsapp:biz \
--non-interactive \
--json

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.

OpenClaw

OpenClaw Expert

Still stuck?

If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.