Skip to main content
OpenClaw /

OpenClaw

A self-hosted personal AI assistant that can browse the web, run commands, and connect to chat platforms like Slack, Discord, and Telegram.

Coding Agents
Versionlatest
InterfaceWeb UI
GPUOptional
Securely deploy OpenClaw on Laboratory OS.

OpenClaw

Laboratory OS Installation Details

Environment

Working Directory/workspace/openclaw

Environment Variables

APP_DIRECTORY
/workspace/openclaw
PORT
<assigned at runtime>
OPENCLAW_PROVIDER_URLBase URL for the model provider API (e.g., http://localhost:8000/v1)
OPENCLAW_API_KEYAPI key/token for the model provider. Leave blank for local providers that do not require authentication.
OPENCLAW_MODEL_IDModel identifier to use with the provider (e.g., llama-3.3-70b, gpt-4o)
OPENCLAW_API_TYPEAPI compatibility type. Use "openai-completions" for OpenAI-compatible endpoints or "anthropic-messages" for Anthropic-compatible endpoints.
openai-completions
OPENCLAW_GATEWAY_TOKENToken to secure access to the OpenClaw gateway API. If not set, a random token will be generated.

Install & Run

install-and-run.sh
#!/bin/bash
set -e

export PATH="/opt/conda/bin:/root/.local/bin:$PATH"

# Create the directory if it doesn't exist
mkdir -p "/workspace/openclaw"
  
# Change to the app directory
cd "/workspace/openclaw"


# Environment setup complete
echo "Environment setup complete!"

npm install -g openclaw@latest

# Configure gateway settings
openclaw config set gateway.mode "local"
openclaw config set gateway.auth.mode "token"
GATEWAY_TOKEN="${OPENCLAW_GATEWAY_TOKEN:-openclaw-local}"
openclaw config set gateway.auth.token "$GATEWAY_TOKEN"
openclaw config set gateway.remote.token "$GATEWAY_TOKEN"
openclaw config set gateway.trustedProxies '["127.0.0.1"]'
openclaw config set gateway.bind "lan"
openclaw config set gateway.port "$PORT"
openclaw config set gateway.controlUi.allowedOrigins '["*"]'

# Configure custom provider if all required vars are set
if [ -n "$OPENCLAW_PROVIDER_URL" ] && [ -n "$OPENCLAW_MODEL_ID" ]; then
  API_TYPE="${OPENCLAW_API_TYPE:-openai-completions}"
  API_KEY_VALUE="${OPENCLAW_API_KEY:-local}"

  cat > /tmp/openclaw-provider.json <<PROVIDER_EOF
{"baseUrl": "${OPENCLAW_PROVIDER_URL}", "apiKey": "${API_KEY_VALUE}", "api": "${API_TYPE}", "models": [{"id": "${OPENCLAW_MODEL_ID}", "name": "Custom Model"}]}
PROVIDER_EOF
  openclaw config set models.providers.custom "$(cat /tmp/openclaw-provider.json)"
  openclaw config set agents.defaults.model.primary "custom/${OPENCLAW_MODEL_ID}"
  rm -f /tmp/openclaw-provider.json
fi

# Background process to auto-approve device requests for out-of-the-box usability
(
  set +e
  sleep 5
  while true; do
    PENDING=$(openclaw devices list 2>&1 | grep -oE "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}" | head -1)
    if [ -n "$PENDING" ]; then
      openclaw devices approve "$PENDING" 2>&1 || true
    fi
    sleep 2
  done
) &
APPROVER_PID=$!

# Start gateway
openclaw gateway $OPENLAB_EXTRA_ARGS &
GATEWAY_PID=$!

# Wait for gateway process
wait $GATEWAY_PID
kill $APPROVER_PID 2>/dev/null || true

CLI Command

cli.sh
# OpenClaw
exec openclaw