Skip to main content

Module media_client

Module media_client 

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

MediaClient
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.