Langsung ke konten utama

Otomasi CLI

Gunakan --non-interactive untuk mengotomatiskan openclaw onboard.
--json tidak menyiratkan mode non-interaktif. Gunakan --non-interactive (dan --workspace) untuk skrip.

Contoh dasar non-interaktif

openclaw onboard --non-interactive \
  --mode local \
  --auth-choice apiKey \
  --anthropic-api-key "$ANTHROPIC_API_KEY" \
  --secret-input-mode plaintext \
  --gateway-port 18789 \
  --gateway-bind loopback \
  --install-daemon \
  --daemon-runtime node \
  --skip-skills
Tambahkan --json untuk ringkasan yang dapat dibaca mesin. Gunakan --secret-input-mode ref untuk menyimpan referensi berbasis env dalam profil auth alih-alih nilai plaintext. Pemilihan interaktif antara referensi env dan referensi provider yang dikonfigurasi (file atau exec) tersedia dalam alur onboarding. Dalam mode ref non-interaktif, env var provider harus disetel di lingkungan proses. Meneruskan flag key inline tanpa env var yang cocok sekarang akan langsung gagal. Contoh:
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice openai-api-key \
  --secret-input-mode ref \
  --accept-risk

Contoh khusus provider

openclaw onboard --non-interactive \
  --mode local \
  --auth-choice apiKey \
  --anthropic-api-key "$ANTHROPIC_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice gemini-api-key \
  --gemini-api-key "$GEMINI_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice zai-api-key \
  --zai-api-key "$ZAI_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice ai-gateway-api-key \
  --ai-gateway-api-key "$AI_GATEWAY_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
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
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice moonshot-api-key \
  --moonshot-api-key "$MOONSHOT_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice mistral-api-key \
  --mistral-api-key "$MISTRAL_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice synthetic-api-key \
  --synthetic-api-key "$SYNTHETIC_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice opencode-zen \
  --opencode-zen-api-key "$OPENCODE_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
Ganti ke --auth-choice opencode-go --opencode-go-api-key "$OPENCODE_API_KEY" untuk katalog Go.
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice ollama \
  --custom-model-id "qwen3.5:27b" \
  --accept-risk \
  --gateway-port 18789 \
  --gateway-bind loopback
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice custom-api-key \
  --custom-base-url "https://llm.example.com/v1" \
  --custom-model-id "foo-large" \
  --custom-api-key "$CUSTOM_API_KEY" \
  --custom-provider-id "my-custom" \
  --custom-compatibility anthropic \
  --gateway-port 18789 \
  --gateway-bind loopback
--custom-api-key bersifat opsional. Jika dihilangkan, onboarding memeriksa CUSTOM_API_KEY.Varian mode ref:
export CUSTOM_API_KEY="your-key"
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice custom-api-key \
  --custom-base-url "https://llm.example.com/v1" \
  --custom-model-id "foo-large" \
  --secret-input-mode ref \
  --custom-provider-id "my-custom" \
  --custom-compatibility anthropic \
  --gateway-port 18789 \
  --gateway-bind loopback
Dalam mode ini, onboarding menyimpan apiKey sebagai { source: "env", provider: "default", id: "CUSTOM_API_KEY" }.
Setup-token Anthropic tetap tersedia sebagai jalur token onboarding yang didukung, tetapi OpenClaw sekarang lebih memilih penggunaan ulang Claude CLI bila tersedia. Untuk produksi, lebih baik gunakan API key Anthropic.

Tambahkan agent lain

Gunakan openclaw agents add <name> untuk membuat agent terpisah dengan workspace, sesi, dan profil auth miliknya sendiri. Menjalankan tanpa --workspace akan meluncurkan wizard.
openclaw agents add work \
  --workspace ~/.openclaw/workspace-work \
  --model openai/gpt-5.4 \
  --bind whatsapp:biz \
  --non-interactive \
  --json
Apa yang disetel:
  • agents.list[].name
  • agents.list[].workspace
  • agents.list[].agentDir
Catatan:
  • Workspace default mengikuti ~/.openclaw/workspace-<agentId>.
  • Tambahkan bindings untuk merutekan pesan masuk (wizard dapat melakukannya).
  • Flag non-interaktif: --model, --agent-dir, --bind, --non-interactive.

Dokumen terkait