Toolbelt provides dedicated REST endpoints for text-to-speech (TTS), speech-to-text (STT), and conversational voice turns. These APIs let you build voice-enabled automations, transcribe audio recordings, synthesize spoken notifications, or connect hardware clients like IoT devices and smartwatches directly to your assistants.
Convert text strings into WAV or MP3 audio buffers using OpenAI or Gemini Flash TTS models.
Transcribe spoken audio files up to 25MB using OpenAI Whisper.
Turnkey voice chat endpoints accepting raw audio from microcontrollers and smartwatches.
Authentication#
All voice endpoints require authentication using a standard Toolbelt API key:
Authorization: Bearer <apikey>
Alternatively, pass the key as a query parameter (?apikey=<apikey>). For full details on generating and scoping keys, see API Access.
OpenAI Text-to-Speech (POST /api/voice/tts)#
Converts text into spoken audio using OpenAI TTS models.
Endpoint#
POST /api/voice/tts
Content-Type: application/json
Request Parameters#
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
text |
string | Yes | — | The text to synthesize into speech. |
voice |
string | No | alloy |
Voice ID: alloy, echo, fable, onyx, nova, or shimmer. |
speed |
number | No | 1.0 |
Playback speed from 0.25 to 4.0. |
format |
string | No | wav |
Audio format: wav (recommended for embedded devices) or mp3. |
Example Request#
curl -X POST https://toolbelt.apexti.com/api/voice/tts \
-H "Authorization: Bearer <apikey>" \
-H "Content-Type: application/json" \
-d '{
"text": "Your scheduled backup task completed successfully with zero errors.",
"voice": "nova",
"speed": 1.0,
"format": "mp3"
}' \
--output notification.mp3
Response#
Returns raw binary audio with the appropriate Content-Type:
audio/wavwhenformatiswav.audio/mpegwhenformatismp3.
Workspace Gemini TTS (POST /api/workspaces/:id/tts)#
Generates speech using Google's Gemini Flash TTS models with assistant credit metering, optional multi-speaker dialogue, and automatic file saving to assistant media storage. This is the same backend engine that powers sdk.tts in the Dashboard SDK.
Endpoint#
POST /api/workspaces/<workspaceId>/tts
Authorization: Bearer <apikey>
Content-Type: application/json
Request Parameters#
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
text |
string | Conditional | — | Spoken text (max 5,000 characters in workspaces; 1,500 on public dashboards). Required if turns is omitted. |
voice |
string | No | Kore |
Prebuilt voice name: Kore, Puck, Charon, Zephyr, Fenrir, etc. |
style |
string | No | — | Natural language delivery description (e.g., "calm and professional"). |
model |
string | No | gemini-3.8-flash-lite-tts |
gemini-3.8-flash-lite-tts (fast read-aloud) or gemini-3.8-flash-tts (higher fidelity). |
save |
boolean | No | false |
When true, automatically persists the generated WAV file to assistant media storage. |
turns |
array | Conditional | — | Dialogue array of { speaker, text, style? }. Required for multi-speaker synthesis. |
speakers |
array | Conditional | — | Speaker mapping array of { speaker, voice } (supports up to 2 speakers). |
Example Request (Single Speaker with Storage Save)#
curl -X POST https://toolbelt.apexti.com/api/workspaces/<workspaceId>/tts \
-H "Authorization: Bearer <apikey>" \
-H "Content-Type: application/json" \
-d '{
"text": "Executive summary: Monthly revenue increased 14 percent. <short pause> Server uptime remained at 99.98 percent.",
"voice": "Kore",
"style": "confident and authoritative",
"save": true
}'
Response#
{
"mimeType": "audio/wav",
"data": "<base64-encoded-wav-bytes>",
"dataUrl": "data:audio/wav;base64,<base64-encoded-wav-bytes>",
"model": "gemini-3.8-flash-lite-tts",
"file": {
"path": "media/audio/tts-2026-10-23-abc123.wav",
"url": "https://storage.googleapis.com/.../tts-2026-10-23-abc123.wav?..."
}
}
Speech-to-Text (POST /api/voice/stt)#
Transcribes audio recordings into text using OpenAI Whisper (whisper-1).
Endpoint#
POST /api/voice/stt
Content-Type: multipart/form-data
Request Parameters#
Send multipart form fields:
| Field | Type | Required | Description |
|---|---|---|---|
audio |
binary file | Yes | Audio file buffer (WAV, MP3, M4A, etc.). Maximum size is 25MB. |
language |
string | No | Two-letter ISO language code (e.g., en, es, de). |
prompt |
string | No | Optional guiding prompt to clarify technical terms or acronyms. |
Example Request#
curl -X POST https://toolbelt.apexti.com/api/voice/stt \
-H "Authorization: Bearer <apikey>" \
-F "audio=@meeting-clip.wav" \
-F "language=en"
Response#
{
"transcript": "Let's review the customer onboarding checklist for the staging rollout."
}
Conversational Voice Chat (POST /api/voice/chat)#
A single-turn endpoint that handles transcription, model reasoning, and speech synthesis in one request. You submit an audio recording, and Toolbelt returns a spoken audio response along with base64-encoded transcript headers.
Endpoint#
POST /api/voice/chat
Content-Type: multipart/form-data
Request Parameters#
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
audio |
binary file | Yes | — | The user's spoken audio (WAV). |
workspaceId |
string | No | — | Target assistant workspace ID to apply its model, instructions, and tools. |
voice |
string | No | alloy |
TTS voice to use for the response. |
How It Works#
- Toolbelt transcribes the uploaded audio using Whisper.
- If
workspaceIdis provided, Toolbelt applies the assistant's system instructions and model (defaulting togpt-4o-mini). - An instruction is automatically appended: "Keep responses concise since they will be spoken aloud."
- The generated text response is synthesized into speech and returned as
audio/wav.
Response Headers#
The audio response binary is accompanied by base64-encoded HTTP headers containing the textual dialogue:
X-Transcript: Base64-encoded string of what the user said.X-Response-Text: Base64-encoded string of what the assistant answered.
Example Request#
curl -X POST https://toolbelt.apexti.com/api/voice/chat \
-H "Authorization: Bearer <apikey>" \
-F "audio=@query.wav" \
-F "workspaceId=<workspaceId>" \
-F "voice=nova" \
--output reply.wav
To decode the text transcript from the response headers:
# In bash / macOS:
echo "<base64-content-from-header>" | base64 --decode
Device & IoT Endpoint (POST /api/voice/chat/device)#
Built specifically for resource-constrained hardware such as smartwatches, ESP32 microcontrollers, and IoT hubs that cannot parse multipart forms or handle complex WebSocket handshakes.
Characteristics#
- Raw binary payload: Accepts raw
audio/wavbyte streams directly in the HTTP request body (application/octet-streamoraudio/wav). - Device authentication: Authenticates via device tokens provisioned through
/api/devices. - Ultra-compact response: Returns raw
audio/wav(24kHz, 16-bit mono) formatted for direct playback through hardware audio codecs. - Concise voice prompt: Enforces strict smartwatch-friendly conciseness in assistant replies.
Listing Available Voices (GET /api/voice/voices)#
Returns the current catalog of supported TTS voices.
GET /api/voice/voices
Authorization: Bearer <apikey>
Response#
[
{ "id": "alloy", "name": "Alloy", "gender": "neutral" },
{ "id": "echo", "name": "Echo", "gender": "male" },
{ "id": "fable", "name": "Fable", "gender": "neutral" },
{ "id": "onyx", "name": "Onyx", "gender": "male" },
{ "id": "nova", "name": "Nova", "gender": "female" },
{ "id": "shimmer", "name": "Shimmer", "gender": "female" }
]
