diff --git a/box/guides/openclaw-setup.mdx b/box/guides/openclaw-setup.mdx new file mode 100644 index 00000000..3c4977de --- /dev/null +++ b/box/guides/openclaw-setup.mdx @@ -0,0 +1,110 @@ +--- +title: "OpenClaw Setup" +--- +This guide covers a basic setup to run [OpenClaw](https://docs.openclaw.ai/start/wizard-cli-automation) inside an Upstash Box. For advanced non-interactive configuration options, refer to the [full CLI automation docs](https://docs.openclaw.ai/start/wizard-cli-automation). + +--- + +## 1. Create box + +Create a `node` box with [attach headers](/box/overall/security#attach-headers) for the LLM provider your OpenClaw agent will call. + +In the console, use **Settings > Attach headers**, or set `attachHeaders` in code: + + + +```typescript +import { Box } from "@upstash/box" + +const box = await Box.create({ + runtime: "node", + attachHeaders: { + "api.anthropic.com": { + Authorization: `Bearer ${process.env.ANTHROPIC_API_KEY}`, + }, + }, +}) +``` + + +```typescript +import { Box } from "@upstash/box" + +const box = await Box.create({ + runtime: "node", + attachHeaders: { + "api.openai.com": { + Authorization: `Bearer ${process.env.OPENAI_API_KEY}`, + }, + }, +}) +``` + + +```typescript +import { Box } from "@upstash/box" + +const box = await Box.create({ + runtime: "node", + attachHeaders: { + "openrouter.ai": { + Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}`, + }, + }, +}) +``` + + + + + +## 2. Install OpenClaw + +Install the OpenClaw CLI globally inside the box. + +```bash +sudo npm i -g openclaw +``` + + + +## 3. Run onboarding + +Configure OpenClaw non-interactively for your provider. This sets up the local gateway and authentication without requiring any interactive prompts. + + + +```bash +openclaw onboard --non-interactive --accept-risk --mode local --auth-choice apiKey --anthropic-api-key "dummy" --gateway-port 18789 --gateway-bind loopback --skip-skills --skip-health +``` + + +```bash +openclaw onboard --non-interactive --accept-risk --mode local --auth-choice openai-api-key --openai-api-key "dummy" --gateway-port 18789 --gateway-bind loopback --skip-skills --skip-health +``` + + +```bash +openclaw onboard --non-interactive --accept-risk --mode local --auth-choice custom-api-key --custom-base-url "https://openrouter.ai/api/v1" --custom-model-id "anthropic/claude-sonnet-4-6" --custom-api-key "dummy" --custom-provider-id "openrouter" --custom-compatibility anthropic --gateway-port 18789 --gateway-bind loopback --skip-skills --skip-health +``` + + + +See the [CLI automation docs](https://docs.openclaw.ai/start/wizard-cli-automation) for the full list of flags and options. + + + +## 4. Start the gateway and chat with your agent + +Start the OpenClaw gateway in the background, verify it's healthy, then send your first message to the agent. + +```bash +# Start the gateway in the background +openclaw gateway run & + +# Verify it's running +openclaw gateway health + +# Chat with your agent +openclaw agent --agent main --message "hello, are you there?" +``` diff --git a/docs.json b/docs.json index 4b6673c6..9b79ea33 100644 --- a/docs.json +++ b/docs.json @@ -1592,7 +1592,7 @@ "box/overall/security", { "group": "Guides", - "pages": ["box/guides/code-review-agent"] + "pages": ["box/guides/code-review-agent", "box/guides/openclaw-setup"] } ] }