Detect language from audio with a speech-to-text API

Detect the language spoken in an audio file: run speech-to-text with no language hint, then read the detected code and confidence from the result.

4 min readSume
All posts

To detect the language of an audio file with an API, run speech-to-text without a language hint and read the detected language code from the result; the same call gives you the transcript. Sume STT 1.0 auto-detects when you omit language_code, and its result reports language_code and a language_probability confidence when they are available.

STT 1.0 is specified in the OpenAPI document behind the Sume API reference, which the API reference docs page names as the source for exact request and response shapes. The video route is in Video inspect. All were read on 2026-09-27.

How do I detect the spoken language with an API?

Send the audio with no language_code. The API reference's own auto_detect_language example is exactly that: an audio_url and a mode, nothing else. The URL must be public HTTPS; the request below also sets duration_seconds, which sizes the usage reservation.

After the submit, poll GET /v1/jobs/{id}/status until terminal is true, or pass a webhook_url, then read the language fields from GET /v1/jobs/{id}/result.

curl -X POST https://api.sume.com/v1/stt-1.0/transcribe \
  -H "Authorization: Bearer $SUME_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: detect-lang-call-0117" \
  -d '{
    "audio_url": "https://example.com/audio/call-0117.wav",
    "duration_seconds": 90,
    "mode": "async"
  }'

What does the result tell me?

A completed result carries these fields under data.result. Both language fields are “when available”, so code for a result without them. The reference calls language_probability a confidence without giving its scale, so pick your cutoff from results on your own files.

STT 1.0 result fields from the Sume API reference, read 2026-09-27.
FieldWhat the reference saysUse it to
language_codeDetected or requested language code, when availableRoute the file to translation, captions, storage, or a reviewer
language_probabilityLanguage detection confidence, when availableHold uncertain files for a person
textThe transcript textKeep it: the detection already paid for it
words[]Each token with start and end in seconds from the audio startTime captions, search, or excerpts
// data from GET /v1/jobs/{id}/result
const { language_code, language_probability, text } = data.result;
const unsure =
  !language_code ||
  (language_probability != null && language_probability < MIN_CONFIDENCE);
if (unsure) sendToReview(file, text); // MIN_CONFIDENCE: your own cutoff
else routeByLanguage(file, language_code, text);

Should I pass a language hint instead?

Only when you already know the language. language_code is an optional BCP-47 hint of 2–16 characters, such as en or ko. With a hint, the result's language_code can be the code you requested rather than one it detected, so it may only echo your hint.

Leave the hint off for unlabeled files, and set it for files you have already sorted, such as a Korean-only archive.

Can I detect the language of a video?

Yes, if the video is on Sume. Video inspect with transcribe: true runs STT 1.0 on a clip on your workspace's media.sume.com, and its language_code works the same way: omit it for auto-detect. In the API reference, the inspect transcript has a language_code field but no language_probability.

For a video file of your own, send its audio track to STT 1.0, as in Transcribe video to text with an API.

What does detection cost, and what are the limits?

  • Detection comes with a full transcription, billed at $0.01 per audio minute on API pricing, plus a 5.5% agent fee by default. To spend less on long recordings, send a short excerpt: fewer audio minutes cost less.
  • One file per request, up to 10 minutes: duration_seconds runs 1–600. Omit it and Sume reserves 1 minute.
  • The result has one language_code for the whole file. The reference doesn't say how a recording that switches languages is labeled.
  • The reference names en and ko as example hints. Test detection on recordings like yours before you rely on it.

Sources

Related posts

More in Media tools

All Media tools posts

Written by Sume