Transcriptions

POST /api/v1/audio/transcriptions

Send a recording and get its text back. Send it as multipart/form-data with the file, or as JSON with the audio in base64.

curl https://functionvoice.ai/api/v1/audio/transcriptions \
  -H "Authorization: Bearer $FUNCTION_API_KEY" \
  -F model=function/dictate-1.2 \
  -F file=@recording.m4a

JSON body

curl https://functionvoice.ai/api/v1/audio/transcriptions \
  -H "Authorization: Bearer $FUNCTION_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "function/transcribe-1.2",
    "input_audio": { "data": "'"$(base64 < recording.wav)"'", "format": "wav" },
    "language": "en",
    "keyterms": ["Priya", "Q3 roadmap"]
  }'
FieldTypeDescription
modelstringfunction/dictate-1.2 for polished text, function/transcribe-1.2 for every word as it was said. function/dictate and function/transcribe name the latest version. Required.
input_audioobjectThe recording. Required.
input_audio.datastringThe audio as base64: the raw bytes, not a data URI. Required.
input_audio.formatstringwav, m4a (AAC) or pcm (raw 16-bit little-endian mono). Required.
languagestringThe language spoken, as an ISO-639-1 code such as en or es. English if left out. Dictate writes in the language that was spoken.
keytermsarray of stringsNames and terms to spell exactly as given: people, products, jargon. Up to 1,000, each up to 100 characters.
sample_rateintegerFor pcm only: its sample rate in Hz. 8000 to 48000. 16000 if left out.
response_formatstringverbose_json adds task, language and duration to the answer. json if left out.

Multipart body

FieldTypeDescription
modelstringfunction/dictate-1.2 for polished text, function/transcribe-1.2 for every word as it was said. function/dictate and function/transcribe name the latest version. Required.
filefileThe recording. Its format is read from the file. Required.
languagestringThe language spoken, as an ISO-639-1 code such as en or es. English if left out. Dictate writes in the language that was spoken.
keyterms[]array of stringsNames and terms to spell exactly as given: people, products, jargon. Up to 1,000, each up to 100 characters. Repeat the field once per term.
sample_rateintegerFor pcm only: its sample rate in Hz. 8000 to 48000. 16000 if left out.
response_formatstringverbose_json adds task, language and duration to the answer. json if left out.

prompt, temperature, timestamp_granularities, provider, user, session_id are accepted and ignored, so a client written for the common transcription shape works unchanged.

Audio

FormatWhat it takes
WAVAny common sample rate, mono or stereo.
M4AAAC, as phones record it.
PCMRaw 16-bit little-endian mono, 16 kHz unless sample_rate says otherwise.

Up to 10 minutes and 24 MB a request. MP3, FLAC, Ogg and WebM are refused with unsupported_audio_format.

Response

Response
{
  "text": "Can you send the deck to Priya by Friday?",
  "usage": {
    "seconds": 3.82,
    "cost": 0.0013611111
  }
}
FieldTypeDescription
textstringThe text: polished for Dictate, as said for Transcribe. Empty when nothing was said.
usageobjectWhat the request used and cost.
taskstringWith verbose_json only.
languagestring or nullWith verbose_json only: the language heard, when known.
durationnumberWith verbose_json only: the recording's length, in seconds.

The X-Function-Generation-Id header names the request. It is the id in the dashboard's request list. Quote it when you report a problem.

Errors

Statuserror_typeMeaning
400invalid_requestA field is missing or wrong. The message says which.
400unsupported_audio_formatNot WAV, M4A or PCM.
401missing_api_keyNo key in the Authorization header.
401invalid_api_keyThe key is wrong or revoked.
401expired_api_keyThe key is past its expiry.
402payment_requiredAdd a payment method in the dashboard.
403ip_not_allowedThe request came from outside the key's IP allowlist.
403forbiddenThe key isn't allowed to use this model.
403spend_limitThe key reached its spending limit. metadata.limit_source says which: key_lifetime, key_week or key_month.
413payload_too_largeOver 10 minutes or 24 MB of audio.
429rate_limitedOver 120 requests a minute for the key. Wait for Retry-After.
500internal_errorSomething went wrong on our side. Try again.
502transcription_failedThe audio couldn't be transcribed this time. Try again. You aren't charged.
503unavailableThe service is briefly unavailable. Try again after Retry-After.

Every error has the same shape.

View as Markdown