Expand description
Shared HTTP helpers for multimedia tools (image gen / vision / TTS / STT).
All four tools hit OpenAI-compatible endpoints and share:
- API-key secrecy (never logged, never echoed back)
- SSRF pre-flight via
crate::internal::tool_runtime::url_safety::check_url_private_ip - Configurable timeout + bounded redirect policy
- Minimal request envelope (Bearer auth, JSON or multipart body)
Structs§
- Media
Client - Runtime handle that media tools share: resolved base URL, API key, and HTTP client with a consistent timeout.
Functions§
- load_
bytes_ from_ location - Resolve a “location” (absolute URL, file path, or
data:URI) into bytes + optional mime-type. Applies SSRF check when fetching over HTTP. - persist_
output - Save bytes to
<data_dir>/media/<subdir>/<uuid>.<ext>and return the absolute path. Creates the parent directory as needed.