Overview

Switch between OpenAI, Anthropic, Gemini, or Mistral without changing your call sites.

A provider is the transport that talks to one AI vendor. The Client resolves which one to use from johannschopplich.copilot.provider and forwards every request unchanged – your call sites never know the difference.

Built-in Implementations

OpenAIProvider

The base. Doubles as the transport for any OpenAI-compatible endpoint (Mistral, Gemini's /v1beta/openai, OpenRouter, Ollama).

AnthropicProvider

Anthropic's native API. Structured output always matches the schema.

GeminiProvider

Extends OpenAIProvider. Targets Google's OpenAI-compat endpoint at generativelanguage.googleapis.com/v1beta/openai.

MistralProvider

Extends OpenAIProvider. Targets api.mistral.ai/v1.

All four classes are marked @internal. Use them through Client for stable behavior. Direct instantiation works but constructor signatures may shift between minor versions.

Retry Behavior

ProviderRetry
OpenAIProvider and subclassesBuilt-in retry wrapper – see details.
AnthropicProviderDelegated to the official anthropic-ai/sdk.

Every provider applies the per-provider timeout to its HTTP client, so a stalled connection fails rather than blocking. A failed request throws ProviderException with the upstream error attached as previous.