# JavaScript speech recognition libraries

JavaScript speech recognition libraries turn recorded or live audio into text. Most send the audio to a cloud speech-to-text service that returns a transcript with timestamps and speaker labels. These libraries let voice agents, meeting tools, and captioning apps act on what people say.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [@elevenlabs/elevenlabs-js](#elevenlabs-elevenlabs-js) | 5.7M | 456 | Nov 2026 | MIT |
| [Deepgram JavaScript SDK](#deepgram-sdk) | 5.3M | 286 | Nov 2026 | MIT |
| [Google Cloud Speech](#google-cloud-speech-to-text) | 3.5M | 3.2K | Oct 2026 | Apache-2.0 |
| [@aws-sdk/client-transcribe](#aws-sdk-client-transcribe) | 3.4M | 3.7K | Nov 2026 | Apache-2.0 |
| [AssemblyAI](#assemblyai) | 2.9M | 77 | Nov 2026 | MIT |
| [microsoft-cognitiveservices-speech-sdk](#microsoft-speech-sdk) | 2.7M | 327 | Oct 2026 | MIT |
| [@aws-sdk/client-transcribe-streaming](#amazon-transcribe-streaming) | 2.1M | 3.7K | Nov 2026 | Apache-2.0 |
| [react-speech-recognition](#react-speech-recognition) | 1.1M | 843 | Apr 2025 | MIT |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

The [ElevenLabs JavaScript SDK](#elevenlabs-elevenlabs-js) has the most monthly downloads in this comparison, at 5.7M, a count that covers every ElevenLabs API rather than speech recognition alone.

## Capabilities

| Library | Live audio | Speaker labels |
| --- | --- | --- |
| [@elevenlabs/elevenlabs-js](#elevenlabs-elevenlabs-js) | Yes | Yes |
| [Deepgram JavaScript SDK](#deepgram-sdk) | Yes | Yes |
| [Google Cloud Speech](#google-cloud-speech-to-text) | Yes | Yes |
| [@aws-sdk/client-transcribe](#aws-sdk-client-transcribe) | No | Yes |
| [AssemblyAI](#assemblyai) | Yes | Yes |
| [microsoft-cognitiveservices-speech-sdk](#microsoft-speech-sdk) | Yes | Yes |
| [@aws-sdk/client-transcribe-streaming](#amazon-transcribe-streaming) | Yes | Yes |
| [react-speech-recognition](#react-speech-recognition) | Yes | No |

## Libraries

### @elevenlabs/elevenlabs-js

[GitHub](https://github.com/elevenlabs/elevenlabs-js) · [npm](https://www.npmjs.com/package/@elevenlabs/elevenlabs-js) · [Docs](https://elevenlabs.io/docs/developers/guides/cookbooks/speech-to-text/quickstart)

Provides the official JavaScript library for the ElevenLabs API.

- Downloads / mo: 5.7M
- Stars: 456
- Last release: 2.79.0
- License: MIT
- Capabilities: [From the @elevenlabs/elevenlabs-js docs](https://elevenlabs.io/docs/developers/guides/cookbooks/speech-to-text/quickstart)

```sh
npm install @elevenlabs/elevenlabs-js@2.79.0
```

**Quickstart**

```typescript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
const client = new ElevenLabsClient();
const audio = await fetch("https://storage.googleapis.com/eleven-public-cdn/audio/marketing/nicole.mp3");
const transcript = await client.speechToText.convert({
  file: new Blob([await audio.arrayBuffer()], { type: "audio/mp3" }),
  modelId: "scribe_v3",
});
console.log(transcript);

```

From [example.mts](https://elevenlabs.io/docs/developers/guides/cookbooks/speech-to-text/quickstart) · [Find projects using @elevenlabs/elevenlabs-js →](https://dashboard.exa.ai/playground/search?q=%40elevenlabs/elevenlabs-js%20GitHub%20projects)

### Deepgram JavaScript SDK

[GitHub](https://github.com/deepgram/deepgram-js-sdk) · [npm](https://www.npmjs.com/package/@deepgram/sdk) · [Docs](https://registry.npmjs.org/%40deepgram%2Fsdk/latest)

Provides the official JavaScript SDK for Deepgram.

- Downloads / mo: 5.3M
- Stars: 286
- Last release: 5.20.0
- License: MIT
- Capabilities: [From the Deepgram JavaScript SDK docs](https://registry.npmjs.org/%40deepgram%2Fsdk/latest)

```sh
npm install @deepgram/sdk@5.20.0
```

**Quickstart**

```typescript
import { createReadStream } from "node:fs";
import { DeepgramClient } from "@deepgram/sdk";
const client = new DeepgramClient();
const response = await client.listen.v1.media.transcribeFile(
  createReadStream("audio.wav"), { model: "nova-3" }
);
console.log(response.results.channels[0].alternatives[0].transcript);

```

From [README.md](https://registry.npmjs.org/%40deepgram%2Fsdk/latest) · [Find projects using Deepgram JavaScript SDK →](https://dashboard.exa.ai/playground/search?q=%40deepgram/sdk%20GitHub%20projects)

### Google Cloud Speech

[GitHub](https://github.com/googleapis/google-cloud-node) · [npm](https://www.npmjs.com/package/@google-cloud/speech) · [Docs](https://github.com/googleapis/google-cloud-node/blob/b3a96877f6830e2869b9026e95c10df41923790d/packages/google-cloud-speech/src/v1/speech_client.ts)

Recognizes speech through Google Cloud's Node.js client.

- Downloads / mo: 3.5M
- Stars: 3.2K
- Last release: 8.2.1
- License: Apache-2.0
- Capabilities: [From the Google Cloud Speech docs](https://github.com/googleapis/google-cloud-node/blob/b3a96877f6830e2869b9026e95c10df41923790d/packages/google-cloud-speech/src/v1/speech_client.ts)

**Strengths**

- **Processes recordings asynchronously.** Use longRunningRecognize to retrieve a transcript when processing finishes.
- **Returns speaker-tagged words.** Enable diarization to attach speaker labels to recognized words.

**Watch out for**

- **Streaming requires gRPC.** Route live audio through a gRPC-capable Node backend.

```sh
npm install @google-cloud/speech@8.2.1
```

**GoogleCloudPlatform/nodejs-docs-samples** (3.0K stars)

[GoogleCloudPlatform/nodejs-docs-samples](https://github.com/GoogleCloudPlatform/nodejs-docs-samples) 

```typescript
async function asyncRecognizeGCS(
  gcsUri,
  encoding,
  sampleRateHertz,
  languageCode
) {
  // [START speech_transcribe_async_gcs]
  // Imports the Google Cloud client library
  const speech = require('@google-cloud/speech');

  // Creates a client
  const client = new speech.SpeechClient();

  /**
   * TODO(developer): Uncomment the following lines before running the sample.
   */
  // const gcsUri = 'gs://my-bucket/audio.raw';
  // const encoding = 'Encoding of the audio file, e.g. LINEAR16';
  // const sampleRateHertz = 16000;
  // const languageCode = 'BCP-47 language code, e.g. en-US';

  const config = {
    encoding: encoding,
    sampleRateHertz: sampleRateHertz,
    languageCode: languageCode,
  };

  const audio = {
    uri: gcsUri,
  };

  const request = {
    config: config,
    audio: audio,
  };

  // Detects speech in the audio file. This creates a recognition job that you
  // can wait for now, or get its result later.
  const [operation] = await client.longRunningRecognize(request);
  // Get a Promise representation of the final result of the job
  const [response] = await operation.promise();
  const transcription = response.results
    .map(result => result.alternatives[0].transcript)
    .join('\n');
  console.log(`Transcription: ${transcription}`);
  // [END speech_transcribe_async_gcs]
}

```

[speech/recognize.js](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/7d399e2b93deac11a75e781b0525580d8a7cceec/speech/recognize.js#L227) · [More projects using Google Cloud Speech →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20application%20%40google-cloud/speech%20speech%20recognition%20transcription%20streaming%20audio&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
import { SpeechClient } from "@google-cloud/speech";
const client = new SpeechClient();
const [response] = await client.recognize({
  audio: { uri: process.env.AUDIO_GCS_URI },
  config: { encoding: "LINEAR16", sampleRateHertz: 16000, languageCode: "en-US" },
});
console.log(response.results?.map(result => result.alternatives?.[0]?.transcript));

```

From [quickstart.js](https://github.com/googleapis/google-cloud-node/blob/b3a96877f6830e2869b9026e95c10df41923790d/packages/google-cloud-speech/src/v1/speech_client.ts)

### @aws-sdk/client-transcribe

[GitHub](https://github.com/aws/aws-sdk-js-v3) · [npm](https://www.npmjs.com/package/@aws-sdk/client-transcribe) · [Docs](https://api.github.com/repos/aws/aws-sdk-js-v3/contents/clients/client-transcribe/src/commands/StartTranscriptionJobCommand.ts?ref=v3.1172.0)

Provides the AWS SDK client for Amazon Transcribe in Node.js, browsers, and React Native.

- Downloads / mo: 3.4M
- Stars: 3.7K
- Last release: 3.1172.0
- License: Apache-2.0
- Capabilities: [From the @aws-sdk/client-transcribe docs](https://api.github.com/repos/aws/aws-sdk-js-v3/contents/clients/client-transcribe/src/commands/StartTranscriptionJobCommand.ts?ref=v3.1172.0)

```sh
npm install @aws-sdk/client-transcribe@3.1172.0
```

**awsdocs/aws-doc-sdk-examples** (10.5K stars)

[awsdocs/aws-doc-sdk-examples](https://github.com/awsdocs/aws-doc-sdk-examples) 

```typescript
export const run = async () => {
  try {
    const data = await transcribeClient.send(
      new StartTranscriptionJobCommand(params),
    );
    console.log("Success - put", data);
    return data; // For unit tests.
  } catch (err) {
    console.log("Error", err);
  }
};

```

[javascriptv3/example_code/transcribe/src/transcribe_create_job.js](https://github.com/awsdocs/aws-doc-sdk-examples/blob/9d44b4c73c4d85f5b953d7063aa81fc3616f3f6c/javascriptv3/example_code/transcribe/src/transcribe_create_job.js#L39) · [More projects using @aws-sdk/client-transcribe →](https://dashboard.exa.ai/playground/search?q=%40aws-sdk/client-transcribe%20GitHub%20projects)

**Quickstart**

```typescript
import { TranscribeClient, StartTranscriptionJobCommand } from "@aws-sdk/client-transcribe";
const client = new TranscribeClient({ region: process.env.AWS_REGION });
const response = await client.send(new StartTranscriptionJobCommand({
  TranscriptionJobName: process.env.TRANSCRIPTION_JOB_NAME,
  LanguageCode: "en-US",
  Media: { MediaFileUri: process.env.AUDIO_S3_URI },
}));
console.log(response.TranscriptionJob);

```

From [StartTranscriptionJobCommand.ts](https://api.github.com/repos/aws/aws-sdk-js-v3/contents/clients/client-transcribe/src/commands/StartTranscriptionJobCommand.ts?ref=v3.1172.0)

### AssemblyAI

[GitHub](https://github.com/AssemblyAI/assemblyai-node-sdk) · [npm](https://www.npmjs.com/package/assemblyai) · [Docs](https://registry.npmjs.org/assemblyai/latest)

Provides JavaScript interfaces for asynchronous and streaming transcription.

- Downloads / mo: 2.9M
- Stars: 77
- Last release: 4.43.4
- License: MIT
- Capabilities: [From the AssemblyAI docs](https://registry.npmjs.org/assemblyai/latest)

**Strengths**

- **Waits for completed file transcripts.** transcribe submits the job and polls until it finishes.
- **Returns speaker-labeled utterances.** Set speaker_labels to group the transcript by speaker.

**Watch out for**

- **Synchronous word timings are opt-in.** Set timestamps to true when the synchronous transcript needs timings.
- **Browser streaming needs token setup.** Create a temporary streaming token on a server.

```sh
npm install assemblyai@4.43.4
```

**run-llama/LlamaIndexTS** (3.1K stars)

[run-llama/LlamaIndexTS](https://github.com/run-llama/LlamaIndexTS) 

```typescript
protected async transcribeOrGetTranscript(params: TranscribeParams | string) {
    const client = await this.clientPromise;
    if (typeof params === "string") {
      return await client.transcripts.get(params);
    } else {
      return await client.transcripts.transcribe(params);
    }
  }

```

[packages/providers/assemblyai/src/reader.ts](https://github.com/run-llama/LlamaIndexTS/blob/ba24377def1b056f7eae066247e9ae1230509164/packages/providers/assemblyai/src/reader.ts#L58) · [More projects using AssemblyAI →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20application%20assemblyai%20speech%20recognition%20transcription%20streaming%20audio&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
import { AssemblyAI } from "assemblyai";
const client = new AssemblyAI({ apiKey: process.env.ASSEMBLYAI_API_KEY });
const transcript = await client.transcripts.transcribe({
  audio: "https://assembly.ai/sports_injuries.mp3",
  speech_models: ["universal-3-5-pro", "universal-2"],
  language_detection: true,
});
console.log(transcript.text);

```

From [README.md](https://registry.npmjs.org/assemblyai/latest)

### microsoft-cognitiveservices-speech-sdk

[GitHub](https://github.com/microsoft/cognitive-services-speech-sdk-js) · [npm](https://www.npmjs.com/package/microsoft-cognitiveservices-speech-sdk) · [Docs](https://learn.microsoft.com/en-us/javascript/api/microsoft-cognitiveservices-speech-sdk/speechrecognizer?view=azure-node-latest)

Provides browser and Node.js interfaces to Microsoft's Speech SDK.

- Downloads / mo: 2.7M
- Stars: 327
- Last release: 1.53.0
- License: MIT
- Capabilities: [From the microsoft-cognitiveservices-speech-sdk docs](https://learn.microsoft.com/en-us/javascript/api/microsoft-cognitiveservices-speech-sdk/speechrecognizer?view=azure-node-latest)

**Strengths**

- **Accepts browser microphone input.** Build a browser recognizer with AudioConfig.fromDefaultMicrophoneInput.
- **Separates intermediate and final results.** Use recognizing and recognized to handle tentative and final text.

**Watch out for**

- **Node microphone input is unsupported.** Feed a file or audio stream to the Node recognizer.
- **recognizeOnceAsync stops after one utterance.** Use continuous recognition for sessions containing multiple utterances.

```sh
npm install microsoft-cognitiveservices-speech-sdk@1.53.0
```

**microsoft/chat-copilot** (2.4K stars)

[microsoft/chat-copilot](https://github.com/microsoft/chat-copilot) 

```typescript
private generateSpeechRecognizer(token: string, region: string) {
        const speechConfig = speechSdk.SpeechConfig.fromAuthorizationToken(token, region);
        speechConfig.speechRecognitionLanguage = 'en-US';
        const audioConfig = speechSdk.AudioConfig.fromDefaultMicrophoneInput();
        return new speechSdk.SpeechRecognizer(speechConfig, audioConfig);
    }

```

[webapp/src/libs/services/SpeechService.ts](https://github.com/microsoft/chat-copilot/blob/23b27821baa11b2a1639070434628e5b151ce706/webapp/src/libs/services/SpeechService.ts#L35) · [More projects using microsoft-cognitiveservices-speech-sdk →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20application%20microsoft-cognitiveservices-speech-sdk%20speech%20recognition%20transcription%20streaming%20audio&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
import * as speech from "microsoft-cognitiveservices-speech-sdk";
const authorizationToken = "YOUR_AUTHORIZATION_TOKEN";
const region = "YOUR_AZURE_REGION";
const config = speech.SpeechConfig.fromAuthorizationToken(authorizationToken, region);
const audio = speech.AudioConfig.fromDefaultMicrophoneInput();
const recognizer = new speech.SpeechRecognizer(config, audio);
recognizer.recognizeOnceAsync(
  result => { console.log(result.text); recognizer.close(); },
  error => { console.error(error); recognizer.close(); }
);

```

From [index.js](https://learn.microsoft.com/en-us/javascript/api/microsoft-cognitiveservices-speech-sdk/speechrecognizer?view=azure-node-latest)

### @aws-sdk/client-transcribe-streaming

[GitHub](https://github.com/aws/aws-sdk-js-v3) · [npm](https://www.npmjs.com/package/@aws-sdk/client-transcribe-streaming) · [Docs](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartStreamTranscription.html)

Provides the JavaScript client for Amazon Transcribe streaming.

- Downloads / mo: 2.1M
- Stars: 3.7K
- Last release: 3.1172.0
- License: Apache-2.0
- Capabilities: [From the @aws-sdk/client-transcribe-streaming docs](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartStreamTranscription.html)

**Strengths**

- **Streams partial and final transcripts.** Read IsPartial before committing transcript segments to application state.
- **Runs in browser or Node.** Use WebSocket in browsers and HTTP/2 in Node.

**Watch out for**

- **Sample rate must match audio.** Set MediaSampleRateHertz to the stream's actual sample rate.
- **Partial transcripts can change.** Replace tentative text until IsPartial becomes false.

```sh
npm install @aws-sdk/client-transcribe-streaming@3.1172.0
```

**aws-samples/generative-ai-use-cases** (1.4K stars)

[aws-samples/generative-ai-use-cases](https://github.com/aws-samples/generative-ai-use-cases) 

```typescript
const startStream = async (
    mic: MicrophoneStream,
    languageCode?: LanguageCode,
    speakerLabel: boolean = false,
    languageOptions?: string[],
    enableMultiLanguage: boolean = false
  ): Promise<StreamOutcome> => {
    if (!transcribeClient) return { connected: false, receivedResults: false };

    // Update Language
    if (languageCode) {
      setLanguage(languageCode);
    }

    const audioStream = async function* () {
      for await (const chunk of mic as unknown as Buffer[]) {
        yield {
          AudioEvent: {
            AudioChunk: pcmEncodeChunk(chunk),
          },
        };
      }
    };

    // Best Practice: https://docs.aws.amazon.com/transcribe/latest/dg/streaming.html
    let commandParams;

    if (enableMultiLanguage) {
      // Multi-language identification mode (bidirectional translation)
      commandParams = {
        LanguageCode: undefined,
        IdentifyLanguage: false,
        IdentifyMultipleLanguages: true,
        LanguageOptions: languageOptions
          ? languageOptions.join(',')
          : getTranscribeLanguageOptions().join(','),
      };
    } else if (languageCode) {
      // Specific language mode
      commandParams = {
        LanguageCode: languageCode,
        IdentifyLanguage: false,
        IdentifyMultipleLanguages: false,
        LanguageOptions: undefined,
      };
    } else {
      // Auto language identification mode
      commandParams = {
        LanguageCode: undefined,
        IdentifyLanguage: true,
        IdentifyMultipleLanguages: false,
        LanguageOptions: languageOptions
          ? languageOptions.join(',')
          : getTranscribeLanguageOptions().join(','),
      };
    }

    const command = new StartStreamTranscriptionCommand({
      ...commandParams,
      MediaEncoding: 'pcm',
      MediaSampleRateHertz: getTranscribeSampleRate(mic.context.sampleRate),
      AudioStream: audioStream(),
      ShowSpeakerLabel: speakerLabel,
    });

    let connected = false;
    let receivedResults = false;
    try {
      const response = await transcribeClient.send(command);
      connected = true;

      if (response.TranscriptResultStream) {
        // This snippet should be put into an async function
        for await (const event of response.TranscriptResultStream) {
          if (
            event.TranscriptEvent?.Transcript?.Results &&
            event.TranscriptEvent.Transcript?.Results.length > 0
          ) {
            receivedResults = true;
            // Get multiple possible results, but this code only processes a single result
            const result = event.TranscriptEvent.Transcript?.Results[0];

            // Update Language
            if (result.LanguageCode) {
              setLanguage(result.LanguageCode);
            }

            // Process Multiple Speaker
            const transcriptItems =
              result.Alternatives?.flatMap(
                (alternative) => alternative.Items ?? []
              ) ?? [];
            // Merge consecutive transcript with same Speaker
            const mergedTranscripts = transcriptItems.reduce((acc, curr) => {
              if (acc.length > 0 && curr.Type === 'punctuation') {
                acc[acc.length - 1].Content += curr.Content || '';
              } else if (
                acc.length > 0 &&
                acc[acc.length - 1].Speaker === curr.Speaker
              ) {
                acc[acc.length - 1].Content += ' ' + (curr.Content || '');
              } else {
                acc.push(curr);
              }
              return acc;
            }, [] as Item[]);
            const transcripts: Transcript[] = mergedTranscripts?.map(
              (item) => ({
                speakerLabel: item.Speaker ? 'spk_' + item.Speaker : undefined,
                transcript: item.Content || '',
              })
            );

            // Keep timestamps monotonic across automatic reconnections
            const startTime = (result.StartTime ?? 0) + timeOffsetRef.current;
            const endTime = (result.EndTime ?? 0) + timeOffsetRef.current;
            lastEndTimeRef.current = Math.max(lastEndTimeRef.current, endTime);

            setRawTranscripts((prev) => {
              if (prev.length === 0 || !prev[prev.length - 1].isPartial) {
                // segment is complete
                const tmp = update(prev, {
                  $push: [
                    {
                      resultId:
                        result.ResultId ?? `mic-${Date.now()}-${Math.random()}`,
                      startTime,
                      endTime,
                      isPartial: result.IsPartial ?? false,
                      transcripts,
                      languageCode: result.LanguageCode,
                    },
                  ],
                });
                return tmp;
              } else {
                // segment is NOT complete(overrides the previous segment's transcript)
                const tmp = update(prev, {
                  $splice: [
                    [
                      prev.length - 1,
                      1,
                      {
                        resultId:
                          result.ResultId ??
                          `mic-${Date.now()}-${Math.random()}`,
                        startTime,
                        endTime,
                        isPartial: result.IsPartial ?? false,
                        transcripts,
                        languageCode: result.LanguageCode,
                      },
                    ],
                  ],
                });
                return tmp;
              }
            });
          }
        }
      }
    } catch (error) {
      console.error(error);
    }
    return { connected, receivedResults };
  };

```

[packages/web/src/hooks/useMicrophone.ts](https://github.com/aws-samples/generative-ai-use-cases/blob/f3a73cb8cc12898cf046176033f7d1ae3828497a/packages/web/src/hooks/useMicrophone.ts#L137) · [More projects using @aws-sdk/client-transcribe-streaming →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20application%20%40aws-sdk/client-transcribe-streaming%20speech%20recognition%20transcription%20streaming%20audio&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
import { createReadStream } from "node:fs";
import { TranscribeStreamingClient, StartStreamTranscriptionCommand } from "@aws-sdk/client-transcribe-streaming";
const client = new TranscribeStreamingClient({ region: process.env.AWS_REGION });
async function* audio() {
  for await (const chunk of createReadStream("audio.pcm", { highWaterMark: 3200 }))
    yield { AudioEvent: { AudioChunk: chunk } };
}
const response = await client.send(new StartStreamTranscriptionCommand({
  LanguageCode: "en-US", MediaEncoding: "pcm", MediaSampleRateHertz: 16000, AudioStream: audio(),
}));
for await (const event of response.TranscriptResultStream ?? []) console.log(event.TranscriptEvent);

```

From [transcribeClient.js](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartStreamTranscription.html)

### react-speech-recognition

[GitHub](https://github.com/JamesBrill/react-speech-recognition) · [npm](https://www.npmjs.com/package/react-speech-recognition) · [Docs](https://github.com/JamesBrill/react-speech-recognition/blob/master/docs/API.md)

Adds browser speech recognition to React apps.

- Downloads / mo: 1.1M
- Stars: 843
- Last release: 4.0.1
- License: MIT
- Capabilities: [From the react-speech-recognition docs](https://github.com/JamesBrill/react-speech-recognition/blob/master/docs/API.md)

```sh
npm install react-speech-recognition@4.0.1
```

**Mintplex-Labs/anything-llm** (68.4K stars)

[Mintplex-Labs/anything-llm](https://github.com/Mintplex-Labs/anything-llm) 

```tsx
export default function BrowserNativeSTT({ sendCommand }) {
  const previousTranscriptRef = useRef("");
  const {
    transcript,
    listening,
    resetTranscript,
    browserSupportsSpeechRecognition,
    browserSupportsContinuousListening,
    isMicrophoneAvailable,
  } = useSpeechRecognition({
    clearTranscriptOnListen: true,
  });

  function startSTTSession() {
    if (!isMicrophoneAvailable) {
      alert(
        "AnythingLLM does not have access to microphone. Please enable for this site to use this feature."
      );
      return;
    }

    resetTranscript();
    previousTranscriptRef.current = "";
    SpeechRecognition.startListening({
      continuous: browserSupportsContinuousListening,
      language: window?.navigator?.language ?? "en-US",
    });
  }

  function endSTTSession() {
    SpeechRecognition.stopListening();

    // If auto submit is enabled, send an empty string to the chat window to submit the current transcript
    // since every chunk of text should have been streamed to the chat window by now.
    if (Appearance.get("autoSubmitSttInput")) {
      sendCommand({
        text: "",
        autoSubmit: true,
        writeMode: "append",
      });
    }

    resetTranscript();
    previousTranscriptRef.current = "";
    clearTimeout(timeout);
  }

  useEffect(() => {
    if (transcript?.length > 0 && listening) {
      const previousTranscript = previousTranscriptRef.current;
      const newContent = transcript.slice(previousTranscript.length);

      // Stream just the diff of the new content since transcript is an accumulating string.
      // and not just the new content transcribed.
      if (newContent.length > 0)
        sendCommand({ text: newContent, writeMode: "append" });

      previousTranscriptRef.current = transcript;
      clearTimeout(timeout);
      timeout = setTimeout(() => {
        endSTTSession();
      }, SILENCE_INTERVAL);
    }
  }, [transcript, listening]);

  if (!browserSupportsSpeechRecognition) return null;
  return (
    <MicButton
      listening={listening}
      onStart={startSTTSession}
      onStop={endSTTSession}
    />
  );
}

```

[frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SpeechToText/BrowserNative/index.jsx](https://github.com/Mintplex-Labs/anything-llm/blob/c4e4e677ec5611fb488f8d46782813ae994df59e/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SpeechToText/BrowserNative/index.jsx#L18) · [More projects using react-speech-recognition →](https://dashboard.exa.ai/playground/search?q=react-speech-recognition%20GitHub%20projects)

**Quickstart**

```tsx
import SpeechRecognition, { useSpeechRecognition } from "react-speech-recognition";
export default function Dictation() {
  const { transcript, browserSupportsSpeechRecognition } = useSpeechRecognition();
  if (!browserSupportsSpeechRecognition) return <p>Speech recognition is unavailable.</p>;
  return <>
    <button onClick={() => SpeechRecognition.startListening()}>Start</button>
    <button onClick={() => SpeechRecognition.stopListening()}>Stop</button>
    <p>{transcript}</p>
  </>;
}

```

From [API.md](https://github.com/JamesBrill/react-speech-recognition/blob/master/docs/API.md)

## FAQ

### Which JavaScript speech recognition library should I use?

The speech service decides the library. [Deepgram](#deepgram-sdk), [AssemblyAI](#assemblyai), and [ElevenLabs](#elevenlabs-elevenlabs-js) offer SDKs for prerecorded and live transcription. [react-speech-recognition](#react-speech-recognition) suits React apps that use the browser's own speech recognition.

### What is speaker diarization?

Speaker diarization labels which speaker said each part of a transcript. Every cloud SDK in this comparison except [react-speech-recognition](#react-speech-recognition) returns speaker labels.

### What is the Web Speech API?

The Web Speech API is the browser's built-in speech recognition interface. [react-speech-recognition](#react-speech-recognition) wraps it in a React hook that returns the transcript and reports browser support.

### Deepgram vs AssemblyAI: which should I use?

Both [Deepgram](#deepgram-sdk) and [AssemblyAI](#assemblyai) offer JavaScript SDKs for prerecorded and live audio with speaker labels. A test on the app's own recordings shows which service transcribes them better.

### How do I transcribe live audio in JavaScript?

A streaming SDK sends audio chunks over an open connection and returns partial transcripts as the speaker talks. [AWS Transcribe Streaming](#amazon-transcribe-streaming), [Microsoft Speech SDK](#microsoft-speech-sdk), and [AssemblyAI](#assemblyai) support live audio.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best JavaScript speech recognition speech to text libraries Node browser code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
