openclaw/plugin-sdk:
Plugin API
TheOpenClawPluginApi is passed to your plugin’s register and activate functions.
Properties
string
Plugin identifier (e.g.,
"matrix", "my-plugin")string
Plugin display name
string
Plugin version from package.json
string
Plugin description
string
Absolute path to the plugin entry point
OpenClawConfig
OpenClaw configuration object. Access via
api.config.channels, api.config.agents, etc.Record<string, unknown>
Plugin-specific configuration from
config.json under plugins.entries[id].configPluginRuntime
Runtime services for media, messaging, logging, and more. See Runtime Services.
PluginLogger
Scoped logger for plugin messages:
Registration Methods
(tool: AnyAgentTool | OpenClawPluginToolFactory, opts?: OpenClawPluginToolOptions) => void
Register an agent tool. Tools are exposed to the LLM and can be called during agent runs.Options:
name?: string- Tool name overridenames?: string[]- Multiple tool names (for tool factories)optional?: boolean- Require explicit allowlisting in agent config
(events: string | string[], handler: InternalHookHandler, opts?: OpenClawPluginHookOptions) => void
Register a lifecycle hook. Hooks intercept events at key points in the message lifecycle.See Hooks for available events.
(registration: OpenClawPluginChannelRegistration | ChannelPlugin) => void
(service: OpenClawPluginService) => void
Register a background service. Services run persistent background tasks.
(params: { path: string; handler: OpenClawPluginHttpRouteHandler }) => void
Register an HTTP route for webhooks or custom endpoints.Routes are automatically normalized to prevent conflicts.
(handler: OpenClawPluginHttpHandler) => void
Register a global HTTP handler. Handlers are called for all requests.
(registrar: OpenClawPluginCliRegistrar, opts?: { commands?: string[] }) => void
Register CLI commands. Add custom commands to the
openclaw CLI.(command: OpenClawPluginCommandDefinition) => void
Register a plugin command. Plugin commands bypass the LLM agent and are processed before built-in commands.
(provider: ProviderPlugin) => void
Register an authentication provider. Providers integrate with
openclaw login.(method: string, handler: GatewayRequestHandler) => void
Register a custom gateway method. Gateway methods are JSON-RPC endpoints exposed via the gateway.
Utility Methods
(input: string) => string
Resolve paths relative to the plugin source directory.
<K extends PluginHookName>(hookName: K, handler: PluginHookHandlerMap[K], opts?: { priority?: number }) => void
Alternative API for registering lifecycle hooks with typed event handlers.
Runtime Services
Theapi.runtime object provides access to OpenClaw’s core services.
Config
Media
Text Processing
Reply Dispatching
Logging
State Directory
Channel-Specific Services
The runtime provides channel-specific helpers:Plugin SDK Exports
Theopenclaw/plugin-sdk package exports types and utilities:

