@ai-sdk/elevenlabs 3.0.0-beta.3 → 3.0.0-beta.31

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@ai-sdk/elevenlabs",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-beta.31",
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,20 +24,20 @@
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.3"
32
+ "@ai-sdk/provider": "4.0.0-beta.14",
33
+ "@ai-sdk/provider-utils": "5.0.0-beta.30"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "20.17.24",
37
37
  "tsup": "^8",
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.3",
41
41
  "@vercel/ai-tsconfig": "0.0.0"
42
42
  },
43
43
  "peerDependencies": {
@@ -47,12 +47,14 @@
47
47
  "node": ">=18"
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,21 +1,21 @@
1
1
  import {
2
- TranscriptionModelV3,
3
- SpeechModelV3,
4
- ProviderV3,
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
- export interface ElevenLabsProvider extends ProviderV3 {
18
+ export interface ElevenLabsProvider extends ProviderV4 {
19
19
  (
20
20
  modelId: 'scribe_v1',
21
21
  settings?: {},
@@ -26,12 +26,12 @@ export interface ElevenLabsProvider extends ProviderV3 {
26
26
  /**
27
27
  * Creates a model for transcription.
28
28
  */
29
- transcription(modelId: ElevenLabsTranscriptionModelId): TranscriptionModelV3;
29
+ transcription(modelId: ElevenLabsTranscriptionModelId): TranscriptionModelV4;
30
30
 
31
31
  /**
32
32
  * Creates a model for speech generation.
33
33
  */
34
- speech(modelId: ElevenLabsSpeechModelId): SpeechModelV3;
34
+ speech(modelId: ElevenLabsSpeechModelId): SpeechModelV4;
35
35
 
36
36
  /**
37
37
  * @deprecated Use `embeddingModel` instead.
@@ -98,7 +98,7 @@ export function createElevenLabs(
98
98
  };
99
99
  };
100
100
 
101
- provider.specificationVersion = 'v3' as const;
101
+ provider.specificationVersion = 'v4' as const;
102
102
  provider.transcription = createTranscriptionModel;
103
103
  provider.transcriptionModel = createTranscriptionModel;
104
104
  provider.speech = createSpeechModel;
@@ -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,66 +1,49 @@
1
- import { SpeechModelV3, SharedV3Warning } 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;
54
23
  };
55
24
  }
56
25
 
57
- export class ElevenLabsSpeechModel implements SpeechModelV3 {
58
- readonly specificationVersion = 'v3';
26
+ export class ElevenLabsSpeechModel implements SpeechModelV4 {
27
+ readonly specificationVersion = 'v4';
59
28
 
60
29
  get provider(): string {
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,
@@ -74,8 +57,8 @@ export class ElevenLabsSpeechModel implements SpeechModelV3 {
74
57
  language,
75
58
  speed,
76
59
  providerOptions,
77
- }: Parameters<SpeechModelV3['doGenerate']>[0]) {
78
- const warnings: SharedV3Warning[] = [];
60
+ }: Parameters<SpeechModelV4['doGenerate']>[0]) {
61
+ const warnings: SharedV4Warning[] = [];
79
62
 
80
63
  // Parse provider options
81
64
  const elevenLabsOptions = await parseProviderOptions({
@@ -214,8 +197,8 @@ export class ElevenLabsSpeechModel implements SpeechModelV3 {
214
197
  }
215
198
 
216
199
  async doGenerate(
217
- options: Parameters<SpeechModelV3['doGenerate']>[0],
218
- ): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>> {
200
+ options: Parameters<SpeechModelV4['doGenerate']>[0],
201
+ ): Promise<Awaited<ReturnType<SpeechModelV4['doGenerate']>>> {
219
202
  const currentDate = this.config._internal?.currentDate?.() ?? new Date();
220
203
  const { requestBody, queryParams, warnings, voiceId } =
221
204
  await this.getArgs(options);
@@ -233,7 +216,7 @@ export class ElevenLabsSpeechModel implements SpeechModelV3 {
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 { TranscriptionModelV3, SharedV3Warning } 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?: {
@@ -36,13 +23,27 @@ interface ElevenLabsTranscriptionModelConfig extends ElevenLabsConfig {
36
23
  };
37
24
  }
38
25
 
39
- export class ElevenLabsTranscriptionModel implements TranscriptionModelV3 {
40
- readonly specificationVersion = 'v3';
26
+ export class ElevenLabsTranscriptionModel implements TranscriptionModelV4 {
27
+ readonly specificationVersion = 'v4';
41
28
 
42
29
  get provider(): string {
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,
@@ -52,8 +53,8 @@ export class ElevenLabsTranscriptionModel implements TranscriptionModelV3 {
52
53
  audio,
53
54
  mediaType,
54
55
  providerOptions,
55
- }: Parameters<TranscriptionModelV3['doGenerate']>[0]) {
56
- const warnings: SharedV3Warning[] = [];
56
+ }: Parameters<TranscriptionModelV4['doGenerate']>[0]) {
57
+ const warnings: SharedV4Warning[] = [];
57
58
 
58
59
  // Parse provider options
59
60
  const elevenlabsOptions = await parseProviderOptions({
@@ -111,8 +112,8 @@ export class ElevenLabsTranscriptionModel implements TranscriptionModelV3 {
111
112
  }
112
113
 
113
114
  async doGenerate(
114
- options: Parameters<TranscriptionModelV3['doGenerate']>[0],
115
- ): Promise<Awaited<ReturnType<TranscriptionModelV3['doGenerate']>>> {
115
+ options: Parameters<TranscriptionModelV4['doGenerate']>[0],
116
+ ): Promise<Awaited<ReturnType<TranscriptionModelV4['doGenerate']>>> {
116
117
  const currentDate = this.config._internal?.currentDate?.() ?? new Date();
117
118
  const { formData, warnings } = await this.getArgs(options);
118
119
 
@@ -125,7 +126,7 @@ export class ElevenLabsTranscriptionModel implements TranscriptionModelV3 {
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 { TranscriptionModelV3, ProviderV3, SpeechModelV3 } 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 TranscriptionModelV3 {
40
- readonly modelId: ElevenLabsTranscriptionModelId;
41
- private readonly config;
42
- readonly specificationVersion = "v3";
43
- get provider(): string;
44
- constructor(modelId: ElevenLabsTranscriptionModelId, config: ElevenLabsTranscriptionModelConfig);
45
- private getArgs;
46
- doGenerate(options: Parameters<TranscriptionModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<TranscriptionModelV3['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 ProviderV3 {
53
- (modelId: 'scribe_v1', settings?: {}): {
54
- transcription: ElevenLabsTranscriptionModel;
55
- };
56
- /**
57
- * Creates a model for transcription.
58
- */
59
- transcription(modelId: ElevenLabsTranscriptionModelId): TranscriptionModelV3;
60
- /**
61
- * Creates a model for speech generation.
62
- */
63
- speech(modelId: ElevenLabsSpeechModelId): SpeechModelV3;
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 };