@elizaos/plugin-suno 1.0.6-alpha.4 → 2.0.11-beta.7
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/LICENSE +21 -0
- package/README.md +81 -207
- package/auto-enable.ts +18 -0
- package/package.json +76 -34
- package/biome.json +0 -41
- package/dist/index.js +0 -506
- package/dist/index.js.map +0 -1
- package/src/actions/customGenerate.ts +0 -186
- package/src/actions/extend.ts +0 -164
- package/src/actions/generate.ts +0 -175
- package/src/index.ts +0 -22
- package/src/providers/suno.ts +0 -78
- package/src/types/index.ts +0 -34
- package/tsconfig.json +0 -24
- package/tsup.config.ts +0 -11
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shaw Walters and elizaOS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,207 +1,81 @@
|
|
|
1
|
-
@elizaos/plugin-suno
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- Lengthening existing music pieces
|
|
83
|
-
- Creating seamless loops
|
|
84
|
-
- Generating variations of existing tracks
|
|
85
|
-
|
|
86
|
-
await eliza.execute('suno.extend-audio', {
|
|
87
|
-
audio_id: "your-audio-id",
|
|
88
|
-
duration: 60
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
Generation Parameters Explained:
|
|
92
|
-
|
|
93
|
-
- temperature: Controls randomness in generation (0.0-1.0+)
|
|
94
|
-
* Lower values (0.1-0.5): More conservative, consistent output
|
|
95
|
-
* Higher values (1.0+): More creative, varied output
|
|
96
|
-
|
|
97
|
-
- classifier_free_guidance: Controls how closely the output follows the prompt (1.0-20.0)
|
|
98
|
-
* Lower values: More creative interpretation
|
|
99
|
-
* Higher values: Stricter adherence to prompt
|
|
100
|
-
|
|
101
|
-
- topK/topP: Control the diversity of the generation
|
|
102
|
-
* topK: Limits the number of tokens considered
|
|
103
|
-
* topP: Controls the cumulative probability threshold
|
|
104
|
-
|
|
105
|
-
API REFERENCE
|
|
106
|
-
|
|
107
|
-
SunoProvider Configuration
|
|
108
|
-
The Suno provider accepts the following configuration options:
|
|
109
|
-
|
|
110
|
-
interface SunoConfig {
|
|
111
|
-
apiKey: string;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
Action Parameters:
|
|
115
|
-
|
|
116
|
-
1. Generate Music (suno.generate-music)
|
|
117
|
-
interface GenerateParams {
|
|
118
|
-
prompt: string;
|
|
119
|
-
duration?: number; // Duration in seconds
|
|
120
|
-
temperature?: number; // Controls randomness
|
|
121
|
-
topK?: number; // Top K sampling
|
|
122
|
-
topP?: number; // Top P sampling
|
|
123
|
-
classifier_free_guidance?: number; // Guidance scale
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
2. Custom Generate Music (suno.custom-generate-music)
|
|
127
|
-
interface CustomGenerateParams {
|
|
128
|
-
prompt: string;
|
|
129
|
-
duration?: number;
|
|
130
|
-
temperature?: number;
|
|
131
|
-
topK?: number;
|
|
132
|
-
topP?: number;
|
|
133
|
-
classifier_free_guidance?: number;
|
|
134
|
-
reference_audio?: string; // Path to reference audio file
|
|
135
|
-
style?: string; // Musical style
|
|
136
|
-
bpm?: number; // Beats per minute
|
|
137
|
-
key?: string; // Musical key
|
|
138
|
-
mode?: string; // Musical mode (e.g., "major", "minor")
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
3. Extend Audio (suno.extend-audio)
|
|
142
|
-
interface ExtendParams {
|
|
143
|
-
audio_id: string; // ID of the audio to extend
|
|
144
|
-
duration: number; // Additional duration in seconds
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
Response Type:
|
|
148
|
-
interface GenerationResponse {
|
|
149
|
-
id: string; // Generated audio ID
|
|
150
|
-
status: string; // Status of the generation
|
|
151
|
-
url?: string; // URL to download the generated audio
|
|
152
|
-
error?: string; // Error message if generation failed
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
ERROR HANDLING
|
|
156
|
-
|
|
157
|
-
The plugin includes built-in error handling for common scenarios:
|
|
158
|
-
|
|
159
|
-
try {
|
|
160
|
-
await eliza.execute('suno.generate', params);
|
|
161
|
-
} catch (error) {
|
|
162
|
-
if (error.code === 'SUNO_API_ERROR') {
|
|
163
|
-
// Handle API-specific errors
|
|
164
|
-
}
|
|
165
|
-
// Handle other errors
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
EXAMPLES
|
|
169
|
-
|
|
170
|
-
Creating a Pop Song:
|
|
171
|
-
|
|
172
|
-
const result = await eliza.execute('suno.generate-music', {
|
|
173
|
-
prompt: "Create a pop song with vocals, drums, and guitar",
|
|
174
|
-
duration: 180,
|
|
175
|
-
temperature: 1.0,
|
|
176
|
-
classifier_free_guidance: 3.5
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
Creating a Custom Classical Piece:
|
|
180
|
-
|
|
181
|
-
const result = await eliza.execute('suno.custom-generate-music', {
|
|
182
|
-
prompt: "A classical piano sonata in the style of Mozart",
|
|
183
|
-
duration: 120,
|
|
184
|
-
temperature: 0.8,
|
|
185
|
-
style: "classical",
|
|
186
|
-
bpm: 120,
|
|
187
|
-
key: "C",
|
|
188
|
-
mode: "major"
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
Extending an Existing Track:
|
|
192
|
-
|
|
193
|
-
const extended = await eliza.execute('suno.extend-audio', {
|
|
194
|
-
audio_id: "existing-track-id",
|
|
195
|
-
duration: 60
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
LICENSE
|
|
199
|
-
|
|
200
|
-
MIT
|
|
201
|
-
|
|
202
|
-
SUPPORT
|
|
203
|
-
|
|
204
|
-
For issues and feature requests, please open an issue on our GitHub repository.
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
Built with ❤️ for ElizaOS
|
|
1
|
+
# @elizaos/plugin-suno
|
|
2
|
+
|
|
3
|
+
Suno AI music generation plugin for elizaOS. Enables Eliza agents to generate, custom-generate, and extend audio tracks via the Suno API.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
This plugin contributes a Suno HTTP client and a status provider (`SUNO_STATUS`) to the elizaOS agent runtime. Music generation is dispatched through the `MUSIC` umbrella action (provided by `@elizaos/plugin-music`); this plugin supplies the Suno-specific handler (`sunoGenerateMusicHandler`) that `plugin-music` mounts.
|
|
8
|
+
|
|
9
|
+
Three subactions are supported:
|
|
10
|
+
|
|
11
|
+
| Subaction | Endpoint | Required params |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `generate` | `POST /generate` | `prompt` |
|
|
14
|
+
| `custom_generate` | `POST /custom-generate` | `prompt`; optional: `style`, `bpm`, `key`, `mode`, `reference_audio` |
|
|
15
|
+
| `extend` | `POST /extend` | `audio_id`, `duration` |
|
|
16
|
+
|
|
17
|
+
The subaction is inferred from message text and params when not specified explicitly.
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
- A Suno API key (obtain at [suno.ai](https://suno.ai)).
|
|
22
|
+
- `@elizaos/plugin-music` loaded alongside this plugin to expose the `MUSIC` action to agents.
|
|
23
|
+
|
|
24
|
+
## Configuration
|
|
25
|
+
|
|
26
|
+
Set the API key as an environment variable or in the agent character config:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
SUNO_API_KEY=your-suno-api-key
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The plugin auto-enables when `SUNO_API_KEY` is present, or when agent config sets:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"media": {
|
|
37
|
+
"audio": {
|
|
38
|
+
"provider": "suno",
|
|
39
|
+
"mode": "own-key"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Generation parameters
|
|
46
|
+
|
|
47
|
+
### `generate` and `custom_generate`
|
|
48
|
+
|
|
49
|
+
| Param | Type | Default | Description |
|
|
50
|
+
|---|---|---|---|
|
|
51
|
+
| `prompt` | string | (required) | Text description of the music to generate |
|
|
52
|
+
| `duration` | number | 30 | Duration in seconds |
|
|
53
|
+
| `temperature` | number | 1.0 | Randomness (higher = more creative) |
|
|
54
|
+
| `topK` | number | 250 | Top-K sampling |
|
|
55
|
+
| `topP` | number | 0.95 | Top-P sampling |
|
|
56
|
+
| `classifier_free_guidance` | number | 3.0 | Prompt adherence strength |
|
|
57
|
+
| `style` | string | — | Musical style (custom_generate only) |
|
|
58
|
+
| `bpm` | number | — | Beats per minute (custom_generate only) |
|
|
59
|
+
| `key` | string | — | Musical key, e.g. `"C"` (custom_generate only) |
|
|
60
|
+
| `mode` | string | — | `"major"` or `"minor"` (custom_generate only) |
|
|
61
|
+
| `reference_audio` | string | — | Reference audio path (custom_generate only) |
|
|
62
|
+
|
|
63
|
+
### `extend`
|
|
64
|
+
|
|
65
|
+
| Param | Type | Required | Description |
|
|
66
|
+
|---|---|---|---|
|
|
67
|
+
| `audio_id` | string | Yes | ID of the existing track to extend |
|
|
68
|
+
| `duration` | number | Yes | Additional seconds to add |
|
|
69
|
+
|
|
70
|
+
## Response shape
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
interface GenerationResponse {
|
|
74
|
+
id: string;
|
|
75
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
76
|
+
audio_url?: string;
|
|
77
|
+
error?: string;
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Responses larger than 4000 bytes are truncated before being returned to the agent context.
|
package/auto-enable.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Auto-enable check for @elizaos/plugin-suno.
|
|
2
|
+
//
|
|
3
|
+
// Plugin manifest entry-point — referenced by package.json's
|
|
4
|
+
// `elizaos.plugin.autoEnableModule`. Keep this module light: env reads only,
|
|
5
|
+
// no service init, no transitive imports of the full plugin runtime. The
|
|
6
|
+
// auto-enable engine loads dozens of these per boot.
|
|
7
|
+
import type { PluginAutoEnableContext } from '@elizaos/core';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Enable when a Suno API key is in the environment, or when the user has
|
|
11
|
+
* explicitly selected Suno as the audio provider in own-key mode.
|
|
12
|
+
*/
|
|
13
|
+
export function shouldEnable(ctx: PluginAutoEnableContext): boolean {
|
|
14
|
+
const apiKey = ctx.env.SUNO_API_KEY;
|
|
15
|
+
if (apiKey && apiKey.trim() !== '') return true;
|
|
16
|
+
const audio = ctx.config?.media?.audio;
|
|
17
|
+
return audio?.provider === 'suno' && audio?.mode === 'own-key';
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,38 +1,80 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
"name": "@elizaos/plugin-suno",
|
|
3
|
+
"version": "2.0.11-beta.7",
|
|
4
|
+
"description": "Suno AI Music Generation Plugin for Eliza",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./package.json": "./package.json",
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"eliza-source": {
|
|
13
|
+
"types": "./src/index.ts",
|
|
14
|
+
"import": "./src/index.ts",
|
|
15
|
+
"default": "./src/index.ts"
|
|
16
|
+
},
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"default": "./dist/index.js"
|
|
18
19
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
"./*.css": "./dist/*.css",
|
|
21
|
+
"./*": {
|
|
22
|
+
"types": "./dist/*.d.ts",
|
|
23
|
+
"eliza-source": {
|
|
24
|
+
"types": "./src/*.ts",
|
|
25
|
+
"import": "./src/*.ts",
|
|
26
|
+
"default": "./src/*.ts"
|
|
27
|
+
},
|
|
28
|
+
"import": "./dist/*.js",
|
|
29
|
+
"default": "./dist/*.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"auto-enable.ts"
|
|
35
|
+
],
|
|
36
|
+
"elizaos": {
|
|
37
|
+
"plugin": {
|
|
38
|
+
"autoEnableModule": "./auto-enable.ts",
|
|
39
|
+
"capabilities": [
|
|
40
|
+
"audio-generation"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup --format esm",
|
|
46
|
+
"dev": "tsup --format esm --watch",
|
|
47
|
+
"lint": "bunx @biomejs/biome check .",
|
|
48
|
+
"lint:check": "bun run lint",
|
|
49
|
+
"lint:fix": "bunx @biomejs/biome check --write ./src",
|
|
50
|
+
"format": "bunx @biomejs/biome format --write ./src",
|
|
51
|
+
"format:check": "bunx @biomejs/biome format ./src",
|
|
52
|
+
"test": "vitest run --config vitest.config.ts",
|
|
53
|
+
"typecheck": "tsgo --noEmit -p tsconfig.json"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@biomejs/biome": "^2.4.14",
|
|
57
|
+
"@types/node": "^22.19.17",
|
|
58
|
+
"tsup": "^8.5.1",
|
|
59
|
+
"typescript": "^6.0.3",
|
|
60
|
+
"vitest": "^4.0.0"
|
|
61
|
+
},
|
|
62
|
+
"agentConfig": {
|
|
63
|
+
"pluginType": "elizaos:client:1.0.0",
|
|
64
|
+
"pluginParameters": {
|
|
65
|
+
"apiKey": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"minLength": 1,
|
|
68
|
+
"description": "Your Suno API key for authentication.",
|
|
69
|
+
"optional": false
|
|
70
|
+
}
|
|
37
71
|
}
|
|
72
|
+
},
|
|
73
|
+
"publishConfig": {
|
|
74
|
+
"access": "public"
|
|
75
|
+
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@elizaos/core": "2.0.11-beta.7"
|
|
78
|
+
},
|
|
79
|
+
"gitHead": "cdbc876f793d96073d7eb0d09715a031ce0cd32e"
|
|
38
80
|
}
|
package/biome.json
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
|
|
3
|
-
"organizeImports": {
|
|
4
|
-
"enabled": false
|
|
5
|
-
},
|
|
6
|
-
"linter": {
|
|
7
|
-
"enabled": true,
|
|
8
|
-
"rules": {
|
|
9
|
-
"recommended": true,
|
|
10
|
-
"correctness": {
|
|
11
|
-
"noUnusedVariables": "error"
|
|
12
|
-
},
|
|
13
|
-
"suspicious": {
|
|
14
|
-
"noExplicitAny": "error"
|
|
15
|
-
},
|
|
16
|
-
"style": {
|
|
17
|
-
"useConst": "error",
|
|
18
|
-
"useImportType": "off"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"formatter": {
|
|
23
|
-
"enabled": true,
|
|
24
|
-
"indentStyle": "space",
|
|
25
|
-
"indentWidth": 4,
|
|
26
|
-
"lineWidth": 100
|
|
27
|
-
},
|
|
28
|
-
"javascript": {
|
|
29
|
-
"formatter": {
|
|
30
|
-
"quoteStyle": "single",
|
|
31
|
-
"trailingCommas": "es5"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"files": {
|
|
35
|
-
"ignore": [
|
|
36
|
-
"dist/**/*",
|
|
37
|
-
"extra/**/*",
|
|
38
|
-
"node_modules/**/*"
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
}
|