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.
| Field | Required | Notes |
|---|---|---|
file | yes | the audio. A type the server does not accept returns 400; a file over the size limit returns 413 |
language | no | an 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_format | no | json (default) or text. verbose_json, srt and vtt return 400 |
model, prompt, temperature, timestamp_granularities[] | no | accepted and ignored. The model is the server's |
curl -s "$SHVIA_URL/v1/audio/transcriptions" \
-H "Authorization: Bearer $SHVIA_API_KEY" \
-F "file=@meeting.mp3" \
-F "language=en"{ "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.
| Field | Required | Notes |
|---|---|---|
input | yes | the text. Text beyond the server's limit, 4000 characters by default, is cut silently |
voice | no | a voice name. It is passed to the speech server as it is, so valid names are the server's own |
response_format | no | mp3, opus, aac, flac, wav or pcm. The default is set by the operator, normally mp3 |
model, speed, instructions | no | accepted and ignored |
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.mp3The 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:
| Status | code | When |
|---|---|---|
| 400 | invalid_request_error | no file or input, a format that is not supported, or an audio type that is not accepted |
| 401 | invalid_api_key | the key is not valid |
| 403 | permission_denied | the speech server runs on another machine and your account group may only use the operator's local servers |
| 413 | invalid_request_error | the audio file is too large |
| 429 | none | request limit reached |
| 502 | upstream_error | the speech server could not be reached or answered with an error |
| 503 | audio_not_configured | the operator has not set up speech |