This is a recorded walkthrough, not a live terminal — it shows the shape of a real first setup so you know what to expect, not the exact commands for your specific OS or OpenClaw version (check the project's own README for those, since setup commands change between releases).
Three things happen here: getting the code, telling it which model to use, and starting it up.
git clone https://github.com/openclaw/openclaw.git && cd openclawDownloads the project's source code to your machine, same as any open-source repo.npm installInstalls OpenClaw's own dependencies — nothing model-specific happens yet.cp .env.example .envCreates a local config file for secrets. This file is where the model API key goes — never in the code itself, and never committed to a public repo.echo 'OPENROUTER_API_KEY=sk-or-...' >> .envAdds a model API key to the local .env file. OpenRouter is shown here because it can route to almost any model with one key; you could instead point this directly at a single provider's key.npm run startStarts the gateway. Once you see "connected" and "listening," the bot is live in whatever server you configured — send it a message to confirm it replies before doing anything more.
Clone the project, install dependencies, add a model API key, and start the gateway.
After first start, check these three things
- 1
It replies at all
Send one test message in the connected server and confirm you get a reply — this confirms the model connection works.
- 2
It's not costing more than expected
Check the model provider's usage dashboard after a day of normal traffic against lesson 2's per-1,000-reply estimate.
- 3
Its permissions are scoped
Confirm the bot only has access to the channels/servers you intended — a gateway with broad platform permissions is a bigger blast radius if the key or config leaks.
Knowledge check
Right after running `npm run start` for the first time with a brand-new API key, what's the most important thing to do before letting the bot loose on a busy server?