@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
50 lines (49 loc) • 1.59 kB
TypeScript
/**
* OpenAI Text-to-Speech Handler
*
* Implementation of TTS using OpenAI's TTS API.
*
* @module voice/providers/OpenAITTS
*/
import type { TTSHandler, TTSOptions, TTSResult, TTSVoice } from "../../types/index.js";
/**
* OpenAI Text-to-Speech Handler
*
* Supports high-quality neural TTS with multiple voices.
*
* @see https://platform.openai.com/docs/api-reference/audio/createSpeech
*/
export declare class OpenAITTS implements TTSHandler {
private readonly apiKey;
private readonly baseUrl;
/**
* Maximum text length (4096 characters)
*/
readonly maxTextLength = 4096;
/**
* Available voices
*/
private static readonly VOICES;
constructor(apiKey?: string);
isConfigured(): boolean;
getVoices(languageCode?: string): Promise<TTSVoice[]>;
synthesize(text: string, options?: TTSOptions): Promise<TTSResult>;
/**
* Map TTSAudioFormat to OpenAI response_format.
* OpenAI TTS supports: mp3, wav, opus (ogg maps to opus).
* Unsupported formats are coerced to mp3 with a warning.
*/
private mapFormat;
/**
* Get sample rate for format
*/
private getSampleRate;
/**
* Map the OpenAI `response_format` string back to the canonical
* `TTSAudioFormat` so `TTSResult.format` reflects what the API actually
* returned (mapFormat() coerces unsupported requests to "mp3"). Note:
* OpenAI returns Ogg-Opus for both "ogg" and "opus" requests — both
* surface as "opus" since the bytes are an .ogg/Opus container.
*/
private effectiveFormat;
}