Skip to main content
This guide walks through building a provider plugin that adds a model provider (LLM) to FluffBuzz. 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 FluffBuzz plugin before, read Getting Started first for the basic package structure and manifest setup.
Provider plugins add models to FluffBuzz’s normal inference loop. If the model must run through a native agent daemon that owns threads, compaction, or tool events, pair the provider with an agent harness instead of putting daemon protocol details in core.

Walkthrough

1

Package and manifest

The manifest declares 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 id, label, auth, and catalog:
index.ts
That is a working provider. Users can now 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 resolveDynamicModel:
If resolving requires a network call, use 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.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 replay families today:Available stream families today:
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-sharedProviderReplayFamily, 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-streamProviderStreamFamily, 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-toolsProviderToolCompatFamily, buildProviderToolCompatFamilyHooks("gemini"), underlying Gemini schema helpers (normalizeGeminiToolSchemas, inspectGeminiToolSchemas), and xAI compat helpers (resolveXaiModelCompatPatch(), applyXaiModelCompat(model)). The bundled xAI plugin uses normalizeResolvedModel + contributeResolvedModelCompat with these to keep xAI rules owned by the provider.
Some stream helpers stay provider-local on purpose. @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).
For providers that need a token exchange before each inference call:
FluffBuzz calls hooks in this order. Most providers only use 2-3:Runtime fallback notes:
  • normalizeConfig checks 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.
  • resolveConfigApiKey uses the provider hook when exposed. The bundled amazon-bedrock path also has a built-in AWS env-marker resolver here, even though Bedrock runtime auth itself still uses the AWS SDK default chain.
  • resolveSystemPromptContribution lets a provider inject cache-aware system-prompt guidance for a model family. Prefer it over before_prompt_build when the behavior belongs to one provider/model family and should preserve the stable/dynamic cache split.
For detailed descriptions and real-world examples, see Internals: Provider Runtime Hooks.
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:
6

Test

src/provider.test.ts

Publish to ClawHub

Provider plugins publish the same way as any other external code plugin:
Do not use the legacy skill-only publish alias here; plugin packages should use buzzhub package publish.

File structure

Catalog order reference

catalog.order controls when your catalog merges relative to built-in providers:

Next steps