OverpayingForAIPricing desk

Lesson 3 of 3 · 6 min read · Beginner

Setting up your first OpenClaw bot

A recorded terminal walkthrough of the shape a first OpenClaw setup takes: cloning the project, adding a model API key, and starting the gateway.

In this lesson you will

  • Follow a realistic first-setup command sequence
  • Know where the model API key goes and why it's kept out of the code
  • Understand what to check once the bot reports itself as running

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

A first OpenClaw setup, start to finish

Three things happen here: getting the code, telling it which model to use, and starting it up.

recorded session — not a live shell0 / 5
  1. git clone https://github.com/openclaw/openclaw.git && cd openclawDownloads the project's source code to your machine, same as any open-source repo.
  2. npm installInstalls OpenClaw's own dependencies — nothing model-specific happens yet.
  3. 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.
  4. 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.
  5. 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. 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. 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. 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?

Lesson FAQ

How do I set up OpenClaw?

Clone the project's repository, install its dependencies, add a model provider's API key to a local .env config file (never into the code itself), and start the gateway. Exact commands vary by release — check the project's own README for the current setup steps.

Where does the API key go when setting up OpenClaw?

Into a local .env configuration file, kept out of version control, never hardcoded into the project's source. That key is billed the instant the bot starts processing real messages.

Finished reading?

Mark it done to track your progress through the course.

Save progress across devices

Get a private link that restores your lessons on any device. Email is optional and only used to send you the link.

Compare, calculate, decide

If our calculators helped you cut down on hidden AI wallet leaks, thanks for using them. A tiny fraction of your savings is what keeps our pricing indexes updated daily.

Not sure which AI is cheapest for your use case? Find out in 30 seconds — no signup required.

AI cost intelligence

Stop overpaying for AI tools

Join the OverpayingForAI list for pricing updates, cheaper alternatives, and practical buying guidance.

Now tracking 50+ AI tools, models, platforms, subscriptions, coding tools, and automation products.

We use your email only for OverpayingForAI updates. Unsubscribe anytime.