/** * Speech-to-text transcription for push-to-talk voice input (cloud path). * * Provider-agnostic: most supported cloud providers speak the OpenAI * `/audio/transcriptions` shape (see `stt-registry.ts`), so we drive them * through Mastra's own voice abstraction — `OpenAIVoice` (a `MastraVoice`) from * `@mastra/voice-openai`. The `openai` provider uses the default endpoint; every * other OpenAI-compatible host is reached by pointing the underlying client at * its `baseURL`. Deepgram is not OpenAI-compatible, so it is driven through * `DeepgramVoice` from `@mastra/voice-deepgram` instead. * * Using `MastraVoice.listen()` keeps this aligned with the framework's voice * ecosystem and normalizes provider responses to a transcript string. The voice * package constructs its own SDK client internally, so this avoids coupling to a * specific `@ai-sdk/*` model-spec version. * * Note: OpenAI OAuth (Codex) tokens cannot be used for the audio transcription * REST endpoint, so a real provider API key is required. */ import type { AuthStorage } from '@mastra/code-sdk/auth/storage'; export declare class VoiceCredentialError extends Error { constructor(provider: string); } /** * Resolve an API key for a cloud STT provider. * Honors the env-overrides-stored-key contract: the provider's env var wins, * then the stored credential is used as a fallback. */ export declare function resolveProviderApiKey(provider: string, authStorage?: AuthStorage): string | undefined; export interface TranscribeOptions { /** STT provider id (see `stt-registry.ts`). Defaults to the registry default. */ provider?: string; /** Model id within the provider. Defaults to the provider's default model. */ model?: string; authStorage?: AuthStorage; } /** * Transcribe recorded WAV audio to text via the configured cloud provider. * Throws VoiceCredentialError if no API key is available for the provider. */ export declare function transcribeAudio(audio: Buffer, options?: TranscribeOptions): Promise; /** * A reusable transcriber bound to one provider/model. Building the underlying * `MastraVoice` client once and reusing it across calls lets the HTTP client * keep its connection to the provider warm (keep-alive), which removes the * DNS + TLS handshake cost from every live-partial tick — the main reason the * first dictation streams in slowly while later ones feel instant. */ export interface ReusableTranscriber { transcribe(audio: Buffer): Promise; } /** * Create a transcriber that reuses a single provider client across calls. * Resolves the provider/model and API key once up front (throwing * `VoiceCredentialError` if no key is available), so a session can build it on * start and call `transcribe()` per tick without re-resolving or reconnecting. */ export declare function createTranscriber(options?: TranscribeOptions): ReusableTranscriber; /** * Check whether a cloud STT provider has a usable API key, without recording. */ export declare function hasProviderCredential(provider: string, authStorage?: AuthStorage): boolean; //# sourceMappingURL=transcribe.d.ts.map