Skip to main content

Module remote

Module remote 

Source
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§

ElevenLabsHttpPolicy
ElevenLabs HTTP policy (xi-api-key; no Bearer / OpenRouter headers).
HardenedHttpClient
Hardened reqwest client shared by remote STT and cleanup.
OpenAiHttpPolicy
OpenAI first-party HTTP policy (Bearer; no OpenRouter attribution headers).
OpenAiSpeechRequest
OpenAI-compatible speech request body (no secrets).
OpenRouterHttpPolicy
OpenRouter HTTP policy (Bearer + attribution headers).
RemoteBodyLimits
Endpoint-specific body byte caps.
RemoteEndpoint
Validated remote endpoint with trust classification.
RemotePolicy
Policy knobs for building the shared client (timeouts / proxy / loopback).
TranscriptLimits
Limits applied after JSON parse to transcript structures.
XaiHttpPolicy
xAI HTTP policy (Bearer; no OpenRouter attribution headers).

Enums§

AuthScheme
How credentials are attached to outbound requests.
ExpectedWireFormat
What the client requested / capability promised for a remote TTS body.
SpeechResponseFormat
Wire response_format values 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§

ProviderHttpPolicy
Provider-specific HTTP trust and header contract.

Functions§

effective_chunk_secs
Effective chunk length: AURUM_REMOTE_STT_CHUNK_SECS if 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-Type like audio/pcm;rate=24000;channels=1.
plan_chunk_windows
Plan non-overlapping PCM windows covering [0, total_samples).
public_network_reason
Map a reqwest error 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_shot once, or time-chunk + stitch when audio is longer than chunk_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.