export type LightningV31Request = {text: string, voice_id: string, model?: ('lightning_v3.1' | 'lightning_v3.1_pro') | undefined, sample_rate?: (8000 | 16000 | 24000 | 44100) | undefined, speed?: number | undefined, language?: ('en' | 'hi' | 'mr' | 'kn' | 'ta' | 'bn' | 'gu' | 'te' | 'ml' | 'pa' | 'or' | 'es') | undefined, number_pronunciation_language?: ('en' | 'hi' | 'mr' | 'kn' | 'ta' | 'bn' | 'gu' | 'te' | 'ml' | 'pa' | 'or' | 'es') | undefined, output_format?: ('mp3' | 'pcm' | 'wav' | 'ulaw' | 'alaw') | undefined, pronunciation_dicts?: Array | undefined, session_id?: string | undefined, request_id?: string | undefined}; export type CreateApiWavesV1LightningV31GetSpeechArgs = {Accept: 'audio/wav', body: LightningV31Request}; export type CreateApiWavesV1LightningV31GetSpeechOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Generate speech from text (Lightning V3.1) * * POST /waves/v1/lightning-v3.1/get_speech */ export const createApiWavesV1LightningV31GetSpeech = async (args: CreateApiWavesV1LightningV31GetSpeechArgs, options?: CreateApiWavesV1LightningV31GetSpeechOptions) => { const {baseUrl = "https://api.smallest.ai", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "audio/wav") if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/waves/v1/lightning-v3.1/get_speech${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };