Expand description
Normalized model access: a provider-agnostic request/response shape, and the wire adapters
(Anthropic Messages, OpenAI Chat Completions, Google Gemini) that speak it. The router
(crate::router) only ever talks to Provider; it never knows which wire format is
behind a given rung.
Structs§
- Anthropic
Provider - Speaks
POST {base}/v1/messages(Anthropic Messages API). - Auth
- BYOK credentials for one request, extracted from headers with env-var fallback.
- Bedrock
Provider - Speaks
POST https://bedrock-runtime.{region}.amazonaws.com/model/{model}/invoke(Claude on AWS Bedrock) — an Anthropic-shaped body ([anthropic_messages_body]) authenticated with AWS SigV4 request signing rather than an API key (ADR 0006 P2). Credentials come from the standardAWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKENenv vars, read fresh per call — never logged, never put in the URL (I2). - Chat
Message - One message in a normalized chat conversation.
contentis either a plain string (the common case — serializes byte-identically to a text message) OR the original array of content blocks (text/tool_use/tool_result/image), forwarded verbatim so tool and multimodal turns survive the enforce path (ADR 0005). UseChatMessage::text_viewto read a text projection for gating. - Gemini
Provider - Speaks
POST {base}/v1beta/models/{model}:generateContent(Google Gemini Generative Language API). The API key goes in thex-goog-api-keyheader — never the URL query string, so it stays out of logs and proxies. - Model
Request - A provider-agnostic model request, built once per incoming call and re-used (with
modelswapped) across every rung of the ladder. - Model
Response - A provider-agnostic model response.
- Open
AiProvider - Speaks
POST {base}/v1/chat/completions(OpenAI Chat Completions API). - Provider
Registry - Lookup from provider id (
"anthropic","openai", …) to theProviderthat serves it. - Vertex
Provider - Speaks
POST https://{region}-aiplatform.googleapis.com/.../publishers/anthropic/models/{model}:rawPredict(Claude on Google Vertex AI) — an Anthropic-shaped body ([anthropic_messages_body]) authenticated with a GCP OAuth2 bearer token rather than an API key (ADR 0006 P3). The token is minted and cached bygcp_authfromGOOGLE_APPLICATION_CREDENTIALSor the ambient GCP environment — this adapter never caches or logs it, and it never goes in the URL (I2).
Enums§
- Provider
Error - Failure modes of a provider call.
Traits§
- Provider
- A normalized model backend. Implementations translate
ModelRequest/ModelResponseto/from one wire API.