Register a provider
Register New Provider
To add a completely new provider, specifymodels along with the required configuration.
If the model list comes from a remote endpoint, use an async extension factory:
models is provided, it replaces all existing models for that provider.
Unregister Provider
Usepi.unregisterProvider(name) to remove a provider that was previously registered via pi.registerProvider(name, ...):
/reload is required.
API Types
Theapi field determines which streaming implementation is used:
Most OpenAI-compatible providers work with
openai-completions. Use model-level thinkingLevelMap for model-specific thinking levels, and compat for provider quirks:
openrouter for OpenRouter-style reasoning: { effort } controls. Use together for Together-style reasoning: { enabled } controls; with supportsReasoningEffort, it also sends reasoning_effort. Use qwen-chat-template for local Qwen-compatible servers that read chat_template_kwargs.enable_thinking and need preserve_thinking.
Use cacheControlFormat: "anthropic" for OpenAI-compatible providers that expose Anthropic-style prompt caching via cache_control on the system prompt, last tool definition, and last user/assistant text content.
Use mistral-conversations for native Mistral models. If you intentionally route a Mistral-compatible or custom endpoint through openai-completions, set the required compat flags explicitly.
Auth Header
If your provider expectsAuthorization: Bearer <key> but doesn’t use a standard API, set authHeader: true: