import { WebSocket } from 'ws';
import { ConnectionPool } from '../connection_pool.js';
import type { ChunkedStream } from '../tts/index.js';
import { SynthesizeStream as BaseSynthesizeStream, TTS as BaseTTS } from '../tts/index.js';
import { type APIConnectOptions } from '../types.js';
import { type AnyString } from './utils.js';
export type CartesiaModels = 'cartesia/sonic-3' | 'cartesia/sonic-2' | 'cartesia/sonic-turbo' | 'cartesia/sonic';
export type DeepgramTTSModels = 'deepgram/aura' | 'deepgram/aura-2';
export type ElevenlabsModels = 'elevenlabs/eleven_flash_v2' | 'elevenlabs/eleven_flash_v2_5' | 'elevenlabs/eleven_turbo_v2' | 'elevenlabs/eleven_turbo_v2_5' | 'elevenlabs/eleven_multilingual_v2';
export type InworldModels = 'inworld/inworld-tts-1.5-max' | 'inworld/inworld-tts-1.5-mini' | 'inworld/inworld-tts-1-max' | 'inworld/inworld-tts-1';
export type RimeModels = 'rime/arcana' | 'rime/mistv2';
export interface CartesiaOptions {
    duration?: number;
    speed?: 'slow' | 'normal' | 'fast';
}
export interface ElevenlabsOptions {
    inactivity_timeout?: number;
    apply_text_normalization?: 'auto' | 'off' | 'on';
}
export interface DeepgramTTSOptions {
}
export interface RimeOptions {
}
export interface InworldOptions {
}
type _TTSModels = CartesiaModels | DeepgramTTSModels | ElevenlabsModels | RimeModels | InworldModels;
export type TTSModels = CartesiaModels | DeepgramTTSModels | ElevenlabsModels | RimeModels | InworldModels | AnyString;
export type ModelWithVoice = `${_TTSModels}:${string}` | TTSModels;
export type TTSOptions<TModel extends TTSModels> = TModel extends CartesiaModels ? CartesiaOptions : TModel extends DeepgramTTSModels ? DeepgramTTSOptions : TModel extends ElevenlabsModels ? ElevenlabsOptions : TModel extends RimeModels ? RimeOptions : TModel extends InworldModels ? InworldOptions : Record<string, unknown>;
type TTSEncoding = 'pcm_s16le';
export interface InferenceTTSOptions<TModel extends TTSModels> {
    model?: TModel;
    voice?: string;
    language?: string;
    encoding: TTSEncoding;
    sampleRate: number;
    baseURL: string;
    apiKey: string;
    apiSecret: string;
    modelOptions: TTSOptions<TModel>;
}
/**
 * Livekit Cloud Inference TTS
 */
export declare class TTS<TModel extends TTSModels> extends BaseTTS {
    #private;
    private opts;
    private streams;
    pool: ConnectionPool<WebSocket>;
    constructor(opts: {
        model: TModel;
        voice?: string;
        language?: string;
        baseURL?: string;
        encoding?: TTSEncoding;
        sampleRate?: number;
        apiKey?: string;
        apiSecret?: string;
        modelOptions?: TTSOptions<TModel>;
    });
    get label(): string;
    static fromModelString(modelString: string): TTS<AnyString>;
    updateOptions(opts: Partial<Pick<InferenceTTSOptions<TModel>, 'model' | 'voice' | 'language'>>): void;
    synthesize(_: string): ChunkedStream;
    stream(options?: {
        connOptions?: APIConnectOptions;
    }): SynthesizeStream<TModel>;
    connectWs(timeout: number): Promise<WebSocket>;
    closeWs(ws: WebSocket): Promise<void>;
    prewarm(): void;
    close(): Promise<void>;
}
export declare class SynthesizeStream<TModel extends TTSModels> extends BaseSynthesizeStream {
    #private;
    private opts;
    private tts;
    constructor(tts: TTS<TModel>, opts: InferenceTTSOptions<TModel>, connOptions: APIConnectOptions);
    get label(): string;
    updateOptions(opts: Partial<Pick<InferenceTTSOptions<TModel>, 'model' | 'voice' | 'language'>>): void;
    protected run(): Promise<void>;
}
export {};
//# sourceMappingURL=tts.d.ts.map