feat(replicate): add support for custom Replicate model selection

This commit is contained in:
Richard R 2026-04-16 11:24:19 -06:00
parent 9da9232d39
commit d0c0ab7420
3 changed files with 16 additions and 5 deletions

View file

@ -29,6 +29,7 @@ Settings modal values override env vars. See [TTS Providers](../tts-providers) f
- `minimax/speech-2.8-turbo`
- `qwen/qwen3-tts`
- `inworld/tts-1.5-mini`
- You can also choose `Other` and enter any Replicate model ID (for example `owner/model-name`).
- Native model speed is not available on all Replicate models; OpenReader hides/disables native speed controls where unsupported.
- TTS requests are sent from the server, not the browser. The API key is never exposed to clients.

View file

@ -23,7 +23,7 @@ For `OpenAI`, `Deepinfra`, and `Replicate` you only need to supply an API key. F
## Built-in model catalogs
- **Replicate** models: `google/gemini-3.1-flash-tts`, `minimax/speech-2.8-turbo`, `qwen/qwen3-tts`, `inworld/tts-1.5-mini`
- **Replicate** models: `google/gemini-3.1-flash-tts`, `minimax/speech-2.8-turbo`, `qwen/qwen3-tts`, `inworld/tts-1.5-mini` (or choose `Other` and enter any Replicate model ID)
- **OpenAI** models: `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`
- **Deepinfra** models: includes `hexgrad/Kokoro-82M` and additional hosted models (depending on API key / feature flags)

View file

@ -59,6 +59,7 @@ const REPLICATE_MODELS: TtsModelDefinition[] = [
{ id: 'minimax/speech-2.8-turbo', name: 'MiniMax Speech 2.8 Turbo' },
{ id: 'qwen/qwen3-tts', name: 'Qwen3 TTS' },
{ id: 'inworld/tts-1.5-mini', name: 'Inworld TTS 1.5 Mini' },
{ id: 'custom', name: 'Other' },
];
const DEFAULT_MODELS: TtsModelDefinition[] = [{ id: 'tts-1', name: 'TTS-1' }];
@ -104,7 +105,7 @@ export const TTS_PROVIDER_DEFINITIONS: TtsProviderDefinition[] = [
{
id: 'replicate',
name: 'Replicate',
supportsCustomModel: false,
supportsCustomModel: true,
models: () => REPLICATE_MODELS,
},
{
@ -137,6 +138,11 @@ const REPLICATE_MODELS_WITHOUT_NATIVE_SPEED = new Set([
'qwen/qwen3-tts',
]);
const REPLICATE_MODELS_WITH_NATIVE_SPEED = new Set([
'minimax/speech-2.8-turbo',
'inworld/tts-1.5-mini',
]);
export function supportsTtsInstructions(model: string | null | undefined): boolean {
return !!model && MODELS_WITH_INSTRUCTIONS.has(model);
}
@ -146,8 +152,12 @@ export function supportsNativeModelSpeed(provider: string | null | undefined, mo
return true;
}
if (provider === 'replicate' && REPLICATE_MODELS_WITHOUT_NATIVE_SPEED.has(model)) {
return false;
if (provider === 'replicate') {
if (REPLICATE_MODELS_WITHOUT_NATIVE_SPEED.has(model)) {
return false;
}
return REPLICATE_MODELS_WITH_NATIVE_SPEED.has(model);
}
return true;
@ -193,7 +203,7 @@ export function getDefaultVoices(provider: string, model: string): string[] {
if (model === 'inworld/tts-1.5-mini') {
return [...INWORLD_TTS_VOICES];
}
return [...GEMINI_FLASH_TTS_VOICES];
return ['default'];
}
if (provider === 'deepinfra') {