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.

AnthropicCompatibleProvider

Stream a service that speaks the Anthropic Messages protocol.

image_block

Convert a typed image source into a Messages content block.

messages_effort

Name the output_config.effort value for a reasoning level.

messages_server_tools

Render server tools using their versioned native schemas.

messages_tools

Render local tools, deferring the ones tool search is meant to load.

search_result_blocks

Turn a local tool search result into tool_reference blocks.

to_content_blocks

Convert a message into Messages 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.

usage_from_mapping

Normalize token usage returned by OpenAI-compatible chat APIs.

DeepSeekAnthropicProvider

Stream DeepSeek through its Anthropic Messages protocol.

DeepSeekProvider

Stream DeepSeek through its OpenAI-compatible protocol.

GLMAnthropicProvider

Stream GLM through its Anthropic Messages protocol.

GLMProvider

Stream GLM through its OpenAI-compatible protocol.

glm_version

Return the (major, minor) of a GLM model name such as glm-4.6 or glm-5, else None.

CerebrasProvider

Stream a model served by Cerebras Inference.

GoogleProvider

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

GroqProvider

Stream a model served by Groq.

DeepInfraProvider

Stream a model hosted by DeepInfra.

FireworksProvider

Stream a model hosted by Fireworks AI.

SiliconFlowProvider

Stream a model hosted by SiliconFlow.

TogetherProvider

Stream a model hosted by Together AI.

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.

KimiAnthropicProvider

Stream Kimi through its Anthropic Messages protocol.

KimiProvider

Stream Kimi through its OpenAI-compatible protocol.

MiniMaxAnthropicProvider

Stream MiniMax through its Anthropic Messages protocol.

MiniMaxProvider

Stream MiniMax through its OpenAI-compatible protocol.

MistralProvider

Stream a Mistral model.

OllamaProvider

Stream Ollama SDK events without buffering the entire HTTP response.

OpenAIProvider

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

ChatDelta

What one streamed delta says, in the runtime’s terms.

OpenAICompatibleProvider

Stream a service that speaks the OpenAI Chat Completions protocol.

chat_image

Render an image source as a Chat Completions image_url content part.

chat_message

Render one message as a Chat Completions message, without any vendor extension.

chat_server_tools

Render opaque server tools without treating them as local functions.

chat_tools

Render function tools in Chat Completions format.

low_medium_high

Map a provider-neutral level onto low, medium and high, the names many services share.

OpenRouterProvider

Stream any model OpenRouter serves.

XAIProvider

Stream Grok through Chat Completions, or through Responses with response=True.

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.