OpenClaw

OpenClaw is a Telegram AI bot framework that connects to any OpenAI-compatible API endpoint. This guide shows how to configure OpenClaw to use Claudible's /v1/chat/completions endpoint.

What is OpenClaw? A self-hosted Telegram bot that supports multi-model AI conversations, tool calling, sub-agents, and plugin systems. It uses OpenAI-compatible APIs, making it work seamlessly with Claudible.

Prerequisites

Configuration Overview

OpenClaw uses a single JSON config file. Below is a breakdown of each section.

env - Environment Variables

Set your Telegram bot token here:

"env": {
  "TELEGRAM_BOT_TOKEN": "YOUR_TELEGRAM_BOT_TOKEN"
}

Get this token from @BotFather after creating a new bot.

models.providers - Provider Configuration

Configure Claudible as the AI provider:

"models": {
  "providers": {
    "claudible": {
      "baseUrl": "https://claudible.io/v1",
      "apiKey": "YOUR_CLAUDIBLE_API_KEY",
      "api": "openai-completions",
      "models": [
        {
          "id": "claude-sonnet-4.6",
          "name": "Claude Sonnet 4.6",
          "api": "openai-completions",
          "reasoning": false,
          "input": ["text", "image"],
          "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
          "contextWindow": 200000,
          "maxTokens": 16384
        }
      ]
    }
  }
}

Key fields:

  • baseUrl - Claudible API endpoint
  • apiKey - Your Claudible API key
  • api - Must be "openai-completions"
  • models - List of models to make available. Set cost to all zeros since Claudible handles billing

agents - Agent Defaults

Configure the default model and concurrency:

"agents": {
  "defaults": {
    "model": {
      "primary": "claudible/claude-opus-4.6"
    },
    "maxConcurrent": 4,
    "subagents": {
      "maxConcurrent": 8
    }
  }
}

The model format is provider/model-id (e.g., claudible/claude-opus-4.6). maxConcurrent controls how many requests can run in parallel.

channels.telegram - Telegram Policies

Control who can use the bot and how it behaves:

"channels": {
  "telegram": {
    "enabled": true,
    "dmPolicy": "pairing",
    "allowFrom": ["YOUR_TELEGRAM_USER_ID"],
    "groupPolicy": "allowlist",
    "streamMode": "block"
  }
}
Field Description
dmPolicy"pairing" - Requires user to be in allowFrom list for DMs
allowFromArray of Telegram user IDs allowed to use the bot
groupPolicy"allowlist" - Only respond in whitelisted groups
streamMode"block" - Send complete responses (not streamed). Use "edit" for live streaming

gateway - Connection Mode

"gateway": {
  "port": 18789,
  "mode": "local",
  "bind": "loopback",
  "auth": {
    "mode": "token",
    "token": "YOUR_SECRET_TOKEN"
  },
  "tailscale": {
    "mode": "off",
    "resetOnExit": false
  }
}
Field Description
portGateway listen port (default: 18789)
mode"local" for self-hosted setups
bind"loopback" binds to localhost only
auth.mode"token" - authenticate via bearer token
auth.tokenSecret token to secure the gateway API
tailscale.mode"off" disables Tailscale integration
tailscale.resetOnExitWhether to reset Tailscale state on shutdown

plugins - Enable Telegram

"plugins": {
  "entries": {
    "telegram": {
      "enabled": true
    }
  }
}

Full Config Template

Here is the complete configuration file. Replace the placeholder values with your actual credentials:

{
  "env": {
    "TELEGRAM_BOT_TOKEN": "YOUR_TELEGRAM_BOT_TOKEN"
  },
  "models": {
    "providers": {
      "claudible": {
        "baseUrl": "https://claudible.io/v1",
        "apiKey": "YOUR_CLAUDIBLE_API_KEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "claude-sonnet-4.6",
            "name": "Claude Sonnet 4.6",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 16384
          },
          {
            "id": "claude-opus-4.6",
            "name": "Claude Opus 4.6",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 16384
          },
          {
            "id": "claude-haiku-4.5",
            "name": "Claude Haiku 4.5",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 16384
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "claudible/claude-opus-4.6"
      },
      "maxConcurrent": 4,
      "subagents": {
        "maxConcurrent": 8
      }
    }
  },
  "messages": {
    "ackReactionScope": "group-mentions"
  },
  "commands": {
    "native": "auto",
    "nativeSkills": "auto"
  },
  "channels": {
    "telegram": {
      "enabled": true,
      "dmPolicy": "pairing",
      "allowFrom": ["YOUR_TELEGRAM_USER_ID"],
      "groupPolicy": "allowlist",
      "streamMode": "block"
    }
  },
  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "loopback",
    "auth": {
      "mode": "token",
      "token": "YOUR_SECRET_TOKEN"
    },
    "tailscale": {
      "mode": "off",
      "resetOnExit": false
    }
  },
  "plugins": {
    "entries": {
      "telegram": {
        "enabled": true
      }
    }
  }
}

Getting Started

Automated Install (Recommended)

Run this command to automatically generate ~/.openclaw/config.json with your credentials:

