OpenAITTSConfig
Configuration for the OpenAITTS provider.
Defined in: src/providers/tts/openai/OpenAITTS.ts:78
Configuration for the OpenAITTS provider.
Remarks
Provide either apiKey (for direct API access) or proxyUrl (for server-side proxy). At least one must be set. If both are provided, proxyUrl takes precedence and the API key is not sent to the client.
Example
// Direct API access
const config: OpenAITTSConfig = {
apiKey: 'sk-xxxxxxxxxxxx',
model: 'tts-1',
voice: 'nova',
responseFormat: 'mp3',
speed: 1.0,
};
// Via proxy server
const proxyConfig: OpenAITTSConfig = {
proxyUrl: 'http://localhost:3001/api/proxy/openai',
model: 'tts-1-hd',
voice: 'alloy',
};
See
- OpenAITTSVoice - Available voice options.
- OpenAITTSFormat - Available audio format options.
Extends
Properties
| Property | Type | Default value | Description | Overrides | Inherited from | Defined in |
|---|---|---|---|---|---|---|
apiKey? | string | undefined | OpenAI API key for direct authentication. Remarks Required when connecting directly to OpenAI (no proxy). Omit when using proxyUrl — the proxy server supplies the key server-side. | TTSProviderConfig.apiKey | - | src/providers/tts/openai/OpenAITTS.ts:86 |
baseURL? | string | undefined (uses OpenAI’s default endpoint) | Base URL for the OpenAI API. Remarks Use this for custom API-compatible endpoints (e.g., Azure OpenAI). For CompositeVoice proxy routing, use proxyUrl instead. | - | - | src/providers/tts/openai/OpenAITTS.ts:152 |
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. | - | TTSProviderConfig.debug | src/core/types/providers.ts:86 |
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. | - | TTSProviderConfig.endpoint | src/core/types/providers.ts:75 |
maxRetries? | number | 3 | Maximum number of retries for failed API requests. | - | - | src/providers/tts/openai/OpenAITTS.ts:159 |
model? | string | 'tts-1' | The TTS model to use. Remarks - 'tts-1' — Optimized for speed and low latency - 'tts-1-hd' — Optimized for audio quality | TTSProviderConfig.model | - | src/providers/tts/openai/OpenAITTS.ts:108 |
organizationId? | string | undefined | OpenAI organization ID for billing attribution. | - | - | src/providers/tts/openai/OpenAITTS.ts:141 |
outputFormat? | string | undefined | Output audio format identifier. Remarks Provider-specific format string (e.g., 'linear16', 'mp3', 'opus'). | - | TTSProviderConfig.outputFormat | src/core/types/providers.ts:1000 |
pitch? | number | undefined | Pitch adjustment in semitones. Remarks Values from -20 to +20 semitones. Not all providers support pitch adjustment. | - | TTSProviderConfig.pitch | src/core/types/providers.ts:992 |
proxyUrl? | string | undefined | URL of the CompositeVoice proxy server’s OpenAI endpoint. Remarks When set, all API requests are routed through the proxy. The apiKey is not required on the client side. Example 'http://localhost:3001/api/proxy/openai' | - | - | src/providers/tts/openai/OpenAITTS.ts:97 |
rate? | number | undefined | Speech rate multiplier. Remarks Values from 0.25 (quarter speed) to 4.0 (quadruple speed), where 1.0 is normal speed. Not all providers support rate adjustment. | - | TTSProviderConfig.rate | src/core/types/providers.ts:984 |
responseFormat? | OpenAITTSFormat | 'mp3' | The audio output format. See OpenAITTSFormat | - | - | src/providers/tts/openai/OpenAITTS.ts:124 |
sampleRate? | number | undefined | Sample rate for the output audio in Hz. Remarks Common values are 16000, 24000, and 48000. Must match the format capabilities of the chosen voice and model. | - | TTSProviderConfig.sampleRate | src/core/types/providers.ts:1009 |
speed? | number | 1.0 | Speech speed multiplier. Remarks Accepted range is 0.25 to 4.0, where 1.0 is normal speed. | - | - | src/providers/tts/openai/OpenAITTS.ts:134 |
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. | - | TTSProviderConfig.timeout | src/core/types/providers.ts:95 |
voice? | OpenAITTSVoice | 'alloy' | The voice to use for synthesis. See OpenAITTSVoice | TTSProviderConfig.voice | - | src/providers/tts/openai/OpenAITTS.ts:116 |