feat(replicate): add support for custom Replicate model selection
This commit is contained in:
parent
9da9232d39
commit
d0c0ab7420
3 changed files with 16 additions and 5 deletions
|
|
@ -29,6 +29,7 @@ Settings modal values override env vars. See [TTS Providers](../tts-providers) f
|
||||||
- `minimax/speech-2.8-turbo`
|
- `minimax/speech-2.8-turbo`
|
||||||
- `qwen/qwen3-tts`
|
- `qwen/qwen3-tts`
|
||||||
- `inworld/tts-1.5-mini`
|
- `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.
|
- 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.
|
- TTS requests are sent from the server, not the browser. The API key is never exposed to clients.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ For `OpenAI`, `Deepinfra`, and `Replicate` you only need to supply an API key. F
|
||||||
|
|
||||||
## Built-in model catalogs
|
## 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`
|
- **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)
|
- **Deepinfra** models: includes `hexgrad/Kokoro-82M` and additional hosted models (depending on API key / feature flags)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ const REPLICATE_MODELS: TtsModelDefinition[] = [
|
||||||
{ id: 'minimax/speech-2.8-turbo', name: 'MiniMax Speech 2.8 Turbo' },
|
{ id: 'minimax/speech-2.8-turbo', name: 'MiniMax Speech 2.8 Turbo' },
|
||||||
{ id: 'qwen/qwen3-tts', name: 'Qwen3 TTS' },
|
{ id: 'qwen/qwen3-tts', name: 'Qwen3 TTS' },
|
||||||
{ id: 'inworld/tts-1.5-mini', name: 'Inworld TTS 1.5 Mini' },
|
{ 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' }];
|
const DEFAULT_MODELS: TtsModelDefinition[] = [{ id: 'tts-1', name: 'TTS-1' }];
|
||||||
|
|
@ -104,7 +105,7 @@ export const TTS_PROVIDER_DEFINITIONS: TtsProviderDefinition[] = [
|
||||||
{
|
{
|
||||||
id: 'replicate',
|
id: 'replicate',
|
||||||
name: 'Replicate',
|
name: 'Replicate',
|
||||||
supportsCustomModel: false,
|
supportsCustomModel: true,
|
||||||
models: () => REPLICATE_MODELS,
|
models: () => REPLICATE_MODELS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -137,6 +138,11 @@ const REPLICATE_MODELS_WITHOUT_NATIVE_SPEED = new Set([
|
||||||
'qwen/qwen3-tts',
|
'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 {
|
export function supportsTtsInstructions(model: string | null | undefined): boolean {
|
||||||
return !!model && MODELS_WITH_INSTRUCTIONS.has(model);
|
return !!model && MODELS_WITH_INSTRUCTIONS.has(model);
|
||||||
}
|
}
|
||||||
|
|
@ -146,8 +152,12 @@ export function supportsNativeModelSpeed(provider: string | null | undefined, mo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider === 'replicate' && REPLICATE_MODELS_WITHOUT_NATIVE_SPEED.has(model)) {
|
if (provider === 'replicate') {
|
||||||
return false;
|
if (REPLICATE_MODELS_WITHOUT_NATIVE_SPEED.has(model)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return REPLICATE_MODELS_WITH_NATIVE_SPEED.has(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -193,7 +203,7 @@ export function getDefaultVoices(provider: string, model: string): string[] {
|
||||||
if (model === 'inworld/tts-1.5-mini') {
|
if (model === 'inworld/tts-1.5-mini') {
|
||||||
return [...INWORLD_TTS_VOICES];
|
return [...INWORLD_TTS_VOICES];
|
||||||
}
|
}
|
||||||
return [...GEMINI_FLASH_TTS_VOICES];
|
return ['default'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider === 'deepinfra') {
|
if (provider === 'deepinfra') {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue