> For the complete documentation index, see [llms.txt](https://docs.tensorx.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tensorx.ai/ai-agents-and-chatbots/moltbot.md).

# OpenClaw

Configure OpenClaw to use TensorX for its model requests.

***

## What is OpenClaw?

[OpenClaw](https://openclaw.ai) is a self-hosted agent gateway for messaging platforms. TensorX is configured as a custom model provider.

***

## Prerequisites

* **Node.js** >= 22 ([download here](https://nodejs.org/))
* **macOS, Linux, or Windows** (PowerShell installer available)
* A TensorX API key ([sign up here](https://app.tensorx.ai/register))

***

## Installation

### Step 1: Install OpenClaw

{% tabs %}
{% tab title="macOS / Linux / WSL2" %}

```bash
curl -fsSL https://openclaw.ai/install.sh | bash
```

{% endtab %}

{% tab title="Windows (PowerShell)" %}

```powershell
iwr -useb https://openclaw.ai/install.ps1 | iex
```

{% endtab %}

{% tab title="npm" %}

```bash
npm install -g openclaw@latest
```

{% endtab %}
{% endtabs %}

Verify installation:

```bash
openclaw --version
```

***

## Configuration

### Step 2: Run the Onboarding Wizard

```bash
openclaw onboard --install-daemon
```

The wizard guides you through auth, gateway settings, and optional channels. Accept the defaults to get started quickly.

### Step 3: Configure TensorX as a Custom Provider

OpenClaw uses a JSON5 config file at `~/.openclaw/openclaw.json`. Add TensorX as a custom provider:

```json5
// ~/.openclaw/openclaw.json
{
  models: {
    providers: {
      tensorx: {
        api: "openai-completions",
        baseUrl: "https://api.tensorx.ai/v1",
        apiKey: "${TENSORX_API_KEY}",
      }
    }
  },
  agents: {
    defaults: {
      model: "tensorx/<MODEL_ID>",
      models: {
        "tensorx/<MODEL_ID>": { alias: "primary" },
      }
    }
  }
}
```

Replace `<MODEL_ID>` with an ID returned by `GET /v1/models`.

{% hint style="warning" %}
**Override the default base URL.** OpenClaw points at `api.z.ai` out of the box. The `baseUrl: "https://api.tensorx.ai/v1"` line above overrides that default — make sure it is set so requests reach TensorX rather than the default endpoint.
{% endhint %}

Then set your API key in `~/.openclaw/.env`:

```bash
echo 'TENSORX_API_KEY=your-tensorx-api-key-here' >> ~/.openclaw/.env
```

{% hint style="warning" %}
**Important:** Replace `your-tensorx-api-key-here` with your actual TensorX API key from [app.tensorx.ai](https://app.tensorx.ai/dashboard).
{% endhint %}

### Step 4: Restart the Gateway

```bash
openclaw gateway restart
```

### Step 5: Verify Setup

```bash
# Check gateway status
openclaw gateway status

# Open the Control UI in your browser
openclaw dashboard
```

The Control UI opens at `http://127.0.0.1:18789/`. Send a test message to verify the connection.

***

## Model selection

Call `GET /v1/models` with your TensorX API key and use one of the returned IDs. If the integration depends on a capability or token limit, query `GET /v1/model/info` before selecting the model. See [Models](/api-reference/models.md) for examples.

***

## Adding Chat Channels

OpenClaw supports WhatsApp, Telegram, Discord, Slack, iMessage, Signal, Google Chat, Mattermost, MS Teams, IRC, and more.

### WhatsApp

```bash
openclaw channels login
```

Scan the QR code in **WhatsApp → Settings → Linked Devices**, then approve the pairing:

```bash
openclaw pairing approve whatsapp WA-XXXXX
```

### Telegram

1. Create a bot via [@BotFather](https://t.me/BotFather) and copy the bot token
2. Add to `~/.openclaw/.env`:

   ```bash
   TELEGRAM_BOT_TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
   ```
3. Restart and approve pairing:

   ```bash
   openclaw gateway restart
   openclaw pairing approve telegram TG-XXXXX
   ```

### Discord

1. Create a bot at the [Discord Developer Portal](https://discord.com/developers/applications) and copy the token
2. Add to `~/.openclaw/.env`:

   ```bash
   DISCORD_BOT_TOKEN=your_discord_bot_token_here
   ```
3. Restart the gateway:

   ```bash
   openclaw gateway restart
   ```

{% hint style="info" %}
See the [OpenClaw channels documentation](https://docs.openclaw.ai/channels/telegram) for setup guides for all supported platforms.
{% endhint %}

***

## Multi-Agent Routing

Run multiple agents with different models for different purposes:

```json5
// ~/.openclaw/openclaw.json
{
  agents: {
    list: [
      { id: "coder", model: "tensorx/z-ai/glm-5.3", default: true },
      { id: "thinker", model: "tensorx/deepseek/deepseek-v4-pro-0813" },
    ],
    defaults: {
      // ... provider config from above
    }
  },
  bindings: [
    { match: { channel: "telegram" }, agent: "thinker" },
    { match: { channel: "whatsapp" }, agent: "coder" },
  ]
}
```

***

## Common Commands

```bash
# Gateway
openclaw gateway status           # Check status
openclaw gateway start            # Start gateway
openclaw gateway stop             # Stop gateway
openclaw gateway restart          # Restart gateway
openclaw dashboard                # Open Control UI
openclaw doctor                   # Diagnose issues

# Channels & Pairing
openclaw channels login                       # Connect a channel
openclaw pairing list                         # List pending pairings
openclaw pairing approve <channel> <code>     # Approve pairing

# Configuration
openclaw configure                # Interactive config wizard
openclaw config get <key>         # Read a config value
openclaw config set <key> <val>   # Set a config value
```

***

## Troubleshooting

### Gateway Won't Start

```bash
# Check if the port is in use
lsof -i :18789

# Run diagnostics
openclaw doctor
```

### No Response from Model

1. Verify your TensorX API key works:

   ```bash
   curl https://api.tensorx.ai/v1/models \
     -H "Authorization: Bearer YOUR_TENSORX_KEY"
   ```
2. Check your config for typos:

   ```bash
   openclaw config get models.providers.tensorx
   ```
3. Restart the gateway:

   ```bash
   openclaw gateway restart
   ```

### Channel Not Working

```bash
# Check gateway logs
openclaw logs

# Verify channel status
openclaw channels status
```

***

Use OpenClaw's pairing system to prevent unauthorized usage that would consume your credits.

***

## Resources

* **OpenClaw Documentation:** [docs.openclaw.ai](https://docs.openclaw.ai/)
* **OpenClaw GitHub:** [github.com/openclaw/openclaw](https://github.com/openclaw/openclaw)
* **TensorX Models:** [tensorx.ai/models](https://tensorx.ai/models)
* **TensorX Dashboard:** [app.tensorx.ai](https://app.tensorx.ai/dashboard)

***

## FAQ

**Q: Do I need an Anthropic or OpenAI account?**

No. A TensorX API key is sufficient for the TensorX provider.

**Q: Can I switch between models on the fly?**

Yes. Use `/model <alias>` in a chat to switch models, for example `/model reasoning`.

**Q: Can I switch back to Claude or another provider later?**

Yes. Update the `models.providers` section in `~/.openclaw/openclaw.json` to point to a different provider, or add multiple providers and switch between them.

**Q: Which model should I use?**

Call `GET /v1/models` for the IDs available to the key. Use `GET /v1/model/info` when the selection depends on a capability or token limit.

***

**Need help?** Contact <support@tensorx.ai> or check the [OpenClaw documentation](https://docs.openclaw.ai/).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.tensorx.ai/ai-agents-and-chatbots/moltbot.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
