Skip to content

AzureSTTConfig

Configuration options for the AzureSTT provider.

Defined in: src/providers/stt/azure/AzureSTT.ts:78

Configuration options for the AzureSTT provider.

Remarks

Extends STTProviderConfig with Azure-specific settings. You must provide either apiKey (for direct browser-to-Azure connections) or proxyUrl (for a server-side proxy that injects the key). If both are provided, proxyUrl takes precedence. In direct mode, region is required.

Browsers cannot set WebSocket headers, so in direct mode the credential travels as a query parameter (as the official Azure JS SDK does): a string apiKey is sent as Ocp-Apim-Subscription-Key=<key>, while an async apiKey factory is assumed to return a short-lived bearer token (from Azure’s POST https://<region>.api.cognitive.microsoft.com/sts/v1.0/issueToken) and is sent as Authorization=Bearer <token>. Set authType explicitly to override either default.

Example

// Direct connection with a server-issued 10-minute token
const config: AzureSTTConfig = {
  region: 'eastus',
  apiKey: async () => {
    const res = await fetch('/api/azure-speech-token');
    const { token } = await res.json();
    return token;
  },
};

// Proxy connection (recommended for production)
const proxyConfig: AzureSTTConfig = {
  proxyUrl: 'http://localhost:3001/api/proxy/azure-stt',
  language: 'en-US',
};

See

AzureSTT for the provider class

Extends

Properties

PropertyTypeDefault valueDescriptionInherited fromDefined in
apiKey?string | () => Promise<string>undefinedAPI 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.apiKeysrc/core/types/providers.ts:71
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.authTypesrc/core/types/providers.ts:115
bitsPerSample?numberundefinedBits per PCM sample. Default 16-src/providers/stt/azure/AzureSTT.ts:129
context?Record<string, unknown>undefinedAdditional speech.context payload merged into the context message sent at the start of every turn (advanced; see the Speech service protocol documentation).-src/providers/stt/azure/AzureSTT.ts:136
debug?booleanfalseWhether 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.debugsrc/core/types/providers.ts:126
endpoint?stringundefinedCustom endpoint URL to override the provider’s default API endpoint. Remarks Useful for self-hosted instances, proxy servers, or development environments.STTProviderConfig.endpointsrc/core/types/providers.ts:79
interimResults?booleanundefinedWhether 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.interimResultssrc/core/types/providers.ts:392
keywords?string[]undefinedCustom 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.keywordssrc/core/types/providers.ts:406
language?stringundefinedLanguage 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.languagesrc/core/types/providers.ts:375
model?stringundefinedModel to use for transcription. Remarks Provider-specific model identifier (e.g., 'nova-3' for Deepgram).STTProviderConfig.modelsrc/core/types/providers.ts:383
numChannels?numberundefinedNumber of audio channels. Default 1-src/providers/stt/azure/AzureSTT.ts:123
outputFormat?"simple" | "detailed"'simple'Result detail level, sent as the format query parameter. Remarks 'simple' returns DisplayText only; 'detailed' adds an NBest list with per-alternative confidence and lexical/ITN forms.-src/providers/stt/azure/AzureSTT.ts:105
profanity?"raw" | "masked" | "removed"undefinedProfanity handling, sent as the profanity query parameter. One of 'masked' (service default), 'removed', or 'raw'.-src/providers/stt/azure/AzureSTT.ts:111
proxyUrl?stringundefinedURL 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.proxyUrlsrc/core/types/providers.ts:97
punctuation?booleanundefinedWhether to enable automatic punctuation in transcription results.STTProviderConfig.punctuationsrc/core/types/providers.ts:397
recognitionMode?AzureSTTRecognitionMode'conversation'Recognition mode, which selects the endpoint path. See AzureSTTRecognitionMode-src/providers/stt/azure/AzureSTT.ts:94
region?stringundefinedAzure region of your Speech resource (e.g. 'eastus', 'westeurope'). Remarks Required in direct mode (ignored when proxyUrl or endpoint is set). Selects the wss://<region>.stt.speech.microsoft.com endpoint.-src/providers/stt/azure/AzureSTT.ts:86
sampleRate?numberundefinedAudio sample rate in Hz of the streamed PCM audio. Default 16000-src/providers/stt/azure/AzureSTT.ts:117
timeout?numberundefinedRequest timeout in milliseconds. Remarks Applies to HTTP requests (REST providers) and connection establishment (WebSocket providers). Set to 0 for no timeout.STTProviderConfig.timeoutsrc/core/types/providers.ts:135

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency