Provider Plugin SDK
Provider plugins usedefinePluginEntry(...) and call api.registerProvider(...)
with a ProviderPlugin definition.
Minimal provider entry
Provider subpaths
| Subpath | Use it for |
|---|---|
plugin-sdk/provider-auth | API key, OAuth, auth-profile, and PKCE helpers |
plugin-sdk/provider-onboard | Config patches after setup/auth |
plugin-sdk/provider-models | Model-definition and catalog helpers |
plugin-sdk/provider-setup | Shared local/self-hosted setup flows |
plugin-sdk/self-hosted-provider-setup | OpenAI-compatible self-hosted providers |
plugin-sdk/provider-usage | Usage snapshot fetch helpers |
API key auth
createProviderApiKeyAuthMethod(...) is the standard helper for API-key
providers:
OAuth auth
buildOauthProviderAuthResult(...) builds the standard auth result payload for
OAuth-style providers:
Catalog and discovery hooks
Provider plugins usually implement eithercatalog or the legacy discovery
alias. catalog is preferred.
Onboarding config patches
plugin-sdk/provider-onboard keeps post-auth config writes consistent.
Common helpers:
applyProviderConfigWithDefaultModel(...)applyProviderConfigWithDefaultModels(...)applyProviderConfigWithModelCatalog(...)applyAgentDefaultModelPrimary(...)ensureModelAllowlistEntry(...)
Self-hosted and local model setup
Useplugin-sdk/provider-setup or
plugin-sdk/self-hosted-provider-setup when the provider is an OpenAI-style
backend, Ollama, SGLang, or vLLM.
Examples from the shared setup surfaces:
promptAndConfigureOllama(...)configureOllamaNonInteractive(...)promptAndConfigureOpenAICompatibleSelfHostedProvider(...)discoverOpenAICompatibleSelfHostedProvider(...)
Usage snapshots
If the provider owns quota or usage endpoints, useresolveUsageAuth(...) and
fetchUsageSnapshot(...).
plugin-sdk/provider-usage includes shared fetch helpers such as:
fetchClaudeUsage(...)fetchCodexUsage(...)fetchGeminiUsage(...)fetchMinimaxUsage(...)fetchZaiUsage(...)
Provider guidance
- Keep auth logic in
provider-auth. - Keep config mutation in
provider-onboard. - Keep catalog/model helpers in
provider-models. - Keep usage logic in
provider-usage. - Use
catalog, notdiscovery, in new plugins.