AIR

Providers reference

See ../core/providers.md for the general provider interface, and the individual pages under providers/ for each built in provider's exact constructor, request/response handling, and error classification:

Provider (base class)

Import: from air.providers.base import Provider (also available as from air import Provider).

python
class Provider(ABC):
    name: str
 
    @abstractmethod
    async def chat(self, request: ChatRequest) -> ChatResponse:
        ...

Common constructor shape

All four built in providers share this constructor signature:

python
Provider(
    api_key: str,
    model: str,
    base_url: str = "<provider default>",
    timeout: float = 60.0,
    transport: httpx.AsyncBaseTransport | None = None,
)

transport is intended for tests (for example httpx.MockTransport), not normal application use.

Common error classification pattern

All four raise AuthenticationError (with provider=<name>) immediately at construction time if api_key is empty. During chat(...), all four classify HTTP and network errors into the same exception types (AuthenticationError, QuotaExceededError, RateLimitError, ProviderAPIError, ProviderTimeoutError, ProviderResponseError), though the exact status codes and keyword heuristics used differ per provider; see each provider's page for specifics.