> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-staging.joytokens.ai/llms.txt.

# OpenClaw

> Use OpenClaw with JoyToken

## Prerequisites

| Item             | Value                       |
| ---------------- | --------------------------- |
| OpenClaw version | `2026.6.11`                 |
| Config file      | `~/.openclaw/openclaw.json` |
| Provider id      | `joytoken`                  |
| Model name       | `joytoken/auto`             |
| API key env      | `JOY_TOKEN_API_KEY`         |

OpenClaw supports both protocols. Select the same protocol for the base URL, onboarding compatibility mode, and JoyToken check.

## Step 1: Install

```bash
npm install -g openclaw@2026.6.11
openclaw --version
```

## Step 2: Set the API key and base URL

#### OpenAI

```bash
export JOY_TOKEN_API_KEY="sk-xxx"
export JOY_TOKEN_OPENAI_BASE_URL="https://api-staging.joytokens.ai/openai/v1"
```

#### Anthropic

```bash
export JOY_TOKEN_API_KEY="sk-xxx"
export JOY_TOKEN_ANTHROPIC_BASE_URL="https://api-staging.joytokens.ai/anthropic/v1"
```

For persistent use, add the selected variables to your shell profile.

## Step 3: Register the provider

#### OpenAI

```bash
openclaw onboard \
  --non-interactive \
  --accept-risk \
  --auth-choice custom-api-key \
  --custom-provider-id joytoken \
  --custom-base-url "$JOY_TOKEN_OPENAI_BASE_URL" \
  --custom-compatibility openai \
  --custom-model-id auto \
  --custom-api-key "$JOY_TOKEN_API_KEY" \
  --skip-channels \
  --skip-daemon \
  --skip-skills \
  --skip-search \
  --skip-ui \
  --skip-health
```

#### Anthropic

```bash
openclaw onboard \
  --non-interactive \
  --accept-risk \
  --auth-choice custom-api-key \
  --custom-provider-id joytoken \
  --custom-base-url "$JOY_TOKEN_ANTHROPIC_BASE_URL" \
  --custom-compatibility anthropic \
  --custom-model-id auto \
  --custom-api-key "$JOY_TOKEN_API_KEY" \
  --skip-channels \
  --skip-daemon \
  --skip-skills \
  --skip-search \
  --skip-ui \
  --skip-health
```

## Step 4: Confirm the config

```bash
cat ~/.openclaw/openclaw.json
```

The provider should contain `joytoken/auto` and the API value for the selected tab:

#### OpenAI

```json
{
  "models": {
    "providers": {
      "joytoken": {
        "baseUrl": "https://api-staging.joytokens.ai/openai/v1",
        "api": "openai-completions"
      }
    }
  }
}
```

#### Anthropic

```json
{
  "models": {
    "providers": {
      "joytoken": {
        "baseUrl": "https://api-staging.joytokens.ai/anthropic/v1",
        "api": "anthropic-messages"
      }
    }
  }
}
```

## Step 5: Verify

```bash
openclaw models status
```

Expected output includes `joytoken/auto`. Run one request:

```bash
openclaw infer model run \
  --local \
  --model joytoken/auto \
  --prompt "Reply with exactly: pong" \
  --json
```

A successful response includes `pong`.

## JoyToken Check

#### OpenAI

| Place | Expected result                               |
| ----- | --------------------------------------------- |
| Logs  | Request path is `/openai/v1/chat/completions` |
| Auth  | Bearer authentication                         |
| Usage | Tokens and credits are recorded               |

#### Anthropic

| Place | Expected result                          |
| ----- | ---------------------------------------- |
| Logs  | Request path is `/anthropic/v1/messages` |
| Auth  | `x-api-key` authentication               |
| Usage | Tokens and credits are recorded          |

## Common Errors

| Error                                | Fix                                                                                   |
| ------------------------------------ | ------------------------------------------------------------------------------------- |
| `custom-api-key` argument is missing | Install `openclaw@2026.6.11`                                                          |
| Default model is not `joytoken/auto` | Run `openclaw onboard` again                                                          |
| `401 Unauthorized`                   | Set `JOY_TOKEN_API_KEY` again                                                         |
| No JoyToken logs                     | Check the selected `baseUrl`, `api`, and default model in `~/.openclaw/openclaw.json` |

## Resources

* [JoyToken API Guide](/open-api/api-guides/overview)
* [JoyToken Authentication](/user-guide/authentication)
* [JoyToken Usage & Billing](/user-guide/usage-billing)