Skip to main content

Building Plugins

Plugins extend OpenClaw with new capabilities: channels, model providers, speech, image generation, web search, agent tools, or any combination. You do not need to add your plugin to the OpenClaw repository. Publish to ClawHub or npm and users install with openclaw plugins install <package-name>. OpenClaw tries ClawHub first and falls back to npm automatically.

Prerequisites

  • Node >= 22 and a package manager (npm or pnpm)
  • Familiarity with TypeScript (ESM)
  • For in-repo plugins: repository cloned and pnpm install done

What kind of plugin?

Channel plugin

Connect OpenClaw to a messaging platform (Discord, IRC, etc.)

Provider plugin

Add a model provider (LLM, proxy, or custom endpoint)

Tool / hook plugin

Register agent tools, event hooks, or services — continue below

Quick start: tool plugin

This walkthrough creates a minimal plugin that registers an agent tool. Channel and provider plugins have dedicated guides linked above.
1

Create the package and manifest

Every plugin needs a manifest, even with no config. See Manifest for the full schema.
2

Write the entry point

definePluginEntry is for non-channel plugins. For channels, use defineChannelPluginEntry — see Channel Plugins. For full entry point options, see Entry Points.
3

Test and publish

External plugins: publish to ClawHub or npm, then install:
OpenClaw checks ClawHub first, then falls back to npm.In-repo plugins: place under extensions/ — automatically discovered.

Plugin capabilities

A single plugin can register any number of capabilities via the api object: For the full registration API, see SDK Overview.

Registering agent tools

Tools are typed functions the LLM can call. They can be required (always available) or optional (user opt-in):
Users enable optional tools in config:
  • Tool names must not clash with core tools (conflicts are skipped)
  • Use optional: true for tools with side effects or extra binary requirements
  • Users can enable all tools from a plugin by adding the plugin id to tools.allow

Import conventions

Always import from focused openclaw/plugin-sdk/<subpath> paths:
For the full subpath reference, see SDK Overview. Within your plugin, use local barrel files (api.ts, runtime-api.ts) for internal imports — never import your own plugin through its SDK path.

Pre-submission checklist

package.json has correct openclaw metadata
openclaw.plugin.json manifest is present and valid
Entry point uses defineChannelPluginEntry or definePluginEntry
All imports use focused plugin-sdk/<subpath> paths
Internal imports use local modules, not SDK self-imports
Tests pass (pnpm test -- extensions/my-plugin/)
pnpm check passes (in-repo plugins)

Next steps

Channel Plugins

Build a messaging channel plugin

Provider Plugins

Build a model provider plugin

SDK Overview

Import map and registration API reference

Runtime Helpers

TTS, search, subagent via api.runtime

Testing

Test utilities and patterns

Plugin Manifest

Full manifest schema reference