runapi-suno 0.7.0__tar.gz → 0.8.0__tar.gz
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.
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/PKG-INFO +5 -5
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/README.md +3 -3
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/pyproject.toml +2 -2
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/client.py +3 -1
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/__init__.py +2 -0
- runapi_suno-0.8.0/src/runapi/suno/resources/text_to_speech.py +53 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/types.py +10 -8
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/tests/test_client.py +67 -19
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/__init__.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/py.typed +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/add_instrumental.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/add_samples.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/add_vocals.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/audio_actions.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/audio_exports.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/blend_lyrics.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/boost_style.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/check_voice.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/convert_audio.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/cover_audio.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/create_mashup.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/extend_music.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/generate_artwork.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/generate_lyrics.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/generate_midi.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/generate_persona.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/generate_voice.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/get_timestamped_lyrics.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/inspire_music.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/music_from_sample.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/music_visualizations.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/personas.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/regenerate_validation_phrase.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/remaster_audio.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/replace_section.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/separate_audio_stems.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/stitch_audio.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/style_expansions.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/text_to_music.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/text_to_sound.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/timestamped_lyrics.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/visualize_music.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/voice_to_validation_phrase.py +0 -0
- {runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/voices.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: runapi-suno
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: RunAPI Suno SDK for text-to-music, lyric generation and blending, cover audio, music extension, stem separation, voice validation phrase, custom voice, and related audio workflows in JavaScript, Python, Ruby, Go, Java, and PHP
|
|
5
5
|
Project-URL: Homepage, https://runapi.ai/models/suno
|
|
6
6
|
Project-URL: Documentation, https://runapi.ai/docs/resources/sdks
|
|
7
7
|
Project-URL: Source, https://github.com/runapi-ai/suno-sdk
|
|
8
8
|
Project-URL: Issues, https://github.com/runapi-ai/suno-sdk/issues
|
|
9
9
|
Project-URL: Changelog, https://github.com/runapi-ai/suno-sdk/blob/main/CHANGELOG.md
|
|
10
|
-
Project-URL: Release Notes, https://github.com/runapi-ai/suno-sdk/releases/tag/python%2Fv0.
|
|
10
|
+
Project-URL: Release Notes, https://github.com/runapi-ai/suno-sdk/releases/tag/python%2Fv0.8.0
|
|
11
11
|
Author-email: RunAPI <contact@runapi.ai>
|
|
12
12
|
License-Expression: Apache-2.0
|
|
13
13
|
Keywords: api,audio-generation,golang,gradle,java,maven,music-api,music-generation,python,ruby,runapi,runapi-ai,sdk,suno,suno-ai-api,typescript
|
|
@@ -42,7 +42,7 @@ client = SunoClient() # reads RUNAPI_API_KEY, or pass api_key="sk-..."
|
|
|
42
42
|
|
|
43
43
|
# Generate music and poll until completion.
|
|
44
44
|
result = client.text_to_music.run(
|
|
45
|
-
model="suno-
|
|
45
|
+
model="suno-v6",
|
|
46
46
|
vocal_mode="auto_lyrics",
|
|
47
47
|
prompt="A chill lo-fi beat with soft vocals",
|
|
48
48
|
)
|
|
@@ -63,7 +63,7 @@ Use `create` to submit a task and return quickly, `get` to fetch the latest task
|
|
|
63
63
|
|
|
64
64
|
```python
|
|
65
65
|
task = client.text_to_music.create(
|
|
66
|
-
model="suno-
|
|
66
|
+
model="suno-v6",
|
|
67
67
|
vocal_mode="instrumental",
|
|
68
68
|
style="ambient piano",
|
|
69
69
|
title="Quiet Morning",
|
|
@@ -84,7 +84,7 @@ Pass parameters as keyword arguments and catch the `runapi.suno` error classes w
|
|
|
84
84
|
- Model page: https://runapi.ai/models/suno
|
|
85
85
|
- SDK docs: https://runapi.ai/docs/resources/sdks
|
|
86
86
|
- Product docs: https://runapi.ai/docs/api/suno/text-to-music
|
|
87
|
-
- Pricing and rate limits: https://runapi.ai/models/suno/
|
|
87
|
+
- Pricing and rate limits: https://runapi.ai/models/suno/v6
|
|
88
88
|
- Provider comparison: https://runapi.ai/providers/suno
|
|
89
89
|
- Full catalog: https://runapi.ai/models
|
|
90
90
|
- Repository: https://github.com/runapi-ai/suno-sdk
|
|
@@ -19,7 +19,7 @@ client = SunoClient() # reads RUNAPI_API_KEY, or pass api_key="sk-..."
|
|
|
19
19
|
|
|
20
20
|
# Generate music and poll until completion.
|
|
21
21
|
result = client.text_to_music.run(
|
|
22
|
-
model="suno-
|
|
22
|
+
model="suno-v6",
|
|
23
23
|
vocal_mode="auto_lyrics",
|
|
24
24
|
prompt="A chill lo-fi beat with soft vocals",
|
|
25
25
|
)
|
|
@@ -40,7 +40,7 @@ Use `create` to submit a task and return quickly, `get` to fetch the latest task
|
|
|
40
40
|
|
|
41
41
|
```python
|
|
42
42
|
task = client.text_to_music.create(
|
|
43
|
-
model="suno-
|
|
43
|
+
model="suno-v6",
|
|
44
44
|
vocal_mode="instrumental",
|
|
45
45
|
style="ambient piano",
|
|
46
46
|
title="Quiet Morning",
|
|
@@ -61,7 +61,7 @@ Pass parameters as keyword arguments and catch the `runapi.suno` error classes w
|
|
|
61
61
|
- Model page: https://runapi.ai/models/suno
|
|
62
62
|
- SDK docs: https://runapi.ai/docs/resources/sdks
|
|
63
63
|
- Product docs: https://runapi.ai/docs/api/suno/text-to-music
|
|
64
|
-
- Pricing and rate limits: https://runapi.ai/models/suno/
|
|
64
|
+
- Pricing and rate limits: https://runapi.ai/models/suno/v6
|
|
65
65
|
- Provider comparison: https://runapi.ai/providers/suno
|
|
66
66
|
- Full catalog: https://runapi.ai/models
|
|
67
67
|
- Repository: https://github.com/runapi-ai/suno-sdk
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "runapi-suno"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.8.0"
|
|
8
8
|
description = "RunAPI Suno SDK for text-to-music, lyric generation and blending, cover audio, music extension, stem separation, voice validation phrase, custom voice, and related audio workflows in JavaScript, Python, Ruby, Go, Java, and PHP"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -27,7 +27,7 @@ Documentation = "https://runapi.ai/docs/resources/sdks"
|
|
|
27
27
|
Source = "https://github.com/runapi-ai/suno-sdk"
|
|
28
28
|
Issues = "https://github.com/runapi-ai/suno-sdk/issues"
|
|
29
29
|
Changelog = "https://github.com/runapi-ai/suno-sdk/blob/main/CHANGELOG.md"
|
|
30
|
-
"Release Notes" = "https://github.com/runapi-ai/suno-sdk/releases/tag/python%2Fv0.
|
|
30
|
+
"Release Notes" = "https://github.com/runapi-ai/suno-sdk/releases/tag/python%2Fv0.8.0"
|
|
31
31
|
|
|
32
32
|
[tool.hatch.build.targets.wheel]
|
|
33
33
|
packages = ["src/runapi"]
|
|
@@ -30,6 +30,7 @@ from .resources.replace_section import ReplaceSection
|
|
|
30
30
|
from .resources.separate_audio_stems import SeparateAudioStems
|
|
31
31
|
from .resources.text_to_music import TextToMusic
|
|
32
32
|
from .resources.text_to_sound import TextToSound
|
|
33
|
+
from .resources.text_to_speech import TextToSpeech
|
|
33
34
|
from .resources.visualize_music import VisualizeMusic
|
|
34
35
|
from .resources.voice_to_validation_phrase import VoiceToValidationPhrase
|
|
35
36
|
from .resources.personas import Personas
|
|
@@ -49,7 +50,7 @@ class SunoClient(ProviderClient):
|
|
|
49
50
|
client = SunoClient(api_key="sk-...")
|
|
50
51
|
result = client.text_to_music.run(
|
|
51
52
|
prompt="A chill lo-fi beat with soft vocals",
|
|
52
|
-
model="suno-
|
|
53
|
+
model="suno-v6",
|
|
53
54
|
vocal_mode="auto_lyrics",
|
|
54
55
|
)
|
|
55
56
|
"""
|
|
@@ -78,6 +79,7 @@ class SunoClient(ProviderClient):
|
|
|
78
79
|
self.replace_section = ReplaceSection(http)
|
|
79
80
|
self.create_mashup = CreateMashup(http)
|
|
80
81
|
self.text_to_sound = TextToSound(http)
|
|
82
|
+
self.text_to_speech = TextToSpeech(http)
|
|
81
83
|
self.voice_to_validation_phrase = VoiceToValidationPhrase(http)
|
|
82
84
|
self.regenerate_validation_phrase = RegenerateValidationPhrase(http)
|
|
83
85
|
self.generate_voice = GenerateVoice(http)
|
|
@@ -22,6 +22,7 @@ from .replace_section import ReplaceSection
|
|
|
22
22
|
from .separate_audio_stems import SeparateAudioStems
|
|
23
23
|
from .text_to_music import TextToMusic
|
|
24
24
|
from .text_to_sound import TextToSound
|
|
25
|
+
from .text_to_speech import TextToSpeech
|
|
25
26
|
from .visualize_music import VisualizeMusic
|
|
26
27
|
from .voice_to_validation_phrase import VoiceToValidationPhrase
|
|
27
28
|
from .personas import Personas
|
|
@@ -53,6 +54,7 @@ __all__ = [
|
|
|
53
54
|
"ReplaceSection",
|
|
54
55
|
"CreateMashup",
|
|
55
56
|
"TextToSound",
|
|
57
|
+
"TextToSpeech",
|
|
56
58
|
"VoiceToValidationPhrase",
|
|
57
59
|
"RegenerateValidationPhrase",
|
|
58
60
|
"GenerateVoice",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Suno text_to_speech resource."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Optional
|
|
6
|
+
|
|
7
|
+
from runapi.core import Resource, RequestOptions
|
|
8
|
+
|
|
9
|
+
from ..types import CompletedTextToSpeechResponse, TextToSpeechResponse
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TextToSpeech(Resource):
|
|
13
|
+
"""Generate spoken audio from a description or an exact script."""
|
|
14
|
+
|
|
15
|
+
ENDPOINT = "/api/v1/suno/text_to_speech"
|
|
16
|
+
|
|
17
|
+
RESPONSE_CLASS = TextToSpeechResponse
|
|
18
|
+
COMPLETED_RESPONSE_CLASS = CompletedTextToSpeechResponse
|
|
19
|
+
|
|
20
|
+
def run(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
21
|
+
"""Generate spoken audio and poll until it completes.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
**params: text-to-speech parameters.
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
The completed (narrowed) response.
|
|
28
|
+
"""
|
|
29
|
+
task = self.create(options=options, **params)
|
|
30
|
+
return self._poll_until_complete(lambda: self.get(task.id, options=options))
|
|
31
|
+
|
|
32
|
+
def create(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
|
|
33
|
+
"""Create a text-to-speech task and return immediately with an id.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
**params: text-to-speech parameters.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
The task creation result with an id.
|
|
40
|
+
"""
|
|
41
|
+
compacted = self._compact_params(params)
|
|
42
|
+
return self._request("post", self.ENDPOINT, body=compacted, options=options)
|
|
43
|
+
|
|
44
|
+
def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
|
|
45
|
+
"""Fetch the current status of a text-to-speech task.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
id: The task id returned by ``create``.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
The current task status.
|
|
52
|
+
"""
|
|
53
|
+
return self._request("get", f"{self.ENDPOINT}/{id}", options=options)
|
|
@@ -10,14 +10,8 @@ MODELS = [
|
|
|
10
10
|
"suno-v6",
|
|
11
11
|
"suno-v6-wild",
|
|
12
12
|
"suno-v6-mini",
|
|
13
|
-
"suno-v5.5",
|
|
14
|
-
"suno-v5",
|
|
15
|
-
"suno-v4.5-plus",
|
|
16
|
-
"suno-v4.5-all",
|
|
17
|
-
"suno-v4.5",
|
|
18
|
-
"suno-v4",
|
|
19
13
|
]
|
|
20
|
-
SOUND_MODELS = ["suno-
|
|
14
|
+
SOUND_MODELS = ["suno-v6"]
|
|
21
15
|
SOUND_KEYS = [
|
|
22
16
|
"Cm",
|
|
23
17
|
"C#m",
|
|
@@ -461,7 +455,6 @@ class MusicVisualizationParams(_AudioReferenceRequiredParams, total=False):
|
|
|
461
455
|
class _MusicFromSampleRequiredParams(TypedDict):
|
|
462
456
|
model: str
|
|
463
457
|
audio_url: str
|
|
464
|
-
start_seconds: float
|
|
465
458
|
end_seconds: float
|
|
466
459
|
|
|
467
460
|
|
|
@@ -469,6 +462,7 @@ class MusicFromSampleParams(_MusicFromSampleRequiredParams, total=False):
|
|
|
469
462
|
"""Parameters for creating music guided by an uploaded audio sample."""
|
|
470
463
|
|
|
471
464
|
prompt: str
|
|
465
|
+
start_seconds: float
|
|
472
466
|
callback_url: str
|
|
473
467
|
|
|
474
468
|
|
|
@@ -565,3 +559,11 @@ class CompletedMusicFromSampleResponse(MusicFromSampleResponse):
|
|
|
565
559
|
"""Narrowed music-from-sample response once polling observes completion."""
|
|
566
560
|
|
|
567
561
|
audios = required([lambda: Audio])
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
class TextToSpeechResponse(AsyncTaskResponse):
|
|
565
|
+
audios = optional([Audio])
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
class CompletedTextToSpeechResponse(TextToSpeechResponse):
|
|
569
|
+
audios = required([Audio])
|
|
@@ -126,13 +126,13 @@ def test_create_posts_compacted_body():
|
|
|
126
126
|
fake = FakeHttp({"id": "t1", "status": "pending"})
|
|
127
127
|
client = SunoClient(api_key="k", http_client=fake)
|
|
128
128
|
result = client.text_to_music.create(
|
|
129
|
-
model="suno-
|
|
129
|
+
model="suno-v6", vocal_mode="auto_lyrics", prompt="hello", title=None
|
|
130
130
|
)
|
|
131
131
|
assert fake.calls == [
|
|
132
132
|
(
|
|
133
133
|
"post",
|
|
134
134
|
"/api/v1/suno/text_to_music",
|
|
135
|
-
{"model": "suno-
|
|
135
|
+
{"model": "suno-v6", "vocal_mode": "auto_lyrics", "prompt": "hello"},
|
|
136
136
|
)]
|
|
137
137
|
assert isinstance(result, TextToMusicResponse)
|
|
138
138
|
|
|
@@ -141,7 +141,7 @@ def test_create_accepts_canonical_voice_handle():
|
|
|
141
141
|
fake = FakeHttp({"id": "voice_task", "status": "pending"})
|
|
142
142
|
client = SunoClient(api_key="k", http_client=fake)
|
|
143
143
|
client.text_to_music.create(
|
|
144
|
-
model="suno-
|
|
144
|
+
model="suno-v6", vocal_mode="exact_lyrics", lyrics="[Verse] hello",
|
|
145
145
|
style="acoustic pop", title="Hello", voice_id="res_voice_handle",
|
|
146
146
|
)
|
|
147
147
|
assert fake.calls[0][2]["voice_id"] == "res_voice_handle"
|
|
@@ -168,23 +168,23 @@ def test_audio_actions_post_public_request_shapes():
|
|
|
168
168
|
fake = FakeHttp()
|
|
169
169
|
client = SunoClient(api_key="k", http_client=fake)
|
|
170
170
|
|
|
171
|
-
client.stitch_audio.create(model="suno-
|
|
172
|
-
client.remaster_audio.create(model="suno-
|
|
171
|
+
client.stitch_audio.create(model="suno-v6", source_task_id="source", audio_id="audio")
|
|
172
|
+
client.remaster_audio.create(model="suno-v6", source_task_id="source", audio_id="audio")
|
|
173
173
|
client.add_samples.create(
|
|
174
|
-
model="suno-
|
|
174
|
+
model="suno-v6", audio_url="https://file.runapi.ai/source.mp3", prompt="Add a crisp handclap sample to the chorus", start_seconds=5, end_seconds=20
|
|
175
175
|
)
|
|
176
176
|
client.inspire_music.create(
|
|
177
|
-
model="suno-
|
|
177
|
+
model="suno-v6",
|
|
178
178
|
audio_urls=["https://file.runapi.ai/inspiration-one.mp3", "https://file.runapi.ai/inspiration-two.mp3"],
|
|
179
179
|
)
|
|
180
180
|
|
|
181
181
|
assert fake.calls == [
|
|
182
|
-
("post", "/api/v1/suno/stitch_audio", {"model": "suno-
|
|
183
|
-
("post", "/api/v1/suno/remaster_audio", {"model": "suno-
|
|
182
|
+
("post", "/api/v1/suno/stitch_audio", {"model": "suno-v6", "source_task_id": "source", "audio_id": "audio"}),
|
|
183
|
+
("post", "/api/v1/suno/remaster_audio", {"model": "suno-v6", "source_task_id": "source", "audio_id": "audio"}),
|
|
184
184
|
("post", "/api/v1/suno/add_samples", {
|
|
185
|
-
"model": "suno-
|
|
185
|
+
"model": "suno-v6", "audio_url": "https://file.runapi.ai/source.mp3", "prompt": "Add a crisp handclap sample to the chorus", "start_seconds": 5, "end_seconds": 20}),
|
|
186
186
|
("post", "/api/v1/suno/inspire_music", {
|
|
187
|
-
"model": "suno-
|
|
187
|
+
"model": "suno-v6",
|
|
188
188
|
"audio_urls": ["https://file.runapi.ai/inspiration-one.mp3", "https://file.runapi.ai/inspiration-two.mp3"]})]
|
|
189
189
|
|
|
190
190
|
|
|
@@ -198,7 +198,7 @@ def test_run_narrows_completed_type():
|
|
|
198
198
|
)
|
|
199
199
|
client = SunoClient(api_key="k", http_client=fake)
|
|
200
200
|
result = client.text_to_music.run(
|
|
201
|
-
model="suno-
|
|
201
|
+
model="suno-v6", vocal_mode="auto_lyrics", prompt="a calm tune"
|
|
202
202
|
)
|
|
203
203
|
assert isinstance(result, CompletedTextToMusicResponse)
|
|
204
204
|
assert result.audios[0].audio_url == "https://x/y.mp3"
|
|
@@ -211,7 +211,7 @@ def test_extend_music_run_narrows_completed():
|
|
|
211
211
|
)
|
|
212
212
|
client = SunoClient(api_key="k", http_client=fake)
|
|
213
213
|
result = client.extend_music.run(
|
|
214
|
-
task_id="src", parameter_mode="source", model="suno-
|
|
214
|
+
task_id="src", parameter_mode="source", model="suno-v6"
|
|
215
215
|
)
|
|
216
216
|
from runapi.suno.types import CompletedExtendMusicResponse
|
|
217
217
|
|
|
@@ -296,7 +296,7 @@ def test_replace_section_upload_source_posts_body():
|
|
|
296
296
|
client = SunoClient(api_key="k", http_client=fake)
|
|
297
297
|
client.replace_section.create(
|
|
298
298
|
upload_url="https://cdn.runapi.ai/public/samples/music.mp3",
|
|
299
|
-
model="suno-
|
|
299
|
+
model="suno-v6",
|
|
300
300
|
lyrics="x",
|
|
301
301
|
full_lyrics="[Verse] x",
|
|
302
302
|
tags="y",
|
|
@@ -310,7 +310,7 @@ def test_replace_section_upload_source_posts_body():
|
|
|
310
310
|
"/api/v1/suno/replace_section",
|
|
311
311
|
{
|
|
312
312
|
"upload_url": "https://cdn.runapi.ai/public/samples/music.mp3",
|
|
313
|
-
"model": "suno-
|
|
313
|
+
"model": "suno-v6",
|
|
314
314
|
"lyrics": "x",
|
|
315
315
|
"full_lyrics": "[Verse] x",
|
|
316
316
|
"tags": "y",
|
|
@@ -591,7 +591,7 @@ def test_music_from_sample_create_posts_compacted_body():
|
|
|
591
591
|
client = SunoClient(api_key="k", http_client=fake)
|
|
592
592
|
|
|
593
593
|
result = client.music_from_sample.create(
|
|
594
|
-
model="suno-
|
|
594
|
+
model="suno-v6",
|
|
595
595
|
audio_url="https://cdn.runapi.ai/sample.mp3",
|
|
596
596
|
start_seconds=12,
|
|
597
597
|
end_seconds=32,
|
|
@@ -603,7 +603,7 @@ def test_music_from_sample_create_posts_compacted_body():
|
|
|
603
603
|
"post",
|
|
604
604
|
"/api/v1/music_from_sample",
|
|
605
605
|
{
|
|
606
|
-
"model": "suno-
|
|
606
|
+
"model": "suno-v6",
|
|
607
607
|
"audio_url": "https://cdn.runapi.ai/sample.mp3",
|
|
608
608
|
"start_seconds": 12,
|
|
609
609
|
"end_seconds": 32},
|
|
@@ -623,7 +623,7 @@ def test_music_from_sample_run_narrows_completed_response():
|
|
|
623
623
|
client = SunoClient(api_key="k", http_client=fake)
|
|
624
624
|
|
|
625
625
|
result = client.music_from_sample.run(
|
|
626
|
-
model="suno-
|
|
626
|
+
model="suno-v6", audio_url="https://cdn.runapi.ai/sample.mp3", start_seconds=12, end_seconds=32
|
|
627
627
|
)
|
|
628
628
|
|
|
629
629
|
assert fake.calls == [
|
|
@@ -631,7 +631,7 @@ def test_music_from_sample_run_narrows_completed_response():
|
|
|
631
631
|
"post",
|
|
632
632
|
"/api/v1/music_from_sample",
|
|
633
633
|
{
|
|
634
|
-
"model": "suno-
|
|
634
|
+
"model": "suno-v6",
|
|
635
635
|
"audio_url": "https://cdn.runapi.ai/sample.mp3",
|
|
636
636
|
"start_seconds": 12,
|
|
637
637
|
"end_seconds": 32},
|
|
@@ -639,3 +639,51 @@ def test_music_from_sample_run_narrows_completed_response():
|
|
|
639
639
|
("get", "/api/v1/music_from_sample/sample_1", None)]
|
|
640
640
|
assert isinstance(result, CompletedMusicFromSampleResponse)
|
|
641
641
|
assert result.audios[0].audio_url == "https://file.runapi.ai/sample.mp3"
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
def test_raw_log_retention_responses():
|
|
645
|
+
import json
|
|
646
|
+
from pathlib import Path
|
|
647
|
+
fixtures = Path(__file__).resolve().parents[4] / "testdata"
|
|
648
|
+
music_path = fixtures / "raw-log-retention-music.json"
|
|
649
|
+
lyrics_path = fixtures / "raw-log-retention-lyrics.json"
|
|
650
|
+
if not music_path.is_file() or not lyrics_path.is_file():
|
|
651
|
+
pytest.skip("Monorepo testdata fixtures are not bundled in standalone package.")
|
|
652
|
+
music = json.loads(music_path.read_text())
|
|
653
|
+
lyrics = json.loads(lyrics_path.read_text())
|
|
654
|
+
client = SunoClient(api_key="k", http_client=FakeHttp(music, lyrics))
|
|
655
|
+
result = client.text_to_music.get("retained-music")
|
|
656
|
+
assert result.audios[0].id == ""
|
|
657
|
+
assert result.audios[0].audio_url == "https://file.runapi.ai/retained-track"
|
|
658
|
+
assert result.audios[0].lyrics is None
|
|
659
|
+
deleted = client.generate_lyrics.get("deleted-lyrics")
|
|
660
|
+
assert deleted.id == "deleted-lyrics"
|
|
661
|
+
assert deleted.to_dict()["payload_retained"] is False
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
def test_text_to_speech_create_and_get():
|
|
665
|
+
http = FakeHttp(
|
|
666
|
+
{"id": "speech-1", "status": "processing"},
|
|
667
|
+
{"id": "speech-1", "status": "completed", "audios": [{"id": "audio-1", "audio_url": "https://file.runapi.ai/speech.mp3", "duration": 2.5}]},
|
|
668
|
+
)
|
|
669
|
+
client = SunoClient(api_key="k", http_client=http)
|
|
670
|
+
created = client.text_to_speech.create(model="suno-speech", custom_mode=False, prompt="A welcome message")
|
|
671
|
+
result = client.text_to_speech.get(created.id)
|
|
672
|
+
assert http.calls == [
|
|
673
|
+
("post", "/api/v1/suno/text_to_speech", {"model": "suno-speech", "custom_mode": False, "prompt": "A welcome message"}),
|
|
674
|
+
("get", "/api/v1/suno/text_to_speech/speech-1", None),
|
|
675
|
+
]
|
|
676
|
+
assert result.audios[0].id == "audio-1"
|
|
677
|
+
assert result.audios[0].audio_url == "https://file.runapi.ai/speech.mp3"
|
|
678
|
+
assert result.audios[0].duration == 2.5
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
def test_text_to_speech_advanced_run():
|
|
682
|
+
http = FakeHttp(
|
|
683
|
+
{"id": "speech-1", "status": "processing"},
|
|
684
|
+
{"id": "speech-1", "status": "completed", "audios": [{"id": "audio-1", "audio_url": "https://file.runapi.ai/speech.mp3", "duration": 2.5}]},
|
|
685
|
+
)
|
|
686
|
+
client = SunoClient(api_key="k", http_client=http)
|
|
687
|
+
result = client.text_to_speech.run(model="suno-speech", custom_mode=True, script="Hello.", variety=0, background_music=False)
|
|
688
|
+
assert http.calls[0] == ("post", "/api/v1/suno/text_to_speech", {"model": "suno-speech", "custom_mode": True, "script": "Hello.", "variety": 0, "background_music": False})
|
|
689
|
+
assert result.audios[0].duration == 2.5
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/regenerate_validation_phrase.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{runapi_suno-0.7.0 → runapi_suno-0.8.0}/src/runapi/suno/resources/voice_to_validation_phrase.py
RENAMED
|
File without changes
|
|
File without changes
|