ShvIA

Docs · OpenAI-compatible API

Audio

Speech to text and text to speech, in the OpenAI shapes.

Both endpoints take your API key, count against the shared /v1 request limit, and are not counted against your token quota.

POST/v1/audio/transcriptions#

Send the audio as multipart/form-data.

FieldRequiredNotes
fileyesthe audio. A type the server does not accept returns 400; a file over the size limit returns 413
languagenoan ISO language code. When omitted the server's default applies, which is Portuguese unless the operator changed it, so set it for other languages
response_formatnojson (default) or text. verbose_json, srt and vtt return 400
model, prompt, temperature, timestamp_granularities[]noaccepted and ignored. The model is the server's
bash
curl -s "$SHVIA_URL/v1/audio/transcriptions" \
  -H "Authorization: Bearer $SHVIA_API_KEY" \
  -F "file=@meeting.mp3" \
  -F "language=en"
json
{ "text": "Welcome, everyone. Let us start with the numbers." }

With response_format=text the body is the plain transcript. The accepted audio types are WebM, Ogg, MP4, M4A, AAC, MP3, WAV and FLAC. The default size limit is 15 MiB, set by the operator.

POST/v1/audio/speech#

Send JSON.

FieldRequiredNotes
inputyesthe text. Text beyond the server's limit, 4000 characters by default, is cut silently
voicenoa voice name. It is passed to the speech server as it is, so valid names are the server's own
response_formatnomp3, opus, aac, flac, wav or pcm. The default is set by the operator, normally mp3
model, speed, instructionsnoaccepted and ignored
bash
curl -s "$SHVIA_URL/v1/audio/speech" \
  -H "Authorization: Bearer $SHVIA_API_KEY" -H "Content-Type: application/json" \
  -d '{ "input": "Your order has shipped.", "response_format": "mp3" }' \
  --output answer.mp3

The response is the audio bytes, buffered and sent whole, with Cache-Control: no-store. The Content-Type follows the format you asked for. pcm is labelled audio/wav.

Errors#

The OpenAI shape, as in chat completions:

StatuscodeWhen
400invalid_request_errorno file or input, a format that is not supported, or an audio type that is not accepted
401invalid_api_keythe key is not valid
403permission_deniedthe speech server runs on another machine and your account group may only use the operator's local servers
413invalid_request_errorthe audio file is too large
429nonerequest limit reached
502upstream_errorthe speech server could not be reached or answered with an error
503audio_not_configuredthe operator has not set up speech