Live docs for voice lookup, authenticated TTS, and instant audio playback.
This page now uses the production BedVibe API contract. It loads your current Supabase
session, fetches live voices from /api/voices, builds the
base_voice and emotion request body, sends
/api/tts, and plays the raw audio response in-browser.
base_voice and emotion for TTS requests.
The backend does not use speaker.
Current account context
Checking your BedVibe session and preparing the live tester.
/api/tts request
needs your current Supabase access token.
Live tester
The speaker selector is populated from Object.keys(base_voices).
The emotion selector is populated from base_voices[selectedSpeaker].
If a selected speaker has no emotions, the tester automatically falls back to neutral.
Request preview
{
"text": "",
"language": "en",
"base_voice": "YOUR_BASE_VOICE",
"emotion": "neutral",
"hd": false,
"return_visemes": false,
"return_audio_base64": false
}
Audio response
`res.blob()` -> `URL.createObjectURL(blob)`Endpoints
These are the two core routes used by the page below. The live tester calls both against the BedVibe production API.
Returns the live voice catalog.
The UI uses Object.keys(base_voices) for the speaker list and base_voices[selectedSpeaker] for the emotion list.
Requires Authorization: Bearer <Supabase access token>.
Accepts text, language, base_voice, emotion, and hd, then responds with raw audio bytes.
Live voices response shape
{
"count": 0,
"voice_ids": [],
"base_voices": {
"YOUR_BASE_VOICE": ["neutral"]
}
}
Auth header
Authorization: Bearer YOUR_SUPABASE_ACCESS_TOKEN
Examples
The examples below stay aligned with the live tester and use base_voice plus
emotion instead of the older speaker field.
JSON body
{
"text": "Welcome to BedVibe.",
"language": "en",
"base_voice": "YOUR_BASE_VOICE",
"emotion": "neutral",
"hd": false,
"return_visemes": false,
"return_audio_base64": false
}
cURL
curl -X POST "https://api.bedvibe.studio/api/tts" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"text": "Welcome to BedVibe.",
"language": "en",
"base_voice": "YOUR_BASE_VOICE",
"emotion": "neutral",
"hd": false,
"return_visemes": false,
"return_audio_base64": false
}'
JavaScript
const token = "YOUR_ACCESS_TOKEN";
const res = await fetch("https://api.bedvibe.studio/api/tts", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`
},
body: JSON.stringify({
text: "Welcome to BedVibe.",
language: "en",
base_voice: "YOUR_BASE_VOICE",
emotion: "neutral",
hd: false,
return_visemes: false,
return_audio_base64: false
})
});
if (!res.ok) {
throw new Error("TTS request failed");
}
const blob = await res.blob();
const url = URL.createObjectURL(blob);
audio.src = url;
audio.play();
What this page is doing
- Loads
/supabaseClient.jsand/auth.jsfrom the existing BedVibe site. - Reads the current Supabase session access token from the active browser session.
- Calls
/api/voicesto build the speaker and emotion selectors. - Calls
/api/ttswithbase_voice,emotion, and raw audio response handling. - Shows login state, request errors, and playback controls directly in the page.
If the voice catalog changes on the backend, this page will pick up the new
base_voices mapping automatically on refresh.