Expand description
Shared remote HTTP client and response validation (JOE-1587, JOE-1588, JOE-1934).
All OpenRouter STT/cleanup traffic should go through this module so endpoint policy, redirects, credentials, and body caps stay consistent.
Provider-specific origins, auth, and headers live in [policy] named
ProviderHttpPolicy implementations — not hard-coded in the client.
Structs§
- Eleven
Labs Http Policy - ElevenLabs HTTP policy (
xi-api-key; no Bearer / OpenRouter headers). - Hardened
Http Client - Hardened reqwest client shared by remote STT and cleanup.
- Open
AiHttp Policy - OpenAI first-party HTTP policy (Bearer; no OpenRouter attribution headers).
- Open
AiSpeech Request - OpenAI-compatible speech request body (no secrets).
- Open
Router Http Policy - OpenRouter HTTP policy (Bearer + attribution headers).
- 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 (timeouts / proxy / loopback).
- Transcript
Limits - Limits applied after JSON parse to transcript structures.
- XaiHttp
Policy - xAI HTTP policy (Bearer; no OpenRouter attribution headers).
Enums§
- Auth
Scheme - How credentials are attached to outbound requests.
- Expected
Wire Format - What the client requested / capability promised for a remote TTS body.
- Speech
Response Format - Wire
response_formatvalues for/audio/speech.
Constants§
- DEFAULT_
CHAT_ BODY_ CAP - DEFAULT_
CLEANUP_ BODY_ CAP - DEFAULT_
REMOTE_ STT_ CHUNK_ SECS - Default remote STT window length (seconds). Matches Plaud dual-ref chunk recipes.
- DEFAULT_
STT_ BODY_ CAP - Default hard caps for response bodies (bytes).
- ELEVENLABS_
DEFAULT_ BASE - ELEVENLABS_
ORIGIN - OPENAI_
DEFAULT_ BASE - OPENAI_
ORIGIN - OPENROUTER_
APP_ CATEGORIES - Marketplace categories (max 2 per request; lowercase hyphen-separated).
- OPENROUTER_
APP_ REFERER - OpenRouter app attribution for Aurum.
- OPENROUTER_
APP_ TITLE - Display name on openrouter.ai rankings / analytics (
X-OpenRouter-Title). - OPENROUTER_
DEFAULT_ BASE - OPENROUTER_
ORIGIN - Official OpenRouter origin and default API base.
- XAI_
DEFAULT_ BASE - XAI_
ORIGIN
Traits§
- Provider
Http Policy - Provider-specific HTTP trust and header contract.
Functions§
- effective_
chunk_ secs - Effective chunk length:
AURUM_REMOTE_STT_CHUNK_SECSif set and valid, else default. - map_
http_ status - Map HTTP status codes to typed provider errors.
- needs_
time_ chunk - Minimum duration that triggers chunking (must be > 0 and finite).
- normalize_
request_ path - Normalize and reject dangerous path segments before allowlist checks.
- parse_
pcm_ content_ type - Parse sample rate from
Content-Typelikeaudio/pcm;rate=24000;channels=1. - plan_
chunk_ windows - Plan non-overlapping PCM windows covering
[0, total_samples). - public_
network_ reason - Map a
reqwesterror into a public-safe network reason (JOE-1980). - read_
body_ limited - Stream a response body under a hard byte cap.
- read_
body_ limited_ with_ op - Stream a response body under a hard byte cap, interruptible by
OpContext. - redact_
secret - Redact bearer tokens / API keys from diagnostic strings.
- redact_
secret_ with - Like
redact_secret, also scrubbing the provided known secret values. - resolve_
encoded_ format - Resolve encoded format from expected request format + response Content-Type.
- send_
with_ op - Send a request, aborting promptly on cancel or absolute deadline.
- soft_
split_ text_ segments - Soft-split an overlong single segment into adjacent pieces under
max_chars. - stitch_
chunk_ results - Join chunk results into one transcript for the full media duration.
- transcribe_
maybe_ chunked - Run
one_shotonce, or time-chunk + stitch when audio is longer thanchunk_secs. - validate_
endpoint - Parse and validate a base URL under remote + provider policy.
- validate_
segments - Validate segment list: counts, lengths, finite ordered timestamps.
- validate_
text_ bounds - Validate transcript text size and optional expansion vs input.