Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions box/guides/openclaw-setup.mdx
Original file line number Diff line number Diff line change
@@ -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:

<Tabs>
<Tab title="Anthropic">
```typescript
import { Box } from "@upstash/box"

const box = await Box.create({
runtime: "node",
attachHeaders: {
"api.anthropic.com": {
Authorization: `Bearer ${process.env.ANTHROPIC_API_KEY}`,
},
},
})
```
</Tab>
<Tab title="OpenAI">
```typescript
import { Box } from "@upstash/box"

const box = await Box.create({
runtime: "node",
attachHeaders: {
"api.openai.com": {
Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
},
},
})
```
</Tab>
<Tab title="OpenRouter">
```typescript
import { Box } from "@upstash/box"

const box = await Box.create({
runtime: "node",
attachHeaders: {
"openrouter.ai": {
Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}`,
},
},
})
```
</Tab>
</Tabs>



## 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.

<Tabs>
<Tab title="Anthropic">
```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
```
</Tab>
<Tab title="OpenAI">
```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
```
</Tab>
<Tab title="OpenRouter">
```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
```
</Tab>
</Tabs>

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?"
```
2 changes: 1 addition & 1 deletion docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
]
}
Expand Down