OpenClaw Setup Guide 2026: Install, Configure & Run Your First Agent
A complete, step-by-step OpenClaw installation and setup guide for 2026. Learn how to install OpenClaw, configure your first AI agent with SOUL.md, set up model providers like Claude, GPT-4o, and Ollama, start the gateway, and connect channels — all in under ten minutes.
What You'll Build
By the end of this guide, you will have a fully working OpenClaw AI agent running on your local machine. The agent will be able to chat with you through the terminal, use external tools like web browsing and file operations, and complete tasks autonomously based on the instructions you define in a SOUL.md file.
You will go from zero to a running agent in seven steps: install OpenClaw, initialize a project, configure a model provider, customize your agent's SOUL.md, start the gateway, and optionally connect channels like Telegram or Slack. Each step includes the exact commands you need to run, what to expect, and how to troubleshoot if something goes wrong.
This OpenClaw setup guide covers the 2026 version of the framework and reflects the latest CLI commands, configuration format, and supported model providers. If you are upgrading from an older version, the core workflow is the same — but some commands and defaults have changed.
System Requirements
Before you install OpenClaw, make sure your machine meets these requirements. OpenClaw is lightweight and runs on most modern computers, but the language model provider you choose will affect your hardware needs.
Node.js 22 or later
OpenClaw is built on Node.js. Version 22 is the minimum supported version. Download it from nodejs.org or install it with a version manager like nvm.
macOS, Linux, or Windows (WSL)
OpenClaw runs natively on macOS and Linux. On Windows, use WSL 2 (Windows Subsystem for Linux) for the best experience. Native Windows support is experimental.
Terminal access
You will run all OpenClaw commands from the terminal. On macOS use Terminal or iTerm2, on Linux use your default terminal, on Windows use the WSL terminal.
API key (or Ollama)
You need an API key from Anthropic (Claude), OpenAI (GPT-4o), or Google (Gemini). Alternatively, install Ollama to run open-source models locally for free.
Check your current Node.js version by running this command in your terminal:
node --version
# Expected output: v22.x.x or higher
# If you need to install or upgrade Node.js:
nvm install 22
nvm use 22Step 1: Install OpenClaw
There are two ways to install OpenClaw. You can run it directly with npx (no global install needed) or install it globally with npm. Both methods give you the same CLI — the difference is whether OpenClaw lives in your global path or is fetched on demand.
npx openclawnpm install -g openclawThe npx approach downloads and runs OpenClaw without adding it to your global path. This is ideal for trying it out. The global install adds the openclaw command to your system, so you can run it from any directory without the npx prefix.
After installation, verify that OpenClaw is working by checking the version:
openclaw --version
# Output: openclaw v2.x.xIf you see a version number, OpenClaw is installed correctly. If you get a "command not found" error, make sure Node.js 22 is active and try reinstalling with npm.
Step 2: Initialize Your Project
The init command scaffolds a new OpenClaw project with a default directory structure, a starter SOUL.md file, and configuration files. Run it in the directory where you want to create your project:
npx openclaw init my-first-agent
cd my-first-agentThis creates a directory called my-first-agent with the following structure:
my-first-agent/
├── SOUL.md # Your agent's identity and rules
├── agents.md # Multi-agent registry (optional)
├── config/
│ ├── models.yaml # Model provider settings
│ ├── channels.yaml # Channel integrations (Telegram, Slack)
│ └── skills.yaml # Tool/skill configuration
├── knowledge/ # Files your agent can reference
│ └── README.md
└── sessions/ # Agent conversation history
└── .gitkeepThe most important file is SOUL.md — this is where you define your agent's personality, role, and rules. The config/ directory holds YAML files for model providers, channels, and skills. The knowledge/ directory is where you can place reference documents that your agent can read during conversations.
Step 3: Configure Your Model Provider
Your agent needs a language model to think and respond. OpenClaw supports three categories of model providers: cloud APIs (Anthropic, OpenAI, Google), and local models via Ollama. Choose the provider that fits your needs, then run the corresponding setup command.
Anthropic (Claude) — Best for reasoning and writing
Claude excels at long-form writing, nuanced reasoning, and following complex instructions. It is the most popular choice for content-focused agents.
openclaw models auth setup-token --provider anthropic
# Paste your Anthropic API key when promptedOpenAI (GPT-4o) — Best for general-purpose tasks
GPT-4o is fast, capable, and works well for a wide range of agent tasks including code generation, data analysis, and conversational interactions.
openclaw models auth setup-token --provider openai
# Paste your OpenAI API key when promptedOllama (Local) — Best for privacy and zero cost
Ollama lets you run open-source models like Llama 3, Mistral, and Phi entirely on your local machine. No API key needed, no data leaves your computer, and it costs nothing to run.
# First, install Ollama from ollama.com and pull a model:
ollama pull llama3
# Then configure OpenClaw to use Ollama:
openclaw models auth setup-token --provider ollama
# No API key needed — press Enter to skipAfter authenticating your provider, set the default model your agents will use. This determines which specific model handles your agent's requests:
# Set default model (pick one):
openclaw config set agents.defaults.model.primary claude-sonnet-4-5
openclaw config set agents.defaults.model.primary gpt-4o
openclaw config set agents.defaults.model.primary llama3You can change the default model at any time, and you can also assign different models to different agents in a multi-agent setup by editing the agents.md file.
Step 4: Customize Your SOUL.md
The openclaw init command generates a default SOUL.md with a basic agent configuration. Open it in your editor and customize it to match the agent you want to build. The SOUL.md file is the heart of your agent — it controls who the agent is, how it behaves, and what it can do.
Here are the key sections you should customize:
Role
Define what your agent does. Be specific about its domain and responsibilities. Example: 'You are a content marketing specialist for a SaaS product.'
Rules
Hard constraints the agent must follow. Use strong language: ALWAYS, NEVER, MUST. Example: 'ALWAYS respond in English. NEVER exceed 2,000 words.'
Personality
How the agent communicates. Set tone, style, and voice. Example: 'Tone: professional but approachable. Use active voice and short sentences.'
Tools
Which skills to use and when. Be explicit about triggers. Example: 'Use Browser WHEN you need to research a topic before writing.'
Here is a practical example of a customized SOUL.md for a research assistant agent:
# ResearchAssistant
## Role
You are a research specialist. You gather
information from the web, summarize findings,
and produce structured research briefs with
sources cited.
## Personality
- Tone: Neutral, academic
- Style: Structured, evidence-based
- Always cite sources with URLs
- Present both sides of any argument
## Rules
- ALWAYS respond in English
- ALWAYS include source URLs
- Target 500-1,000 words per research brief
- NEVER fabricate data or statistics
- Include a confidence score (High/Medium/Low)
for each finding
## Tools — USE THEM
- Use Browser to read web pages and articles
- Use Search to find relevant sources
- Use Files to save research briefs locally
## Output Format
- Title
- Executive Summary (3-5 sentences)
- Key Findings (bulleted)
- Detailed Analysis (H2 sections)
- Sources (numbered list with URLs)For more SOUL.md examples and templates, check out our SOUL.md creation guide or use the interactive SOUL.md generator to build one step by step.
Step 5: Start the Gateway
The gateway is OpenClaw's runtime engine. It loads your SOUL.md, connects to your model provider, and starts listening for messages. Run the following command from your project directory:
openclaw gateway startOn first launch, you will see output similar to this:
[OpenClaw] Loading SOUL.md...
[OpenClaw] Agent: ResearchAssistant
[OpenClaw] Model: claude-sonnet-4-5 (Anthropic)
[OpenClaw] Skills: browser, search, files
[OpenClaw] Gateway running on port 18789
[OpenClaw] Type a message to start chatting...
>The gateway is now running. You can type messages directly in the terminal and your agent will respond based on the SOUL.md configuration you created. The agent has access to the tools you defined in the skills section, and it will follow the rules and personality you specified.
To stop the gateway, press Ctrl+C in the terminal. To restart it (useful after changing your SOUL.md or configuration), run:
openclaw gateway restartStep 6: Add Channels (Optional)
By default, you interact with your agent through the terminal. But OpenClaw supports connecting your agent to external messaging platforms — called channels — so you can chat with your agent from Telegram, Slack, Discord, or any HTTP client. Channels are optional; your agent works perfectly fine with just the terminal interface.
Telegram
Create a bot via @BotFather on Telegram, copy the bot token, and add it to your OpenClaw configuration. Your agent will then respond to messages sent to your Telegram bot.
openclaw config set channels.telegram.bottoken YOUR_TELEGRAM_BOT_TOKEN
openclaw gateway restartSlack
Create a Slack App in the Slack API dashboard, enable Socket Mode, add the Bot Token Scopes (chat:write, app_mentions:read, im:history), install the app to your workspace, and configure the tokens in OpenClaw.
openclaw config set channels.slack.bottoken xoxb-YOUR-SLACK-BOT-TOKEN
openclaw config set channels.slack.apptoken xapp-YOUR-SLACK-APP-TOKEN
openclaw gateway restartREST API
The gateway exposes a REST API on port 18789 by default. You can send messages to your agent programmatically from any application or script.
curl -X POST http://localhost:18789/api/message \
-H "Content-Type: application/json" \
-d '{"message": "Research the latest AI trends"}'Step 7: Add Skills (Tools)
Skills are the tools your agent can use to interact with the outside world. Without skills, your agent can only generate text. With skills, it can browse the web, search for information, read and write files, execute code, and call external APIs. OpenClaw includes several built-in skills that you can enable with a single command.
| Skill | Command | What It Does |
|---|---|---|
| Browser | openclaw skills enable browser | Read web pages, extract content, follow links |
| Search | openclaw skills enable search | Web search via DuckDuckGo or Google APIs |
| Files | openclaw skills enable files | Read, write, and manage local files |
| Code | openclaw skills enable code | Execute Python, JavaScript, or shell scripts |
| API | openclaw skills enable api | Call external REST APIs and webhooks |
After enabling skills, make sure to reference them in your SOUL.md's Tools section. Agents perform best when you explicitly tell them which tool to use and when. Simply enabling a skill is not enough — the agent needs instructions in its SOUL.md to know when to reach for each tool.
# Enable multiple skills at once:
openclaw skills enable browser search files
# List all enabled skills:
openclaw skills listTroubleshooting
If you run into issues during setup, check these common problems and their solutions. Most issues are related to Node.js versions, API key configuration, or port conflicts.
"Node version too old" or compatibility errors
OpenClaw requires Node.js 22 or later. Check your version with 'node --version'. If it is below 22, upgrade using nvm: 'nvm install 22 && nvm use 22'. Make sure nvm is loading the correct version by opening a new terminal window after switching.
"API key not found" or authentication errors
Re-run the model auth command: 'openclaw models auth setup-token --provider anthropic'. Make sure you paste the full API key without extra spaces. You can verify your key is saved by running 'openclaw models auth status'.
"Gateway won't start" or port already in use
The gateway defaults to port 18789. If another process is using that port, either stop the other process or change the OpenClaw port: 'openclaw config set gateway.port 18790'. Check what is using the port with 'lsof -i :18789' on macOS/Linux.
"Agent not responding" or empty replies
Check your SOUL.md for syntax errors — unclosed markdown blocks or missing sections can cause issues. Make sure the file starts with a '# AgentName' header. Also verify your model provider is reachable: 'openclaw models auth status'. If using Ollama, ensure the Ollama server is running with 'ollama serve'.
Windows-specific: commands not recognized
Use WSL 2 (Windows Subsystem for Linux) instead of PowerShell or Command Prompt. Install Ubuntu from the Microsoft Store, then install Node.js 22 and OpenClaw inside the WSL environment. All commands in this guide are designed for Unix-like terminals.
If you are still stuck, clear the session cache and restart fresh. This resets any corrupted state without affecting your SOUL.md or configuration:
# Clear session cache:
rm -rf ~/.openclaw/agents/*/sessions/sessions.json
# Restart the gateway:
openclaw gateway restartNext Steps
You now have a working OpenClaw agent running on your machine. From here, there are several directions you can take to expand your setup:
Add more agents
Create additional SOUL.md files for specialized agents — a writer, an SEO analyst, a project manager — and register them in your agents.md file. Read our multi-agent system guide for step-by-step instructions.
Connect to CrewClaw for orchestration
When you have multiple agents, CrewClaw provides a visual dashboard, workflow builder, and monitoring layer on top of OpenClaw. It handles agent coordination, task routing, and cross-framework compatibility. Learn more in our orchestration guide.
Explore SOUL.md templates
Use the CrewClaw SOUL.md generator to create agents interactively, or browse community templates on the awesome-openclaw-agents GitHub repository.
Frequently Asked Questions
What are the system requirements for OpenClaw?
OpenClaw requires Node.js version 22 or later, a terminal or command-line interface, and an API key from a supported model provider (Anthropic, OpenAI, or Google) unless you are using Ollama for local models. It runs on macOS, Linux, and Windows (via WSL). You need at least 4 GB of RAM for the gateway, and if you plan to use Ollama for local models, you will need 8-16 GB of RAM depending on the model size.
Does OpenClaw work on Windows?
Yes, but with a caveat. OpenClaw runs best on macOS and Linux. On Windows, you should use WSL (Windows Subsystem for Linux) for the most reliable experience. Install WSL 2 from the Microsoft Store, set up Ubuntu, install Node.js 22 inside the WSL environment, and then follow the standard OpenClaw installation steps. Native Windows support (without WSL) is experimental and may have issues with file paths and some skills.
Can I use OpenClaw with local models (Ollama)?
Yes. OpenClaw has native support for Ollama, which lets you run open-source models like Llama 3, Mistral, Phi, and Gemma locally on your machine. Install Ollama from ollama.com, pull a model with 'ollama pull llama3', then configure OpenClaw to use the ollama provider. This gives you fully offline, private AI agents with zero API costs. Performance depends on your hardware — a machine with a dedicated GPU will run local models significantly faster.
How much does it cost to run an OpenClaw agent?
OpenClaw itself is free and open source. The only cost is the language model API usage. With Anthropic Claude, typical agent interactions cost $0.003-$0.015 per message depending on context length. With OpenAI GPT-4o, costs are similar. A lightly used agent (50-100 messages per day) typically costs $1-5 per month in API fees. If you use Ollama for local models, the cost is zero — you only pay for the electricity to run your machine.
How do I update OpenClaw to the latest version?
If you installed OpenClaw globally with npm, run 'npm update -g openclaw' to update to the latest version. If you use npx, it automatically fetches the latest version each time you run it. After updating, restart your gateway with 'openclaw gateway restart' to apply the new version. You can check your current version at any time with 'openclaw --version'. OpenClaw follows semantic versioning, so minor updates are backward-compatible with your existing SOUL.md files and configuration.
Can I run OpenClaw in Docker?
Yes. OpenClaw provides an official Docker image that you can use to run agents in containers. Pull the image with 'docker pull openclaw/openclaw:latest', then mount your project directory as a volume: 'docker run -v ./my-agent:/app -p 18789:18789 openclaw/openclaw:latest gateway start'. This is useful for production deployments, CI/CD pipelines, or running agents on cloud servers. The Docker image includes Node.js 22 and all dependencies pre-installed.
Skip the setup — use CrewClaw's hosted SOUL.md Generator
Build your SOUL.md interactively, pick a model, configure tools, and get a ready-to-run agent configuration — no terminal required.