0
# Studio Projects
1
2
Studio API for creating long-form audio projects including podcasts with automatic content conversion and chapter management.
3
4
## Project Methods
5
6
### studio.createPodcast()
7
8
```typescript { .api }
9
createPodcast(
10
request: {
11
safetyIdentifier: string;
12
modelId: string;
13
mode: object; // Configuration mode
14
source: object; // Content source
15
},
16
options?: RequestOptions
17
): Promise<PodcastProjectResponseModel>
18
```
19
20
### studio.getProject()
21
22
```typescript { .api }
23
getProject(
24
projectId: string,
25
options?: RequestOptions
26
): Promise<ProjectResponseModel>
27
```
28
29
### studio.deleteProject()
30
31
```typescript { .api }
32
deleteProject(
33
projectId: string,
34
options?: RequestOptions
35
): Promise<void>
36
```
37
38
### studio.updateProject()
39
40
```typescript { .api }
41
updateProject(
42
projectId: string,
43
request: ProjectUpdateRequest,
44
options?: RequestOptions
45
): Promise<ProjectResponseModel>
46
```
47
48
## Chapter Methods
49
50
### studio.getChapter()
51
52
```typescript { .api }
53
getChapter(
54
projectId: string,
55
chapterId: string,
56
options?: RequestOptions
57
): Promise<ChapterResponseModel>
58
```
59
60
### studio.updateChapter()
61
62
```typescript { .api }
63
updateChapter(
64
projectId: string,
65
chapterId: string,
66
request: ChapterUpdateRequest,
67
options?: RequestOptions
68
): Promise<ChapterResponseModel>
69
```
70
71
### studio.deleteChapter()
72
73
```typescript { .api }
74
deleteChapter(
75
projectId: string,
76
chapterId: string,
77
options?: RequestOptions
78
): Promise<void>
79
```
80
81
### studio.convertChapter()
82
83
```typescript { .api }
84
convertChapter(
85
projectId: string,
86
chapterId: string,
87
options?: RequestOptions
88
): Promise<void>
89
```
90
91
## Snapshot Methods
92
93
### studio.streamProjectSnapshot()
94
95
```typescript { .api }
96
streamProjectSnapshot(
97
projectId: string,
98
request?: {
99
snapshotId?: string;
100
convertToMp3?: boolean;
101
},
102
options?: RequestOptions
103
): Promise<ReadableStream<Uint8Array>>
104
```
105
106
### studio.archiveProjectSnapshot()
107
108
```typescript { .api }
109
archiveProjectSnapshot(
110
projectId: string,
111
request: {
112
snapshotId: string;
113
},
114
options?: RequestOptions
115
): Promise<void>
116
```
117
118
## Usage Examples
119
120
### Create Podcast Project
121
122
```typescript
123
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
124
125
const client = new ElevenLabsClient({ apiKey: process.env.ELEVENLABS_API_KEY });
126
127
const podcast = await client.studio.createPodcast({
128
safetyIdentifier: "my-podcast-id",
129
modelId: "eleven_multilingual_v2",
130
mode: {
131
type: "conversational",
132
numSpeakers: 2
133
},
134
source: {
135
type: "url",
136
url: "https://example.com/article.html"
137
}
138
});
139
140
console.log(`Project created: ${podcast.projectId}`);
141
```
142
143
### Get Project Status
144
145
```typescript
146
const project = await client.studio.getProject("project_id");
147
148
console.log("Status:", project.status);
149
console.log("Chapters:", project.chapters?.length);
150
```
151
152
### Update Project
153
154
```typescript
155
const updated = await client.studio.updateProject("project_id", {
156
name: "Updated Podcast Name",
157
description: "New description"
158
});
159
```
160
161
### Manage Chapters
162
163
```typescript
164
// Get chapter
165
const chapter = await client.studio.getChapter("project_id", "chapter_id");
166
console.log("Chapter:", chapter.title);
167
168
// Update chapter
169
await client.studio.updateChapter("project_id", "chapter_id", {
170
title: "New Chapter Title",
171
text: "Updated chapter content..."
172
});
173
174
// Convert chapter to audio
175
await client.studio.convertChapter("project_id", "chapter_id");
176
177
// Delete chapter
178
await client.studio.deleteChapter("project_id", "chapter_id");
179
```
180
181
### Stream Project Audio
182
183
```typescript
184
import fs from "fs";
185
186
const audioStream = await client.studio.streamProjectSnapshot("project_id", {
187
convertToMp3: true
188
});
189
190
const output = fs.createWriteStream("podcast.mp3");
191
for await (const chunk of audioStream) {
192
output.write(chunk);
193
}
194
output.end();
195
196
console.log("Podcast downloaded");
197
```
198
199
### Archive Snapshot
200
201
```typescript
202
await client.studio.archiveProjectSnapshot("project_id", {
203
snapshotId: "snapshot_id"
204
});
205
206
console.log("Snapshot archived");
207
```
208
209
### Complete Podcast Workflow
210
211
```typescript
212
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
213
import fs from "fs";
214
215
const client = new ElevenLabsClient({ apiKey: process.env.ELEVENLABS_API_KEY });
216
217
// 1. Create podcast from URL
218
const podcast = await client.studio.createPodcast({
219
safetyIdentifier: "podcast-2024-01",
220
modelId: "eleven_multilingual_v2",
221
mode: {
222
type: "conversational",
223
numSpeakers: 2
224
},
225
source: {
226
type: "url",
227
url: "https://example.com/blog-post.html"
228
}
229
});
230
231
console.log(`Created: ${podcast.projectId}`);
232
233
// 2. Poll for completion
234
let project;
235
while (true) {
236
project = await client.studio.getProject(podcast.projectId);
237
console.log(`Status: ${project.status}`);
238
239
if (project.status === "completed") break;
240
if (project.status === "failed") throw new Error("Project failed");
241
242
await new Promise(r => setTimeout(r, 5000));
243
}
244
245
// 3. Review and update chapters
246
if (project.chapters) {
247
for (const chapter of project.chapters) {
248
console.log(`Chapter: ${chapter.title}`);
249
250
// Optionally update chapter
251
await client.studio.updateChapter(podcast.projectId, chapter.chapterId, {
252
title: `Updated: ${chapter.title}`
253
});
254
}
255
}
256
257
// 4. Download podcast audio
258
const audio = await client.studio.streamProjectSnapshot(podcast.projectId, {
259
convertToMp3: true
260
});
261
262
const file = fs.createWriteStream("final_podcast.mp3");
263
for await (const chunk of audio) {
264
file.write(chunk);
265
}
266
file.end();
267
268
console.log("Podcast workflow complete!");
269
```
270
271
## Important Notes
272
273
- **Podcast Creation**: Automatic conversion from text/URL to audio
274
- **Chapter Management**: Individual chapter editing and regeneration
275
- **Snapshots**: Versioned audio outputs, can be archived
276
- **Status**: Poll project status for async processing
277
- **Audio Format**: Convert to MP3 during download
278
- **Safety Identifier**: Unique ID for tracking/safety
279
- **Multi-Speaker**: Configure number of speakers in mode
280