@ai-sdk/elevenlabs 3.0.0-beta.4 → 3.0.0-beta.50

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.
@@ -29,10 +29,10 @@ The ElevenLabs provider is available in the `@ai-sdk/elevenlabs` module. You can
29
29
 
30
30
  ## Provider Instance
31
31
 
32
- You can import the default provider instance `elevenlabs` from `@ai-sdk/elevenlabs`:
32
+ You can import the default provider instance `elevenLabs` from `@ai-sdk/elevenlabs`:
33
33
 
34
34
  ```ts
35
- import { elevenlabs } from '@ai-sdk/elevenlabs';
35
+ import { elevenLabs } from '@ai-sdk/elevenlabs';
36
36
  ```
37
37
 
38
38
  If you need a customized setup, you can import `createElevenLabs` from `@ai-sdk/elevenlabs` and create a provider instance with your settings:
@@ -40,7 +40,7 @@ If you need a customized setup, you can import `createElevenLabs` from `@ai-sdk/
40
40
  ```ts
41
41
  import { createElevenLabs } from '@ai-sdk/elevenlabs';
42
42
 
43
- const elevenlabs = createElevenLabs({
43
+ const elevenLabs = createElevenLabs({
44
44
  // custom settings, e.g.
45
45
  fetch: customFetch,
46
46
  });
@@ -72,18 +72,18 @@ using the `.speech()` factory method.
72
72
  The first argument is the model id e.g. `eleven_multilingual_v2`.
73
73
 
74
74
  ```ts
75
- const model = elevenlabs.speech('eleven_multilingual_v2');
75
+ const model = elevenLabs.speech('eleven_multilingual_v2');
76
76
  ```
77
77
 
78
78
  The `voice` argument can be set to a voice ID from the [ElevenLabs Voice Library](https://elevenlabs.io/app/voice-library).
79
79
  You can find voice IDs by selecting a voice in the library and copying its ID.
80
80
 
81
81
  ```ts highlight="6"
82
- import { experimental_generateSpeech as generateSpeech } from 'ai';
83
- import { elevenlabs } from '@ai-sdk/elevenlabs';
82
+ import { generateSpeech } from 'ai';
83
+ import { elevenLabs } from '@ai-sdk/elevenlabs';
84
84
 
85
85
  const result = await generateSpeech({
86
- model: elevenlabs.speech('eleven_multilingual_v2'),
86
+ model: elevenLabs.speech('eleven_multilingual_v2'),
87
87
  text: 'Hello, world!',
88
88
  voice: '21m00Tcm4TlvDq8ikWAM', // Rachel voice
89
89
  });
@@ -92,14 +92,14 @@ const result = await generateSpeech({
92
92
  You can also pass additional provider-specific options using the `providerOptions` argument:
93
93
 
94
94
  ```ts highlight="7-9"
95
- import { experimental_generateSpeech as generateSpeech } from 'ai';
95
+ import { generateSpeech } from 'ai';
96
96
  import {
97
- elevenlabs,
97
+ elevenLabs,
98
98
  type ElevenLabsSpeechModelOptions,
99
99
  } from '@ai-sdk/elevenlabs';
100
100
 
101
101
  const result = await generateSpeech({
102
- model: elevenlabs.speech('eleven_multilingual_v2'),
102
+ model: elevenLabs.speech('eleven_multilingual_v2'),
103
103
  text: 'Hello, world!',
104
104
  voice: '21m00Tcm4TlvDq8ikWAM',
105
105
  providerOptions: {
@@ -118,7 +118,6 @@ const result = await generateSpeech({
118
118
 
119
119
  - **voiceSettings** _object or null_
120
120
  Optional. Voice settings that override stored settings for the given voice. These are applied only to the current request.
121
-
122
121
  - **stability** _double or null_
123
122
  Optional. Determines how stable the voice is and the randomness between each generation. Lower values introduce broader emotional range; higher values result in a more monotonous voice.
124
123
  - **useSpeakerBoost** _boolean or null_
@@ -131,7 +130,6 @@ const result = await generateSpeech({
131
130
  - **pronunciationDictionaryLocators** _array of objects or null_
132
131
  Optional. A list of pronunciation dictionary locators to apply to the text, in order. Up to 3 locators per request.
133
132
  Each locator object:
134
-
135
133
  - **pronunciationDictionaryId** _string_ (required)
136
134
  The ID of the pronunciation dictionary.
137
135
  - **versionId** _string or null_ (optional)
@@ -155,7 +153,6 @@ const result = await generateSpeech({
155
153
  - **applyTextNormalization** _enum_
156
154
  Optional. Controls text normalization.
157
155
  Allowed values: `'auto'` (default), `'on'`, `'off'`.
158
-
159
156
  - `'auto'`: System decides whether to apply normalization (e.g., spelling out numbers).
160
157
  - `'on'`: Always apply normalization.
161
158
  - `'off'`: Never apply normalization.
@@ -188,20 +185,20 @@ using the `.transcription()` factory method.
188
185
  The first argument is the model id e.g. `scribe_v1`.
189
186
 
190
187
  ```ts
191
- const model = elevenlabs.transcription('scribe_v1');
188
+ const model = elevenLabs.transcription('scribe_v1');
192
189
  ```
193
190
 
194
191
  You can also pass additional provider-specific options using the `providerOptions` argument. For example, supplying the input language in ISO-639-1 (e.g. `en`) format can sometimes improve transcription performance if known beforehand.
195
192
 
196
193
  ```ts highlight="6"
197
- import { experimental_transcribe as transcribe } from 'ai';
194
+ import { transcribe } from 'ai';
198
195
  import {
199
- elevenlabs,
196
+ elevenLabs,
200
197
  type ElevenLabsTranscriptionModelOptions,
201
198
  } from '@ai-sdk/elevenlabs';
202
199
 
203
200
  const result = await transcribe({
204
- model: elevenlabs.transcription('scribe_v1'),
201
+ model: elevenLabs.transcription('scribe_v1'),
205
202
  audio: new Uint8Array([1, 2, 3, 4]),
206
203
  providerOptions: {
207
204
  elevenlabs: {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@ai-sdk/elevenlabs",
3
- "version": "3.0.0-beta.4",
3
+ "version": "3.0.0-beta.50",
4
+ "type": "module",
4
5
  "license": "Apache-2.0",
5
6
  "sideEffects": false,
6
7
  "main": "./dist/index.js",
7
- "module": "./dist/index.mjs",
8
8
  "types": "./dist/index.d.ts",
9
9
  "files": [
10
10
  "dist/**/*",
@@ -24,35 +24,37 @@
24
24
  "./package.json": "./package.json",
25
25
  ".": {
26
26
  "types": "./dist/index.d.ts",
27
- "import": "./dist/index.mjs",
28
- "require": "./dist/index.js"
27
+ "import": "./dist/index.js",
28
+ "default": "./dist/index.js"
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@ai-sdk/provider": "4.0.0-beta.2",
33
- "@ai-sdk/provider-utils": "5.0.0-beta.4"
32
+ "@ai-sdk/provider": "4.0.0-beta.19",
33
+ "@ai-sdk/provider-utils": "5.0.0-beta.49"
34
34
  },
35
35
  "devDependencies": {
36
- "@types/node": "20.17.24",
37
- "tsup": "^8",
36
+ "@types/node": "22.19.19",
37
+ "tsup": "^8.5.1",
38
38
  "typescript": "5.6.3",
39
39
  "zod": "3.25.76",
40
- "@ai-sdk/test-server": "2.0.0-beta.0",
40
+ "@ai-sdk/test-server": "2.0.0-beta.7",
41
41
  "@vercel/ai-tsconfig": "0.0.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "zod": "^3.25.76 || ^4.1.8"
45
45
  },
46
46
  "engines": {
47
- "node": ">=18"
47
+ "node": ">=22"
48
48
  },
49
49
  "publishConfig": {
50
- "access": "public"
50
+ "access": "public",
51
+ "provenance": true
51
52
  },
52
53
  "homepage": "https://ai-sdk.dev/docs",
53
54
  "repository": {
54
55
  "type": "git",
55
- "url": "git+https://github.com/vercel/ai.git"
56
+ "url": "https://github.com/vercel/ai",
57
+ "directory": "packages/elevenlabs"
56
58
  },
57
59
  "bugs": {
58
60
  "url": "https://github.com/vercel/ai/issues"
@@ -64,9 +66,7 @@
64
66
  "build": "tsup --tsconfig tsconfig.build.json",
65
67
  "build:watch": "tsup --tsconfig tsconfig.build.json --watch",
66
68
  "clean": "del-cli dist docs && del-cli internal/dist",
67
- "lint": "eslint \"./**/*.ts*\"",
68
69
  "type-check": "tsc --noEmit",
69
- "prettier-check": "prettier --check \"./**/*.ts*\"",
70
70
  "test": "pnpm test:node && pnpm test:edge",
71
71
  "test:update": "pnpm test:node -u",
72
72
  "test:watch": "vitest --config vitest.node.config.js",
@@ -1,9 +1,9 @@
1
- import { FetchFunction } from '@ai-sdk/provider-utils';
1
+ import type { FetchFunction } from '@ai-sdk/provider-utils';
2
2
 
3
3
  export type ElevenLabsConfig = {
4
4
  provider: string;
5
5
  url: (options: { modelId: string; path: string }) => string;
6
- headers: () => Record<string, string | undefined>;
6
+ headers?: () => Record<string, string | undefined>;
7
7
  fetch?: FetchFunction;
8
8
  generateId?: () => string;
9
9
  };
@@ -1,18 +1,18 @@
1
1
  import {
2
- TranscriptionModelV4,
3
- SpeechModelV4,
4
- ProviderV4,
5
2
  NoSuchModelError,
3
+ type TranscriptionModelV4,
4
+ type SpeechModelV4,
5
+ type ProviderV4,
6
6
  } from '@ai-sdk/provider';
7
7
  import {
8
- FetchFunction,
9
8
  loadApiKey,
10
9
  withUserAgentSuffix,
10
+ type FetchFunction,
11
11
  } from '@ai-sdk/provider-utils';
12
12
  import { ElevenLabsTranscriptionModel } from './elevenlabs-transcription-model';
13
- import { ElevenLabsTranscriptionModelId } from './elevenlabs-transcription-options';
13
+ import type { ElevenLabsTranscriptionModelId } from './elevenlabs-transcription-options';
14
14
  import { ElevenLabsSpeechModel } from './elevenlabs-speech-model';
15
- import { ElevenLabsSpeechModelId } from './elevenlabs-speech-options';
15
+ import type { ElevenLabsSpeechModelId } from './elevenlabs-speech-options';
16
16
  import { VERSION } from './version';
17
17
 
18
18
  export interface ElevenLabsProvider extends ProviderV4 {
@@ -135,4 +135,4 @@ export function createElevenLabs(
135
135
  /**
136
136
  * Default ElevenLabs provider instance.
137
137
  */
138
- export const elevenlabs = createElevenLabs();
138
+ export const elevenLabs = createElevenLabs();
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod/v4';
2
+
3
+ // Schema for camelCase input from users
4
+ export const elevenLabsSpeechModelOptionsSchema = z.object({
5
+ languageCode: z.string().optional(),
6
+ voiceSettings: z
7
+ .object({
8
+ stability: z.number().min(0).max(1).optional(),
9
+ similarityBoost: z.number().min(0).max(1).optional(),
10
+ style: z.number().min(0).max(1).optional(),
11
+ useSpeakerBoost: z.boolean().optional(),
12
+ })
13
+ .optional(),
14
+ pronunciationDictionaryLocators: z
15
+ .array(
16
+ z.object({
17
+ pronunciationDictionaryId: z.string(),
18
+ versionId: z.string().optional(),
19
+ }),
20
+ )
21
+ .max(3)
22
+ .optional(),
23
+ seed: z.number().min(0).max(4294967295).optional(),
24
+ previousText: z.string().optional(),
25
+ nextText: z.string().optional(),
26
+ previousRequestIds: z.array(z.string()).max(3).optional(),
27
+ nextRequestIds: z.array(z.string()).max(3).optional(),
28
+ applyTextNormalization: z.enum(['auto', 'on', 'off']).optional(),
29
+ applyLanguageTextNormalization: z.boolean().optional(),
30
+ enableLogging: z.boolean().optional(),
31
+ });
32
+
33
+ export type ElevenLabsSpeechModelOptions = z.infer<
34
+ typeof elevenLabsSpeechModelOptionsSchema
35
+ >;
@@ -1,53 +1,22 @@
1
- import { SpeechModelV4, SharedV4Warning } from '@ai-sdk/provider';
1
+ import type { SpeechModelV4, SharedV4Warning } from '@ai-sdk/provider';
2
2
  import {
3
3
  combineHeaders,
4
4
  createBinaryResponseHandler,
5
5
  parseProviderOptions,
6
6
  postJsonToApi,
7
+ serializeModelOptions,
8
+ WORKFLOW_SERIALIZE,
9
+ WORKFLOW_DESERIALIZE,
7
10
  } from '@ai-sdk/provider-utils';
8
- import { z } from 'zod/v4';
9
- import { ElevenLabsConfig } from './elevenlabs-config';
11
+ import type { ElevenLabsConfig } from './elevenlabs-config';
10
12
  import { elevenlabsFailedResponseHandler } from './elevenlabs-error';
11
- import { ElevenLabsSpeechAPITypes } from './elevenlabs-speech-api-types';
12
- import {
13
+ import { elevenLabsSpeechModelOptionsSchema } from './elevenlabs-speech-model-options';
14
+ import type { ElevenLabsSpeechAPITypes } from './elevenlabs-speech-api-types';
15
+ import type {
13
16
  ElevenLabsSpeechModelId,
14
17
  ElevenLabsSpeechVoiceId,
15
18
  } from './elevenlabs-speech-options';
16
19
 
17
- // Schema for camelCase input from users
18
- const elevenLabsSpeechModelOptionsSchema = z.object({
19
- languageCode: z.string().optional(),
20
- voiceSettings: z
21
- .object({
22
- stability: z.number().min(0).max(1).optional(),
23
- similarityBoost: z.number().min(0).max(1).optional(),
24
- style: z.number().min(0).max(1).optional(),
25
- useSpeakerBoost: z.boolean().optional(),
26
- })
27
- .optional(),
28
- pronunciationDictionaryLocators: z
29
- .array(
30
- z.object({
31
- pronunciationDictionaryId: z.string(),
32
- versionId: z.string().optional(),
33
- }),
34
- )
35
- .max(3)
36
- .optional(),
37
- seed: z.number().min(0).max(4294967295).optional(),
38
- previousText: z.string().optional(),
39
- nextText: z.string().optional(),
40
- previousRequestIds: z.array(z.string()).max(3).optional(),
41
- nextRequestIds: z.array(z.string()).max(3).optional(),
42
- applyTextNormalization: z.enum(['auto', 'on', 'off']).optional(),
43
- applyLanguageTextNormalization: z.boolean().optional(),
44
- enableLogging: z.boolean().optional(),
45
- });
46
-
47
- export type ElevenLabsSpeechModelOptions = z.infer<
48
- typeof elevenLabsSpeechModelOptionsSchema
49
- >;
50
-
51
20
  interface ElevenLabsSpeechModelConfig extends ElevenLabsConfig {
52
21
  _internal?: {
53
22
  currentDate?: () => Date;
@@ -61,6 +30,20 @@ export class ElevenLabsSpeechModel implements SpeechModelV4 {
61
30
  return this.config.provider;
62
31
  }
63
32
 
33
+ static [WORKFLOW_SERIALIZE](model: ElevenLabsSpeechModel) {
34
+ return serializeModelOptions({
35
+ modelId: model.modelId,
36
+ config: model.config,
37
+ });
38
+ }
39
+
40
+ static [WORKFLOW_DESERIALIZE](options: {
41
+ modelId: ElevenLabsSpeechModelId;
42
+ config: ElevenLabsSpeechModelConfig;
43
+ }) {
44
+ return new ElevenLabsSpeechModel(options.modelId, options.config);
45
+ }
46
+
64
47
  constructor(
65
48
  readonly modelId: ElevenLabsSpeechModelId,
66
49
  private readonly config: ElevenLabsSpeechModelConfig,
@@ -233,7 +216,7 @@ export class ElevenLabsSpeechModel implements SpeechModelV4 {
233
216
  const queryString = new URLSearchParams(queryParams).toString();
234
217
  return queryString ? `${baseUrl}?${queryString}` : baseUrl;
235
218
  })(),
236
- headers: combineHeaders(this.config.headers(), options.headers),
219
+ headers: combineHeaders(this.config.headers?.(), options.headers),
237
220
  body: requestBody,
238
221
  failedResponseHandler: elevenlabsFailedResponseHandler,
239
222
  successfulResponseHandler: createBinaryResponseHandler(),
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod/v4';
2
+
3
+ // https://elevenlabs.io/docs/api-reference/speech-to-text/convert
4
+ export const elevenLabsTranscriptionModelOptionsSchema = z.object({
5
+ languageCode: z.string().nullish(),
6
+ tagAudioEvents: z.boolean().nullish().default(true),
7
+ numSpeakers: z.number().int().min(1).max(32).nullish(),
8
+ timestampsGranularity: z
9
+ .enum(['none', 'word', 'character'])
10
+ .nullish()
11
+ .default('word'),
12
+ diarize: z.boolean().nullish().default(false),
13
+ fileFormat: z.enum(['pcm_s16le_16', 'other']).nullish().default('other'),
14
+ });
15
+
16
+ export type ElevenLabsTranscriptionModelOptions = z.infer<
17
+ typeof elevenLabsTranscriptionModelOptionsSchema
18
+ >;
@@ -1,4 +1,4 @@
1
- import { TranscriptionModelV4, SharedV4Warning } from '@ai-sdk/provider';
1
+ import type { TranscriptionModelV4, SharedV4Warning } from '@ai-sdk/provider';
2
2
  import {
3
3
  combineHeaders,
4
4
  convertBase64ToUint8Array,
@@ -6,29 +6,16 @@ import {
6
6
  mediaTypeToExtension,
7
7
  parseProviderOptions,
8
8
  postFormDataToApi,
9
+ serializeModelOptions,
10
+ WORKFLOW_SERIALIZE,
11
+ WORKFLOW_DESERIALIZE,
9
12
  } from '@ai-sdk/provider-utils';
10
13
  import { z } from 'zod/v4';
11
- import { ElevenLabsConfig } from './elevenlabs-config';
14
+ import type { ElevenLabsConfig } from './elevenlabs-config';
12
15
  import { elevenlabsFailedResponseHandler } from './elevenlabs-error';
13
- import { ElevenLabsTranscriptionModelId } from './elevenlabs-transcription-options';
14
- import { ElevenLabsTranscriptionAPITypes } from './elevenlabs-api-types';
15
-
16
- // https://elevenlabs.io/docs/api-reference/speech-to-text/convert
17
- const elevenLabsTranscriptionModelOptionsSchema = z.object({
18
- languageCode: z.string().nullish(),
19
- tagAudioEvents: z.boolean().nullish().default(true),
20
- numSpeakers: z.number().int().min(1).max(32).nullish(),
21
- timestampsGranularity: z
22
- .enum(['none', 'word', 'character'])
23
- .nullish()
24
- .default('word'),
25
- diarize: z.boolean().nullish().default(false),
26
- fileFormat: z.enum(['pcm_s16le_16', 'other']).nullish().default('other'),
27
- });
28
-
29
- export type ElevenLabsTranscriptionModelOptions = z.infer<
30
- typeof elevenLabsTranscriptionModelOptionsSchema
31
- >;
16
+ import { elevenLabsTranscriptionModelOptionsSchema } from './elevenlabs-transcription-model-options';
17
+ import type { ElevenLabsTranscriptionModelId } from './elevenlabs-transcription-options';
18
+ import type { ElevenLabsTranscriptionAPITypes } from './elevenlabs-api-types';
32
19
 
33
20
  interface ElevenLabsTranscriptionModelConfig extends ElevenLabsConfig {
34
21
  _internal?: {
@@ -43,6 +30,20 @@ export class ElevenLabsTranscriptionModel implements TranscriptionModelV4 {
43
30
  return this.config.provider;
44
31
  }
45
32
 
33
+ static [WORKFLOW_SERIALIZE](model: ElevenLabsTranscriptionModel) {
34
+ return serializeModelOptions({
35
+ modelId: model.modelId,
36
+ config: model.config,
37
+ });
38
+ }
39
+
40
+ static [WORKFLOW_DESERIALIZE](options: {
41
+ modelId: ElevenLabsTranscriptionModelId;
42
+ config: ElevenLabsTranscriptionModelConfig;
43
+ }) {
44
+ return new ElevenLabsTranscriptionModel(options.modelId, options.config);
45
+ }
46
+
46
47
  constructor(
47
48
  readonly modelId: ElevenLabsTranscriptionModelId,
48
49
  private readonly config: ElevenLabsTranscriptionModelConfig,
@@ -125,7 +126,7 @@ export class ElevenLabsTranscriptionModel implements TranscriptionModelV4 {
125
126
  path: '/v1/speech-to-text',
126
127
  modelId: this.modelId,
127
128
  }),
128
- headers: combineHeaders(this.config.headers(), options.headers),
129
+ headers: combineHeaders(this.config.headers?.(), options.headers),
129
130
  formData,
130
131
  failedResponseHandler: elevenlabsFailedResponseHandler,
131
132
  successfulResponseHandler: createJsonResponseHandler(
package/src/index.ts CHANGED
@@ -1,4 +1,9 @@
1
- export { createElevenLabs, elevenlabs } from './elevenlabs-provider';
1
+ export {
2
+ createElevenLabs,
3
+ elevenLabs,
4
+ /** @deprecated Use `elevenLabs` instead. */
5
+ elevenLabs as elevenlabs,
6
+ } from './elevenlabs-provider';
2
7
  export type {
3
8
  ElevenLabsProvider,
4
9
  ElevenLabsProviderSettings,
@@ -7,6 +12,6 @@ export type {
7
12
  ElevenLabsSpeechModelId,
8
13
  ElevenLabsSpeechVoiceId,
9
14
  } from './elevenlabs-speech-options';
10
- export type { ElevenLabsSpeechModelOptions } from './elevenlabs-speech-model';
11
- export type { ElevenLabsTranscriptionModelOptions } from './elevenlabs-transcription-model';
15
+ export type { ElevenLabsSpeechModelOptions } from './elevenlabs-speech-model-options';
16
+ export type { ElevenLabsTranscriptionModelOptions } from './elevenlabs-transcription-model-options';
12
17
  export { VERSION } from './version';
package/dist/index.d.mts DELETED
@@ -1,122 +0,0 @@
1
- import { TranscriptionModelV4, ProviderV4, SpeechModelV4 } from '@ai-sdk/provider';
2
- import { FetchFunction } from '@ai-sdk/provider-utils';
3
- import { z } from 'zod/v4';
4
-
5
- type ElevenLabsConfig = {
6
- provider: string;
7
- url: (options: {
8
- modelId: string;
9
- path: string;
10
- }) => string;
11
- headers: () => Record<string, string | undefined>;
12
- fetch?: FetchFunction;
13
- generateId?: () => string;
14
- };
15
-
16
- type ElevenLabsTranscriptionModelId = 'scribe_v1' | 'scribe_v1_experimental' | (string & {});
17
-
18
- declare const elevenLabsTranscriptionModelOptionsSchema: z.ZodObject<{
19
- languageCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
- tagAudioEvents: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>>;
21
- numSpeakers: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
22
- timestampsGranularity: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodEnum<{
23
- none: "none";
24
- word: "word";
25
- character: "character";
26
- }>>>>;
27
- diarize: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>>;
28
- fileFormat: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodEnum<{
29
- pcm_s16le_16: "pcm_s16le_16";
30
- other: "other";
31
- }>>>>;
32
- }, z.core.$strip>;
33
- type ElevenLabsTranscriptionModelOptions = z.infer<typeof elevenLabsTranscriptionModelOptionsSchema>;
34
- interface ElevenLabsTranscriptionModelConfig extends ElevenLabsConfig {
35
- _internal?: {
36
- currentDate?: () => Date;
37
- };
38
- }
39
- declare class ElevenLabsTranscriptionModel implements TranscriptionModelV4 {
40
- readonly modelId: ElevenLabsTranscriptionModelId;
41
- private readonly config;
42
- readonly specificationVersion = "v4";
43
- get provider(): string;
44
- constructor(modelId: ElevenLabsTranscriptionModelId, config: ElevenLabsTranscriptionModelConfig);
45
- private getArgs;
46
- doGenerate(options: Parameters<TranscriptionModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<TranscriptionModelV4['doGenerate']>>>;
47
- }
48
-
49
- type ElevenLabsSpeechModelId = 'eleven_v3' | 'eleven_multilingual_v2' | 'eleven_flash_v2_5' | 'eleven_flash_v2' | 'eleven_turbo_v2_5' | 'eleven_turbo_v2' | 'eleven_monolingual_v1' | 'eleven_multilingual_v1' | (string & {});
50
- type ElevenLabsSpeechVoiceId = string;
51
-
52
- interface ElevenLabsProvider extends ProviderV4 {
53
- (modelId: 'scribe_v1', settings?: {}): {
54
- transcription: ElevenLabsTranscriptionModel;
55
- };
56
- /**
57
- * Creates a model for transcription.
58
- */
59
- transcription(modelId: ElevenLabsTranscriptionModelId): TranscriptionModelV4;
60
- /**
61
- * Creates a model for speech generation.
62
- */
63
- speech(modelId: ElevenLabsSpeechModelId): SpeechModelV4;
64
- /**
65
- * @deprecated Use `embeddingModel` instead.
66
- */
67
- textEmbeddingModel(modelId: string): never;
68
- }
69
- interface ElevenLabsProviderSettings {
70
- /**
71
- * API key for authenticating requests.
72
- */
73
- apiKey?: string;
74
- /**
75
- * Custom headers to include in the requests.
76
- */
77
- headers?: Record<string, string>;
78
- /**
79
- * Custom fetch implementation. You can use it as a middleware to intercept requests,
80
- * or to provide a custom fetch implementation for e.g. testing.
81
- */
82
- fetch?: FetchFunction;
83
- }
84
- /**
85
- * Create an ElevenLabs provider instance.
86
- */
87
- declare function createElevenLabs(options?: ElevenLabsProviderSettings): ElevenLabsProvider;
88
- /**
89
- * Default ElevenLabs provider instance.
90
- */
91
- declare const elevenlabs: ElevenLabsProvider;
92
-
93
- declare const elevenLabsSpeechModelOptionsSchema: z.ZodObject<{
94
- languageCode: z.ZodOptional<z.ZodString>;
95
- voiceSettings: z.ZodOptional<z.ZodObject<{
96
- stability: z.ZodOptional<z.ZodNumber>;
97
- similarityBoost: z.ZodOptional<z.ZodNumber>;
98
- style: z.ZodOptional<z.ZodNumber>;
99
- useSpeakerBoost: z.ZodOptional<z.ZodBoolean>;
100
- }, z.core.$strip>>;
101
- pronunciationDictionaryLocators: z.ZodOptional<z.ZodArray<z.ZodObject<{
102
- pronunciationDictionaryId: z.ZodString;
103
- versionId: z.ZodOptional<z.ZodString>;
104
- }, z.core.$strip>>>;
105
- seed: z.ZodOptional<z.ZodNumber>;
106
- previousText: z.ZodOptional<z.ZodString>;
107
- nextText: z.ZodOptional<z.ZodString>;
108
- previousRequestIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
109
- nextRequestIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
- applyTextNormalization: z.ZodOptional<z.ZodEnum<{
111
- auto: "auto";
112
- on: "on";
113
- off: "off";
114
- }>>;
115
- applyLanguageTextNormalization: z.ZodOptional<z.ZodBoolean>;
116
- enableLogging: z.ZodOptional<z.ZodBoolean>;
117
- }, z.core.$strip>;
118
- type ElevenLabsSpeechModelOptions = z.infer<typeof elevenLabsSpeechModelOptionsSchema>;
119
-
120
- declare const VERSION: string;
121
-
122
- export { type ElevenLabsProvider, type ElevenLabsProviderSettings, type ElevenLabsSpeechModelId, type ElevenLabsSpeechModelOptions, type ElevenLabsSpeechVoiceId, type ElevenLabsTranscriptionModelOptions, VERSION, createElevenLabs, elevenlabs };