Building Provider Plugins
This guide walks through building a provider plugin that adds a model provider (LLM) to OpenClaw. By the end you will have a provider with a model catalog, API key auth, and dynamic model resolution.If you have not built any OpenClaw plugin before, read
Getting Started first for the basic package
structure and manifest setup.
Walkthrough
1
Package and manifest
providerAuthEnvVars so OpenClaw can detect
credentials without loading your plugin runtime.2
Register the provider
A minimal provider needs an That is a working provider. Users can now
If your auth flow also needs to patch
id, label, auth, and catalog:index.ts
openclaw onboard --acme-ai-api-key <key> and select
acme-ai/acme-large as their model.For bundled providers that only register one text provider with API-key
auth plus a single catalog-backed runtime, prefer the narrower
defineSingleProviderPluginEntry(...) helper:models.providers.*, aliases, and
the agent default model during onboarding, use the preset helpers from
openclaw/plugin-sdk/provider-onboard. The narrowest helpers are
createDefaultModelPresetAppliers(...),
createDefaultModelsPresetAppliers(...), and
createModelCatalogPresetAppliers(...).3
Add dynamic model resolution
If your provider accepts arbitrary model IDs (like a proxy or router),
add If resolving requires a network call, use
resolveDynamicModel:prepareDynamicModel for async
warm-up — resolveDynamicModel runs again after it completes.4
Add runtime hooks (as needed)
Most providers only need
catalog + resolveDynamicModel. Add hooks
incrementally as your provider requires them.- Token exchange
- Custom headers
- Usage and billing
For providers that need a token exchange before each inference call:
All available provider hooks
All available provider hooks
OpenClaw calls hooks in this order. Most providers only use 2-3:
For detailed descriptions and real-world examples, see
Internals: Provider Runtime Hooks.
5
Add extra capabilities (optional)
A provider plugin can register speech, media understanding, image
generation, and web search alongside text inference:OpenClaw classifies this as a hybrid-capability plugin. This is the
recommended pattern for company plugins (one plugin per vendor). See
Internals: Capability Ownership.
6
Test
src/provider.test.ts
File structure
Catalog order reference
catalog.order controls when your catalog merges relative to built-in
providers:
Next steps
- Channel Plugins — if your plugin also provides a channel
- SDK Runtime —
api.runtimehelpers (TTS, search, subagent) - SDK Overview — full subpath import reference
- Plugin Internals — hook details and bundled examples