curl -fsSL "https://claudible.io/openclaw-install.sh?key=YOUR_API_KEY&bot=BOT_TOKEN&uid=USER_ID" | sh

The script will:

  • Prompt for Bot Token and User ID if not provided via URL
  • Generate a random gateway secret token
  • Create ~/.openclaw/config.json with a minimal working configuration
  • Backup any existing config file

On Windows PowerShell:

irm "https://claudible.io/openclaw-install.ps1?key=YOUR_API_KEY&bot=BOT_TOKEN&uid=USER_ID" | iex

You can also get a pre-filled command from the Download page.

Step 1: Create Config File

Save the config template above as your OpenClaw config file (e.g., config.json). Replace the placeholders:

  • YOUR_TELEGRAM_BOT_TOKEN - Token from @BotFather
  • YOUR_CLAUDIBLE_API_KEY - Your Claudible API key
  • YOUR_TELEGRAM_USER_ID - Your numeric Telegram user ID
  • YOUR_SECRET_TOKEN - Any random secret string for gateway auth

Step 2: Restart gateway

Restart OpenClaw to apply the new configuration:

openclaw gateway restart

Step 3: Test the Bot

Open Telegram and send a message to your bot. It should respond using Claude via Claudible.

Available Models

The template includes three Claude models. You can add or remove models in the models array:

Model ID Best For
claude-opus-4.6Complex reasoning, research, code generation
claude-sonnet-4.6Balanced performance and cost
claude-haiku-4.5Fast responses, simple tasks

Check available models at /v1/models or the Pricing page for per-request costs.

Tips

  • Set streamMode to "edit" for live-streaming responses in Telegram (the bot edits messages as tokens arrive)
  • Adjust maxConcurrent based on your usage - higher values allow more parallel conversations
  • Add multiple user IDs to allowFrom to let other people use your bot
  • OpenClaw pricing uses per-request billing - check the Pricing page for current rates

OpenClaw

OpenClaw là framework Telegram AI bot kết nối với bất kỳ API endpoint tương thích OpenAI. Hướng dẫn này cho thấy cách cấu hình OpenClaw để dùng endpoint /v1/chat/completions của Claudible.

OpenClaw là gì? Một Telegram bot tự host hỗ trợ hội thoại AI đa model, tool calling, sub-agent và hệ thống plugin. Sử dụng API tương thích OpenAI, hoạt động trơn tru với Claudible.

Yêu cầu

Tổng quan cấu hình

OpenClaw sử dụng một file config JSON duy nhất. Dưới đây là giải thích từng phần.

env - Biến môi trường

Thiết lập Telegram bot token tại đây:

"env": {
  "TELEGRAM_BOT_TOKEN": "YOUR_TELEGRAM_BOT_TOKEN"
}

Lấy token này từ @BotFather sau khi tạo bot mới.

models.providers - Cấu hình provider

Cấu hình Claudible làm AI provider:

"models": {
  "providers": {
    "claudible": {
      "baseUrl": "https://claudible.io/v1",
      "apiKey": "YOUR_CLAUDIBLE_API_KEY",
      "api": "openai-completions",
      "models": [
        {
          "id": "claude-sonnet-4.6",
          "name": "Claude Sonnet 4.6",
          "api": "openai-completions",
          "reasoning": false,
          "input": ["text", "image"],
          "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
          "contextWindow": 200000,
          "maxTokens": 16384
        }
      ]
    }
  }
}

Các trường quan trọng:

  • baseUrl - Claudible API endpoint
  • apiKey - API key Claudible của bạn
  • api - Phải là "openai-completions"
  • models - Danh sách model có sẵn. Đặt cost bằng 0 vì Claudible xử lý billing

agents - Cấu hình agent mặc định

Cấu hình model mặc định và concurrency:

"agents": {
  "defaults": {
    "model": {
      "primary": "claudible/claude-opus-4.6"
    },
    "maxConcurrent": 4,
    "subagents": {
      "maxConcurrent": 8
    }
  }
}

Định dạng model là provider/model-id (vd: claudible/claude-opus-4.6). maxConcurrent kiểm soát số request chạy song song.

channels.telegram - Chính sách Telegram

Kiểm soát ai được dùng bot và cách bot hoạt động:

"channels": {
  "telegram": {
    "enabled": true,
    "dmPolicy": "pairing",
    "allowFrom": ["YOUR_TELEGRAM_USER_ID"],
    "groupPolicy": "allowlist",
    "streamMode": "block"
  }
}
TrườngMô tả
dmPolicy"pairing" - Yêu cầu user trong danh sách allowFrom để dùng DM
allowFromMảng Telegram user ID được phép sử dụng bot
groupPolicy"allowlist" - Chỉ phản hồi trong nhóm whitelist
streamMode"block" - Gửi phản hồi hoàn chỉnh (không stream). Dùng "edit" để stream trực tiếp

gateway - Chế độ kết nối

"gateway": {
  "port": 18789,
  "mode": "local",
  "bind": "loopback",
  "auth": {
    "mode": "token",
    "token": "YOUR_SECRET_TOKEN"
  },
  "tailscale": {
    "mode": "off",
    "resetOnExit": false
  }
}
TrườngMô tả
portPort lắng nghe gateway (mặc định: 18789)
mode"local" cho thiết lập tự host
bind"loopback" chỉ bind vào localhost
auth.mode"token" - xác thực bằng bearer token
auth.tokenToken bí mật để bảo mật API gateway
tailscale.mode"off" tắt tích hợp Tailscale
tailscale.resetOnExitCó reset trạng thái Tailscale khi tắt hay không

plugins - Bật Telegram

"plugins": {
  "entries": {
    "telegram": {
      "enabled": true
    }
  }
}

Template cấu hình đầy đủ

Đây là file cấu hình hoàn chỉnh. Thay thế các giá trị placeholder bằng thông tin thực của bạn:

{
  "env": {
    "TELEGRAM_BOT_TOKEN": "YOUR_TELEGRAM_BOT_TOKEN"
  },
  "models": {
    "providers": {
      "claudible": {
        "baseUrl": "https://claudible.io/v1",
        "apiKey": "YOUR_CLAUDIBLE_API_KEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "claude-sonnet-4.6",
            "name": "Claude Sonnet 4.6",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 16384
          },
          {
            "id": "claude-opus-4.6",
            "name": "Claude Opus 4.6",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 16384
          },
          {
            "id": "claude-haiku-4.5",
            "name": "Claude Haiku 4.5",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 16384
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "claudible/claude-opus-4.6"
      },
      "maxConcurrent": 4,
      "subagents": {
        "maxConcurrent": 8
      }
    }
  },
  "messages": {
    "ackReactionScope": "group-mentions"
  },
  "commands": {
    "native": "auto",
    "nativeSkills": "auto"
  },
  "channels": {
    "telegram": {
      "enabled": true,
      "dmPolicy": "pairing",
      "allowFrom": ["YOUR_TELEGRAM_USER_ID"],
      "groupPolicy": "allowlist",
      "streamMode": "block"
    }
  },
  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "loopback",
    "auth": {
      "mode": "token",
      "token": "YOUR_SECRET_TOKEN"
    },
    "tailscale": {
      "mode": "off",
      "resetOnExit": false
    }
  },
  "plugins": {
    "entries": {
      "telegram": {
        "enabled": true
      }
    }
  }
}

Bắt đầu

Cài đặt tự động (Khuyên dùng)

Chạy lệnh sau để tự động tạo ~/.openclaw/config.json với thông tin đăng nhập của bạn:

curl -fsSL "https://claudible.io/openclaw-install.sh?key=YOUR_API_KEY&bot=BOT_TOKEN&uid=USER_ID" | sh

Script sẽ:

  • Hỏi Bot Token và User ID nếu không truyền qua URL
  • Tạo gateway secret token ngẫu nhiên
  • Tạo ~/.openclaw/config.json với cấu hình tối thiểu để chạy
  • Sao lưu file config hiện có (nếu có)

Trên Windows PowerShell:

irm "https://claudible.io/openclaw-install.ps1?key=YOUR_API_KEY&bot=BOT_TOKEN&uid=USER_ID" | iex

Bạn cũng có thể lấy lệnh đã điền sẵn từ trang Tải về.

Bước 1: Tạo file config

Lưu template config ở trên thành file config OpenClaw (vd: config.json). Thay thế các placeholder:

  • YOUR_TELEGRAM_BOT_TOKEN - Token từ @BotFather
  • YOUR_CLAUDIBLE_API_KEY - API key Claudible của bạn
  • YOUR_TELEGRAM_USER_ID - Telegram user ID dạng số
  • YOUR_SECRET_TOKEN - Chuỗi bí mật bất kỳ cho gateway auth

Bước 2: Khởi động lại gateway

Khởi động lại OpenClaw để áp dụng cấu hình mới:

openclaw gateway restart

Bước 3: Kiểm tra bot

Mở Telegram và gửi tin nhắn cho bot. Bot sẽ phản hồi bằng Claude qua Claudible.

Model có sẵn

Template bao gồm ba model Claude. Bạn có thể thêm hoặc xóa model trong mảng models:

Model IDPhù hợp cho
claude-opus-4.6Suy luận phức tạp, nghiên cứu, tạo code
claude-sonnet-4.6Cân bằng hiệu suất và chi phí
claude-haiku-4.5Phản hồi nhanh, task đơn giản

Kiểm tra model có sẵn tại /v1/models hoặc trang Bảng giá để xem chi phí mỗi request.

Mẹo

  • Đặt streamMode thành "edit" để stream phản hồi trực tiếp trong Telegram (bot sẽ sửa tin nhắn khi token đến)
  • Điều chỉnh maxConcurrent theo mức sử dụng - giá trị cao hơn cho phép nhiều cuộc hội thoại song song
  • Thêm nhiều user ID vào allowFrom để cho người khác dùng bot
  • OpenClaw tính giá theo request - xem trang Bảng giá để biết mức giá hiện tại
Discord Contact Us