Building Provider Plugins
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.
Walkthrough
Package and manifest
providerAuthEnvVars so FluffBuzz can detect
credentials without loading your plugin runtime.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
fluffbuzz 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
fluffbuzz/plugin-sdk/provider-onboard. The narrowest helpers are
createDefaultModelPresetAppliers(...),
createDefaultModelsPresetAppliers(...), and
createModelCatalogPresetAppliers(...).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.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
FluffBuzz calls hooks in this order. Most providers only use 2-3:
For detailed descriptions and real-world examples, see
Internals: Provider Runtime Hooks.
| # | Hook | When to use |
|---|---|---|
| 1 | catalog | Model catalog or base URL defaults |
| 2 | resolveDynamicModel | Accept arbitrary upstream model IDs |
| 3 | prepareDynamicModel | Async metadata fetch before resolving |
| 4 | normalizeResolvedModel | Transport rewrites before the runner |
| 5 | capabilities | Transcript/tooling metadata (data, not callable) |
| 6 | prepareExtraParams | Default request params |
| 7 | wrapStreamFn | Custom headers/body wrappers |
| 8 | formatApiKey | Custom runtime token shape |
| 9 | refreshOAuth | Custom OAuth refresh |
| 10 | buildAuthDoctorHint | Auth repair guidance |
| 11 | isCacheTtlEligible | Prompt cache TTL gating |
| 12 | buildMissingAuthMessage | Custom missing-auth hint |
| 13 | suppressBuiltInModel | Hide stale upstream rows |
| 14 | augmentModelCatalog | Synthetic forward-compat rows |
| 15 | isBinaryThinking | Binary thinking on/off |
| 16 | supportsXHighThinking | xhigh reasoning support |
| 17 | resolveDefaultThinkingLevel | Default /think policy |
| 18 | isModernModelRef | Live/smoke model matching |
| 19 | prepareRuntimeAuth | Token exchange before inference |
| 20 | resolveUsageAuth | Custom usage credential parsing |
| 21 | fetchUsageSnapshot | Custom usage endpoint |
| 22 | onModelSelected | Post-selection callback (e.g. telemetry) |
Add extra capabilities (optional)
A provider plugin can register speech, media understanding, image
generation, and web search alongside text inference:FluffBuzz classifies this as a hybrid-capability plugin. This is the
recommended pattern for company plugins (one plugin per vendor). See
Internals: Capability Ownership.
File structure
Catalog order reference
catalog.order controls when your catalog merges relative to built-in
providers:
| Order | When | Use case |
|---|---|---|
simple | First pass | Plain API-key providers |
profile | After simple | Providers gated on auth profiles |
paired | After profile | Synthesize multiple related entries |
late | Last pass | Override existing providers (wins on collision) |
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