Providers#

Connect a provider and configure retries, credentials, and transport.

Read the walkthrough before consulting individual signatures.

Public interfaces#

Interface

Purpose

AnthropicProvider

Map Anthropic SDK streams, including signed thinking and tool blocks.

_to_anthropic_content_blocks

Convert a domain message into Anthropic content blocks.

ProviderAuthError

Raised when a remote provider rejects the configured credentials.

ProviderError

Base error for provider adapter failures.

ProviderHTTPError

The provider answered with an HTTP failure, or with something that was not an API reply.

ProviderRefusalError

A request was refused before the model produced any output.

ProviderResponseError

Raised when provider responses do not satisfy the expected stream protocol.

ProviderTimeoutError

The provider stayed silent for longer than TimeoutOptions allows.

_message_to_openai_payload

Public constant or type alias.

_normalize_image_source

Normalize a typed image source into an OpenAI-compatible content block.

_usage_from_mapping

Normalize token usage returned by OpenAI-compatible chat APIs.

DeepSeekProvider

Stream DeepSeek through its OpenAI-compatible protocol.

GoogleProvider

Map official Google GenAI SDK streams and preserve signed replay parts.

HttpFailure

What an HTTP error response or a response that was not an API reply turned out to say.

failure_message

Return one sentence that says what the provider answered and what that usually means.

read_failure

Work out what a failed or unexpected response body is.

OllamaProvider

Stream Ollama SDK events without buffering the entire HTTP response.

OpenAIProvider

Map OpenAI-compatible chat streams to provider-neutral model events.

refusal_from_response_error

Return the refusal a failed OpenAI Responses stream describes, or None for a plain failure.

refusal_from_status_error

Return the refusal an HTTP error response describes, or None when it is something else.

withhold_replay_blocks

Drop the replay blocks that are client tool calls.