@mevdragon/vidfarm-devcli 0.19.0 → 0.20.0

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.
Files changed (44) hide show
  1. package/.agents/skills/editor-capabilities/SKILL.md +3 -3
  2. package/.agents/skills/music/SKILL.md +416 -0
  3. package/.agents/skills/music/references/api_reference.md +519 -0
  4. package/.agents/skills/music/references/installation.md +65 -0
  5. package/.agents/skills/text-to-speech/SKILL.md +226 -0
  6. package/.agents/skills/text-to-speech/references/installation.md +90 -0
  7. package/.agents/skills/text-to-speech/references/streaming.md +307 -0
  8. package/.agents/skills/text-to-speech/references/voice-settings.md +115 -0
  9. package/.agents/skills/vidfarm-media/SKILL.md +25 -11
  10. package/.agents/skills/vidfarm-media/references/tts.md +41 -3
  11. package/SKILL.director.md +31 -13
  12. package/SKILL.platform.md +2 -2
  13. package/demo/dist/app.css +1 -1
  14. package/demo/dist/app.js +76 -74
  15. package/dist/src/account-pages-legacy.js +1 -1
  16. package/dist/src/app.js +308 -111
  17. package/dist/src/cli.js +162 -5
  18. package/dist/src/config.js +13 -0
  19. package/dist/src/devcli/clips.js +7 -2
  20. package/dist/src/devcli/composition-edit.js +5 -2
  21. package/dist/src/domain.js +3 -0
  22. package/dist/src/editor-chat.js +8 -1
  23. package/dist/src/primitive-context.js +45 -2
  24. package/dist/src/primitive-registry.js +140 -18
  25. package/dist/src/reskin/chat-page.js +1 -1
  26. package/dist/src/reskin/inpaint-clipper-page.js +446 -205
  27. package/dist/src/reskin/inpaint-page.js +1 -1
  28. package/dist/src/reskin/inpaint-video-page.js +1 -1
  29. package/dist/src/reskin/library-page.js +7 -1
  30. package/dist/src/reskin/portfolio-page.js +687 -0
  31. package/dist/src/reskin/settings-page.js +4 -4
  32. package/dist/src/reskin/theme.js +1 -0
  33. package/dist/src/services/billing.js +5 -0
  34. package/dist/src/services/clip-curation/ffmpeg.js +48 -0
  35. package/dist/src/services/clip-curation/hunt.js +2 -0
  36. package/dist/src/services/clip-curation/index.js +1 -1
  37. package/dist/src/services/clip-curation/scan.js +29 -16
  38. package/dist/src/services/elevenlabs.js +222 -0
  39. package/dist/src/services/hyperframes.js +252 -83
  40. package/dist/src/services/providers.js +216 -2
  41. package/dist/src/services/serverless-jobs.js +3 -1
  42. package/dist/src/services/swipe-customize.js +5 -2
  43. package/dist/src/template-editor-pages.js +1 -1
  44. package/package.json +1 -1
@@ -63,7 +63,7 @@ A full worked example is in `references/re-theme-walkthrough.md`.
63
63
 
64
64
  A heavy scenes-axis replace needs footage. Source it in **cost order**, and be proactive: when a big scene re-work is asked for but no footage is given, offer to hunt a source *before* defaulting to expensive AI generation.
65
65
 
