import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.speech.speakStreaming({
textToSpeechStreamingRequest: {
text: "Hello, welcome to our text-to-speech service.",
language: "en",
},
});
console.log(result);
}
run();"(binary)"Convert text to speech with real-time streaming audio delivery.
Key Features:
Request Body:
text: Input text to convert to speech - requiredlanguage: Language code (default: “auto”) - “auto” for automatic detection, or ISO 639-1 codes: en, zh, hi, es, ar, bn, pt, ru, ja, pa, de, ko, fr, tr, it, th, pl, nl, id, vi, urformat: Audio format (default: “mp3”) - “mp3” for compressed MPEG audio (96 kbps) or “pcm” for uncompressed WAVResponse:
X-Language-Code header with detected/used languageaudio/mpeg (MP3) or audio/wav (PCM)Use Cases:
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.speech.speakStreaming({
textToSpeechStreamingRequest: {
text: "Hello, welcome to our text-to-speech service.",
language: "en",
},
});
console.log(result);
}
run();"(binary)"Authenticate with your MKA1 API key at the API gateway: Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, also send X-On-Behalf-Of to identify the end user making the request.
Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.
Request parameters for streaming text-to-speech conversion with language selection and format options.
Input text to convert to speech
1Language code: 'auto' for automatic detection, or ISO 639-1 language codes
auto, en, zh, hi, es, ar, bn, pt, ru, ja, pa, de, ko, fr, tr, it, th, pl, nl, id, vi, ur Audio output format: 'mp3' for MPEG audio (default), or 'pcm' for uncompressed PCM/WAV (24kHz, 16-bit, mono)
mp3, pcm Streaming audio in MP3 or PCM/WAV format with language code header
MP3 audio stream (when format=mp3): 24kHz sample rate, 96 kbps bitrate, 16-bit, mono
Was this page helpful?