Skip to main content
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);
import sunra_client

result = sunra_client.subscribe(
    "elevenlabs/scribe-v1/speech-to-text",
    arguments={
        "audio": "https://assets.sunra.ai/uploads/1749243418768-74d68e25.wav",
        "language": "English",
        "tag_audio_events": True,
        "speaker_diarization": False
    },
    with_logs=True,
    on_enqueue=print,
    on_queue_update=print,
)
print(result) 
import ai.sunra.client.*;
import java.util.Map;
import com.google.gson.JsonObject;

var client = SunraClient.withEnvCredentials();

var response = client.subscribe(
    "elevenlabs/scribe-v1/speech-to-text",
    SubscribeOptions.<JsonObject>builder()
        .input(Map.of(
            "audio", "https://assets.sunra.ai/uploads/1749243418768-74d68e25.wav",
            "language", "English",
            "tag_audio_events", true,
            "speaker_diarization", false))
        .resultType(JsonObject.class)
        .onQueueUpdate(update -> System.out.printf(
            "\nStatus Update: %s, Request ID: %s%n",
            update.getStatus(),
            update.getRequestId()
        ))
        .logs(true)
        .build()
);

System.out.println("Completed!");
System.out.println(response.getData());
curl --request POST \
  --url https://api.sunra.ai/v1/queue/elevenlabs/scribe-v1/speech-to-text \
  --header "Authorization: Key $SUNRA_KEY" \
  --header "Content-Type: application/json" \
  --data '{"audio":"https://assets.sunra.ai/uploads/1749243418768-74d68e25.wav","language":"English","tag_audio_events":true,"speaker_diarization":false}'

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.