GenAI.Provider.ElevenLabs (Noizu Labs, GenAI Wrapper v0.3.5)

Copy Markdown View Source

ElevenLabs audio media provider (ADR-016). NOT an LLM — media only.

Official API (https://api.elevenlabs.io). All three capabilities are SYNC endpoints that return audio bytes directly (no job/polling), so every declared modality is :sync and generate_media/2 returns the shared {:ok, %{data, mime, meta}} contract:

  • speech - POST /v1/text-to-speech/{voice_id} (model eleven_multilingual_v2, output format mp3_44100_128; voice defaults to Rachel and comes from req.settings[:voice_id] / [:voice])
  • sfx - POST /v1/sound-generation (duration_seconds, prompt_influence knobs; always audio/mpeg)
  • music - POST /v1/music/compose (model music_v1 default — pass "music_v2" explicitly for the current generation; music_length_ms, force_instrumental)

Auth is the xi-api-key header (NOT Bearer). Key resolution: req.api_key first, then ELEVENLABS_API_KEY; missing keys fast-fail {:error, :missing_api_key}. base_url is overridable via config :genai, :eleven_labs, base_url: "...".

Summary

Functions

Return config_key inference provide application config stored under :genai entry

Obtain map of effective settings: settings, model_settings, provider_settings, config_settings, etc.

Prepare endpoint and method to make inference call to

Prepare request body to be passed to inference call.

Build and run inference thread

Build and run inference thread in streaming mode

Functions

chat(messages, tools, settings)

chat(model, messages, tools, hyper_parameters, provider_settings \\ [], context \\ nil, options \\ nil)

Callback implementation for GenAI.InferenceProviderBehaviour.chat/7.

config_key()

Return config_key inference provide application config stored under :genai entry

default_encoder()

effective_settings(model, session, context, options \\ nil)

Obtain map of effective settings: settings, model_settings, provider_settings, config_settings, etc.

endpoint(model, settings, session, context, options \\ nil)

Prepare endpoint and method to make inference call to

headers(options)

headers(model, settings, session, context, options \\ nil)

Prepare request headers

request_body(model, messages, tools, settings, session, context, options \\ nil)

Prepare request body to be passed to inference call.

run(session, context, options \\ nil)

Build and run inference thread

standardize_model(model)

Callback implementation for GenAI.InferenceProviderBehaviour.standardize_model/1.

stream(session, context, options \\ nil)

Build and run inference thread in streaming mode