Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

VoiceGenerationOptions.md

128 lines3.2 KB

1---
2id: VoiceGenerationOptions
3title: VoiceGenerationOptions
4---
5​
6Defined in: [packages/ai/src/types.ts:3105](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L3105)
7​
8Options for creating a voice.
9​
10Providers create voices in one of two ways, and some support both:
11- **design** — synthesize a brand new voice from a text [prompt](#prompt).
12- **clone** — derive a voice from [referenceAudio](#referenceaudio) of a real speaker.
13​
14At least one of `prompt` / `referenceAudio` is required; which ones an
15adapter accepts depends on the model. An adapter may require both — the
16only adapter today, `elevenlabsVoiceDesign`, always needs `prompt` and
17takes `referenceAudio` as an additional design reference.
18​
19## Type Parameters
20​
21### TProviderOptions
22​
23`TProviderOptions` *extends* `object` = `object`
24​
25## Properties
26​
27### abortSignal?
28​
29```ts
30optional abortSignal?: AbortSignal;
31```
32​
33Defined in: [packages/ai/src/types.ts:3140](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L3140)
34​
35Effective abort signal composed by the activity from caller `abortSignal`
36and/or `timeout`. Adapters should forward this to the provider SDK when
37supported. Request-specific - never store on a global client config.
38​
39***
40​
41### description?
42​
43```ts
44optional description?: string;
45```
46​
47Defined in: [packages/ai/src/types.ts:3126](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L3126)
48​
49Human-readable description stored alongside the voice
50​
51***
52​
53### logger
54​
55```ts
56logger: InternalLogger;
57```
58​
59Defined in: [packages/ai/src/types.ts:3134](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L3134)
60​
61Internal logger threaded from the generateVoice() entry point. Adapters
62must call logger.request() before the SDK call and logger.errors() in
63catch blocks.
64​
65***
66​
67### model
68​
69```ts
70model: string;
71```
72​
73Defined in: [packages/ai/src/types.ts:3109](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L3109)
74​
75The model to use for voice creation
76​
77***
78​
79### modelOptions?
80​
81```ts
82optional modelOptions?: TProviderOptions;
83```
84​
85Defined in: [packages/ai/src/types.ts:3128](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L3128)
86​
87Model-specific options for voice creation
88​
89***
90​
91### name?
92​
93```ts
94optional name?: string;
95```
96​
97Defined in: [packages/ai/src/types.ts:3124](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L3124)
98​
99Name to store the voice under in the provider's voice library. Providers
100differ on what this implies — ElevenLabs only persists a designed voice
101when a name is given. Read [GeneratedVoice.saved](GeneratedVoice.md#saved) to find out what
102actually happened.
103​
104***
105​
106### prompt?
107​
108```ts
109optional prompt?: string;
110```
111​
112Defined in: [packages/ai/src/types.ts:3111](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L3111)
113​
114Text description of the voice to create, for design-capable models
115​
116***
117​
118### referenceAudio?
119​
120```ts
121optional referenceAudio?: string | ArrayBuffer | File | Blob;
122```
123​
124Defined in: [packages/ai/src/types.ts:3117](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L3117)
125​
126Reference audio of the speaker to clone - base64 string, base64 data URL,
127File, Blob, or ArrayBuffer. For clone-capable models. Remote URLs are not
128accepted; read the file and pass the bytes.