ai.errors
Reference for SDK error types.
ai.errors contains the framework and provider error hierarchy.
Base Errors
Base errors are not tied to a provider HTTP response.
AIErrorConfigurationErrorInstallationErrorUnsupportedProviderError
Provider Errors
Provider errors represent failures raised by model providers.
ProviderErrorProviderNotConfiguredErrorProviderAPIErrorProviderConnectionErrorProviderTimeoutErrorProviderResponseErrorProviderIncompleteResponseError
ProviderAPIError includes request_id, http_context, body, code,
param, type, and is_retryable.
Provider Status Errors
Status errors represent provider responses with non-success HTTP status codes.
ProviderStatusErrorProviderBadRequestErrorProviderAuthenticationErrorProviderPermissionDeniedErrorProviderNotFoundErrorProviderModelNotFoundErrorProviderConflictErrorProviderRequestTooLargeErrorProviderUnprocessableEntityErrorProviderRateLimitErrorProviderInternalServerErrorProviderServiceUnavailableErrorProviderDeadlineExceededErrorProviderOverloadedError
HTTPErrorContext
HTTPErrorContext exposes normalized HTTP context from provider errors.
context.status_code
context.request
context.responsehttp_status_to_provider_status_error_class
http_status_to_provider_status_error_class returns the provider status error
class for an HTTP status code.
error_cls = ai.errors.http_status_to_provider_status_error_class(429)