Expand description
Shared HTTP primitives (ApiError, retry backoff) reused by chat_api and embedding_api.
Shared HTTP primitives for the OpenRouter chat and embeddings clients.
crate::chat_api::OpenRouterChatClient and
crate::embedding_api::OpenRouterClient talk to the same OpenAI-compatible
REST surface and run the exact same retry/backoff policy. This module
centralizes the pieces that were duplicated verbatim between the two
(GAP-SG-74): the structured provider-error envelope, the
exponential-backoff-with-jitter sleep helper, and — per the reauditor
addendum — the retry-verdict classifiers both clients use to attach a
typed crate::retry::AttemptOutcome to every error AT THE ORIGIN (the
exact HTTP status or structured provider code), instead of letting a
downstream consumer (the enrich queue) infer it from a formatted message
substring, which rules_rust_tratamento_de_erros.md and
rules_rust_retry_com_backoff.md both forbid (“NUNCA usar string matching
em mensagens de erro”).