To convert speech to text using the sunra API, you need to send a request to the appropriate endpoint with the required input parameters. The API leverages pre-trained models to transcribe audio files into text, enabling seamless conversion by simply providing an audio file.

Here’s how you can use the sunra API for speech-to-text conversion:

import { sunra } from "@sunra/client";

const result = await sunra.subscribe("elevenlabs/scribe-v1/speech-to-text", {
  input: {
    audio: 'https://assets.sunra.ai/uploads/1749243418768-74d68e25.wav',
    language: 'English',
    tag_audio_events: true,
    speaker_diarization: false
  },
  logs: true,
  onQueueUpdate: (update) => {
    console.log(update)
  },
});
console.log(result.data);
console.log(result.requestId);

Choosing the Right Model

sunra provides a range of speech-to-text models to suit different needs. Select a model based on your requirements for accuracy and performance.

Here are some available options:

  • elevenlabs/scribe-v1: 99-language speech-to-text with word-level timestamps and diarisation—the company’s most accurate ASR yet.

To use a specific model, specify its ID in the subscribe method as shown in the example. For more models and details, visit the Speech to Text Models page.