From 9534a62f91981621a65541f1ffcc0077a67dc7a5 Mon Sep 17 00:00:00 2001 From: "rosetta-livekit-bot[bot]" <282703043+rosetta-livekit-bot[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 22:50:07 +0000 Subject: [PATCH] feat(elevenlabs): add STT enableLogging option --- plugins/elevenlabs/src/stt.test.ts | 2 +- plugins/elevenlabs/src/stt.ts | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/plugins/elevenlabs/src/stt.test.ts b/plugins/elevenlabs/src/stt.test.ts index 918c321dc..629a04438 100644 --- a/plugins/elevenlabs/src/stt.test.ts +++ b/plugins/elevenlabs/src/stt.test.ts @@ -203,7 +203,7 @@ describe('ElevenLabs STT', () => { }); expect(request?.method).toBe('POST'); - expect(request?.url).toBe('/speech-to-text'); + expect(request?.url).toBe('/speech-to-text?enable_logging=true'); expect(request?.apiKey).toBe('test-key'); expect(request?.body).toContain('name="model_id"'); expect(request?.body).toContain('scribe_v2'); diff --git a/plugins/elevenlabs/src/stt.ts b/plugins/elevenlabs/src/stt.ts index 25f0ecb53..49219d75f 100644 --- a/plugins/elevenlabs/src/stt.ts +++ b/plugins/elevenlabs/src/stt.ts @@ -60,6 +60,7 @@ export interface STTOptions { modelId?: ElevenLabsSTTModels | string; keyterms?: string[]; noVerbatim?: boolean; + enableLogging?: boolean; } interface ResolvedSTTOptions { @@ -73,6 +74,7 @@ interface ResolvedSTTOptions { serverVad?: VADOptions | null; keyterms?: string[]; noVerbatim: boolean; + enableLogging: boolean; } export interface STTRecognizeOptions { @@ -237,6 +239,7 @@ export class STT extends stt.STT { modelId, keyterms: opts.keyterms, noVerbatim: opts.noVerbatim ?? false, + enableLogging: opts.enableLogging ?? true, }; this.#session = opts.httpSession ?? {}; } @@ -355,12 +358,15 @@ export class STT extends stt.STT { try { const fetchFn = this.#session.fetch ?? fetch; - const response = await fetchFn(`${this.#opts.baseURL}/speech-to-text`, { - method: 'POST', - headers: { [AUTHORIZATION_HEADER]: this.#opts.apiKey }, - body: form, - signal: abortSignal ?? null, - }); + const response = await fetchFn( + `${this.#opts.baseURL}/speech-to-text?enable_logging=${String(this.#opts.enableLogging).toLowerCase()}`, + { + method: 'POST', + headers: { [AUTHORIZATION_HEADER]: this.#opts.apiKey }, + body: form, + signal: abortSignal ?? null, + }, + ); const responseJson = parseBatchResponse(await response.json()); if (response.status !== 200) { throw new APIStatusError({ @@ -672,6 +678,7 @@ export class SpeechStream extends stt.SpeechStream { `model_id=${this.#opts.modelId}`, `audio_format=pcm_${this.#opts.sampleRate}`, `commit_strategy=${commitStrategy}`, + `enable_logging=${String(this.#opts.enableLogging).toLowerCase()}`, ]; if (!this.#language) {