66
- 1. **The user's own library** — `browse_files` search/list over `/raws` (footage) and `/files` (durable assets). Free.
66
+ 1. **The user's own library** — `browse_files` search/list over `/raws` (footage) and `/files` (durable assets). Free. **You do not need the user to paste a URL.** When they say "use my raws" / "it's in my file directory" / name a clip, `browse_files action=search` (or `list path='/raws'`) to find it, then `action=read` with its `file_id` — the read's **`view_url` IS the public, ready media URL**. Drop that `view_url` straight into `set_layer_media` `src`. Never stall asking for a URL you can look up, and never pass a placeholder `src` like `"please-ignore"`.
67
67
  2. **HUNT new raws** out of a long-form source (podcast/VOD/webinar or any YouTube/TikTok/IG/X URL): `POST /clips/scan` (aka `/raws/scan`) with `{ source_url|temp_file_id|s3_key, prompt, aspect, target_duration_sec?, ranges?, avoid_text? }` — async (202 + scan_id), bills **AWS compute only** (the AI tagging runs on the user's own keys, never billed). Then browse `/raws/feed?source=<id>` and reuse the picks (`set_layer_media` in place, `add_layer`/`generate_layer intent:"add"` for net-new scenes).
68
68
  3. **`generate_layer` AI generation** — the expensive last resort, only for scenes no real clip can cover. AI *image* gen is cheap (use freely); AI *video* gen is expensive — ask permission / confirm budget first.
69
69
 
@@ -115,7 +115,7 @@ You usually already know a clip's aspect from how you sourced it (a hunted raw's
115
115
  **Generate & export**
116
116
  - `generate_layer` — submit an AI generate job, drop a placeholder in the target slot, auto-swap the finished media (no manual poll). `intent`: `fill_gap` (+ start/duration on a `timeline_gaps` span), `replace_layer` (+ `replace_layer_key` — timing/geometry copied), or `add`. Set `aspect_ratio` to the canvas.
117
117
  - **Transparent overlays ("Vox-style") — `POST /api/v1/primitives/images/create-overlay`** via `http_request`. This is the go-to way to mint a floating illustration / prop / icon / cut-out character to animate over the video: one job generates an AI image on a forced flat key-color background and chroma-keys it out to a transparent PNG (`result.primary_file_url`). Body `{ tracer, payload: { prompt, aspect_ratio?, key_color?, prompt_attachments? } }` — describe only the subject (the background instruction is injected for you). Then `add_layer` the finished URL as an overlay image and animate it (`ken_burns`/`set_layer_keyframes`/`set_transitions`). Reach for it *often* when a scene wants a transparent graphic element rather than a full-frame still. Cheap-remove sibling for an image already on a flat background: `POST /api/v1/primitives/images/remove-background-greenscreen` (`key_color`/`tolerance`/`softness`); use RapidAPI `images/remove-background` only for messy-background photos.
118
- - `export_composition` — same as the Export button; queues the render on AWS Lambda. The MP4 appears as `last_export_url` in a later `editor_context`; never fabricate the URL.
118
+ - `export_composition` — same as the Export button; queues the render on AWS Lambda. The MP4 appears as `last_export_url` in a later `editor_context`; never fabricate the URL. **Confirm first — never auto-render.** Rendering is slow, costs money, and pops a status modal, so by default STOP after an edit, let the user review the live preview, and *ask* ("Happy with the preview? Render the final MP4?") before firing this. Only export unprompted when the user pre-authorized it ("edit and just render it"). A render started, then the user can keep working — multiple renders are tracked in the Viral DNA panel's "N Rendering…" badge and its render-history modal.
119
119
  - `fork_composition` — branch a NEW editable copy and open it (only on an explicit user branch/duplicate/"save as" request — see Forking). `fork_from:"current"` keeps all current edits; `fork_from:"default"` starts fresh from the template's original default. Same as the ⋯ menu's **New fork** and `POST /api/v1/compositions/:forkId/fork { from }`.
120
120
 
121
121
  ## Reading `editor_context` — the fields that matter
@@ -125,7 +125,7 @@ You usually already know a clip's aspect from how you sourced it (a hunted raw's
125
125
  - `composition_context` (the viral DNA — read before writing any copy).
126
126
  - `editor_harness` (the **style-execution brief** — read before any nontrivial edit; see below).
127
127
  - `composition_width`/`_height`/`aspect_ratio` (request matching aspect on generate so media fills the canvas), `composition_duration_seconds`.
128
- - `layers[]` — each with `layer_key`/`element_id`/`slug`, `track` (= z-index), start/duration/geometry, current `object_fit`/`object_position` (the media's fit framing — read it before re-cropping an aspect-mismatched clip), `transition`/`transition_out`/`ken_burns`/`animation`, and `is_full_canvas`/`is_timeline_proxy` (a proxy renders 100%×100% even if shown tiny — trust the flag on replacement).
128
+ - `layers[]` — each with `layer_key`/`element_id`/`slug`, `kind` (video/image/audio/caption/text), current `src`, `track` (= z-index), start/duration/geometry, current `object_fit`/`object_position` (the media's fit framing — read it before re-cropping an aspect-mismatched clip), `transition`/`transition_out`/`ken_burns`/`animation`, and `is_full_canvas`/`is_timeline_proxy` (a proxy renders 100%×100% even if shown tiny — trust the flag on replacement). **This is the ONLY valid source of layer keys.** To swap a clip's media, copy the EXACT `layer_key` (or `slug`) of the *video/image* layer from here — do not invent a semantic scene name (`growth_examples`, `mistakes_reflection`) unless that exact string is a key/slug in this array, and don't target a scene label/group when you mean the video inside it. If `set_layer_media` returns "No change applied" or "Layer not found", the error lists the real media layers — retry with one of those exact keys, and never report a swap done until the next `editor_context` shows the layer's `src` changed.
129
129
  - `timeline_gaps[]` — precomputed blank/black spans; map a user's timestamp to the covering gap.
130
130
  - `pending_generations[]` — AI gens still rendering (don't double-fire; report progress; `status:"error"` means it failed).
131
131
  - `cast[]` — recurring people for character consistency (use `reference_url` on generate).
@@ -0,0 +1,416 @@
1
+ ---
2
+ name: music
3
+ description: Generate music using ElevenLabs Music API. Use when creating instrumental tracks, songs with lyrics, background music, jingles, or any AI-generated music composition. Supports prompt-based generation, composition plans for granular control, and detailed output with metadata.
4
+ license: MIT
5
+ compatibility: Requires internet access and an ElevenLabs API key (ELEVENLABS_API_KEY).
6
+ metadata: {"openclaw": {"requires": {"env": ["ELEVENLABS_API_KEY"]}, "primaryEnv": "ELEVENLABS_API_KEY"}}
7
+ ---
8
+
9
+ # ElevenLabs Music Generation
10
+
11
+ Generate music from text prompts - supports instrumental tracks, songs with lyrics, and fine-grained control via composition plans.
12
+
13
+ > **Setup:** See [Installation Guide](references/installation.md). For JavaScript, use `@elevenlabs/*` packages only.
14
+
15
+ All examples below default to `music_v2`, the current generation model. Pass `model_id="music_v1"` only when explicitly requested to.
16
+
17
+ ## Quick Start
18
+
19
+ ### Python
20
+
21
+ ```python
22
+ from elevenlabs import ElevenLabs
23
+
24
+ client = ElevenLabs()
25
+
26
+ audio = client.music.compose(
27
+ prompt="A chill lo-fi hip hop beat with jazzy piano chords",
28
+ music_length_ms=30000,
29
+ model_id="music_v2",
30
+ )
31
+
32
+ with open("output.mp3", "wb") as f:
33
+ for chunk in audio:
34
+ f.write(chunk)
35
+ ```
36
+
37
+ ### TypeScript
38
+
39
+ ```typescript
40
+ import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
41
+ import { createWriteStream } from "fs";
42
+
43
+ const client = new ElevenLabsClient();
44
+ const audio = await client.music.compose({
45
+ prompt: "A chill lo-fi hip hop beat with jazzy piano chords",
46
+ musicLengthMs: 30000,
47
+ modelId: "music_v2",
48
+ });
49
+ audio.pipe(createWriteStream("output.mp3"));
50
+ ```
51
+
52
+ ### cURL
53
+
54
+ ```bash
55
+ curl -X POST "https://api.elevenlabs.io/v1/music" \
56
+ -H "xi-api-key: $ELEVENLABS_API_KEY" -H "Content-Type: application/json" \
57
+ -d '{"prompt": "A chill lo-fi beat", "music_length_ms": 30000, "model_id": "music_v2"}' \
58
+ --output output.mp3
59
+ ```
60
+
61
+ ## Methods
62
+
63
+ | Method | Description |
64
+ |--------|-------------|
65
+ | `music.compose` | Generate audio from a prompt or composition plan |
66
+ | `music.stream` | Stream audio chunks as they are generated (paid plans) |
67
+ | `music.composition_plan.create` | Generate a structured plan for fine-grained control |
68
+ | `music.compose_detailed` | Generate audio + composition plan + metadata; pass `store_for_inpainting=True` to enable inpainting |
69
+ | `music.compose_detailed_stream` | Stream audio plus composition plan, metadata, and optional word timestamps as Server-Sent Events |
70
+ | `music.video_to_music` | Generate background music from one or more uploaded video files |
71
+ | `music.upload` | Upload an audio file for later inpainting workflows, optionally extracting its composition plan or word-level timestamps |
72
+
73
+ See [API Reference](references/api_reference.md) for full parameter details.
74
+
75
+ `music.upload` is available to enterprise clients with access to the inpainting feature.
76
+
77
+ ## Video to Music
78
+
79
+ Generate background music from uploaded video clips via
80
+ [`POST /v1/music/video-to-music`](https://elevenlabs.io/docs/api-reference/music/video-to-music)
81
+ (`client.music.video_to_music`). This is separate from prompt-based
82
+ [`music.compose`](https://elevenlabs.io/docs/api-reference/music/compose) (`POST /v1/music`).
83
+
84
+ The API combines videos in order, accepts an optional natural-language description, and lets you
85
+ steer style with up to 10 tags such as `upbeat` or `cinematic`. This endpoint still defaults to
86
+ `music_v1`; pass `model_id="music_v2"` to use the newer model.
87
+
88
+ ### Python
89
+
90
+ ```python
91
+ from elevenlabs import ElevenLabs
92
+
93
+ client = ElevenLabs()
94
+
95
+ audio = client.music.video_to_music(
96
+ videos=["trailer.mp4"],
97
+ description="Build suspense, then resolve with a warm cinematic finish.",
98
+ tags=["cinematic", "suspenseful", "uplifting"],
99
+ model_id="music_v2",
100
+ )
101
+
102
+ with open("video-score.mp3", "wb") as f:
103
+ for chunk in audio:
104
+ f.write(chunk)
105
+ ```
106
+
107
+ ### TypeScript
108
+
109
+ ```typescript
110
+ import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
111
+ import { createReadStream, createWriteStream } from "fs";
112
+
113
+ const client = new ElevenLabsClient();
114
+
115
+ const audio = await client.music.videoToMusic({
116
+ videos: [createReadStream("trailer.mp4")],
117
+ description: "Build suspense, then resolve with a warm cinematic finish.",
118
+ tags: ["cinematic", "suspenseful", "uplifting"],
119
+ modelId: "music_v2",
120
+ });
121
+
122
+ audio.pipe(createWriteStream("video-score.mp3"));
123
+ ```
124
+
125
+ ### cURL
126
+
127
+ ```bash
128
+ curl -X POST "https://api.elevenlabs.io/v1/music/video-to-music" \
129
+ -H "xi-api-key: $ELEVENLABS_API_KEY" \
130
+ -F "videos=@trailer.mp4" \
131
+ -F "description=Build suspense, then resolve with a warm cinematic finish." \
132
+ -F "tags=cinematic" \
133
+ -F "tags=suspenseful" \
134
+ -F "tags=uplifting" \
135
+ -F "model_id=music_v2" \
136
+ --output video-score.mp3
137
+ ```
138
+
139
+ Constraints from the current API schema:
140
+
141
+ - Upload 1-10 video files per request
142
+ - Keep total combined upload size at or below 200 MB
143
+ - Keep total combined video duration at or below 600 seconds
144
+ - Use `description` for high-level musical direction and `tags` for concise style cues
145
+
146
+ ## Composition Plans
147
+
148
+ `music_v2` composition plans are an ordered list of `chunks`. Each chunk specifies its own
149
+ `text` (section label, lyrics, inline cues), `duration_ms`, `positive_styles`, `negative_styles`,
150
+ and `context_adherence` (`low`, `medium`, or `high`, default `high`). Up to 30 chunks per plan,
151
+ each 3,000–120,000 ms, total length 3 s to 10 minutes.
152
+
153
+ Generate a plan first, edit it, then compose:
154
+
155
+ ```python
156
+ plan = client.music.composition_plan.create(
157
+ prompt="An epic orchestral piece building to a climax",
158
+ music_length_ms=60000,
159
+ model_id="music_v2",
160
+ )
161
+
162
+ # Edit chunks in place
163
+ plan["chunks"][0]["text"] = "[Intro]\nQuiet strings rising"
164
+
165
+ audio = client.music.compose(
166
+ composition_plan=plan,
167
+ model_id="music_v2",
168
+ )
169
+ ```
170
+
171
+ ```typescript
172
+ const plan = await client.music.compositionPlan.create({
173
+ prompt: "An epic orchestral piece building to a climax",
174
+ musicLengthMs: 60000,
175
+ modelId: "music_v2",
176
+ });
177
+
178
+ plan.chunks[0].text = "[Intro]\nQuiet strings rising";
179
+
180
+ const audio = await client.music.compose({
181
+ compositionPlan: plan,
182
+ modelId: "music_v2",
183
+ });
184
+ ```
185
+
186
+ Or hand-build a plan to control lyrics and style per section:
187
+
188
+ ```python
189
+ composition_plan = {
190
+ "chunks": [
191
+ {
192
+ "text": "[Verse]\nWalking down an empty street",
193
+ "duration_ms": 15000,
194
+ "positive_styles": ["pop", "upbeat", "female vocals", "acoustic guitar"],
195
+ "negative_styles": ["dark", "slow"],
196
+ "context_adherence": "high",
197
+ },
198
+ {
199
+ "text": "[Chorus]\nThis is my moment",
200
+ "duration_ms": 15000,
201
+ "positive_styles": ["powerful vocals", "full band"],
202
+ "negative_styles": [],
203
+ "context_adherence": "high",
204
+ },
205
+ ]
206
+ }
207
+
208
+ audio = client.music.compose(composition_plan=composition_plan, model_id="music_v2")
209
+ ```
210
+
211
+ ```typescript
212
+ const compositionPlan = {
213
+ chunks: [
214
+ {
215
+ text: "[Verse]\nWalking down an empty street",
216
+ durationMs: 15000,
217
+ positiveStyles: ["pop", "upbeat", "female vocals", "acoustic guitar"],
218
+ negativeStyles: ["dark", "slow"],
219
+ contextAdherence: "high",
220
+ },
221
+ {
222
+ text: "[Chorus]\nThis is my moment",
223
+ durationMs: 15000,
224
+ positiveStyles: ["powerful vocals", "full band"],
225
+ negativeStyles: [],
226
+ contextAdherence: "high",
227
+ },
228
+ ],
229
+ };
230
+
231
+ const audio = await client.music.compose({
232
+ compositionPlan,
233
+ modelId: "music_v2",
234
+ });
235
+ ```
236
+
237
+ Put broader characteristics (genre, instrumentation, vocal style) in `positive_styles`, not in
238
+ `text`. The first chunk's styles set the overall tone — include 6–7 styles there.
239
+
240
+ ## Output Formats
241
+
242
+ Use the `output_format` query parameter on compose, detailed compose, or stream requests to select
243
+ the generated audio format. `auto` chooses a model-appropriate MP3 format; for `music_v2`, it
244
+ selects `mp3_48000_192`. Higher-bitrate MP3 options include `mp3_48000_240` and `mp3_48000_320`.
245
+
246
+ ## Streaming
247
+
248
+ For paid plans, stream audio chunks as they are generated instead of waiting for the full file:
249
+
250
+ ```python
251
+ from io import BytesIO
252
+
253
+ stream = client.music.stream(
254
+ prompt="A driving synthwave track with arpeggiated leads",
255
+ music_length_ms=30000,
256
+ model_id="music_v2",
257
+ )
258
+
259
+ buffer = BytesIO()
260
+ for chunk in stream:
261
+ if chunk:
262
+ buffer.write(chunk)
263
+ ```
264
+
265
+ ```typescript
266
+ const stream = await client.music.stream({
267
+ prompt: "A driving synthwave track with arpeggiated leads",
268
+ musicLengthMs: 30000,
269
+ modelId: "music_v2",
270
+ });
271
+
272
+ const chunks: Buffer[] = [];
273
+ for await (const chunk of stream) {
274
+ chunks.push(chunk);
275
+ }
276
+ ```
277
+
278
+ ### Detailed streaming
279
+
280
+ Use detailed streaming when the application needs generated music metadata while audio is still
281
+ arriving. `POST /v1/music/detailed/stream` accepts the same prompt or composition-plan body as
282
+ detailed compose, streams `text/event-stream`, and can include word timestamps with
283
+ `with_timestamps`.
284
+
285
+ ```bash
286
+ curl -N -X POST "https://api.elevenlabs.io/v1/music/detailed/stream?output_format=auto" \
287
+ -H "xi-api-key: $ELEVENLABS_API_KEY" \
288
+ -H "Content-Type: application/json" \
289
+ -d '{"prompt": "A bright indie pop hook with warm guitars", "music_length_ms": 30000, "model_id": "music_v2", "with_timestamps": true}'
290
+ ```
291
+
292
+ ## Inpainting
293
+
294
+ Inpainting edits or extends a stored song by mixing **audio reference chunks** (unchanged slices
295
+ of a stored song) with new **generation chunks** in a single composition plan.
296
+
297
+ Step 1 — get a `song_id`, either by storing a fresh generation or uploading existing audio:
298
+
299
+ ```python
300
+ # Option A: keep a generation for later editing
301
+ result = client.music.compose_detailed(
302
+ prompt="An upbeat pop song with verse and chorus",
303
+ music_length_ms=60000,
304
+ model_id="music_v2",
305
+ store_for_inpainting=True,
306
+ )
307
+ song_id = result.song_id
308
+
309
+ # Option B: upload an existing track and extract its plan
310
+ uploaded = client.music.upload(
311
+ file=open("my-song.mp3", "rb"),
312
+ extract_composition_plan="music_v2",
313
+ )
314
+ song_id = uploaded.song_id
315
+ composition_plan = uploaded.composition_plan
316
+ ```
317
+
318
+ ```typescript
319
+ import { createReadStream } from "fs";
320
+
321
+ // Option A: keep a generation for later editing
322
+ const result = await client.music.composeDetailed({
323
+ prompt: "An upbeat pop song with verse and chorus",
324
+ musicLengthMs: 60000,
325
+ modelId: "music_v2",
326
+ storeForInpainting: true,
327
+ });
328
+ let songId = result.songId;
329
+
330
+ // Option B: upload an existing track and extract its plan
331
+ const uploaded = await client.music.upload({
332
+ file: createReadStream("my-song.mp3"),
333
+ extractCompositionPlan: "music_v2",
334
+ });
335
+ songId = uploaded.songId;
336
+ const compositionPlan = uploaded.compositionPlan;
337
+ ```
338
+
339
+ Step 2 — compose a plan that references the stored audio and regenerates the part you want to
340
+ change:
341
+
342
+ ```python
343
+ plan = {
344
+ "chunks": [
345
+ {"song_id": song_id, "range": {"start_ms": 0, "end_ms": 30000}},
346
+ {
347
+ "text": "[Chorus]\nWe're rising up tonight",
348
+ "duration_ms": 30000,
349
+ "positive_styles": ["bigger drums", "layered vocals", "anthemic"],
350
+ "negative_styles": ["sparse"],
351
+ "context_adherence": "high",
352
+ },
353
+ ]
354
+ }
355
+
356
+ audio = client.music.compose(composition_plan=plan, model_id="music_v2")
357
+ ```
358
+
359
+ ```typescript
360
+ const plan = {
361
+ chunks: [
362
+ { songId, range: { startMs: 0, endMs: 30000 } },
363
+ {
364
+ text: "[Chorus]\nWe're rising up tonight",
365
+ durationMs: 30000,
366
+ positiveStyles: ["bigger drums", "layered vocals", "anthemic"],
367
+ negativeStyles: ["sparse"],
368
+ contextAdherence: "high",
369
+ },
370
+ ],
371
+ };
372
+
373
+ const audio = await client.music.compose({
374
+ compositionPlan: plan,
375
+ modelId: "music_v2",
376
+ });
377
+ ```
378
+
379
+ To match the feel of a stored slice without copying it, attach a `conditioning_ref` (up to
380
+ 30,000 ms) plus a `condition_strength` of `low`, `medium`, `high`, or `xhigh` to a generation
381
+ chunk. Conditioning placed on the first chunk influences every later chunk.
382
+
383
+ See [API Reference](references/api_reference.md) for the full inpainting parameter list.
384
+
385
+ ## Content Restrictions
386
+
387
+ - Cannot reference specific artists, bands, or copyrighted lyrics
388
+ - `bad_prompt` errors include a `prompt_suggestion` with alternative phrasing
389
+ - `bad_composition_plan` errors include a `composition_plan_suggestion`
390
+
391
+ ## Error Handling
392
+
393
+ ```python
394
+ try:
395
+ audio = client.music.compose(prompt="...", music_length_ms=30000)
396
+ except Exception as e:
397
+ print(f"API error: {e}")
398
+ ```
399
+
400
+ ```typescript
401
+ try {
402
+ const audio = await client.music.compose({
403
+ prompt: "...",
404
+ musicLengthMs: 30000,
405
+ });
406
+ } catch (err) {
407
+ console.error("API error:", err);
408
+ }
409
+ ```
410
+
411
+ Common errors: 401 (invalid key), 422 (invalid params), 429 (rate limit).
412
+
413
+ ## References
414
+
415
+ - [Installation Guide](references/installation.md)
416
+ - [API Reference](references/api_reference.md)