@j-o-r/hello-dave 0.1.0 → 0.1.4
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/CHANGELOG.md +42 -25
- package/README.md +81 -221
- package/TODO.md +173 -35
- package/agents/agent_creator.js +105 -0
- package/agents/agent_creator.prompt.md +371 -0
- package/agents/ask_agent.js +64 -127
- package/agents/claude_agent.js +68 -0
- package/agents/code_agent.js +55 -135
- package/agents/code_agent.prompt.md +50 -0
- package/agents/echo_agent.js +76 -0
- package/agents/financial_expert.js +75 -0
- package/agents/gpt_agent.js +52 -103
- package/agents/gpt_code.js +81 -0
- package/agents/grok_agent.js +58 -114
- package/agents/minimax_agent.js +92 -0
- package/agents/mureka_agent.js +77 -0
- package/agents/planner_agent.js +172 -0
- package/agents/stability_agent.js +87 -0
- package/agents/test_agent.js +75 -157
- package/agents/weather_agent.js +73 -0
- package/agents/workflow_agent.js +189 -0
- package/bin/dave.js +436 -184
- package/docs/bin-dave.md +85 -35
- package/docs/cdn-ssh.md +100 -0
- package/docs/creating-agents.md +301 -0
- package/docs/creating-toolsets.md +336 -0
- package/docs/docs-organization.md +48 -0
- package/docs/project-overview.md +86 -51
- package/lib/API/elevenlabs.io/music.compose.md +441 -0
- package/lib/API/elevenlabs.io/music.create-composition-plan.md +370 -0
- package/lib/API/elevenlabs.io/music.stream.md +425 -0
- package/lib/API/lalal.ai/lalal.js +445 -0
- package/lib/API/lalal.ai/openapi.json +2614 -0
- package/lib/API/minimax/ImageToolset.js +82 -37
- package/lib/API/minimax/MusicToolset.js +125 -79
- package/lib/API/minimax/VideoToolset.js +170 -167
- package/lib/API/minimax/image.js +5 -1
- package/lib/API/minimax/music.js +210 -23
- package/lib/API/minimax/video.js +242 -53
- package/lib/API/mureka/MusicToolset.js +646 -0
- package/lib/API/mureka/README.md +41 -0
- package/lib/API/mureka/index.js +7 -0
- package/lib/API/mureka/music.js +658 -0
- package/lib/API/openai.com/index.js +7 -0
- package/lib/API/openai.com/{reponses/text.js → responses.js} +64 -18
- package/lib/API/openai.com/video.create.character.md +40 -0
- package/lib/API/openai.com/video.create.md +219 -0
- package/lib/API/openai.com/video.delete.md +44 -0
- package/lib/API/openai.com/video.download.md +31 -0
- package/lib/API/openai.com/video.edit.md +155 -0
- package/lib/API/openai.com/video.extend.md +166 -0
- package/lib/API/openai.com/video.fetch.character.md +43 -0
- package/lib/API/openai.com/video.js +784 -0
- package/lib/API/openai.com/video.list.md +201 -0
- package/lib/API/openai.com/video.remix.md +175 -0
- package/lib/API/openai.com/video.retrieve.md +139 -0
- package/lib/API/openai.com/videoToolset.js +616 -0
- package/lib/API/stability.ai/ImageToolset.js +131 -40
- package/lib/API/stability.ai/MusicToolset.js +79 -47
- package/lib/API/stability.ai/audio.js +63 -131
- package/lib/API/x.ai/chat.responses.md +1040 -0
- package/lib/API/x.ai/image.js +229 -59
- package/lib/API/x.ai/imageToolset.js +376 -0
- package/lib/API/x.ai/index.js +1 -3
- package/lib/API/x.ai/responses.js +9 -18
- package/lib/Agent.js +271 -0
- package/lib/Agent.js.old +284 -0
- package/lib/AgentLauncher.js +562 -0
- package/lib/Cli.js +87 -13
- package/lib/Prompt.js +23 -1
- package/lib/Session.js +5 -4
- package/lib/ToolSet.js +102 -6
- package/lib/agentLoader.js +369 -0
- package/lib/cdn.js +67 -231
- package/lib/{CdnToolset.js → cdnToolset.js} +47 -64
- package/lib/defaultToolsets.js +43 -0
- package/lib/fafs.js +1 -1
- package/lib/genericToolset.js +442 -119
- package/lib/handOffToolset.js +179 -0
- package/lib/index.js +34 -27
- package/lib/toolsetLoader.js +248 -0
- package/package.json +11 -5
- package/types/API/lalal.ai/lalal.d.ts +116 -0
- package/types/API/minimax/image.d.ts +2 -1
- package/types/API/minimax/music.d.ts +189 -26
- package/types/API/minimax/video.d.ts +100 -31
- package/types/API/mureka/index.d.ts +7 -0
- package/types/API/mureka/music.d.ts +472 -0
- package/types/API/openai.com/index.d.ts +7 -0
- package/types/API/openai.com/{reponses/text.d.ts → responses.d.ts} +11 -11
- package/types/API/openai.com/video.d.ts +409 -0
- package/types/API/openai.com/videoToolset.d.ts +24 -0
- package/types/API/stability.ai/audio.d.ts +14 -103
- package/types/API/stability.ai/image.d.ts +2 -2
- package/types/API/x.ai/image.d.ts +138 -26
- package/types/API/x.ai/imageToolset.d.ts +3 -0
- package/types/API/x.ai/index.d.ts +1 -3
- package/types/API/x.ai/responses.d.ts +4 -4
- package/types/Agent.d.ts +123 -0
- package/types/AgentLauncher.d.ts +222 -0
- package/types/Cli.d.ts +28 -8
- package/types/Prompt.d.ts +23 -5
- package/types/Session.d.ts +1 -1
- package/types/ToolSet.d.ts +10 -0
- package/types/agentLoader.d.ts +78 -0
- package/types/cdn.d.ts +15 -90
- package/types/defaultToolsets.d.ts +9 -0
- package/types/fafs.d.ts +1 -1
- package/types/genericToolset.d.ts +1 -1
- package/types/handOffToolset.d.ts +28 -0
- package/types/index.d.ts +19 -16
- package/types/toolsetLoader.d.ts +114 -0
- package/utils/format_log.js +101 -23
- package/utils/launch_agent.js +18 -0
- package/utils/list_sessions.sh +13 -5
- package/utils/search_sessions.sh +65 -29
- package/utils/toolsets.js +33 -0
- package/README.md.bak.1779452127 +0 -240
- package/agents/codeserver.sh +0 -47
- package/agents/daisy_agent.js +0 -173
- package/agents/docs_agent.js +0 -148
- package/agents/memory_agent.js +0 -263
- package/agents/minimax.js +0 -173
- package/agents/npm_agent.js +0 -202
- package/agents/prompt_agent.js +0 -133
- package/agents/readme_agent.js +0 -148
- package/agents/spawn_agent.js +0 -160
- package/agents/stability.js +0 -173
- package/agents/todo_agent.js +0 -175
- package/bin/codeDave +0 -58
- package/docs/agent-dave-websocket-protocol.md +0 -180
- package/docs/agent-manager.md +0 -244
- package/docs/codeserver-pattern.md +0 -191
- package/docs/generic-toolset.md +0 -326
- package/docs/howtos/agent-networking.md +0 -253
- package/docs/howtos/spawn-agents.md.bak +0 -200
- package/docs/howtos/spawn-agents.md.bak_new +0 -200
- package/docs/multi-agent-clusters.md +0 -265
- package/docs/music-toolsets.md +0 -137
- package/docs/path-resolution-best-practices.md +0 -104
- package/docs/plans/minimax-music-generation.md +0 -80
- package/docs/plans/unified-agent-architecture.md +0 -146
- package/docs/plans/websocket-streaming-plan.md.bak +0 -317
- package/docs/prompt/spawn_agent.md +0 -175
- package/docs/prompt/spawn_agent.md.bak +0 -201
- package/docs/prompt/task_clarification_and_documentation.md +0 -35
- package/docs/prompt-class.md +0 -141
- package/docs/todo-archive-infra-2026-04-21.md +0 -15
- package/docs/todo-archive-v0.0.8.md +0 -1
- package/docs/todo-archive-v0.1.0.md +0 -32
- package/docs/todo-archive.md +0 -44
- package/docs/tools-syntax-validation.md +0 -121
- package/docs/toolset.md +0 -164
- package/docs/xai-responses.md +0 -111
- package/docs/xai_collections.md +0 -106
- package/lib/API/x.ai/ImageToolset.js +0 -165
- package/lib/API/x.ai/text.js +0 -415
- package/lib/AgentClient.js +0 -248
- package/lib/AgentManager.js +0 -245
- package/lib/AgentServer.js +0 -404
- package/lib/wsCli.js +0 -287
- package/lib/wsIO.js +0 -90
- package/types/API/x.ai/text.d.ts +0 -286
- package/types/AgentClient.d.ts +0 -109
- package/types/AgentManager.d.ts +0 -100
- package/types/AgentServer.d.ts +0 -89
- package/types/wsCli.d.ts +0 -17
- package/types/wsIO.d.ts +0 -30
- package/utils/test.sh +0 -46
- /package/docs/{suggestions.md → _notes/token-counts.md} +0 -0
- /package/lib/API/openai.com/{reponses/MESSAGES.md → MESSAGES.md} +0 -0
- /package/types/API/{x.ai/ImageToolset.d.ts → mureka/MusicToolset.d.ts} +0 -0
- /package/types/{CdnToolset.d.ts → cdnToolset.d.ts} +0 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.
|
|
2
|
+
|
|
3
|
+
# Compose music
|
|
4
|
+
|
|
5
|
+
POST https://api.elevenlabs.io/v1/music
|
|
6
|
+
Content-Type: application/json
|
|
7
|
+
|
|
8
|
+
Compose a song from a prompt or a composition plan.
|
|
9
|
+
|
|
10
|
+
Reference: https://elevenlabs.io/docs/api-reference/music/compose
|
|
11
|
+
|
|
12
|
+
## OpenAPI Specification
|
|
13
|
+
|
|
14
|
+
```yaml
|
|
15
|
+
openapi: 3.1.0
|
|
16
|
+
info:
|
|
17
|
+
title: api
|
|
18
|
+
version: 1.0.0
|
|
19
|
+
paths:
|
|
20
|
+
/v1/music:
|
|
21
|
+
post:
|
|
22
|
+
operationId: compose
|
|
23
|
+
summary: Compose Music
|
|
24
|
+
description: Compose a song from a prompt or a composition plan.
|
|
25
|
+
tags:
|
|
26
|
+
- subpackage_music
|
|
27
|
+
parameters:
|
|
28
|
+
- name: output_format
|
|
29
|
+
in: query
|
|
30
|
+
description: >-
|
|
31
|
+
Output format of the generated audio. Formatted as
|
|
32
|
+
codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at
|
|
33
|
+
32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate
|
|
34
|
+
requires you to be subscribed to Creator tier or above. PCM with
|
|
35
|
+
44.1kHz sample rate requires you to be subscribed to Pro tier or
|
|
36
|
+
above. Note that the μ-law format (sometimes written mu-law, often
|
|
37
|
+
approximated as u-law) is commonly used for Twilio audio inputs.
|
|
38
|
+
required: false
|
|
39
|
+
schema:
|
|
40
|
+
$ref: '#/components/schemas/AllowedOutputFormats'
|
|
41
|
+
- name: xi-api-key
|
|
42
|
+
in: header
|
|
43
|
+
required: false
|
|
44
|
+
schema:
|
|
45
|
+
type: string
|
|
46
|
+
responses:
|
|
47
|
+
'200':
|
|
48
|
+
description: The generated audio file in the format specified
|
|
49
|
+
content:
|
|
50
|
+
application/octet-stream:
|
|
51
|
+
schema:
|
|
52
|
+
type: string
|
|
53
|
+
format: binary
|
|
54
|
+
'422':
|
|
55
|
+
description: Validation Error
|
|
56
|
+
content:
|
|
57
|
+
application/json:
|
|
58
|
+
schema:
|
|
59
|
+
$ref: '#/components/schemas/HTTPValidationError'
|
|
60
|
+
requestBody:
|
|
61
|
+
content:
|
|
62
|
+
application/json:
|
|
63
|
+
schema:
|
|
64
|
+
$ref: '#/components/schemas/Body_Compose_music_v1_music_post'
|
|
65
|
+
servers:
|
|
66
|
+
- url: https://api.elevenlabs.io
|
|
67
|
+
- url: https://api.us.elevenlabs.io
|
|
68
|
+
- url: https://api.eu.residency.elevenlabs.io
|
|
69
|
+
- url: https://api.in.residency.elevenlabs.io
|
|
70
|
+
components:
|
|
71
|
+
schemas:
|
|
72
|
+
AllowedOutputFormats:
|
|
73
|
+
type: string
|
|
74
|
+
enum:
|
|
75
|
+
- mp3_22050_32
|
|
76
|
+
- mp3_24000_48
|
|
77
|
+
- mp3_44100_32
|
|
78
|
+
- mp3_44100_64
|
|
79
|
+
- mp3_44100_96
|
|
80
|
+
- mp3_44100_128
|
|
81
|
+
- mp3_44100_192
|
|
82
|
+
- pcm_8000
|
|
83
|
+
- pcm_16000
|
|
84
|
+
- pcm_22050
|
|
85
|
+
- pcm_24000
|
|
86
|
+
- pcm_32000
|
|
87
|
+
- pcm_44100
|
|
88
|
+
- pcm_48000
|
|
89
|
+
- ulaw_8000
|
|
90
|
+
- alaw_8000
|
|
91
|
+
- opus_48000_32
|
|
92
|
+
- opus_48000_64
|
|
93
|
+
- opus_48000_96
|
|
94
|
+
- opus_48000_128
|
|
95
|
+
- opus_48000_192
|
|
96
|
+
title: AllowedOutputFormats
|
|
97
|
+
TimeRange:
|
|
98
|
+
type: object
|
|
99
|
+
properties:
|
|
100
|
+
start_ms:
|
|
101
|
+
type: integer
|
|
102
|
+
end_ms:
|
|
103
|
+
type: integer
|
|
104
|
+
required:
|
|
105
|
+
- start_ms
|
|
106
|
+
- end_ms
|
|
107
|
+
title: TimeRange
|
|
108
|
+
SectionSource:
|
|
109
|
+
type: object
|
|
110
|
+
properties:
|
|
111
|
+
song_id:
|
|
112
|
+
type: string
|
|
113
|
+
description: >-
|
|
114
|
+
The ID of the song to source the section from. You can find the song
|
|
115
|
+
ID in the response headers when you generate a song.
|
|
116
|
+
range:
|
|
117
|
+
$ref: '#/components/schemas/TimeRange'
|
|
118
|
+
description: The range to extract from the source song.
|
|
119
|
+
negative_ranges:
|
|
120
|
+
type: array
|
|
121
|
+
items:
|
|
122
|
+
$ref: '#/components/schemas/TimeRange'
|
|
123
|
+
description: The ranges to exclude from the 'range'.
|
|
124
|
+
required:
|
|
125
|
+
- song_id
|
|
126
|
+
- range
|
|
127
|
+
title: SectionSource
|
|
128
|
+
SongSection:
|
|
129
|
+
type: object
|
|
130
|
+
properties:
|
|
131
|
+
section_name:
|
|
132
|
+
type: string
|
|
133
|
+
description: The name of the section. Must be between 1 and 100 characters.
|
|
134
|
+
positive_local_styles:
|
|
135
|
+
type: array
|
|
136
|
+
items:
|
|
137
|
+
type: string
|
|
138
|
+
description: >-
|
|
139
|
+
The styles and musical directions that should be present in this
|
|
140
|
+
section. Use English language for best result.
|
|
141
|
+
negative_local_styles:
|
|
142
|
+
type: array
|
|
143
|
+
items:
|
|
144
|
+
type: string
|
|
145
|
+
description: >-
|
|
146
|
+
The styles and musical directions that should not be present in this
|
|
147
|
+
section. Use English language for best result.
|
|
148
|
+
duration_ms:
|
|
149
|
+
type: integer
|
|
150
|
+
description: >-
|
|
151
|
+
The duration of the section in milliseconds. Must be between 3000ms
|
|
152
|
+
and 120000ms.
|
|
153
|
+
lines:
|
|
154
|
+
type: array
|
|
155
|
+
items:
|
|
156
|
+
type: string
|
|
157
|
+
description: The lyrics of the section. Max 200 characters per line.
|
|
158
|
+
source_from:
|
|
159
|
+
oneOf:
|
|
160
|
+
- $ref: '#/components/schemas/SectionSource'
|
|
161
|
+
- type: 'null'
|
|
162
|
+
description: >-
|
|
163
|
+
Optional source to extract the section from. Used for inpainting.
|
|
164
|
+
Only available to enterprise clients with access to the inpainting
|
|
165
|
+
feature.
|
|
166
|
+
required:
|
|
167
|
+
- section_name
|
|
168
|
+
- positive_local_styles
|
|
169
|
+
- negative_local_styles
|
|
170
|
+
- duration_ms
|
|
171
|
+
- lines
|
|
172
|
+
title: SongSection
|
|
173
|
+
MusicPrompt:
|
|
174
|
+
type: object
|
|
175
|
+
properties:
|
|
176
|
+
positive_global_styles:
|
|
177
|
+
type: array
|
|
178
|
+
items:
|
|
179
|
+
type: string
|
|
180
|
+
description: >-
|
|
181
|
+
The styles and musical directions that should be present in the
|
|
182
|
+
entire song. Use English language for best result.
|
|
183
|
+
negative_global_styles:
|
|
184
|
+
type: array
|
|
185
|
+
items:
|
|
186
|
+
type: string
|
|
187
|
+
description: >-
|
|
188
|
+
The styles and musical directions that should not be present in the
|
|
189
|
+
entire song. Use English language for best result.
|
|
190
|
+
sections:
|
|
191
|
+
type: array
|
|
192
|
+
items:
|
|
193
|
+
$ref: '#/components/schemas/SongSection'
|
|
194
|
+
description: The sections of the song.
|
|
195
|
+
required:
|
|
196
|
+
- positive_global_styles
|
|
197
|
+
- negative_global_styles
|
|
198
|
+
- sections
|
|
199
|
+
title: MusicPrompt
|
|
200
|
+
BodyComposeMusicV1MusicPostModelId:
|
|
201
|
+
type: string
|
|
202
|
+
enum:
|
|
203
|
+
- music_v1
|
|
204
|
+
default: music_v1
|
|
205
|
+
description: The model to use for the generation.
|
|
206
|
+
title: BodyComposeMusicV1MusicPostModelId
|
|
207
|
+
Body_Compose_music_v1_music_post:
|
|
208
|
+
type: object
|
|
209
|
+
properties:
|
|
210
|
+
prompt:
|
|
211
|
+
type:
|
|
212
|
+
- string
|
|
213
|
+
- 'null'
|
|
214
|
+
description: >-
|
|
215
|
+
A simple text prompt to generate a song from. Cannot be used in
|
|
216
|
+
conjunction with `composition_plan`.
|
|
217
|
+
composition_plan:
|
|
218
|
+
oneOf:
|
|
219
|
+
- $ref: '#/components/schemas/MusicPrompt'
|
|
220
|
+
- type: 'null'
|
|
221
|
+
description: >-
|
|
222
|
+
A detailed composition plan to guide music generation. Cannot be
|
|
223
|
+
used in conjunction with `prompt`.
|
|
224
|
+
music_length_ms:
|
|
225
|
+
type:
|
|
226
|
+
- integer
|
|
227
|
+
- 'null'
|
|
228
|
+
description: >-
|
|
229
|
+
The length of the song to generate in milliseconds. Used only in
|
|
230
|
+
conjunction with `prompt`. Must be between 3000ms and 600000ms.
|
|
231
|
+
Optional - if not provided, the model will choose a length based on
|
|
232
|
+
the prompt.
|
|
233
|
+
model_id:
|
|
234
|
+
$ref: '#/components/schemas/BodyComposeMusicV1MusicPostModelId'
|
|
235
|
+
description: The model to use for the generation.
|
|
236
|
+
seed:
|
|
237
|
+
type:
|
|
238
|
+
- integer
|
|
239
|
+
- 'null'
|
|
240
|
+
description: >-
|
|
241
|
+
Random seed to initialize the music generation process. Providing
|
|
242
|
+
the same seed with the same parameters can help achieve more
|
|
243
|
+
consistent results, but exact reproducibility is not guaranteed and
|
|
244
|
+
outputs may change across system updates. Cannot be used in
|
|
245
|
+
conjunction with prompt.
|
|
246
|
+
force_instrumental:
|
|
247
|
+
type: boolean
|
|
248
|
+
default: false
|
|
249
|
+
description: >-
|
|
250
|
+
If true, guarantees that the generated song will be instrumental. If
|
|
251
|
+
false, the song may or may not be instrumental depending on the
|
|
252
|
+
`prompt`. Can only be used with `prompt`.
|
|
253
|
+
respect_sections_durations:
|
|
254
|
+
type: boolean
|
|
255
|
+
default: true
|
|
256
|
+
description: >-
|
|
257
|
+
Controls how strictly section durations in the `composition_plan`
|
|
258
|
+
are enforced. Only used with `composition_plan`. When set to true,
|
|
259
|
+
the model will precisely respect each section's `duration_ms` from
|
|
260
|
+
the plan. When set to false, the model may adjust individual section
|
|
261
|
+
durations which will generally lead to better generation quality and
|
|
262
|
+
improved latency, while always preserving the total song duration
|
|
263
|
+
from the plan.
|
|
264
|
+
store_for_inpainting:
|
|
265
|
+
type: boolean
|
|
266
|
+
default: false
|
|
267
|
+
description: >-
|
|
268
|
+
Whether to store the generated song for inpainting. Only available
|
|
269
|
+
to enterprise clients with access to the inpainting feature.
|
|
270
|
+
sign_with_c2pa:
|
|
271
|
+
type: boolean
|
|
272
|
+
default: false
|
|
273
|
+
description: >-
|
|
274
|
+
Whether to sign the generated song with C2PA. Applicable only for
|
|
275
|
+
mp3 files.
|
|
276
|
+
title: Body_Compose_music_v1_music_post
|
|
277
|
+
ValidationErrorLocItems:
|
|
278
|
+
oneOf:
|
|
279
|
+
- type: string
|
|
280
|
+
- type: integer
|
|
281
|
+
title: ValidationErrorLocItems
|
|
282
|
+
ValidationError:
|
|
283
|
+
type: object
|
|
284
|
+
properties:
|
|
285
|
+
loc:
|
|
286
|
+
type: array
|
|
287
|
+
items:
|
|
288
|
+
$ref: '#/components/schemas/ValidationErrorLocItems'
|
|
289
|
+
msg:
|
|
290
|
+
type: string
|
|
291
|
+
type:
|
|
292
|
+
type: string
|
|
293
|
+
required:
|
|
294
|
+
- loc
|
|
295
|
+
- msg
|
|
296
|
+
- type
|
|
297
|
+
title: ValidationError
|
|
298
|
+
HTTPValidationError:
|
|
299
|
+
type: object
|
|
300
|
+
properties:
|
|
301
|
+
detail:
|
|
302
|
+
type: array
|
|
303
|
+
items:
|
|
304
|
+
$ref: '#/components/schemas/ValidationError'
|
|
305
|
+
title: HTTPValidationError
|
|
306
|
+
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## SDK Code Examples
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
|
|
313
|
+
|
|
314
|
+
async function main() {
|
|
315
|
+
const client = new ElevenLabsClient();
|
|
316
|
+
await client.music.compose({});
|
|
317
|
+
}
|
|
318
|
+
main();
|
|
319
|
+
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
```python
|
|
323
|
+
from elevenlabs import ElevenLabs
|
|
324
|
+
|
|
325
|
+
client = ElevenLabs()
|
|
326
|
+
|
|
327
|
+
client.music.compose()
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
```go
|
|
332
|
+
package main
|
|
333
|
+
|
|
334
|
+
import (
|
|
335
|
+
"fmt"
|
|
336
|
+
"strings"
|
|
337
|
+
"net/http"
|
|
338
|
+
"io"
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
func main() {
|
|
342
|
+
|
|
343
|
+
url := "https://api.elevenlabs.io/v1/music"
|
|
344
|
+
|
|
345
|
+
payload := strings.NewReader("{}")
|
|
346
|
+
|
|
347
|
+
req, _ := http.NewRequest("POST", url, payload)
|
|
348
|
+
|
|
349
|
+
req.Header.Add("Content-Type", "application/json")
|
|
350
|
+
|
|
351
|
+
res, _ := http.DefaultClient.Do(req)
|
|
352
|
+
|
|
353
|
+
defer res.Body.Close()
|
|
354
|
+
body, _ := io.ReadAll(res.Body)
|
|
355
|
+
|
|
356
|
+
fmt.Println(res)
|
|
357
|
+
fmt.Println(string(body))
|
|
358
|
+
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
```ruby
|
|
363
|
+
require 'uri'
|
|
364
|
+
require 'net/http'
|
|
365
|
+
|
|
366
|
+
url = URI("https://api.elevenlabs.io/v1/music")
|
|
367
|
+
|
|
368
|
+
http = Net::HTTP.new(url.host, url.port)
|
|
369
|
+
http.use_ssl = true
|
|
370
|
+
|
|
371
|
+
request = Net::HTTP::Post.new(url)
|
|
372
|
+
request["Content-Type"] = 'application/json'
|
|
373
|
+
request.body = "{}"
|
|
374
|
+
|
|
375
|
+
response = http.request(request)
|
|
376
|
+
puts response.read_body
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
```java
|
|
380
|
+
import com.mashape.unirest.http.HttpResponse;
|
|
381
|
+
import com.mashape.unirest.http.Unirest;
|
|
382
|
+
|
|
383
|
+
HttpResponse<String> response = Unirest.post("https://api.elevenlabs.io/v1/music")
|
|
384
|
+
.header("Content-Type", "application/json")
|
|
385
|
+
.body("{}")
|
|
386
|
+
.asString();
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
```php
|
|
390
|
+
<?php
|
|
391
|
+
require_once('vendor/autoload.php');
|
|
392
|
+
|
|
393
|
+
$client = new \GuzzleHttp\Client();
|
|
394
|
+
|
|
395
|
+
$response = $client->request('POST', 'https://api.elevenlabs.io/v1/music', [
|
|
396
|
+
'body' => '{}',
|
|
397
|
+
'headers' => [
|
|
398
|
+
'Content-Type' => 'application/json',
|
|
399
|
+
],
|
|
400
|
+
]);
|
|
401
|
+
|
|
402
|
+
echo $response->getBody();
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
```csharp
|
|
406
|
+
using RestSharp;
|
|
407
|
+
|
|
408
|
+
var client = new RestClient("https://api.elevenlabs.io/v1/music");
|
|
409
|
+
var request = new RestRequest(Method.POST);
|
|
410
|
+
request.AddHeader("Content-Type", "application/json");
|
|
411
|
+
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
|
|
412
|
+
IRestResponse response = client.Execute(request);
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
```swift
|
|
416
|
+
import Foundation
|
|
417
|
+
|
|
418
|
+
let headers = ["Content-Type": "application/json"]
|
|
419
|
+
let parameters = [] as [String : Any]
|
|
420
|
+
|
|
421
|
+
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
|
|
422
|
+
|
|
423
|
+
let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/music")! as URL,
|
|
424
|
+
cachePolicy: .useProtocolCachePolicy,
|
|
425
|
+
timeoutInterval: 10.0)
|
|
426
|
+
request.httpMethod = "POST"
|
|
427
|
+
request.allHTTPHeaderFields = headers
|
|
428
|
+
request.httpBody = postData as Data
|
|
429
|
+
|
|
430
|
+
let session = URLSession.shared
|
|
431
|
+
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
|
|
432
|
+
if (error != nil) {
|
|
433
|
+
print(error as Any)
|
|
434
|
+
} else {
|
|
435
|
+
let httpResponse = response as? HTTPURLResponse
|
|
436
|
+
print(httpResponse)
|
|
437
|
+
}
|
|
438
|
+
})
|
|
439
|
+
|
|
440
|
+
dataTask.resume()
|
|
441
|
+
```
|