import { type APIConnectOptions, type AudioBuffer, type VAD, stt } from '@livekit/agents';
import { OpenAI } from 'openai';
import type { GroqAudioModels, STTModels } from './models.js';
import type * as api_proto from './realtime/api_proto.js';
/**
 * Build the realtime transcription WebSocket URL.
 *
 * For OpenAI-compatible gateways (LiteLLM, Cloudflare AI Gateway, etc.) the
 * model is included on the upgrade URL so the gateway can route by model
 * before the subsequent `session.update` frame arrives. OpenAI's own
 * `wss://api.openai.com/.../realtime` endpoint, on the other hand, treats a
 * `?model=` query param as selecting a conversation session and rejects the
 * subsequent transcription-mode `session.update` with
 * `error.invalid_request_error.invalid_model`, so the model is intentionally
 * omitted for native OpenAI connections — the model is conveyed via
 * `session.update → audio.input.transcription.model` instead.
 *
 * The scheme of `baseURL` is respected: `http://` maps to `ws://`
 * and `https://` maps to `wss://`.
 *
 * @internal
 */
export declare function buildRealtimeSttUrl(baseURL: string | undefined, model: string): string;
export declare function buildRealtimeTranscriptionConfig(options: {
    model: string;
    languages: string[];
    keywords?: string[];
    prompt?: string;
}): api_proto.InputAudioTranscription;
export declare function _loadRealtimeVad(vad?: VAD): Promise<VAD>;
export declare function _requiresRealtimeVad(model: string, turnDetection: api_proto.TurnDetectionType | null | undefined): boolean;
export declare function _normalizeRealtimeTurnDetection(model: string, turnDetection: SessionTurnDetection | null | undefined): api_proto.TurnDetectionType | null | undefined;
export declare function _validateRealtimeVad(model: string, turnDetection: api_proto.TurnDetectionType | null | undefined, vad: VAD | undefined): void;
export interface STTOptions {
    apiKey?: string;
    language: string | string[];
    prompt?: string;
    /** Literal terms expected in the audio. Supported by gpt-transcribe and gpt-live-transcribe. */
    keywords?: string[];
    detectLanguage: boolean;
    model: STTModels | string;
    baseURL?: string;
    client?: OpenAI;
    useRealtime: boolean;
    turnDetection?: SessionTurnDetection | null;
    noiseReductionType?: api_proto.NoiseReductionType;
    /** Pass null to opt out of the default client VAD and commit audio manually. */
    vad?: VAD | null;
    temperature?: number;
}
export type SessionTurnDetection = (Omit<Extract<api_proto.TurnDetectionType, {
    type: 'server_vad';
}>, 'type'> & {
    type?: 'server_vad';
}) | Extract<api_proto.TurnDetectionType, {
    type: 'semantic_vad';
}>;
type ResolvedSTTOptions = Omit<STTOptions, 'apiKey' | 'language' | 'keywords' | 'turnDetection'> & {
    apiKey: string;
    languages: string[];
    keywords: string[];
    turnDetection?: api_proto.TurnDetectionType | null;
};
export declare class STT extends stt.STT {
    #private;
    label: string;
    get model(): string;
    get turnDetection(): api_proto.TurnDetectionType | null | undefined;
    get provider(): string;
    /**
     * Create a new instance of OpenAI STT.
     *
     * @remarks
     * `apiKey` must be set to your OpenAI API key, either using the argument or by setting the
     * `OPENAI_API_KEY` environment variable.
     */
    constructor(opts?: Partial<STTOptions>);
    /**
     * Create a new instance of Groq STT.
     *
     * @remarks
     * `apiKey` must be set to your Groq API key, either using the argument or by setting the
     * `GROQ_API_KEY` environment variable.
     */
    static withGroq(opts?: Partial<{
        model: string | GroqAudioModels;
        apiKey?: string;
        baseURL?: string;
        client: OpenAI;
        language: string | string[];
        detectLanguage: boolean;
    }>): STT;
    /**
     * Create a new instance of OVHcloud AI Endpoints STT.
     *
     * @remarks
     * `apiKey` must be set to your OVHcloud AI Endpoints API key, either using the argument or by setting the
     * `OVHCLOUD_API_KEY` environment variable.
     */
    static withOVHcloud(opts?: Partial<{
        model: string;
        apiKey?: string;
        baseURL?: string;
        client: OpenAI;
        language: string | string[];
        detectLanguage: boolean;
    }>): STT;
    _recognize(buffer: AudioBuffer, abortSignal?: AbortSignal): Promise<stt.SpeechEvent>;
    updateOptions(opts: Partial<STTOptions>): void;
    _updateSessionKeyterms(keyterms: string[]): void;
    stream(options?: {
        connOptions?: APIConnectOptions;
        language?: string | string[];
    }): stt.SpeechStream;
    close(): Promise<void>;
}
export declare class SpeechStream extends stt.SpeechStream {
    #private;
    label: string;
    constructor(stt: STT, options: ResolvedSTTOptions, connOptions?: APIConnectOptions, onClose?: () => void);
    get languages(): string[];
    updateOptions(options: {
        language?: string | string[];
    }): void;
    /** @internal */
    _updateOptions(options: ResolvedSTTOptions, languages?: string[]): void;
    get isClosed(): boolean;
    close(): void;
    protected run(): Promise<void>;
}
export {};
//# sourceMappingURL=stt.d.ts.map