Automatisation CLI

Utilisez --non-interactive pour automatiser openclaw onboard.

Remarque : --json n’implique pas le mode non interactif. Utilisez --non-interactive (et --workspace) pour les scripts.

Exemple non interactif de base

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

Ajoutez --json pour obtenir un résumé lisible par machine.

Utilisez --secret-input-mode ref pour stocker des références basées sur des variables d’environnement dans les profils d’authentification au lieu de valeurs en clair. La sélection interactive entre les références env et les références de fournisseur configurées (file ou exec) est disponible dans le flux de l’assistant d’onboarding.

En mode non interactif ref, les variables d’environnement des fournisseurs doivent être définies dans l’environnement du processus. Passer des flags de clé inline sans la variable d’environnement correspondante provoque désormais un échec immédiat.

Exemple :

openclaw onboard --non-interactive \
  --mode local \
  --auth-choice openai-api-key \
  --secret-input-mode ref \
  --accept-risk

Exemples par fournisseur

Exemple Gemini
```bash
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice gemini-api-key \
  --gemini-api-key "$GEMINI_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
```
Exemple Z.AI
```bash
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice zai-api-key \
  --zai-api-key "$ZAI_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
```
Exemple Vercel AI Gateway
```bash
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
```
Exemple Cloudflare AI Gateway
```bash
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
```
Exemple Moonshot
```bash
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice moonshot-api-key \
  --moonshot-api-key "$MOONSHOT_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
```
Exemple Mistral
```bash
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice mistral-api-key \
  --mistral-api-key "$MISTRAL_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
```
Exemple Synthetic
```bash
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice synthetic-api-key \
  --synthetic-api-key "$SYNTHETIC_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
```
Exemple OpenCode
```bash
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice opencode-zen \
  --opencode-zen-api-key "$OPENCODE_API_KEY" \
  --gateway-port 18789 \
  --gateway-bind loopback
```
Remplacez par `--auth-choice opencode-go --opencode-go-api-key "$OPENCODE_API_KEY"` pour le catalogue Go.
Exemple Ollama
```bash
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice ollama \
  --custom-model-id "qwen3.5:27b" \
  --accept-risk \
  --gateway-port 18789 \
  --gateway-bind loopback
```
Exemple fournisseur personnalisé
```bash
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` est optionnel. En son absence, l'onboarding vérifie `CUSTOM_API_KEY`.

Variante en mode référence :

```bash
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
```

Dans ce mode, l'onboarding stocke `apiKey` sous la forme `{ source: "env", provider: "default", id: "CUSTOM_API_KEY" }`.

Ajouter un autre agent

Utilisez openclaw agents add <name> pour créer un agent séparé avec son propre espace de travail, ses sessions et ses profils d’authentification. L’exécution sans --workspace lance l’assistant.

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

Ce qui est défini :

  • agents.list[].name
  • agents.list[].workspace
  • agents.list[].agentDir

Notes :

  • Les espaces de travail par défaut suivent le schéma ~/.openclaw/workspace-<agentId>.
  • Ajoutez des bindings pour router les messages entrants (l’assistant peut s’en charger).
  • Flags non interactifs : --model, --agent-dir, --bind, --non-interactive.

Documentation associée