@j-o-r/hello-dave 0.1.1 → 0.1.5
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 -1
- 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 +593 -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 +10 -4
- 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 -1
- package/types/API/x.ai/responses.d.ts +4 -4
- package/types/Agent.d.ts +123 -0
- package/types/AgentLauncher.d.ts +250 -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 -17
- 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,370 @@
|
|
|
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
|
+
# Create composition plan
|
|
4
|
+
|
|
5
|
+
POST https://api.elevenlabs.io/v1/music/plan
|
|
6
|
+
Content-Type: application/json
|
|
7
|
+
|
|
8
|
+
Create a composition plan for music generation. Usage of this endpoint does not cost any credits but is subject to rate limiting depending on your tier.
|
|
9
|
+
|
|
10
|
+
Reference: https://elevenlabs.io/docs/api-reference/music/create-composition-plan
|
|
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/plan:
|
|
21
|
+
post:
|
|
22
|
+
operationId: create
|
|
23
|
+
summary: Generate Composition Plan
|
|
24
|
+
description: >-
|
|
25
|
+
Create a composition plan for music generation. Usage of this endpoint
|
|
26
|
+
does not cost any credits but is subject to rate limiting depending on
|
|
27
|
+
your tier.
|
|
28
|
+
tags:
|
|
29
|
+
- subpackage_music.subpackage_music/compositionPlan
|
|
30
|
+
parameters:
|
|
31
|
+
- name: xi-api-key
|
|
32
|
+
in: header
|
|
33
|
+
required: false
|
|
34
|
+
schema:
|
|
35
|
+
type: string
|
|
36
|
+
responses:
|
|
37
|
+
'200':
|
|
38
|
+
description: Successful Response
|
|
39
|
+
content:
|
|
40
|
+
application/json:
|
|
41
|
+
schema:
|
|
42
|
+
$ref: '#/components/schemas/MusicPrompt'
|
|
43
|
+
'422':
|
|
44
|
+
description: Validation Error
|
|
45
|
+
content:
|
|
46
|
+
application/json:
|
|
47
|
+
schema:
|
|
48
|
+
$ref: '#/components/schemas/HTTPValidationError'
|
|
49
|
+
requestBody:
|
|
50
|
+
content:
|
|
51
|
+
application/json:
|
|
52
|
+
schema:
|
|
53
|
+
$ref: >-
|
|
54
|
+
#/components/schemas/Body_Generate_composition_plan_v1_music_plan_post
|
|
55
|
+
servers:
|
|
56
|
+
- url: https://api.elevenlabs.io
|
|
57
|
+
- url: https://api.us.elevenlabs.io
|
|
58
|
+
- url: https://api.eu.residency.elevenlabs.io
|
|
59
|
+
- url: https://api.in.residency.elevenlabs.io
|
|
60
|
+
components:
|
|
61
|
+
schemas:
|
|
62
|
+
TimeRange:
|
|
63
|
+
type: object
|
|
64
|
+
properties:
|
|
65
|
+
start_ms:
|
|
66
|
+
type: integer
|
|
67
|
+
end_ms:
|
|
68
|
+
type: integer
|
|
69
|
+
required:
|
|
70
|
+
- start_ms
|
|
71
|
+
- end_ms
|
|
72
|
+
title: TimeRange
|
|
73
|
+
SectionSource:
|
|
74
|
+
type: object
|
|
75
|
+
properties:
|
|
76
|
+
song_id:
|
|
77
|
+
type: string
|
|
78
|
+
description: >-
|
|
79
|
+
The ID of the song to source the section from. You can find the song
|
|
80
|
+
ID in the response headers when you generate a song.
|
|
81
|
+
range:
|
|
82
|
+
$ref: '#/components/schemas/TimeRange'
|
|
83
|
+
description: The range to extract from the source song.
|
|
84
|
+
negative_ranges:
|
|
85
|
+
type: array
|
|
86
|
+
items:
|
|
87
|
+
$ref: '#/components/schemas/TimeRange'
|
|
88
|
+
description: The ranges to exclude from the 'range'.
|
|
89
|
+
required:
|
|
90
|
+
- song_id
|
|
91
|
+
- range
|
|
92
|
+
title: SectionSource
|
|
93
|
+
SongSection:
|
|
94
|
+
type: object
|
|
95
|
+
properties:
|
|
96
|
+
section_name:
|
|
97
|
+
type: string
|
|
98
|
+
description: The name of the section. Must be between 1 and 100 characters.
|
|
99
|
+
positive_local_styles:
|
|
100
|
+
type: array
|
|
101
|
+
items:
|
|
102
|
+
type: string
|
|
103
|
+
description: >-
|
|
104
|
+
The styles and musical directions that should be present in this
|
|
105
|
+
section. Use English language for best result.
|
|
106
|
+
negative_local_styles:
|
|
107
|
+
type: array
|
|
108
|
+
items:
|
|
109
|
+
type: string
|
|
110
|
+
description: >-
|
|
111
|
+
The styles and musical directions that should not be present in this
|
|
112
|
+
section. Use English language for best result.
|
|
113
|
+
duration_ms:
|
|
114
|
+
type: integer
|
|
115
|
+
description: >-
|
|
116
|
+
The duration of the section in milliseconds. Must be between 3000ms
|
|
117
|
+
and 120000ms.
|
|
118
|
+
lines:
|
|
119
|
+
type: array
|
|
120
|
+
items:
|
|
121
|
+
type: string
|
|
122
|
+
description: The lyrics of the section. Max 200 characters per line.
|
|
123
|
+
source_from:
|
|
124
|
+
oneOf:
|
|
125
|
+
- $ref: '#/components/schemas/SectionSource'
|
|
126
|
+
- type: 'null'
|
|
127
|
+
description: >-
|
|
128
|
+
Optional source to extract the section from. Used for inpainting.
|
|
129
|
+
Only available to enterprise clients with access to the inpainting
|
|
130
|
+
feature.
|
|
131
|
+
required:
|
|
132
|
+
- section_name
|
|
133
|
+
- positive_local_styles
|
|
134
|
+
- negative_local_styles
|
|
135
|
+
- duration_ms
|
|
136
|
+
- lines
|
|
137
|
+
title: SongSection
|
|
138
|
+
MusicPrompt:
|
|
139
|
+
type: object
|
|
140
|
+
properties:
|
|
141
|
+
positive_global_styles:
|
|
142
|
+
type: array
|
|
143
|
+
items:
|
|
144
|
+
type: string
|
|
145
|
+
description: >-
|
|
146
|
+
The styles and musical directions that should be present in the
|
|
147
|
+
entire song. Use English language for best result.
|
|
148
|
+
negative_global_styles:
|
|
149
|
+
type: array
|
|
150
|
+
items:
|
|
151
|
+
type: string
|
|
152
|
+
description: >-
|
|
153
|
+
The styles and musical directions that should not be present in the
|
|
154
|
+
entire song. Use English language for best result.
|
|
155
|
+
sections:
|
|
156
|
+
type: array
|
|
157
|
+
items:
|
|
158
|
+
$ref: '#/components/schemas/SongSection'
|
|
159
|
+
description: The sections of the song.
|
|
160
|
+
required:
|
|
161
|
+
- positive_global_styles
|
|
162
|
+
- negative_global_styles
|
|
163
|
+
- sections
|
|
164
|
+
title: MusicPrompt
|
|
165
|
+
BodyGenerateCompositionPlanV1MusicPlanPostModelId:
|
|
166
|
+
type: string
|
|
167
|
+
enum:
|
|
168
|
+
- music_v1
|
|
169
|
+
default: music_v1
|
|
170
|
+
description: The model to use for the generation.
|
|
171
|
+
title: BodyGenerateCompositionPlanV1MusicPlanPostModelId
|
|
172
|
+
Body_Generate_composition_plan_v1_music_plan_post:
|
|
173
|
+
type: object
|
|
174
|
+
properties:
|
|
175
|
+
prompt:
|
|
176
|
+
type: string
|
|
177
|
+
description: A simple text prompt to compose a plan from.
|
|
178
|
+
music_length_ms:
|
|
179
|
+
type:
|
|
180
|
+
- integer
|
|
181
|
+
- 'null'
|
|
182
|
+
description: >-
|
|
183
|
+
The length of the composition plan to generate in milliseconds. Must
|
|
184
|
+
be between 3000ms and 600000ms. Optional - if not provided, the
|
|
185
|
+
model will choose a length based on the prompt.
|
|
186
|
+
source_composition_plan:
|
|
187
|
+
oneOf:
|
|
188
|
+
- $ref: '#/components/schemas/MusicPrompt'
|
|
189
|
+
- type: 'null'
|
|
190
|
+
description: >-
|
|
191
|
+
An optional composition plan to use as a source for the new
|
|
192
|
+
composition plan.
|
|
193
|
+
model_id:
|
|
194
|
+
$ref: >-
|
|
195
|
+
#/components/schemas/BodyGenerateCompositionPlanV1MusicPlanPostModelId
|
|
196
|
+
description: The model to use for the generation.
|
|
197
|
+
required:
|
|
198
|
+
- prompt
|
|
199
|
+
title: Body_Generate_composition_plan_v1_music_plan_post
|
|
200
|
+
ValidationErrorLocItems:
|
|
201
|
+
oneOf:
|
|
202
|
+
- type: string
|
|
203
|
+
- type: integer
|
|
204
|
+
title: ValidationErrorLocItems
|
|
205
|
+
ValidationError:
|
|
206
|
+
type: object
|
|
207
|
+
properties:
|
|
208
|
+
loc:
|
|
209
|
+
type: array
|
|
210
|
+
items:
|
|
211
|
+
$ref: '#/components/schemas/ValidationErrorLocItems'
|
|
212
|
+
msg:
|
|
213
|
+
type: string
|
|
214
|
+
type:
|
|
215
|
+
type: string
|
|
216
|
+
required:
|
|
217
|
+
- loc
|
|
218
|
+
- msg
|
|
219
|
+
- type
|
|
220
|
+
title: ValidationError
|
|
221
|
+
HTTPValidationError:
|
|
222
|
+
type: object
|
|
223
|
+
properties:
|
|
224
|
+
detail:
|
|
225
|
+
type: array
|
|
226
|
+
items:
|
|
227
|
+
$ref: '#/components/schemas/ValidationError'
|
|
228
|
+
title: HTTPValidationError
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## SDK Code Examples
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
|
|
236
|
+
|
|
237
|
+
async function main() {
|
|
238
|
+
const client = new ElevenLabsClient();
|
|
239
|
+
await client.music.compositionPlan.create({
|
|
240
|
+
prompt: "string",
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
main();
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
```python
|
|
248
|
+
from elevenlabs import ElevenLabs
|
|
249
|
+
|
|
250
|
+
client = ElevenLabs()
|
|
251
|
+
|
|
252
|
+
client.music.composition_plan.create(
|
|
253
|
+
prompt="string",
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
```go
|
|
259
|
+
package main
|
|
260
|
+
|
|
261
|
+
import (
|
|
262
|
+
"fmt"
|
|
263
|
+
"strings"
|
|
264
|
+
"net/http"
|
|
265
|
+
"io"
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
func main() {
|
|
269
|
+
|
|
270
|
+
url := "https://api.elevenlabs.io/v1/music/plan"
|
|
271
|
+
|
|
272
|
+
payload := strings.NewReader("{\n \"prompt\": \"string\"\n}")
|
|
273
|
+
|
|
274
|
+
req, _ := http.NewRequest("POST", url, payload)
|
|
275
|
+
|
|
276
|
+
req.Header.Add("Content-Type", "application/json")
|
|
277
|
+
|
|
278
|
+
res, _ := http.DefaultClient.Do(req)
|
|
279
|
+
|
|
280
|
+
defer res.Body.Close()
|
|
281
|
+
body, _ := io.ReadAll(res.Body)
|
|
282
|
+
|
|
283
|
+
fmt.Println(res)
|
|
284
|
+
fmt.Println(string(body))
|
|
285
|
+
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
```ruby
|
|
290
|
+
require 'uri'
|
|
291
|
+
require 'net/http'
|
|
292
|
+
|
|
293
|
+
url = URI("https://api.elevenlabs.io/v1/music/plan")
|
|
294
|
+
|
|
295
|
+
http = Net::HTTP.new(url.host, url.port)
|
|
296
|
+
http.use_ssl = true
|
|
297
|
+
|
|
298
|
+
request = Net::HTTP::Post.new(url)
|
|
299
|
+
request["Content-Type"] = 'application/json'
|
|
300
|
+
request.body = "{\n \"prompt\": \"string\"\n}"
|
|
301
|
+
|
|
302
|
+
response = http.request(request)
|
|
303
|
+
puts response.read_body
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
```java
|
|
307
|
+
import com.mashape.unirest.http.HttpResponse;
|
|
308
|
+
import com.mashape.unirest.http.Unirest;
|
|
309
|
+
|
|
310
|
+
HttpResponse<String> response = Unirest.post("https://api.elevenlabs.io/v1/music/plan")
|
|
311
|
+
.header("Content-Type", "application/json")
|
|
312
|
+
.body("{\n \"prompt\": \"string\"\n}")
|
|
313
|
+
.asString();
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
```php
|
|
317
|
+
<?php
|
|
318
|
+
require_once('vendor/autoload.php');
|
|
319
|
+
|
|
320
|
+
$client = new \GuzzleHttp\Client();
|
|
321
|
+
|
|
322
|
+
$response = $client->request('POST', 'https://api.elevenlabs.io/v1/music/plan', [
|
|
323
|
+
'body' => '{
|
|
324
|
+
"prompt": "string"
|
|
325
|
+
}',
|
|
326
|
+
'headers' => [
|
|
327
|
+
'Content-Type' => 'application/json',
|
|
328
|
+
],
|
|
329
|
+
]);
|
|
330
|
+
|
|
331
|
+
echo $response->getBody();
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
```csharp
|
|
335
|
+
using RestSharp;
|
|
336
|
+
|
|
337
|
+
var client = new RestClient("https://api.elevenlabs.io/v1/music/plan");
|
|
338
|
+
var request = new RestRequest(Method.POST);
|
|
339
|
+
request.AddHeader("Content-Type", "application/json");
|
|
340
|
+
request.AddParameter("application/json", "{\n \"prompt\": \"string\"\n}", ParameterType.RequestBody);
|
|
341
|
+
IRestResponse response = client.Execute(request);
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
```swift
|
|
345
|
+
import Foundation
|
|
346
|
+
|
|
347
|
+
let headers = ["Content-Type": "application/json"]
|
|
348
|
+
let parameters = ["prompt": "string"] as [String : Any]
|
|
349
|
+
|
|
350
|
+
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
|
|
351
|
+
|
|
352
|
+
let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/music/plan")! as URL,
|
|
353
|
+
cachePolicy: .useProtocolCachePolicy,
|
|
354
|
+
timeoutInterval: 10.0)
|
|
355
|
+
request.httpMethod = "POST"
|
|
356
|
+
request.allHTTPHeaderFields = headers
|
|
357
|
+
request.httpBody = postData as Data
|
|
358
|
+
|
|
359
|
+
let session = URLSession.shared
|
|
360
|
+
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
|
|
361
|
+
if (error != nil) {
|
|
362
|
+
print(error as Any)
|
|
363
|
+
} else {
|
|
364
|
+
let httpResponse = response as? HTTPURLResponse
|
|
365
|
+
print(httpResponse)
|
|
366
|
+
}
|
|
367
|
+
})
|
|
368
|
+
|
|
369
|
+
dataTask.resume()
|
|
370
|
+
```
|