If you have not built any FluffBuzz plugin before, read
Getting Started first for the basic package
structure and manifest setup.
Walkthrough
1
Package and manifest
providerAuthEnvVars so FluffBuzz can detect
credentials without loading your plugin runtime. Add providerAuthAliases
when a provider variant should reuse another provider id’s auth. modelSupport
is optional and lets FluffBuzz auto-load your provider plugin from shorthand
model ids like acme-large before runtime hooks exist. If you publish the
provider on ClawHub, those fluffbuzz.compat and fluffbuzz.build fields
are required in package.json.2
Register the provider
A minimal provider needs an That is a working provider. Users can now
id, label, auth, and catalog:index.ts
fluffbuzz onboard --acme-ai-api-key <key> and select
acme-ai/acme-large as their model.If the upstream provider uses different control tokens than FluffBuzz, add a
small bidirectional text transform instead of replacing the stream path:input rewrites the final system prompt and text message content before
transport. output rewrites assistant text deltas and final text before
FluffBuzz parses its own control markers or channel delivery.For bundled providers that only register one text provider with API-key
auth plus a single catalog-backed runtime, prefer the narrower
defineSingleProviderPluginEntry(...) helper:buildProvider is the live catalog path used when FluffBuzz can resolve real
provider auth. It may perform provider-specific discovery. Use
buildStaticProvider only for offline rows that are safe to show before auth
is configured; it must not require credentials or make network requests.
FluffBuzz’s models list --all display currently executes static catalogs
only for bundled provider plugins, with an empty config, empty env, and no
agent/workspace paths.If your auth flow also needs to patch models.providers.*, aliases, and
the agent default model during onboarding, use the preset helpers from
fluffbuzz/plugin-sdk/provider-onboard. The narrowest helpers are
createDefaultModelPresetAppliers(...),
createDefaultModelsPresetAppliers(...), and
createModelCatalogPresetAppliers(...).When a provider’s native endpoint supports streamed usage blocks on the
normal openai-completions transport, prefer the shared catalog helpers in
fluffbuzz/plugin-sdk/provider-catalog-shared instead of hardcoding
provider-id checks. supportsNativeStreamingUsageCompat(...) and
applyProviderNativeStreamingUsageCompat(...) detect support from the
endpoint capability map, so native Moonshot/DashScope-style endpoints still
opt in even when a plugin is using a custom provider id.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 Available replay families today:
catalog + resolveDynamicModel. Add hooks
incrementally as your provider requires them.Shared helper builders now cover the most common replay/tool-compat
families, so plugins usually do not need to hand-wire each hook one by one:Available stream families today:
SDK seams powering the family builders
SDK seams powering the family builders
Each family builder is composed from lower-level public helpers exported from the same package, which you can reach for when a provider needs to go off the common pattern:
fluffbuzz/plugin-sdk/provider-model-shared—ProviderReplayFamily,buildProviderReplayFamilyHooks(...), and the raw replay builders (buildOpenAICompatibleReplayPolicy,buildAnthropicReplayPolicyForModel,buildGoogleGeminiReplayPolicy,buildHybridAnthropicOrOpenAIReplayPolicy). Also exports Gemini replay helpers (sanitizeGoogleGeminiReplayHistory,resolveTaggedReasoningOutputMode) and endpoint/model helpers (resolveProviderEndpoint,normalizeProviderId,normalizeGooglePreviewModelId,normalizeNativeXaiModelId).fluffbuzz/plugin-sdk/provider-stream—ProviderStreamFamily,buildProviderStreamFamilyHooks(...),composeProviderStreamWrappers(...), plus the shared OpenAI/Codex wrappers (createOpenAIAttributionHeadersWrapper,createOpenAIFastModeWrapper,createOpenAIServiceTierWrapper,createOpenAIResponsesContextManagementWrapper,createCodexNativeWebSearchWrapper) and shared proxy/provider wrappers (createOpenRouterWrapper,createToolStreamWrapper,createMinimaxFastModeWrapper).fluffbuzz/plugin-sdk/provider-tools—ProviderToolCompatFamily,buildProviderToolCompatFamilyHooks("gemini"), underlying Gemini schema helpers (normalizeGeminiToolSchemas,inspectGeminiToolSchemas), and xAI compat helpers (resolveXaiModelCompatPatch(),applyXaiModelCompat(model)). The bundled xAI plugin usesnormalizeResolvedModel+contributeResolvedModelCompatwith these to keep xAI rules owned by the provider.
@fluffbuzz/anthropic-provider keeps wrapAnthropicProviderStream, resolveAnthropicBetas, resolveAnthropicFastMode, resolveAnthropicServiceTier, and the lower-level Anthropic wrapper builders in its own public api.ts / contract-api.ts seam because they encode Claude OAuth beta handling and context1m gating. The xAI plugin similarly keeps native xAI Responses shaping in its own wrapStreamFn (/fast aliases, default tool_stream, unsupported strict-tool cleanup, xAI-specific reasoning-payload removal).The same package-root pattern also backs @fluffbuzz/openai-provider (provider builders, default-model helpers, realtime provider builders) and @fluffbuzz/openrouter-provider (provider builder plus onboarding/config helpers).- Token exchange
- Custom headers
- Native transport identity
- Usage and billing
For providers that need a token exchange before each inference call:
All available provider hooks
All available provider hooks
FluffBuzz calls hooks in this order. Most providers only use 2-3:
Runtime fallback notes:
normalizeConfigchecks the matched provider first, then other hook-capable provider plugins until one actually changes the config. If no provider hook rewrites a supported Google-family config entry, the bundled Google config normalizer still applies.resolveConfigApiKeyuses the provider hook when exposed. The bundledamazon-bedrockpath also has a built-in AWS env-marker resolver here, even though Bedrock runtime auth itself still uses the AWS SDK default chain.resolveSystemPromptContributionlets a provider inject cache-aware system-prompt guidance for a model family. Prefer it overbefore_prompt_buildwhen the behavior belongs to one provider/model family and should preserve the stable/dynamic cache split.
5
Add extra capabilities (optional)
A provider plugin can register speech, realtime transcription, realtime
voice, media understanding, image generation, video generation, web fetch,
and web search alongside text inference. FluffBuzz classifies this as a
hybrid-capability plugin — the recommended pattern for company plugins
(one plugin per vendor). See
Internals: Capability Ownership.Register each capability inside
register(api) alongside your existing
api.registerProvider(...) call. Pick only the tabs you need:- Speech (TTS)
- Realtime transcription
- Realtime voice
- Media understanding
- Image and video generation
- Web fetch and search
6
Test
src/provider.test.ts
Publish to ClawHub
Provider plugins publish the same way as any other external code plugin:buzzhub package publish.
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