Skip to main content

Crate xil_api

Crate xil_api 

Source
Expand description

Network clients for the pipeline: ElevenLabs (text-to-speech, sound effects, user quota, voices, Studio), Anthropic (the publish stage) and Google Translate TTS (gTTS, the free draft voice backend).

Each client speaks the same HTTP the Python SDKs do, so the requests a Rust run makes can be compared against a Python run’s request for request (see tools/parity/mockapi.py). Base URLs can be redirected with XIL_ELEVENLABS_BASE_URL, ANTHROPIC_BASE_URL and XIL_GTTS_BASE_URL.

Modules§

anthropic
Anthropic Messages API, as anthropic.Anthropic().messages.create calls it.
elevenlabs
The ElevenLabs endpoints the pipeline calls, shaped as elevenlabs 2.x sends them.
gtts
Google Translate TTS, driven exactly as gTTS 2.5 drives it.

Enums§

ApiError
A failed call, split the way the pipeline’s retry logic needs it.

Functions§

agent 🔒
One shared agent: connection reuse, and a generous read timeout for long TTS renders.
base_url 🔒
$name when set and non-empty, else the default.
call 🔒
As call_logged but silent — requests (gTTS) logs nothing at INFO.
call_logged 🔒
Run a request, logging the response like httpx and turning HTTP errors into ApiError.
log_response 🔒
httpx logs every response at INFO, and the pipeline’s root logger passes it to both sinks: HTTP Request: GET <url> "HTTP/1.1 200 OK".
read_bytes 🔒
read_json 🔒
send_json 🔒
POST a JSON body. The result goes straight into call_logged, so ureq::Error stays unboxed.