API Reference
Audio
Use speech generation, audio transcription and audio translation APIs.
Audio APIs include speech generation, transcription and translation. Speech generation uses a JSON request body; transcription and translation usually use multipart form data to upload the audio file.
Endpoints
| Method | Path | Description |
|---|---|---|
POST | /v1/audio/speech | Text to speech |
POST | /v1/audio/transcriptions | Audio transcription |
POST | /v1/audio/translations | Audio translation |
Request Fields
| Field | Type | Applies To | Description |
|---|---|---|---|
model | string | All | Audio model ID, required |
input | string | speech | Text to synthesize |
voice | string | speech | Voice ID |
instructions | string | speech | Voice style or extra instructions |
response_format | string | All | Response format. Transcription and translation default to json |
speed | number | speech | Speech speed |
stream_format | string | speech | Set to sse to enable streaming when the model supports it |
metadata | object | speech | Pass-through metadata |
file | file | transcriptions/translations | Audio file in multipart form data, required |
language | any | extension | Language option supported by some channels |
Speech Generation
curl https://api.tensoraxis.com/v1/audio/speech \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TENSORAXIS_API_KEY" \
-d '{
"model": "tts-1",
"voice": "alloy",
"input": "Hello from TENSORAXIS.",
"response_format": "mp3"
}' \
--output speech.mp3Transcription
curl https://api.tensoraxis.com/v1/audio/transcriptions \
-H "Authorization: Bearer $TENSORAXIS_API_KEY" \
-F model="whisper-1" \
-F file="@audio.mp3" \
-F response_format="json"Translation
curl https://api.tensoraxis.com/v1/audio/translations \
-H "Authorization: Bearer $TENSORAXIS_API_KEY" \
-F model="whisper-1" \
-F file="@audio.mp3" \
-F response_format="json"Response Shape
JSON transcription and translation responses usually include text:
{
"text": "Transcribed text..."
}Speech generation returns binary audio directly. The response Content-Type depends on response_format and the upstream model.