From fb754ca101f09a3af9132dabb05682db2c35e736 Mon Sep 17 00:00:00 2001 From: Hoan HL Date: Wed, 8 Oct 2025 10:26:17 +0700 Subject: [PATCH 1/2] support elevenlabs api_uri --- lib/synth-audio.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/synth-audio.js b/lib/synth-audio.js index 74664e9..9f16857 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -877,7 +877,7 @@ const synthCustomVendor = async(logger, {credentials, stats, language, voice, const synthElevenlabs = async(logger, { credentials, options, stats, voice, key, text, renderForCaching, disableTtsStreaming, disableTtsCache }) => { - const {api_key, model_id, options: credOpts} = credentials; + const {api_key, model_id, api_uri, options: credOpts} = credentials; const opts = !!options && Object.keys(options).length !== 0 ? options : JSON.parse(credOpts || '{}'); /* default to using the streaming interface, unless disabled by env var OR we want just a cache file */ @@ -889,6 +889,7 @@ const synthElevenlabs = async(logger, { params += `,voice=${voice}`; params += `,model_id=${model_id}`; params += `,write_cache_file=${disableTtsCache ? 0 : 1}`; + if (api_uri) params += `,api_uri=${api_uri}`; if (opts.optimize_streaming_latency !== null && opts.optimize_streaming_latency !== undefined) { params += `,optimize_streaming_latency=${opts.optimize_streaming_latency}`; } From b898d794b030105fc64415ee972ab6f51271caa0 Mon Sep 17 00:00:00 2001 From: Hoan HL Date: Wed, 8 Oct 2025 15:05:04 +0700 Subject: [PATCH 2/2] wip --- lib/synth-audio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/synth-audio.js b/lib/synth-audio.js index 9f16857..63c2e48 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -915,7 +915,7 @@ const synthElevenlabs = async(logger, { const optimize_streaming_latency = opts.optimize_streaming_latency ? `?optimize_streaming_latency=${opts.optimize_streaming_latency}` : ''; try { - const post = bent('https://api.elevenlabs.io', 'POST', 'buffer', { + const post = bent(`https://${api_uri}`, 'POST', 'buffer', { 'xi-api-key': api_key, 'Accept': 'audio/mpeg', 'Content-Type': 'application/json'