Skip to main content

Custom Providers

Extensions can register custom model providers via pi.registerProvider(). This enables:
  • Proxies - Route requests through corporate proxies or API gateways
  • Custom endpoints - Use self-hosted or private model deployments
  • OAuth/SSO - Add authentication flows for enterprise providers
  • Custom APIs - Implement streaming for non-standard LLM APIs

Where to go next

This page gets you to a first working provider extension. Each part of the job has its own page: If you only need to add a model for an API Atomic already speaks, use Custom models instead.

Example Extensions

See these complete provider examples:

Table of Contents

Quick Reference

Await provider registration and removal. For dynamic model discovery, fetch and register models in the async extension factory instead of session_start. Atomic waits for the factory before startup continues, so the provider is available during interactive startup and to atomic --list-models. Registering only baseUrl or headers for an existing provider preserves its built-in models. Supplying models in the legacy form replaces that provider’s models across chat, image, and classifier operations. An omitted type means "chat"; image and classifier models require explicit discriminants and implementations keyed by their api values through the images and classifiers fields. For example, a mixed-operation provider can register non-chat models and their implementations together:
Model-level baseUrl values take precedence over the provider endpoint. If no models list is supplied, built-in models of every operation remain registered. Equal model IDs in different operations remain distinct, including their model-specific headers. Every model needs an ID, display name, input capabilities, and cost metadata. Chat and classifier models also need a context window; chat models need an output limit and reasoning support; image models declare their output modalities. Choose the API implementation at the provider level unless one model requires an override.

Override Existing Provider

Moved to Override an existing provider.

Register New Provider

Moved to Register a provider.

Unregister Provider

Moved to Register a provider.

API Types

Moved to Register a provider.

Auth Header

Moved to Register a provider.

OAuth Support

Moved to Provider OAuth.

Dynamic model catalog refresh

Moved to Provider OAuth. A complete Provider calls context.publish({ update }) to install provider-owned model state, then exposes the latest list through getModels(). Legacy ProviderConfig.refreshModels returns mixed-operation model definitions that replace that registration’s live models.

OAuthLoginCallbacks

Moved to Provider OAuth.

OAuthCredentials

Moved to Provider OAuth.

Custom Streaming API

Moved to Provider streaming API.

Stream Pattern

Moved to Provider streaming API.

Event Types

Moved to Provider streaming API.

Stop Reasons

Moved to Provider streaming API.

Content Blocks

Moved to Provider streaming API.

Tool Calls

Moved to Provider streaming API.

Usage and Cost

Moved to Provider streaming API.

Registration

Moved to Provider streaming API.

Testing Your Implementation

Test your provider/model pairs against these behaviors. The filenames below are suggested test names, not a required test suite: Run tests with your provider/model pairs to verify compatibility.

Config Reference

Moved to Provider API reference.

Model Definition Reference

Moved to Provider API reference.