SpeechmaticsSTTConfig
Configuration options for the SpeechmaticsSTT provider.
Defined in: src/providers/stt/speechmatics/SpeechmaticsSTT.ts:50
Configuration options for the SpeechmaticsSTT provider.
Remarks
Extends STTProviderConfig with Speechmatics-specific settings. You must provide either apiKey (for direct browser-to-Speechmatics connections) or proxyUrl (for a server-side proxy that injects the API key). If both are provided, proxyUrl takes precedence.
For direct browser connections, Speechmatics requires a short-lived temporary key (JWT) passed as a jwt query parameter — browsers cannot set WebSocket headers. Generate temporary keys server-side via POST https://mp.speechmatics.com/v1/api_keys?type=rt and pass an async factory as apiKey to fetch a fresh key on each connection.
Example
// Direct connection with a temporary key factory
const config: SpeechmaticsSTTConfig = {
apiKey: async () => {
const res = await fetch('/api/speechmatics-temp-key');
const { keyValue } = await res.json();
return keyValue;
},
language: 'en',
};
// Proxy connection (recommended for production)
const config: SpeechmaticsSTTConfig = {
proxyUrl: 'http://localhost:3001/api/proxy/speechmatics',
language: 'en',
};
See
SpeechmaticsSTT for the provider class
Extends
Properties
| Property | Type | Default value | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
additionalVocab? | ( | string | { content: string; sounds_like?: string[]; })[] | undefined | Custom dictionary entries to improve recognition of specialized vocabulary. Remarks Each entry is either a plain string or an object with content and optional sounds_like pronunciations, passed through to transcription_config.additional_vocab. Example additionalVocab: ['CompositeVoice', { content: 'Speechmatics', sounds_like: ['speech matics'] }] | - | src/providers/stt/speechmatics/SpeechmaticsSTT.ts:143 |
apiKey? | string | () => Promise<string> | undefined | API key or authentication token for the provider. Remarks Can be a static string or an async factory function that returns a fresh token on each call. Use a factory for short-lived tokens (e.g. Deepgram JWTs) so each WebSocket connection gets a valid credential. For client-side usage, consider using a proxy server to keep API keys secure. The SDK provides Express, Next.js, and Node adapters for this purpose. | STTProviderConfig.apiKey | src/core/types/providers.ts:71 |
audioFormat? | string | undefined | Audio format of the streamed audio. Remarks Use a raw encoding — 'pcm_s16le', 'pcm_f32le', or 'mulaw' (requires sampleRate) — or 'file' to stream a container format (wav, mp3, ogg, flac, …) that Speechmatics detects from the stream. Default 'pcm_s16le' | - | src/providers/stt/speechmatics/SpeechmaticsSTT.ts:72 |
authType? | "token" | "bearer" | Provider-specific (typically 'token' for Deepgram, ignored for REST providers) | Authentication type for providers that support multiple auth mechanisms. Remarks Controls how the apiKey is sent to the provider: - 'token' — WebSocket subprotocol ['token', apiKey] or header Authorization: Token <key>. This is the default for Deepgram providers. - 'bearer' — WebSocket subprotocol ['bearer', token] or header Authorization: Bearer <token>. Use this for OAuth tokens or providers that expect Bearer auth. REST/SDK providers (Anthropic, OpenAI) handle auth through their SDK constructors and ignore this field. | STTProviderConfig.authType | src/core/types/providers.ts:115 |
debug? | boolean | false | Whether to enable debug logging for this provider. Remarks When true, the provider emits detailed internal logs. This is separate from the SDK-level LoggingConfig. | STTProviderConfig.debug | src/core/types/providers.ts:126 |
domain? | string | undefined | Optional language-pack domain (e.g. 'finance', 'medical') to bias recognition toward a specialized field. | - | src/providers/stt/speechmatics/SpeechmaticsSTT.ts:153 |
enableSpeakerDiarization? | boolean | undefined | Label each word with the speaker who said it (Speechmatics diarization: 'speaker'). Default false | - | src/providers/stt/speechmatics/SpeechmaticsSTT.ts:128 |
endOfUtteranceSilenceTrigger? | number | undefined | Seconds of silence after speech before Speechmatics emits an EndOfUtterance message, which the provider maps to utteranceComplete: true. Remarks Accepted range is 0 to 2; 0 disables end-of-utterance detection entirely. Must be lower than SpeechmaticsSTTConfig.maxDelay. Speechmatics recommends 0.5–0.8 s for voice agents. Required for automatic turn-taking in the CompositeVoice pipeline — when disabled, no utteranceComplete result is emitted until the stream ends, though you can call SpeechmaticsSTT.forceEndOfUtterance manually. Default 0.75 | - | src/providers/stt/speechmatics/SpeechmaticsSTT.ts:122 |
endpoint? | string | undefined | Custom endpoint URL to override the provider’s default API endpoint. Remarks Useful for self-hosted instances, proxy servers, or development environments. | STTProviderConfig.endpoint | src/core/types/providers.ts:79 |
interimResults? | boolean | undefined | Whether to enable interim (partial) transcription results. Remarks When true, the provider emits results as the user speaks, before the utterance is complete. Only applicable to live/WebSocket providers. | STTProviderConfig.interimResults | src/core/types/providers.ts:392 |
keywords? | string[] | undefined | Custom vocabulary or keyword phrases to boost recognition accuracy. Remarks Useful for domain-specific terminology, product names, or proper nouns that the model might not recognize well by default. | STTProviderConfig.keywords | src/core/types/providers.ts:406 |
language? | string | undefined | Language code for transcription. Remarks Uses BCP 47 language tags (e.g., 'en-US', 'es-ES', 'fr-FR'). The supported languages depend on the provider and model. | STTProviderConfig.language | src/core/types/providers.ts:375 |
maxDelay? | number | undefined | Maximum delay in seconds between the end of a spoken word and the final (AddTranscript) result that contains it. Remarks Accepted range is 0.7 to 4. Lower values reduce latency at a small accuracy cost. Must be greater than SpeechmaticsSTTConfig.endOfUtteranceSilenceTrigger. Default 1 | - | src/providers/stt/speechmatics/SpeechmaticsSTT.ts:97 |
maxDelayMode? | "fixed" | "flexible" | undefined | Whether maxDelay may flex to keep entities (numbers, dates, …) intact ('flexible') or is enforced strictly ('fixed'). Remarks When omitted, the Speechmatics server default ('flexible') is used. | - | src/providers/stt/speechmatics/SpeechmaticsSTT.ts:105 |
model? | string | undefined | Model to use for transcription. Remarks Provider-specific model identifier (e.g., 'nova-3' for Deepgram). | STTProviderConfig.model | src/core/types/providers.ts:383 |
operatingPoint? | "standard" | "enhanced" | undefined | Accuracy/latency trade-off for the underlying model. Remarks 'enhanced' is more accurate but adds latency; 'standard' is the Speechmatics default. When omitted, the server default is used. | - | src/providers/stt/speechmatics/SpeechmaticsSTT.ts:85 |
outputLocale? | string | undefined | Locale for the transcript spelling (e.g. 'en-GB', 'en-US'). When omitted, the Speechmatics default for the language is used. | - | src/providers/stt/speechmatics/SpeechmaticsSTT.ts:148 |
proxyUrl? | string | undefined | URL of a CompositeVoice proxy server endpoint for this provider. Remarks When set, requests are routed through the proxy which injects the real API key server-side. This keeps API keys out of the browser. For WebSocket providers the HTTP URL is automatically converted to ws(s)://. At least one of apiKey or proxyUrl must be set for providers that require authentication (all except NativeSTT, NativeTTS, and WebLLM). Example proxyUrl: 'http://localhost:3000/api/proxy/deepgram' | STTProviderConfig.proxyUrl | src/core/types/providers.ts:97 |
punctuation? | boolean | undefined | Whether to enable automatic punctuation in transcription results. | STTProviderConfig.punctuation | src/core/types/providers.ts:397 |
region? | string | undefined | Speechmatics real-time SaaS region for direct connections. Remarks Builds the WebSocket URL wss://{region}.rt.speechmatics.com/v2. Available regions are 'eu' (Europe) and 'us' (USA). Ignored in proxy mode — the proxy targets the EU endpoint. Default 'eu' | - | src/providers/stt/speechmatics/SpeechmaticsSTT.ts:61 |
sampleRate? | number | undefined | Audio sample rate in Hz. Required for raw audio formats. Default 16000 | - | src/providers/stt/speechmatics/SpeechmaticsSTT.ts:77 |
timeout? | number | undefined | Request timeout in milliseconds. Remarks Applies to HTTP requests (REST providers) and connection establishment (WebSocket providers). Set to 0 for no timeout. | STTProviderConfig.timeout | src/core/types/providers.ts:135 |