@tanstack/ai-elevenlabs 0.4.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/adapters/audio.d.ts +2 -2
- package/dist/esm/adapters/audio.js +3 -3
- package/dist/esm/adapters/audio.js.map +1 -1
- package/dist/esm/adapters/speech.d.ts +14 -2
- package/dist/esm/adapters/speech.js +162 -13
- package/dist/esm/adapters/speech.js.map +1 -1
- package/dist/esm/adapters/voice.d.ts +85 -0
- package/dist/esm/adapters/voice.js +154 -0
- package/dist/esm/adapters/voice.js.map +1 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +3 -2
- package/dist/esm/model-meta.d.ts +35 -10
- package/dist/esm/model-meta.js +38 -8
- package/dist/esm/model-meta.js.map +1 -1
- package/package.json +5 -5
- package/src/adapters/audio.ts +4 -3
- package/src/adapters/speech.ts +241 -25
- package/src/adapters/voice.ts +299 -0
- package/src/index.ts +13 -0
- package/src/model-meta.ts +61 -13
package/src/model-meta.ts
CHANGED
|
@@ -2,8 +2,19 @@ import type { ElevenLabs } from '@elevenlabs/elevenlabs-js'
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* ElevenLabs model identifiers. The lists below are the source of truth —
|
|
5
|
-
* callers are blocked from passing unknown model IDs.
|
|
6
|
-
*
|
|
5
|
+
* callers are blocked from passing unknown model IDs.
|
|
6
|
+
*
|
|
7
|
+
* Maintained by hand: `scripts/sync-provider-models.ts` deliberately excludes
|
|
8
|
+
* elevenlabs, because these are media endpoint ids rather than OpenRouter
|
|
9
|
+
* models. Where the SDK publishes its own union, pin the list to it with
|
|
10
|
+
* `satisfies` so a removed id fails the build instead of a request.
|
|
11
|
+
*
|
|
12
|
+
* Each list is ordered newest-first, with models ElevenLabs has deprecated
|
|
13
|
+
* kept at the bottom so existing callers don't break on an upgrade. An id the
|
|
14
|
+
* SDK has dropped outright is removed rather than kept, because the adapter
|
|
15
|
+
* can no longer send it — see `eleven_text_to_sound_v1`.
|
|
16
|
+
*
|
|
17
|
+
* @see https://elevenlabs.io/docs/models
|
|
7
18
|
*/
|
|
8
19
|
|
|
9
20
|
/**
|
|
@@ -12,18 +23,22 @@ import type { ElevenLabs } from '@elevenlabs/elevenlabs-js'
|
|
|
12
23
|
*/
|
|
13
24
|
export const ELEVENLABS_TTS_MODELS = [
|
|
14
25
|
'eleven_v3',
|
|
26
|
+
'eleven_v3_conversational',
|
|
15
27
|
'eleven_multilingual_v2',
|
|
16
28
|
'eleven_flash_v2_5',
|
|
17
29
|
'eleven_flash_v2',
|
|
30
|
+
// Deprecated by ElevenLabs — use `eleven_flash_v2_5`.
|
|
18
31
|
'eleven_turbo_v2_5',
|
|
32
|
+
// Deprecated by ElevenLabs — use `eleven_flash_v2`.
|
|
19
33
|
'eleven_turbo_v2',
|
|
34
|
+
// Deprecated by ElevenLabs — use `eleven_multilingual_v2`.
|
|
20
35
|
'eleven_monolingual_v1',
|
|
21
36
|
] as const
|
|
22
37
|
|
|
23
38
|
export type ElevenLabsTTSModel = (typeof ELEVENLABS_TTS_MODELS)[number]
|
|
24
39
|
|
|
25
40
|
/**
|
|
26
|
-
* Audio generation models — music (`
|
|
41
|
+
* Audio generation models — music (`music_v*`) + sound effects
|
|
27
42
|
* (`eleven_text_to_sound_v*`) share one `generateAudio` adapter.
|
|
28
43
|
* The adapter dispatches by model id so callers pick behavior via the model.
|
|
29
44
|
*
|
|
@@ -31,24 +46,40 @@ export type ElevenLabsTTSModel = (typeof ELEVENLABS_TTS_MODELS)[number]
|
|
|
31
46
|
* @see https://elevenlabs.io/docs/overview/capabilities/sound-effects
|
|
32
47
|
*/
|
|
33
48
|
export const ELEVENLABS_AUDIO_MODELS = [
|
|
34
|
-
'
|
|
49
|
+
'music_v2_5',
|
|
50
|
+
'music_v2',
|
|
35
51
|
'eleven_text_to_sound_v2',
|
|
36
|
-
|
|
37
|
-
|
|
52
|
+
// Deprecated by ElevenLabs — use `music_v2_5`.
|
|
53
|
+
'music_v1',
|
|
54
|
+
] as const satisfies ReadonlyArray<
|
|
55
|
+
ElevenLabs.MusicModelId | ElevenLabs.SfxModelId
|
|
56
|
+
>
|
|
38
57
|
|
|
39
58
|
export type ElevenLabsAudioModel = (typeof ELEVENLABS_AUDIO_MODELS)[number]
|
|
40
59
|
|
|
41
|
-
/** Music models within the audio family. */
|
|
42
|
-
export type ElevenLabsMusicModel =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
60
|
+
/** Music models within the audio family, derived from the audio list. */
|
|
61
|
+
export type ElevenLabsMusicModel = Extract<
|
|
62
|
+
ElevenLabsAudioModel,
|
|
63
|
+
`music_${string}`
|
|
64
|
+
>
|
|
65
|
+
/** SFX models within the audio family, derived from the audio list. */
|
|
66
|
+
export type ElevenLabsSoundEffectsModel = Extract<
|
|
67
|
+
ElevenLabsAudioModel,
|
|
68
|
+
`eleven_text_to_sound_${string}`
|
|
69
|
+
>
|
|
47
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Matches the `music_` prefix so a new music release needs no branch here,
|
|
73
|
+
* but still checks membership: the narrowed type is the closed set above, so
|
|
74
|
+
* a `music_*` id this package does not ship must not pass.
|
|
75
|
+
*/
|
|
48
76
|
export function isElevenLabsMusicModel(
|
|
49
77
|
model: string,
|
|
50
78
|
): model is ElevenLabsMusicModel {
|
|
51
|
-
return
|
|
79
|
+
return (
|
|
80
|
+
model.startsWith('music_') &&
|
|
81
|
+
(ELEVENLABS_AUDIO_MODELS as ReadonlyArray<string>).includes(model)
|
|
82
|
+
)
|
|
52
83
|
}
|
|
53
84
|
|
|
54
85
|
export function isElevenLabsSoundEffectsModel(
|
|
@@ -63,12 +94,29 @@ export function isElevenLabsSoundEffectsModel(
|
|
|
63
94
|
*/
|
|
64
95
|
export const ELEVENLABS_TRANSCRIPTION_MODELS = [
|
|
65
96
|
'scribe_v2',
|
|
97
|
+
// Domain-tuned for clinical audio.
|
|
98
|
+
'scribe_v2_medical',
|
|
99
|
+
// Deprecated by ElevenLabs — use `scribe_v2`.
|
|
66
100
|
'scribe_v1',
|
|
67
101
|
] as const
|
|
68
102
|
|
|
69
103
|
export type ElevenLabsTranscriptionModel =
|
|
70
104
|
(typeof ELEVENLABS_TRANSCRIPTION_MODELS)[number]
|
|
71
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Voice design (text-to-voice) models, used by the `generateVoice` adapter.
|
|
108
|
+
* `eleven_ttv_v3` is the only one that accepts reference audio, so guiding a
|
|
109
|
+
* design with a recording of a real speaker requires it.
|
|
110
|
+
*
|
|
111
|
+
* @see https://elevenlabs.io/docs/overview/capabilities/voice-design
|
|
112
|
+
*/
|
|
113
|
+
export const ELEVENLABS_VOICE_MODELS = [
|
|
114
|
+
'eleven_ttv_v3',
|
|
115
|
+
'eleven_multilingual_ttv_v2',
|
|
116
|
+
] as const satisfies ReadonlyArray<ElevenLabs.VoiceDesignRequestModelModelId>
|
|
117
|
+
|
|
118
|
+
export type ElevenLabsVoiceModel = (typeof ELEVENLABS_VOICE_MODELS)[number]
|
|
119
|
+
|
|
72
120
|
/**
|
|
73
121
|
* Supported `output_format` strings, encoded as `codec_samplerate[_bitrate]`.
|
|
74
122
|
* Aliased to the SDK's `AllowedOutputFormats` so the list stays in sync
|