@tanstack/ai-elevenlabs 0.6.4 → 0.6.7

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.
@@ -3,10 +3,17 @@ import { ElevenLabs } from '@elevenlabs/elevenlabs-js';
3
3
  * ElevenLabs model identifiers. The lists below are the source of truth —
4
4
  * callers are blocked from passing unknown model IDs.
5
5
  *
6
- * Maintained by hand: `scripts/sync-provider-models.ts` deliberately excludes
7
- * elevenlabs, because these are media endpoint ids rather than OpenRouter
8
- * models. Where the SDK publishes its own union, pin the list to it with
9
- * `satisfies` so a removed id fails the build instead of a request.
6
+ * Ids are inserted by `scripts/sync-elevenlabs-models.ts` during the daily
7
+ * `pnpm generate:models` sync. Text-to-speech comes from
8
+ * `GET /v1/models?provider=elevenlabs` (`canDoTextToSpeech` only). Music,
9
+ * sound effects, and voice design come from the request schemas for
10
+ * `v1/music`, `v1/sound-generation`, and
11
+ * `v1/text-to-voice/design`. The script only adds missing ids. It leaves
12
+ * rows that are already listed, including deprecated ids.
13
+ *
14
+ * Transcription stays hand-maintained: the speech-to-text schema has no
15
+ * `model_id` enum. Where the SDK publishes its own union, pin the list to it
16
+ * with `satisfies` so a removed id fails the build instead of a request.
10
17
  *
11
18
  * Each list is ordered newest-first, with models ElevenLabs has deprecated
12
19
  * kept at the bottom so existing callers don't break on an upgrade. An id the
@@ -19,7 +26,7 @@ import { ElevenLabs } from '@elevenlabs/elevenlabs-js';
19
26
  * Text-to-speech models.
20
27
  * @see https://elevenlabs.io/docs/models
21
28
  */
22
- export declare const ELEVENLABS_TTS_MODELS: readonly ["eleven_v3", "eleven_v3_conversational", "eleven_multilingual_v2", "eleven_flash_v2_5", "eleven_flash_v2", "eleven_turbo_v2_5", "eleven_turbo_v2", "eleven_monolingual_v1"];
29
+ export declare const ELEVENLABS_TTS_MODELS: readonly ["eleven_v4", "eleven_v4_turbo", "eleven_v3", "eleven_v3_conversational", "eleven_multilingual_v2", "eleven_flash_v2_5", "eleven_flash_v2", "eleven_turbo_v2_5", "eleven_turbo_v2", "eleven_monolingual_v1"];
23
30
  export type ElevenLabsTTSModel = (typeof ELEVENLABS_TTS_MODELS)[number];
24
31
  /**
25
32
  * Audio generation models — music (`music_v*`) + sound effects
@@ -3,10 +3,17 @@
3
3
  * ElevenLabs model identifiers. The lists below are the source of truth —
4
4
  * callers are blocked from passing unknown model IDs.
5
5
  *
6
- * Maintained by hand: `scripts/sync-provider-models.ts` deliberately excludes
7
- * elevenlabs, because these are media endpoint ids rather than OpenRouter
8
- * models. Where the SDK publishes its own union, pin the list to it with
9
- * `satisfies` so a removed id fails the build instead of a request.
6
+ * Ids are inserted by `scripts/sync-elevenlabs-models.ts` during the daily
7
+ * `pnpm generate:models` sync. Text-to-speech comes from
8
+ * `GET /v1/models?provider=elevenlabs` (`canDoTextToSpeech` only). Music,
9
+ * sound effects, and voice design come from the request schemas for
10
+ * `v1/music`, `v1/sound-generation`, and
11
+ * `v1/text-to-voice/design`. The script only adds missing ids. It leaves
12
+ * rows that are already listed, including deprecated ids.
13
+ *
14
+ * Transcription stays hand-maintained: the speech-to-text schema has no
15
+ * `model_id` enum. Where the SDK publishes its own union, pin the list to it
16
+ * with `satisfies` so a removed id fails the build instead of a request.
10
17
  *
11
18
  * Each list is ordered newest-first, with models ElevenLabs has deprecated
12
19
  * kept at the bottom so existing callers don't break on an upgrade. An id the
@@ -20,6 +27,8 @@
20
27
  * @see https://elevenlabs.io/docs/models
21
28
  */
