Skip to main content

Register a provider

Multiple accounts for one provider

Use pi.registerProviderAlias() instead of copying a provider’s models, OAuth methods, and transport. Register aliases in the extension factory so they are available at startup:
Run /login openai-1 and choose Sign in with ChatGPT, then select an openai-1 model with /model. Repeat for each account. The source openai uses the new OpenAI ChatGPT login, not the separate openai-codex login. Each alias stores and refreshes its own credentials. An alias does not borrow the source’s stored login or ambient API key. Keeping an existing alias ID, such as openai-1, preserves credentials already saved under that ID. Confirm the intended account in the browser when logging into each alias; an alias name does not select a browser account or provide extra quota. Aliases support OAuth credentials and non-empty stored API keys. For ambient-only authentication, such as an AWS profile or environment-based service account, use the original provider or a full custom registration instead. Source endpoint and header configuration is shared too. Do not hard-code account credentials in source headers when using aliases; supply each account through /login. Aliases inherit the source’s current models, Fast variants, OAuth callback support, and request handling. Callbacks and saved messages retain the alias ID. Source catalog updates are shared, while availability filters receive each alias’s own credential. Aliases do not run account-specific catalog discovery with their credentials; use a full provider registration if each account requires a separately discovered catalog. The source must already be registered and cannot itself be an alias. Alias IDs must not replace an existing provider. Configure endpoints and models on the source rather than on the alias. Use pi.unregisterProvider("openai-1") to remove an alias without deleting its saved credentials. Aliases follow normal extension reload and rollback behavior. This API requires an Atomic version that includes provider aliases. Older versions report registerProviderAlias is not a function; upgrade Atomic before loading an alias extension.

Register New Provider

To add a completely new provider, specify models along with the required configuration. If the model list comes from a remote endpoint, use an async extension factory:
This registers the fetched models before startup finishes.
When models is provided, it replaces all existing chat, image, and classifier models for that provider. A missing type means chat; image and classifier models need type: "image" or type: "classifier" and implementations in the images or classifiers maps keyed by each model’s api. See the mixed-operation provider example. A provider registered this way is listed in /login like a built-in provider: /login my-llm prompts for an API key and saves it to auth.json, and the selector shows whether the provider is configured (for example ✓ env: MY_LLM_API_KEY). /model lists its models once it is configured. When $MY_LLM_API_KEY is unset and no key is stored, using one of its models reports No API key found for my-llm with the /login hint, as for a built-in provider. This also holds in interactive sessions, where extensions run in the engine process.

Unregister Provider

Use pi.unregisterProvider(name) to remove a provider that was previously registered via pi.registerProvider(name, ...):
Unregistering removes that provider’s dynamic models, API key fallback, OAuth provider registration, and custom stream handler registrations. Any built-in models or provider behavior that were overridden are restored. Calls made after the initial extension load phase are applied immediately, so no /reload is required.

API Types

The api 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:
Use 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 expects Authorization: Bearer <key> but doesn’t use a standard API, set authHeader: true: