GenAI.Provider.Media.OpenAICompat (Noizu Labs, GenAI Wrapper v0.3.2)

Copy Markdown

Shared OpenAI-compatible media-generation calls (ADR-016), parameterized by base_url + API key so the OpenAI providers and the LiteLLM proxy providers share ONE definition of each endpoint's request build + response decode (dmitri's "one definition" principle):

  • image/3 - POST {base}/v1/images/generations -> b64_json image bytes
  • speech/3 - POST {base}/v1/audio/speech -> raw audio bytes (TTS)
  • transcription/3 - POST {base}/v1/audio/transcriptions (multipart) -> transcript (STT)

Each returns the shared media contract {:ok, %{data, mime, meta}} | {:error, term}.

Summary

Functions

text -> image (gpt-image-1 / DALL·E compatible).

text -> speech (TTS); returns raw audio bytes with the right MIME.

speech -> text (transcription). Audio bytes ride in req.settings[:audio].

Functions

image(base_url, key, req)

text -> image (gpt-image-1 / DALL·E compatible).

speech(base_url, key, req)

text -> speech (TTS); returns raw audio bytes with the right MIME.

transcription(base_url, key, req)

speech -> text (transcription). Audio bytes ride in req.settings[:audio].