22
29
  var ELEVENLABS_TTS_MODELS = [
30
+ "eleven_v4",
31
+ "eleven_v4_turbo",
23
32
  "eleven_v3",
24
33
  "eleven_v3_conversational",
25
34
  "eleven_multilingual_v2",
@@ -1 +1 @@
1
- {"version":3,"file":"model-meta.js","names":[],"sources":["../../src/model-meta.ts"],"sourcesContent":["import type { ElevenLabs } from '@elevenlabs/elevenlabs-js'\n\n/**\n * ElevenLabs model identifiers. The lists below are the source of truth —\n * callers are blocked from passing unknown model IDs.\n *\n * Maintained by hand: `scripts/sync-provider-models.ts` deliberately excludes\n * elevenlabs, because these are media endpoint ids rather than OpenRouter\n * models. Where the SDK publishes its own union, pin the list to it with\n * `satisfies` so a removed id fails the build instead of a request.\n *\n * Each list is ordered newest-first, with models ElevenLabs has deprecated\n * kept at the bottom so existing callers don't break on an upgrade. An id the\n * SDK has dropped outright is removed rather than kept, because the adapter\n * can no longer send it — see `eleven_text_to_sound_v1`.\n *\n * @see https://elevenlabs.io/docs/models\n */\n\n/**\n * Text-to-speech models.\n * @see https://elevenlabs.io/docs/models\n */\nexport const ELEVENLABS_TTS_MODELS = [\n 'eleven_v3',\n 'eleven_v3_conversational',\n 'eleven_multilingual_v2',\n 'eleven_flash_v2_5',\n 'eleven_flash_v2',\n // Deprecated by ElevenLabs — use `eleven_flash_v2_5`.\n 'eleven_turbo_v2_5',\n // Deprecated by ElevenLabs — use `eleven_flash_v2`.\n 'eleven_turbo_v2',\n // Deprecated by ElevenLabs — use `eleven_multilingual_v2`.\n 'eleven_monolingual_v1',\n] as const\n\nexport type ElevenLabsTTSModel = (typeof ELEVENLABS_TTS_MODELS)[number]\n\n/**\n * Audio generation models — music (`music_v*`) + sound effects\n * (`eleven_text_to_sound_v*`) share one `generateAudio` adapter.\n * The adapter dispatches by model id so callers pick behavior via the model.\n *\n * @see https://elevenlabs.io/docs/overview/capabilities/music\n * @see https://elevenlabs.io/docs/overview/capabilities/sound-effects\n */\nexport const ELEVENLABS_AUDIO_MODELS = [\n 'music_v2_5',\n 'music_v2',\n 'eleven_text_to_sound_v2',\n // Deprecated by ElevenLabs — use `music_v2_5`.\n 'music_v1',\n] as const satisfies ReadonlyArray<\n ElevenLabs.MusicModelId | ElevenLabs.SfxModelId\n>\n\nexport type ElevenLabsAudioModel = (typeof ELEVENLABS_AUDIO_MODELS)[number]\n\n/** Music models within the audio family, derived from the audio list. */\nexport type ElevenLabsMusicModel = Extract<\n ElevenLabsAudioModel,\n `music_${string}`\n>\n/** SFX models within the audio family, derived from the audio list. */\nexport type ElevenLabsSoundEffectsModel = Extract<\n ElevenLabsAudioModel,\n `eleven_text_to_sound_${string}`\n>\n\n/**\n * Matches the `music_` prefix so a new music release needs no branch here,\n * but still checks membership: the narrowed type is the closed set above, so\n * a `music_*` id this package does not ship must not pass.\n */\nexport function isElevenLabsMusicModel(\n model: string,\n): model is ElevenLabsMusicModel {\n return (\n model.startsWith('music_') &&\n (ELEVENLABS_AUDIO_MODELS as ReadonlyArray<string>).includes(model)\n )\n}\n\nexport function isElevenLabsSoundEffectsModel(\n model: string,\n): model is ElevenLabsSoundEffectsModel {\n return model.startsWith('eleven_text_to_sound_')\n}\n\n/**\n * Speech-to-text (transcription) models — Scribe family.\n * @see https://elevenlabs.io/docs/overview/capabilities/speech-to-text\n */\nexport const ELEVENLABS_TRANSCRIPTION_MODELS = [\n 'scribe_v2',\n // Domain-tuned for clinical audio.\n 'scribe_v2_medical',\n // Deprecated by ElevenLabs — use `scribe_v2`.\n 'scribe_v1',\n] as const\n\nexport type ElevenLabsTranscriptionModel =\n (typeof ELEVENLABS_TRANSCRIPTION_MODELS)[number]\n\n/**\n * Voice design (text-to-voice) models, used by the `generateVoice` adapter.\n * `eleven_ttv_v3` is the only one that accepts reference audio, so guiding a\n * design with a recording of a real speaker requires it.\n *\n * @see https://elevenlabs.io/docs/overview/capabilities/voice-design\n */\nexport const ELEVENLABS_VOICE_MODELS = [\n 'eleven_ttv_v3',\n 'eleven_multilingual_ttv_v2',\n] as const satisfies ReadonlyArray<ElevenLabs.VoiceDesignRequestModelModelId>\n\nexport type ElevenLabsVoiceModel = (typeof ELEVENLABS_VOICE_MODELS)[number]\n\n/**\n * Supported `output_format` strings, encoded as `codec_samplerate[_bitrate]`.\n * Aliased to the SDK's `AllowedOutputFormats` so the list stays in sync\n * automatically whenever the `@elevenlabs/elevenlabs-js` dependency is bumped.\n *\n * @see https://elevenlabs.io/docs/api-reference/text-to-speech/convert\n */\nexport type ElevenLabsOutputFormat = ElevenLabs.AllowedOutputFormats\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CAEA;CAEA;CAEA;AACF;;;;;;;;;AAYA,IAAa,0BAA0B;CACrC;CACA;CACA;CAEA;AACF;;;;;;AAsBA,SAAgB,uBACd,OAC+B;CAC/B,OACE,MAAM,WAAW,QAAQ,KACxB,wBAAkD,SAAS,KAAK;AAErE;AAEA,SAAgB,8BACd,OACsC;CACtC,OAAO,MAAM,WAAW,uBAAuB;AACjD;;;;;AAMA,IAAa,kCAAkC;CAC7C;CAEA;CAEA;AACF;;;;;;;;AAYA,IAAa,0BAA0B,CACrC,iBACA,4BACF"}
1
+ {"version":3,"file":"model-meta.js","names":[],"sources":["../../src/model-meta.ts"],"sourcesContent":["import type { ElevenLabs } from '@elevenlabs/elevenlabs-js'\n\n/**\n * ElevenLabs model identifiers. The lists below are the source of truth —\n * callers are blocked from passing unknown model IDs.\n *\n * Ids are inserted by `scripts/sync-elevenlabs-models.ts` during the daily\n * `pnpm generate:models` sync. Text-to-speech comes from\n * `GET /v1/models?provider=elevenlabs` (`canDoTextToSpeech` only). Music,\n * sound effects, and voice design come from the request schemas for\n * `v1/music`, `v1/sound-generation`, and\n * `v1/text-to-voice/design`. The script only adds missing ids. It leaves\n * rows that are already listed, including deprecated ids.\n *\n * Transcription stays hand-maintained: the speech-to-text schema has no\n * `model_id` enum. Where the SDK publishes its own union, pin the list to it\n * with `satisfies` so a removed id fails the build instead of a request.\n *\n * Each list is ordered newest-first, with models ElevenLabs has deprecated\n * kept at the bottom so existing callers don't break on an upgrade. An id the\n * SDK has dropped outright is removed rather than kept, because the adapter\n * can no longer send it — see `eleven_text_to_sound_v1`.\n *\n * @see https://elevenlabs.io/docs/models\n */\n\n/**\n * Text-to-speech models.\n * @see https://elevenlabs.io/docs/models\n */\nexport const ELEVENLABS_TTS_MODELS = [\n 'eleven_v4',\n 'eleven_v4_turbo',\n 'eleven_v3',\n 'eleven_v3_conversational',\n 'eleven_multilingual_v2',\n 'eleven_flash_v2_5',\n 'eleven_flash_v2',\n // Deprecated by ElevenLabs — use `eleven_flash_v2_5`.\n 'eleven_turbo_v2_5',\n // Deprecated by ElevenLabs — use `eleven_flash_v2`.\n 'eleven_turbo_v2',\n // Deprecated by ElevenLabs — use `eleven_multilingual_v2`.\n 'eleven_monolingual_v1',\n] as const\n\nexport type ElevenLabsTTSModel = (typeof ELEVENLABS_TTS_MODELS)[number]\n\n/**\n * Audio generation models — music (`music_v*`) + sound effects\n * (`eleven_text_to_sound_v*`) share one `generateAudio` adapter.\n * The adapter dispatches by model id so callers pick behavior via the model.\n *\n * @see https://elevenlabs.io/docs/overview/capabilities/music\n * @see https://elevenlabs.io/docs/overview/capabilities/sound-effects\n */\nexport const ELEVENLABS_AUDIO_MODELS = [\n 'music_v2_5',\n 'music_v2',\n 'eleven_text_to_sound_v2',\n // Deprecated by ElevenLabs — use `music_v2_5`.\n 'music_v1',\n] as const satisfies ReadonlyArray<\n ElevenLabs.MusicModelId | ElevenLabs.SfxModelId\n>\n\nexport type ElevenLabsAudioModel = (typeof ELEVENLABS_AUDIO_MODELS)[number]\n\n/** Music models within the audio family, derived from the audio list. */\nexport type ElevenLabsMusicModel = Extract<\n ElevenLabsAudioModel,\n `music_${string}`\n>\n/** SFX models within the audio family, derived from the audio list. */\nexport type ElevenLabsSoundEffectsModel = Extract<\n ElevenLabsAudioModel,\n `eleven_text_to_sound_${string}`\n>\n\n/**\n * Matches the `music_` prefix so a new music release needs no branch here,\n * but still checks membership: the narrowed type is the closed set above, so\n * a `music_*` id this package does not ship must not pass.\n */\nexport function isElevenLabsMusicModel(\n model: string,\n): model is ElevenLabsMusicModel {\n return (\n model.startsWith('music_') &&\n (ELEVENLABS_AUDIO_MODELS as ReadonlyArray<string>).includes(model)\n )\n}\n\nexport function isElevenLabsSoundEffectsModel(\n model: string,\n): model is ElevenLabsSoundEffectsModel {\n return model.startsWith('eleven_text_to_sound_')\n}\n\n/**\n * Speech-to-text (transcription) models — Scribe family.\n * @see https://elevenlabs.io/docs/overview/capabilities/speech-to-text\n */\nexport const ELEVENLABS_TRANSCRIPTION_MODELS = [\n 'scribe_v2',\n // Domain-tuned for clinical audio.\n 'scribe_v2_medical',\n // Deprecated by ElevenLabs — use `scribe_v2`.\n 'scribe_v1',\n] as const\n\nexport type ElevenLabsTranscriptionModel =\n (typeof ELEVENLABS_TRANSCRIPTION_MODELS)[number]\n\n/**\n * Voice design (text-to-voice) models, used by the `generateVoice` adapter.\n * `eleven_ttv_v3` is the only one that accepts reference audio, so guiding a\n * design with a recording of a real speaker requires it.\n *\n * @see https://elevenlabs.io/docs/overview/capabilities/voice-design\n */\nexport const ELEVENLABS_VOICE_MODELS = [\n 'eleven_ttv_v3',\n 'eleven_multilingual_ttv_v2',\n] as const satisfies ReadonlyArray<ElevenLabs.VoiceDesignRequestModelModelId>\n\nexport type ElevenLabsVoiceModel = (typeof ELEVENLABS_VOICE_MODELS)[number]\n\n/**\n * Supported `output_format` strings, encoded as `codec_samplerate[_bitrate]`.\n * Aliased to the SDK's `AllowedOutputFormats` so the list stays in sync\n * automatically whenever the `@elevenlabs/elevenlabs-js` dependency is bumped.\n *\n * @see https://elevenlabs.io/docs/api-reference/text-to-speech/convert\n */\nexport type ElevenLabsOutputFormat = ElevenLabs.AllowedOutputFormats\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CAEA;CAEA;AACF;;;;;;;;;AAYA,IAAa,0BAA0B;CACrC;CACA;CACA;CAEA;AACF;;;;;;AAsBA,SAAgB,uBACd,OAC+B;CAC/B,OACE,MAAM,WAAW,QAAQ,KACxB,wBAAkD,SAAS,KAAK;AAErE;AAEA,SAAgB,8BACd,OACsC;CACtC,OAAO,MAAM,WAAW,uBAAuB;AACjD;;;;;AAMA,IAAa,kCAAkC;CAC7C;CAEA;CAEA;AACF;;;;;;;;AAYA,IAAa,0BAA0B,CACrC,iBACA,4BACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/ai-elevenlabs",
3
- "version": "0.6.4",
3
+ "version": "0.6.7",
4
4
  "description": "ElevenLabs adapter for TanStack AI realtime voice, text-to-speech, transcription, music, and sound effects.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -57,11 +57,11 @@
57
57
  "@tanstack/ai-utils": "^0.4.1"
58
58
  },
59
59
  "peerDependencies": {
60
- "@tanstack/ai": "^0.61.0"
60
+ "@tanstack/ai": "^0.64.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@vitest/coverage-v8": "4.1.10",
64
- "@tanstack/ai": "0.61.0"
64
+ "@tanstack/ai": "0.64.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "vite build",
@@ -69,6 +69,7 @@
69
69
  "lint:fix": "oxlint src --type-aware --fix",
70
70
  "test:build": "publint --strict",
71
71
  "test:oxlint": "oxlint src --type-aware",
72
+ "test:coverage": "vitest run --passWithNoTests --coverage --coverage.include='src/**' --coverage.reporter=text-summary --coverage.reporter=json-summary",
72
73
  "test:lib": "vitest --passWithNoTests",
73
74
  "test:lib:dev": "pnpm test:lib --watch",
74
75
  "test:types": "tsc"
package/src/model-meta.ts CHANGED
@@ -4,10 +4,17 @@ import type { ElevenLabs } from '@elevenlabs/elevenlabs-js'
4
4
  * ElevenLabs model identifiers. The lists below are the source of truth —
5
5
  * callers are blocked from passing unknown model IDs.
6
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.
7
+ * Ids are inserted by `scripts/sync-elevenlabs-models.ts` during the daily
8
+ * `pnpm generate:models` sync. Text-to-speech comes from
9
+ * `GET /v1/models?provider=elevenlabs` (`canDoTextToSpeech` only). Music,
10
+ * sound effects, and voice design come from the request schemas for
11
+ * `v1/music`, `v1/sound-generation`, and
12
+ * `v1/text-to-voice/design`. The script only adds missing ids. It leaves
13
+ * rows that are already listed, including deprecated ids.
14
+ *
15
+ * Transcription stays hand-maintained: the speech-to-text schema has no
16
+ * `model_id` enum. Where the SDK publishes its own union, pin the list to it
17
+ * with `satisfies` so a removed id fails the build instead of a request.
11
18
  *
12
19
  * Each list is ordered newest-first, with models ElevenLabs has deprecated
13
20
  * kept at the bottom so existing callers don't break on an upgrade. An id the
@@ -22,6 +29,8 @@ import type { ElevenLabs } from '@elevenlabs/elevenlabs-js'
22
29
  * @see https://elevenlabs.io/docs/models
23
30
  */
24
31
  export const ELEVENLABS_TTS_MODELS = [
32
+ 'eleven_v4',
33
+ 'eleven_v4_turbo',
25
34
  'eleven_v3',
26
35
  'eleven_v3_conversational',
27
36
  'eleven_multilingual_v2',