FishAudioTTSConfig
Configuration for the FishAudioTTS provider.
Defined in: src/providers/tts/fishaudio/FishAudioTTS.ts:118
Configuration for the FishAudioTTS 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.
The optional peer dependency @msgpack/msgpack must be installed — it is loaded lazily during initialize().
Example
// Direct API access
const config: FishAudioTTSConfig = {
apiKey: 'fa_xxxxxxxxxxxx',
referenceId: 'your-voice-id',
model: 's2.1-pro',
format: 'mp3',
};
// Via proxy server
const proxyConfig: FishAudioTTSConfig = {
proxyUrl: 'http://localhost:3001/api/proxy/fishaudio',
referenceId: 'your-voice-id',
};
See
- FishAudioTTSModel - Available model generations.
- FishAudioTTSFormat - Available audio format options.
Extends
Properties
| Property | Type | Default value | Description | Overrides | Inherited from | Defined in |
|---|---|---|---|---|---|---|
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. | - | TTSProviderConfig.apiKey | src/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. | - | TTSProviderConfig.authType | src/core/types/providers.ts:115 |
chunkLength? | number | 300 (server-side) | Maximum characters per internal synthesis chunk (100-300). | - | - | src/providers/tts/fishaudio/FishAudioTTS.ts:164 |
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:126 |
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:79 |
format? | FishAudioTTSFormat | 'mp3' | The audio output format. See FishAudioTTSFormat | - | - | src/providers/tts/fishaudio/FishAudioTTS.ts:150 |
latency? | FishAudioTTSLatency | 'normal' (server-side) | Latency mode trading stability for time-to-first-audio. See FishAudioTTSLatency | - | - | src/providers/tts/fishaudio/FishAudioTTS.ts:179 |
maxRetries? | number | 3 | Maximum number of retries for failed API requests. | - | - | src/providers/tts/fishaudio/FishAudioTTS.ts:212 |
model? | FishAudioTTSModel | 's2.1-pro-free' | The TTS model generation, sent as the model HTTP header. Remarks Use 's2.1-pro' in production; 's2.1-pro-free' (the default, matching the API’s own default) is a free tier for testing and development. See FishAudioTTSModel | TTSProviderConfig.model | - | src/providers/tts/fishaudio/FishAudioTTS.ts:142 |
mp3Bitrate? | 64 | 128 | 192 | 128 (server-side) | Bitrate for mp3 output, in kbps. | - | - | src/providers/tts/fishaudio/FishAudioTTS.ts:157 |
normalize? | boolean | true (server-side) | Whether to normalize numbers, dates, and other text before synthesis. | - | - | src/providers/tts/fishaudio/FishAudioTTS.ts:171 |
outputFormat? | string | undefined | Output audio format identifier. Remarks Provider-specific format string (e.g., 'linear16', 'mp3', 'opus'). | - | TTSProviderConfig.outputFormat | src/core/types/providers.ts:1190 |
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:1182 |
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' | - | TTSProviderConfig.proxyUrl | src/core/types/providers.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:1174 |
referenceId? | string | undefined (model default voice) | The voice model to synthesize with, from Fish Audio’s voice catalog (or a voice you created). Remarks Sent as reference_id in the request body. When omitted, the model’s default voice is used — or provide inline references for instant voice cloning. | - | - | src/providers/tts/fishaudio/FishAudioTTS.ts:130 |
references? | FishAudioReference[] | undefined (no cloning; uses referenceId or model default) | Inline reference audio samples for instant voice cloning. Remarks Binary reference audio is the reason this provider speaks msgpack — the JSON encoding cannot carry raw bytes. See FishAudioReference | - | - | src/providers/tts/fishaudio/FishAudioTTS.ts:205 |
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:1199 |
speed? | number | undefined (server default, 1.0) | Speech speed multiplier, sent as prosody.speed (0.5-2.0). | - | - | src/providers/tts/fishaudio/FishAudioTTS.ts:186 |
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:135 |
voice? | string | undefined | Voice ID or name to use for synthesis. Remarks Provider-specific voice identifier. For example, Deepgram uses identifiers like 'aura-asteria-en', while ElevenLabs uses voice IDs. | - | TTSProviderConfig.voice | src/core/types/providers.ts:1157 |
volume? | number | undefined (server default, 0) | Volume adjustment, sent as prosody.volume. | - | - | src/providers/tts/fishaudio/FishAudioTTS.ts:193 |