Expand description
Shared remote HTTP client and response validation (JOE-1587, JOE-1588).
All OpenRouter STT/cleanup traffic should go through this module so endpoint policy, redirects, credentials, and body caps stay consistent.
Structs§
- Hardened
Http Client - Hardened reqwest client shared by STT and cleanup.
- Remote
Body Limits - Endpoint-specific body byte caps.
- Remote
Endpoint - Validated remote endpoint with trust classification.
- Remote
Policy - Policy knobs for building the shared client.
- Transcript
Limits - Limits applied after JSON parse to transcript structures.
Constants§
- DEFAULT_
CHAT_ BODY_ CAP - DEFAULT_
CLEANUP_ BODY_ CAP - DEFAULT_
OPENROUTER_ ORIGIN - Official OpenRouter HTTPS origin (credentialed default).
- DEFAULT_
STT_ BODY_ CAP - Default hard caps for response bodies (bytes).
Functions§
- map_
http_ status - Map HTTP status codes to typed provider errors (no payload echo of secrets).
- read_
body_ limited - Stream a response body under a hard byte cap.
- redact_
secret - Redact bearer tokens / API keys from diagnostic strings.
- validate_
endpoint - Parse and validate a base URL under the remote policy.
- validate_
segments - Validate segment list: counts, lengths, finite ordered timestamps.
- validate_
text_ bounds - Validate transcript text size and optional expansion vs input.