Skip to main content

Module provider

Module provider 

Source
Expand description

Normalized model access: a provider-agnostic request/response shape, and the two wire adapters (Anthropic Messages, OpenAI Chat Completions) that speak it. The router (crate::router) only ever talks to Provider; it never knows which wire format is behind a given rung.

Structs§

AnthropicProvider
Speaks POST {base}/v1/messages (Anthropic Messages API).
Auth
BYOK credentials for one request, extracted from headers with env-var fallback.
ChatMessage
One message in a normalized chat conversation.
ModelRequest
A provider-agnostic model request, built once per incoming call and re-used (with model swapped) across every rung of the ladder.
ModelResponse
A provider-agnostic model response.
OpenAiProvider
Speaks POST {base}/v1/chat/completions (OpenAI Chat Completions API).
ProviderRegistry
Lookup from provider id ("anthropic", "openai", …) to the Provider that serves it.

Enums§

ProviderError
Failure modes of a provider call.

Traits§

Provider
A normalized model backend. Implementations translate ModelRequest/ModelResponse to/from one wire API.