runapi-suno 0.2.6 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/runapi/suno/client.rb +53 -11
- data/lib/runapi/suno/resources/add_instrumental.rb +1 -0
- data/lib/runapi/suno/resources/add_vocals.rb +1 -0
- data/lib/runapi/suno/resources/boost_style.rb +1 -0
- data/lib/runapi/suno/resources/check_voice.rb +1 -0
- data/lib/runapi/suno/resources/convert_audio.rb +1 -0
- data/lib/runapi/suno/resources/cover_audio.rb +1 -0
- data/lib/runapi/suno/resources/create_mashup.rb +1 -0
- data/lib/runapi/suno/resources/extend_music.rb +1 -0
- data/lib/runapi/suno/resources/generate_artwork.rb +1 -0
- data/lib/runapi/suno/resources/generate_lyrics.rb +1 -0
- data/lib/runapi/suno/resources/generate_midi.rb +1 -0
- data/lib/runapi/suno/resources/generate_persona.rb +1 -0
- data/lib/runapi/suno/resources/generate_voice.rb +1 -0
- data/lib/runapi/suno/resources/get_timestamped_lyrics.rb +1 -0
- data/lib/runapi/suno/resources/regenerate_validation_phrase.rb +1 -0
- data/lib/runapi/suno/resources/replace_section.rb +1 -0
- data/lib/runapi/suno/resources/separate_audio_stems.rb +1 -0
- data/lib/runapi/suno/resources/text_to_music.rb +1 -0
- data/lib/runapi/suno/resources/text_to_sound.rb +1 -0
- data/lib/runapi/suno/resources/visualize_music.rb +1 -0
- data/lib/runapi/suno/resources/voice_to_validation_phrase.rb +1 -0
- data/lib/runapi/suno/types.rb +40 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7408c126663eb2e648020669baa1dc31570c6df7eb74a2d38856c8ba25eb7d3e
|
|
4
|
+
data.tar.gz: 69968db8a1c4d03cafe72847d036be448f8eadb2edc7797445660371c700807a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3cfaaa5a15a681d6ce11f36c8c04d116a245191f2148da349d71b0429fc931421e315d9bfe81faebabde0dc077afe7779969fa1eccc728510d43c5f3dda280f6
|
|
7
|
+
data.tar.gz: 0c40c4d0cd2e6a45dc2c30614217b994caf48ce3e6871f3c8945e918bbae174f66b0fae6e3a11452f5dadcf48093f721e2045dca0c9014972395d8e3c34b652b
|
data/README.md
CHANGED
|
@@ -24,6 +24,8 @@ status = client.generations.get(task.id)
|
|
|
24
24
|
|
|
25
25
|
Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
|
|
26
26
|
|
|
27
|
+
RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
|
|
28
|
+
|
|
27
29
|
## Language notes
|
|
28
30
|
|
|
29
31
|
Use Ruby keyword arguments and the `RunApi::Suno` error classes when building music jobs, Rails workers, or scripts. The available resources include generations, extensions, upload and extensions, covers, upload and covers, instrumentals, vocals, vocal removals, midi, wav conversions, music videos, lyrics, timestamped lyrics, section replacements, mashups, sounds, personas, and styles. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
|
|
@@ -33,7 +35,7 @@ Use Ruby keyword arguments and the `RunApi::Suno` error classes when building mu
|
|
|
33
35
|
- Model page: https://runapi.ai/models/suno
|
|
34
36
|
- SDK docs: https://runapi.ai/docs#sdk-suno
|
|
35
37
|
- Product docs: https://runapi.ai/docs#suno
|
|
36
|
-
- Pricing and rate limits: https://runapi.ai/models/suno/
|
|
38
|
+
- Pricing and rate limits: https://runapi.ai/models/suno/v4
|
|
37
39
|
- Provider comparison: https://runapi.ai/providers/suno
|
|
38
40
|
- Full catalog: https://runapi.ai/models
|
|
39
41
|
- Repository: https://github.com/runapi-ai/suno-sdk
|
data/lib/runapi/suno/client.rb
CHANGED
|
@@ -2,19 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Suno
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
# Suno music platform client covering song generation, extension, covers, stems,
|
|
6
|
+
# MIDI, lyrics, mashups, sound effects, visualization, personas, and voice cloning.
|
|
7
|
+
#
|
|
8
|
+
# @example Generate a song from a text prompt
|
|
9
|
+
# client = RunApi::Suno::Client.new(api_key: "sk-your-api-key")
|
|
10
|
+
# result = client.text_to_music.run(
|
|
11
|
+
# prompt: "A chill lo-fi beat with soft vocals",
|
|
12
|
+
# model: "suno-v4.5-plus"
|
|
13
|
+
# )
|
|
14
|
+
class Client < RunApi::Core::Client
|
|
15
|
+
# @return [Resources::TextToMusic] generates songs from a text prompt with configurable vocal mode, style, and persona
|
|
16
|
+
attr_reader :text_to_music
|
|
17
|
+
# @return [Resources::ExtendMusic] continues an existing track from a specified timestamp
|
|
18
|
+
attr_reader :extend_music
|
|
19
|
+
# @return [Resources::GenerateArtwork] creates cover artwork for an existing music task
|
|
20
|
+
attr_reader :generate_artwork
|
|
21
|
+
# @return [Resources::CoverAudio] re-records vocals over an uploaded audio file with a new style or voice
|
|
22
|
+
attr_reader :cover_audio
|
|
23
|
+
# @return [Resources::AddInstrumental] generates and adds an instrumental backing track to uploaded audio
|
|
24
|
+
attr_reader :add_instrumental
|
|
25
|
+
# @return [Resources::AddVocals] generates and adds vocals to an uploaded instrumental track
|
|
26
|
+
attr_reader :add_vocals
|
|
27
|
+
# @return [Resources::SeparateAudioStems] splits a track into individual instrument stems
|
|
28
|
+
attr_reader :separate_audio_stems
|
|
29
|
+
# @return [Resources::GenerateMidi] extracts per-instrument MIDI note data from a generated track
|
|
30
|
+
attr_reader :generate_midi
|
|
31
|
+
# @return [Resources::ConvertAudio] converts a generated track to WAV format
|
|
32
|
+
attr_reader :convert_audio
|
|
33
|
+
# @return [Resources::VisualizeMusic] generates a music visualization video from an existing track
|
|
34
|
+
attr_reader :visualize_music
|
|
35
|
+
# @return [Resources::GenerateLyrics] produces AI-generated lyrics from a text prompt
|
|
36
|
+
attr_reader :generate_lyrics
|
|
37
|
+
# @return [Resources::GetTimestampedLyrics] retrieves word-level timing alignment for a track (synchronous)
|
|
38
|
+
attr_reader :get_timestamped_lyrics
|
|
39
|
+
# @return [Resources::ReplaceSection] re-generates a time range within an existing track
|
|
40
|
+
attr_reader :replace_section
|
|
41
|
+
# @return [Resources::CreateMashup] blends two audio tracks into a single new composition
|
|
42
|
+
attr_reader :create_mashup
|
|
43
|
+
# @return [Resources::TextToSound] generates sound effects from a text description
|
|
44
|
+
attr_reader :text_to_sound
|
|
45
|
+
# @return [Resources::VoiceToValidationPhrase] step 1 of voice cloning: extracts a validation phrase
|
|
46
|
+
attr_reader :voice_to_validation_phrase
|
|
47
|
+
# @return [Resources::RegenerateValidationPhrase] step 2 (optional) of voice cloning: requests a new phrase
|
|
48
|
+
attr_reader :regenerate_validation_phrase
|
|
49
|
+
# @return [Resources::GenerateVoice] step 3 of voice cloning: trains a custom voice
|
|
50
|
+
attr_reader :generate_voice
|
|
51
|
+
# @return [Resources::CheckVoice] step 4 of voice cloning: checks whether a custom voice is ready (synchronous)
|
|
52
|
+
attr_reader :check_voice
|
|
53
|
+
# @return [Resources::GeneratePersona] creates a reusable style or voice persona from a track's vocals (synchronous)
|
|
54
|
+
attr_reader :generate_persona
|
|
55
|
+
# @return [Resources::BoostStyle] generates style/genre tags from a text description (synchronous)
|
|
56
|
+
attr_reader :boost_style
|
|
12
57
|
|
|
13
58
|
def initialize(api_key: nil, **options)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
client_options = Core::ClientOptions.new(api_key: @api_key, **options)
|
|
17
|
-
http = client_options.http_client || Core::HttpClient.new(client_options)
|
|
59
|
+
super
|
|
18
60
|
|
|
19
61
|
@text_to_music = Resources::TextToMusic.new(http)
|
|
20
62
|
@extend_music = Resources::ExtendMusic.new(http)
|
data/lib/runapi/suno/types.rb
CHANGED
|
@@ -2,21 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Suno
|
|
5
|
+
# Suno type definitions, response models, and enum constants.
|
|
5
6
|
module Types
|
|
7
|
+
# Suno music generation engine versions. V5.5 has highest quality; V4 is the earliest available.
|
|
6
8
|
MODELS = %w[suno-v5.5 suno-v5 suno-v4.5-plus suno-v4.5-all suno-v4.5 suno-v4].freeze
|
|
9
|
+
# Model versions that support sound effect generation (subset of MODELS).
|
|
7
10
|
SOUND_MODELS = %w[suno-v5 suno-v5.5].freeze
|
|
11
|
+
# Musical keys (major and minor) for sound effect generation.
|
|
8
12
|
SOUND_KEYS = %w[
|
|
9
13
|
Cm C#m Dm D#m Em Fm F#m Gm G#m Am A#m Bm
|
|
10
14
|
C C# D D# E F F# G G# A A# B
|
|
11
15
|
].freeze
|
|
12
16
|
VOCAL_GENDERS = %w[female male].freeze
|
|
17
|
+
# "style" applies genre/mood without changing voice; "voice" applies cloned voice characteristics.
|
|
13
18
|
PERSONA_TYPES = %w[style voice].freeze
|
|
19
|
+
# "source" inherits settings from the original track; "custom" requires explicit values.
|
|
14
20
|
PARAMETER_MODES = %w[source custom].freeze
|
|
21
|
+
# auto_lyrics: generates from prompt; exact_lyrics: sings literal lyrics; instrumental: no vocals.
|
|
15
22
|
VOCAL_MODES = %w[auto_lyrics exact_lyrics instrumental].freeze
|
|
23
|
+
# separate_vocal: isolates vocals+instrumental; split_stem: splits into all individual instruments.
|
|
16
24
|
SEPARATE_AUDIO_STEMS_TYPES = %w[separate_vocal split_stem].freeze
|
|
25
|
+
# Language for the voice-cloning validation phrase the user must read back.
|
|
17
26
|
VALIDATION_PHRASE_LANGUAGES = %w[en zh es fr pt de ja ko hi ru].freeze
|
|
27
|
+
# Singing ability of the voice being cloned; calibrates model expectations.
|
|
18
28
|
SINGER_SKILL_LEVELS = %w[beginner intermediate advanced professional].freeze
|
|
19
29
|
|
|
30
|
+
# Metadata and URLs for a generated music track.
|
|
20
31
|
class Audio < RunApi::Core::BaseModel
|
|
21
32
|
optional :id, String
|
|
22
33
|
optional :audio_url, String
|
|
@@ -29,6 +40,7 @@ module RunApi
|
|
|
29
40
|
optional :duration, Numeric
|
|
30
41
|
end
|
|
31
42
|
|
|
43
|
+
# Metadata and URLs for a generated sound effect (distinct from music Audio).
|
|
32
44
|
class SoundAudio < RunApi::Core::BaseModel
|
|
33
45
|
optional :id, String
|
|
34
46
|
optional :audio_url, String
|
|
@@ -41,10 +53,12 @@ module RunApi
|
|
|
41
53
|
optional :duration, Numeric
|
|
42
54
|
end
|
|
43
55
|
|
|
56
|
+
# A URL to a generated cover artwork image.
|
|
44
57
|
class Cover < RunApi::Core::BaseModel
|
|
45
58
|
required :url, String
|
|
46
59
|
end
|
|
47
60
|
|
|
61
|
+
# Word-level timing alignment for a single word in a track.
|
|
48
62
|
class AlignedWord < RunApi::Core::BaseModel
|
|
49
63
|
required :word, String
|
|
50
64
|
required :success
|
|
@@ -53,6 +67,7 @@ module RunApi
|
|
|
53
67
|
required :palign, Numeric
|
|
54
68
|
end
|
|
55
69
|
|
|
70
|
+
# URLs for each isolated instrument stem after separation. Only populated stems have URLs.
|
|
56
71
|
class SeparatedAudio < RunApi::Core::BaseModel
|
|
57
72
|
optional :vocal_url, String
|
|
58
73
|
optional :instrumental_url, String
|
|
@@ -70,6 +85,7 @@ module RunApi
|
|
|
70
85
|
optional :woodwinds_url, String
|
|
71
86
|
end
|
|
72
87
|
|
|
88
|
+
# A single MIDI note event within an instrument track.
|
|
73
89
|
class MidiNote < RunApi::Core::BaseModel
|
|
74
90
|
required :pitch, Numeric
|
|
75
91
|
required :start_time, Numeric
|
|
@@ -77,22 +93,26 @@ module RunApi
|
|
|
77
93
|
required :velocity, Numeric
|
|
78
94
|
end
|
|
79
95
|
|
|
96
|
+
# All notes for a single instrument extracted from a track.
|
|
80
97
|
class MidiInstrument < RunApi::Core::BaseModel
|
|
81
98
|
required :name, String
|
|
82
99
|
optional :notes, [-> { MidiNote }]
|
|
83
100
|
end
|
|
84
101
|
|
|
102
|
+
# A section of generated lyrics with an optional section title (e.g. "Chorus", "Verse 1").
|
|
85
103
|
class Lyric < RunApi::Core::BaseModel
|
|
86
104
|
optional :title, String
|
|
87
105
|
required :text, String
|
|
88
106
|
end
|
|
89
107
|
|
|
108
|
+
# A reusable style or voice persona, referenced by ID in generation params.
|
|
90
109
|
class Persona < RunApi::Core::BaseModel
|
|
91
110
|
required :id, String
|
|
92
111
|
required :name, String
|
|
93
112
|
required :description, String
|
|
94
113
|
end
|
|
95
114
|
|
|
115
|
+
# Base response for all Suno async tasks, carrying lifecycle status and generation progress.
|
|
96
116
|
class AsyncTaskResponse < RunApi::Core::TaskResponse
|
|
97
117
|
required :id, String
|
|
98
118
|
required :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
|
|
@@ -100,53 +120,66 @@ module RunApi
|
|
|
100
120
|
optional :error, String
|
|
101
121
|
end
|
|
102
122
|
|
|
123
|
+
# Result of a text-to-music generation task.
|
|
103
124
|
class TextToMusicResponse < AsyncTaskResponse
|
|
104
125
|
optional :audios, [-> { Audio }]
|
|
105
126
|
optional :audio_url, String
|
|
106
127
|
end
|
|
107
128
|
|
|
129
|
+
# Result of a music extension task. +original_task_id+ references the source track.
|
|
108
130
|
class ExtendMusicResponse < AsyncTaskResponse
|
|
109
131
|
optional :audios, [-> { Audio }]
|
|
110
132
|
optional :original_task_id, String
|
|
111
133
|
end
|
|
112
134
|
|
|
135
|
+
# Result of an artwork generation task containing cover image URLs.
|
|
113
136
|
class GenerateArtworkResponse < AsyncTaskResponse
|
|
114
137
|
optional :covers, [-> { Cover }]
|
|
115
138
|
end
|
|
116
139
|
|
|
140
|
+
# Result of a cover audio task.
|
|
117
141
|
class CoverAudioResponse < AsyncTaskResponse
|
|
118
142
|
optional :audios, [-> { Audio }]
|
|
119
143
|
end
|
|
120
144
|
|
|
145
|
+
# Result of adding an instrumental backing track.
|
|
121
146
|
class AddInstrumentalResponse < TextToMusicResponse; end
|
|
147
|
+
# Result of adding vocals to a track.
|
|
122
148
|
class AddVocalsResponse < TextToMusicResponse; end
|
|
123
149
|
|
|
150
|
+
# Result of a sound effect generation task (uses SoundAudio instead of Audio).
|
|
124
151
|
class TextToSoundResponse < AsyncTaskResponse
|
|
125
152
|
optional :audios, [-> { SoundAudio }]
|
|
126
153
|
end
|
|
127
154
|
|
|
155
|
+
# Result of a stem separation task.
|
|
128
156
|
class SeparateAudioStemsResponse < AsyncTaskResponse
|
|
129
157
|
optional :separated_audios, -> { SeparatedAudio }
|
|
130
158
|
end
|
|
131
159
|
|
|
160
|
+
# Result of a MIDI extraction task with per-instrument note data.
|
|
132
161
|
class GenerateMidiResponse < AsyncTaskResponse
|
|
133
162
|
optional :instruments, [-> { MidiInstrument }]
|
|
134
163
|
end
|
|
135
164
|
|
|
165
|
+
# Result of a WAV conversion task.
|
|
136
166
|
class ConvertAudioResponse < AsyncTaskResponse
|
|
137
167
|
optional :wav_url, String
|
|
138
168
|
optional :original_task_id, String
|
|
139
169
|
end
|
|
140
170
|
|
|
171
|
+
# Result of a music visualization task containing the generated video URL.
|
|
141
172
|
class VisualizeMusicResponse < AsyncTaskResponse
|
|
142
173
|
optional :video_url, String
|
|
143
174
|
optional :original_task_id, String
|
|
144
175
|
end
|
|
145
176
|
|
|
177
|
+
# Result of a lyrics generation task with sectioned lyrics.
|
|
146
178
|
class GenerateLyricsResponse < AsyncTaskResponse
|
|
147
179
|
optional :lyrics, [-> { Lyric }]
|
|
148
180
|
end
|
|
149
181
|
|
|
182
|
+
# Synchronous response containing word-level timing data and waveform for a track.
|
|
150
183
|
class GetTimestampedLyricsResponse < RunApi::Core::BaseModel
|
|
151
184
|
optional :aligned_words, [-> { AlignedWord }]
|
|
152
185
|
optional :waveform_data, [Numeric]
|
|
@@ -154,36 +187,43 @@ module RunApi
|
|
|
154
187
|
optional :is_streamed
|
|
155
188
|
end
|
|
156
189
|
|
|
190
|
+
# Result of a section replacement task.
|
|
157
191
|
class ReplaceSectionResponse < AsyncTaskResponse
|
|
158
192
|
optional :track, -> { Audio }
|
|
159
193
|
optional :audios, [-> { Audio }]
|
|
160
194
|
end
|
|
161
195
|
|
|
196
|
+
# Synchronous result of persona creation.
|
|
162
197
|
class GeneratePersonaResponse < RunApi::Core::BaseModel
|
|
163
198
|
required :persona, -> { Persona }
|
|
164
199
|
optional :error, String
|
|
165
200
|
end
|
|
166
201
|
|
|
202
|
+
# Synchronous result of style tag generation. +style+ contains the generated tags string.
|
|
167
203
|
class BoostStyleResponse < RunApi::Core::BaseModel
|
|
168
204
|
optional :style, String
|
|
169
205
|
optional :error, String
|
|
170
206
|
end
|
|
171
207
|
|
|
208
|
+
# Result of a mashup task.
|
|
172
209
|
class CreateMashupResponse < AsyncTaskResponse
|
|
173
210
|
optional :audio, -> { Audio }
|
|
174
211
|
optional :audios, [-> { Audio }]
|
|
175
212
|
end
|
|
176
213
|
|
|
214
|
+
# Result of a voice-cloning validation phrase task. The user must re-record this phrase.
|
|
177
215
|
class ValidationPhraseResponse < AsyncTaskResponse
|
|
178
216
|
optional :provider_status, String
|
|
179
217
|
optional :validation_phrase, String
|
|
180
218
|
end
|
|
181
219
|
|
|
220
|
+
# Result of a voice generation (training) task. +voice_id+ is usable in subsequent generation params.
|
|
182
221
|
class VoiceGenerationResponse < AsyncTaskResponse
|
|
183
222
|
optional :provider_status, String
|
|
184
223
|
optional :voice_id, String
|
|
185
224
|
end
|
|
186
225
|
|
|
226
|
+
# Synchronous result indicating whether a custom voice is ready for use.
|
|
187
227
|
class CheckVoiceResponse < RunApi::Core::BaseModel
|
|
188
228
|
optional :is_available
|
|
189
229
|
optional :error, String
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-suno
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.2.
|
|
18
|
+
version: 0.2.6
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.2.
|
|
25
|
+
version: 0.2.6
|
|
26
26
|
description: The suno ai api Ruby SDK is the language-specific package for Suno on
|
|
27
27
|
RunAPI. Use this suno ai api package for song generation, lyrics, vocal, extension,
|
|
28
28
|
and audio transformation flows when your application needs JSON request bodies,
|