melodai 1.5.0__py3-none-any.whl

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.
Files changed (101) hide show
  1. melodai/__init__.py +46 -0
  2. melodai/api/__init__.py +1 -0
  3. melodai/api/account/__init__.py +1 -0
  4. melodai/api/account/get_account.py +169 -0
  5. melodai/api/albums/__init__.py +1 -0
  6. melodai/api/albums/create_album.py +217 -0
  7. melodai/api/albums/create_album_art.py +227 -0
  8. melodai/api/albums/create_album_zip.py +231 -0
  9. melodai/api/albums/delete_album.py +192 -0
  10. melodai/api/albums/get_album.py +192 -0
  11. melodai/api/albums/get_album_zip.py +200 -0
  12. melodai/api/albums/list_albums.py +217 -0
  13. melodai/api/albums/set_album_songs.py +240 -0
  14. melodai/api/albums/update_album.py +217 -0
  15. melodai/api/analysis/__init__.py +1 -0
  16. melodai/api/analysis/create_instruments.py +231 -0
  17. melodai/api/analysis/detect_chords.py +219 -0
  18. melodai/api/analysis/detect_key.py +219 -0
  19. melodai/api/analysis/get_instruments.py +196 -0
  20. melodai/api/cover_art/__init__.py +1 -0
  21. melodai/api/cover_art/create_song_art.py +254 -0
  22. melodai/api/lyric_videos/__init__.py +1 -0
  23. melodai/api/lyric_videos/create_lyric_video.py +237 -0
  24. melodai/api/lyric_videos/create_lyric_video_format.py +241 -0
  25. melodai/api/lyric_videos/get_lyric_video.py +192 -0
  26. melodai/api/lyric_videos/list_lyric_video_themes.py +165 -0
  27. melodai/api/lyric_videos/rerender_lyric_video.py +242 -0
  28. melodai/api/lyrics/__init__.py +1 -0
  29. melodai/api/lyrics/create_lyrics_timing.py +227 -0
  30. melodai/api/lyrics/edit_lyrics.py +221 -0
  31. melodai/api/lyrics/generate_lyrics.py +225 -0
  32. melodai/api/lyrics/get_lyrics_timing.py +200 -0
  33. melodai/api/lyrics/translate_lyrics.py +241 -0
  34. melodai/api/mastering/__init__.py +1 -0
  35. melodai/api/mastering/create_master.py +248 -0
  36. melodai/api/mastering/get_master.py +230 -0
  37. melodai/api/remix/__init__.py +1 -0
  38. melodai/api/remix/create_remix_master.py +248 -0
  39. melodai/api/remix/create_remix_render.py +248 -0
  40. melodai/api/remix/create_remix_stems_zip.py +223 -0
  41. melodai/api/remix/get_remix.py +200 -0
  42. melodai/api/remix/get_remix_grid.py +204 -0
  43. melodai/api/remix/get_remix_job.py +200 -0
  44. melodai/api/remix/save_remix.py +271 -0
  45. melodai/api/remix/suggest_remix.py +264 -0
  46. melodai/api/songs/__init__.py +1 -0
  47. melodai/api/songs/create_song.py +221 -0
  48. melodai/api/songs/delete_song.py +192 -0
  49. melodai/api/songs/get_song.py +192 -0
  50. melodai/api/songs/list_songs.py +240 -0
  51. melodai/api/songs/update_song.py +221 -0
  52. melodai/api/stems/__init__.py +1 -0
  53. melodai/api/stems/create_stems.py +219 -0
  54. melodai/api/stems/get_stems.py +192 -0
  55. melodai/api/tabs/__init__.py +1 -0
  56. melodai/api/tabs/claim_tab.py +227 -0
  57. melodai/api/tabs/create_tab.py +242 -0
  58. melodai/api/tabs/get_tab.py +196 -0
  59. melodai/api/tabs/list_tabs.py +284 -0
  60. melodai/api/versions/__init__.py +1 -0
  61. melodai/api/versions/delete_version.py +210 -0
  62. melodai/api/versions/extend_song.py +245 -0
  63. melodai/api/versions/list_versions.py +196 -0
  64. melodai/api/versions/set_default_version.py +233 -0
  65. melodai/client.py +280 -0
  66. melodai/errors.py +16 -0
  67. melodai/models/__init__.py +65 -0
  68. melodai/models/album_create_public.py +42 -0
  69. melodai/models/album_patch_public.py +74 -0
  70. melodai/models/album_songs_public.py +42 -0
  71. melodai/models/art_request_public.py +42 -0
  72. melodai/models/error_envelope.py +67 -0
  73. melodai/models/error_envelope_error.py +80 -0
  74. melodai/models/generate_request.py +153 -0
  75. melodai/models/list_songs_status_type_0.py +13 -0
  76. melodai/models/list_tabs_status_type_0.py +12 -0
  77. melodai/models/lyric_video_create_public.py +81 -0
  78. melodai/models/lyric_video_create_public_format.py +10 -0
  79. melodai/models/lyric_video_format_public.py +44 -0
  80. melodai/models/lyric_video_format_public_format.py +10 -0
  81. melodai/models/lyric_video_rerender_public.py +89 -0
  82. melodai/models/lyric_video_rerender_public_format_type_0.py +10 -0
  83. melodai/models/public_extend_request.py +79 -0
  84. melodai/models/public_lyrics_edit_request.py +69 -0
  85. melodai/models/public_lyrics_generate_request.py +81 -0
  86. melodai/models/public_master_request.py +70 -0
  87. melodai/models/public_master_request_preset.py +11 -0
  88. melodai/models/public_remix_master_request.py +110 -0
  89. melodai/models/public_remix_master_request_preset_type_0.py +10 -0
  90. melodai/models/public_remix_render_request.py +70 -0
  91. melodai/models/public_remix_render_request_format.py +9 -0
  92. melodai/models/public_translate_request.py +61 -0
  93. melodai/models/song_patch_public.py +74 -0
  94. melodai/models/suggest_remix_kind.py +10 -0
  95. melodai/models/tab_request_public.py +88 -0
  96. melodai/py.typed +0 -0
  97. melodai/types.py +54 -0
  98. melodai-1.5.0.dist-info/METADATA +99 -0
  99. melodai-1.5.0.dist-info/RECORD +101 -0
  100. melodai-1.5.0.dist-info/WHEEL +4 -0
  101. melodai-1.5.0.dist-info/licenses/LICENSE +21 -0
melodai/__init__.py ADDED
@@ -0,0 +1,46 @@
1
+ """Official Python client for the MelodAI Public API.
2
+
3
+ Generated from the public OpenAPI spec (sdks/generate.py); this template
4
+ (sdks/python/templates/package_init.py.jinja) only adds ``create_client``.
5
+
6
+ from melodai import create_client
7
+ from melodai.api.songs import create_song, get_song
8
+ from melodai.models import GenerateRequest
9
+
10
+ client = create_client(api_key="mk_live_...")
11
+ created = create_song.sync(client=client, body=GenerateRequest(prompt="lo-fi beat"))
12
+ """
13
+
14
+ from .client import AuthenticatedClient, Client
15
+
16
+ DEFAULT_BASE_URL = "https://api.melodai.ai/api/public/v1"
17
+
18
+
19
+ def create_client(
20
+ api_key: str, base_url: str = DEFAULT_BASE_URL, **kwargs
21
+ ) -> AuthenticatedClient:
22
+ """A client that sends ``api_key`` as the ``X-API-Key`` header on every call.
23
+
24
+ Create a key at https://melodai.ai/app/api-keys. Extra keyword arguments
25
+ (``timeout``, ``headers``, ``raise_on_unexpected_status``, ...) are passed
26
+ to :class:`AuthenticatedClient`.
27
+ """
28
+ if not api_key:
29
+ raise ValueError(
30
+ "melodai: api_key is required (create one at https://melodai.ai/app/api-keys)"
31
+ )
32
+ return AuthenticatedClient(
33
+ base_url=base_url,
34
+ token=api_key,
35
+ prefix="",
36
+ auth_header_name="X-API-Key",
37
+ **kwargs,
38
+ )
39
+
40
+
41
+ __all__ = (
42
+ "DEFAULT_BASE_URL",
43
+ "AuthenticatedClient",
44
+ "Client",
45
+ "create_client",
46
+ )
@@ -0,0 +1 @@
1
+ """Contains methods for accessing the API"""
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,169 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx2
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error_envelope import ErrorEnvelope
9
+ from ...types import Response
10
+
11
+
12
+ def _get_kwargs() -> dict[str, Any]:
13
+
14
+ _kwargs: dict[str, Any] = {
15
+ "method": "get",
16
+ "url": "/me",
17
+ }
18
+
19
+ return _kwargs
20
+
21
+
22
+ def _parse_response(
23
+ *, client: AuthenticatedClient | Client, response: httpx2.Response
24
+ ) -> Any | ErrorEnvelope | None:
25
+ if response.status_code == 200:
26
+ response_200 = response.json()
27
+ return response_200
28
+
29
+ if response.status_code == 401:
30
+ response_401 = ErrorEnvelope.from_dict(response.json())
31
+
32
+ return response_401
33
+
34
+ if response.status_code == 403:
35
+ response_403 = ErrorEnvelope.from_dict(response.json())
36
+
37
+ return response_403
38
+
39
+ if response.status_code == 404:
40
+ response_404 = ErrorEnvelope.from_dict(response.json())
41
+
42
+ return response_404
43
+
44
+ if response.status_code == 422:
45
+ response_422 = ErrorEnvelope.from_dict(response.json())
46
+
47
+ return response_422
48
+
49
+ if response.status_code == 429:
50
+ response_429 = ErrorEnvelope.from_dict(response.json())
51
+
52
+ return response_429
53
+
54
+ if response.status_code == 503:
55
+ response_503 = ErrorEnvelope.from_dict(response.json())
56
+
57
+ return response_503
58
+
59
+ if client.raise_on_unexpected_status:
60
+ raise errors.UnexpectedStatus(response.status_code, response.content)
61
+ else:
62
+ return None
63
+
64
+
65
+ def _build_response(
66
+ *, client: AuthenticatedClient | Client, response: httpx2.Response
67
+ ) -> Response[Any | ErrorEnvelope]:
68
+ return Response(
69
+ status_code=HTTPStatus(response.status_code),
70
+ content=response.content,
71
+ headers=response.headers,
72
+ parsed=_parse_response(client=client, response=response),
73
+ )
74
+
75
+
76
+ def sync_detailed(
77
+ *,
78
+ client: AuthenticatedClient | Client,
79
+ ) -> Response[Any | ErrorEnvelope]:
80
+ """Get your account
81
+
82
+ Plan, API-spendable credits (plan + purchased), tab credits, rate tier, and the key's daily spend
83
+ cap with what it has spent today (UTC). Free.
84
+
85
+ Raises:
86
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
87
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
88
+
89
+ Returns:
90
+ Response[Any | ErrorEnvelope]
91
+ """
92
+
93
+ kwargs = _get_kwargs()
94
+
95
+ response = client.get_httpx_client().request(
96
+ **kwargs,
97
+ )
98
+
99
+ return _build_response(client=client, response=response)
100
+
101
+
102
+ def sync(
103
+ *,
104
+ client: AuthenticatedClient | Client,
105
+ ) -> Any | ErrorEnvelope | None:
106
+ """Get your account
107
+
108
+ Plan, API-spendable credits (plan + purchased), tab credits, rate tier, and the key's daily spend
109
+ cap with what it has spent today (UTC). Free.
110
+
111
+ Raises:
112
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
113
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
114
+
115
+ Returns:
116
+ Any | ErrorEnvelope
117
+ """
118
+
119
+ return sync_detailed(
120
+ client=client,
121
+ ).parsed
122
+
123
+
124
+ async def asyncio_detailed(
125
+ *,
126
+ client: AuthenticatedClient | Client,
127
+ ) -> Response[Any | ErrorEnvelope]:
128
+ """Get your account
129
+
130
+ Plan, API-spendable credits (plan + purchased), tab credits, rate tier, and the key's daily spend
131
+ cap with what it has spent today (UTC). Free.
132
+
133
+ Raises:
134
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
135
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
136
+
137
+ Returns:
138
+ Response[Any | ErrorEnvelope]
139
+ """
140
+
141
+ kwargs = _get_kwargs()
142
+
143
+ response = await client.get_async_httpx_client().request(**kwargs)
144
+
145
+ return _build_response(client=client, response=response)
146
+
147
+
148
+ async def asyncio(
149
+ *,
150
+ client: AuthenticatedClient | Client,
151
+ ) -> Any | ErrorEnvelope | None:
152
+ """Get your account
153
+
154
+ Plan, API-spendable credits (plan + purchased), tab credits, rate tier, and the key's daily spend
155
+ cap with what it has spent today (UTC). Free.
156
+
157
+ Raises:
158
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
159
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
160
+
161
+ Returns:
162
+ Any | ErrorEnvelope
163
+ """
164
+
165
+ return (
166
+ await asyncio_detailed(
167
+ client=client,
168
+ )
169
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,217 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx2
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.album_create_public import AlbumCreatePublic
9
+ from ...models.error_envelope import ErrorEnvelope
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ body: AlbumCreatePublic,
16
+ idempotency_key: str | Unset = UNSET,
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+ if not isinstance(idempotency_key, Unset):
20
+ headers["Idempotency-Key"] = idempotency_key
21
+
22
+ _kwargs: dict[str, Any] = {
23
+ "method": "post",
24
+ "url": "/albums",
25
+ }
26
+
27
+ _kwargs["json"] = body.to_dict()
28
+
29
+ headers["Content-Type"] = "application/json"
30
+
31
+ _kwargs["headers"] = headers
32
+ return _kwargs
33
+
34
+
35
+ def _parse_response(
36
+ *, client: AuthenticatedClient | Client, response: httpx2.Response
37
+ ) -> Any | ErrorEnvelope | None:
38
+ if response.status_code == 201:
39
+ response_201 = response.json()
40
+ return response_201
41
+
42
+ if response.status_code == 401:
43
+ response_401 = ErrorEnvelope.from_dict(response.json())
44
+
45
+ return response_401
46
+
47
+ if response.status_code == 402:
48
+ response_402 = ErrorEnvelope.from_dict(response.json())
49
+
50
+ return response_402
51
+
52
+ if response.status_code == 403:
53
+ response_403 = ErrorEnvelope.from_dict(response.json())
54
+
55
+ return response_403
56
+
57
+ if response.status_code == 409:
58
+ response_409 = ErrorEnvelope.from_dict(response.json())
59
+
60
+ return response_409
61
+
62
+ if response.status_code == 422:
63
+ response_422 = ErrorEnvelope.from_dict(response.json())
64
+
65
+ return response_422
66
+
67
+ if response.status_code == 429:
68
+ response_429 = ErrorEnvelope.from_dict(response.json())
69
+
70
+ return response_429
71
+
72
+ if response.status_code == 503:
73
+ response_503 = ErrorEnvelope.from_dict(response.json())
74
+
75
+ return response_503
76
+
77
+ if client.raise_on_unexpected_status:
78
+ raise errors.UnexpectedStatus(response.status_code, response.content)
79
+ else:
80
+ return None
81
+
82
+
83
+ def _build_response(
84
+ *, client: AuthenticatedClient | Client, response: httpx2.Response
85
+ ) -> Response[Any | ErrorEnvelope]:
86
+ return Response(
87
+ status_code=HTTPStatus(response.status_code),
88
+ content=response.content,
89
+ headers=response.headers,
90
+ parsed=_parse_response(client=client, response=response),
91
+ )
92
+
93
+
94
+ def sync_detailed(
95
+ *,
96
+ client: AuthenticatedClient | Client,
97
+ body: AlbumCreatePublic,
98
+ idempotency_key: str | Unset = UNSET,
99
+ ) -> Response[Any | ErrorEnvelope]:
100
+ """Create an album
101
+
102
+ Create an empty album; add songs with PUT /albums/{album_id}/songs. Free.
103
+
104
+ Args:
105
+ idempotency_key (str | Unset):
106
+ body (AlbumCreatePublic):
107
+
108
+ Raises:
109
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
110
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
111
+
112
+ Returns:
113
+ Response[Any | ErrorEnvelope]
114
+ """
115
+
116
+ kwargs = _get_kwargs(
117
+ body=body,
118
+ idempotency_key=idempotency_key,
119
+ )
120
+
121
+ response = client.get_httpx_client().request(
122
+ **kwargs,
123
+ )
124
+
125
+ return _build_response(client=client, response=response)
126
+
127
+
128
+ def sync(
129
+ *,
130
+ client: AuthenticatedClient | Client,
131
+ body: AlbumCreatePublic,
132
+ idempotency_key: str | Unset = UNSET,
133
+ ) -> Any | ErrorEnvelope | None:
134
+ """Create an album
135
+
136
+ Create an empty album; add songs with PUT /albums/{album_id}/songs. Free.
137
+
138
+ Args:
139
+ idempotency_key (str | Unset):
140
+ body (AlbumCreatePublic):
141
+
142
+ Raises:
143
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
144
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
145
+
146
+ Returns:
147
+ Any | ErrorEnvelope
148
+ """
149
+
150
+ return sync_detailed(
151
+ client=client,
152
+ body=body,
153
+ idempotency_key=idempotency_key,
154
+ ).parsed
155
+
156
+
157
+ async def asyncio_detailed(
158
+ *,
159
+ client: AuthenticatedClient | Client,
160
+ body: AlbumCreatePublic,
161
+ idempotency_key: str | Unset = UNSET,
162
+ ) -> Response[Any | ErrorEnvelope]:
163
+ """Create an album
164
+
165
+ Create an empty album; add songs with PUT /albums/{album_id}/songs. Free.
166
+
167
+ Args:
168
+ idempotency_key (str | Unset):
169
+ body (AlbumCreatePublic):
170
+
171
+ Raises:
172
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
173
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
174
+
175
+ Returns:
176
+ Response[Any | ErrorEnvelope]
177
+ """
178
+
179
+ kwargs = _get_kwargs(
180
+ body=body,
181
+ idempotency_key=idempotency_key,
182
+ )
183
+
184
+ response = await client.get_async_httpx_client().request(**kwargs)
185
+
186
+ return _build_response(client=client, response=response)
187
+
188
+
189
+ async def asyncio(
190
+ *,
191
+ client: AuthenticatedClient | Client,
192
+ body: AlbumCreatePublic,
193
+ idempotency_key: str | Unset = UNSET,
194
+ ) -> Any | ErrorEnvelope | None:
195
+ """Create an album
196
+
197
+ Create an empty album; add songs with PUT /albums/{album_id}/songs. Free.
198
+
199
+ Args:
200
+ idempotency_key (str | Unset):
201
+ body (AlbumCreatePublic):
202
+
203
+ Raises:
204
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
205
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
206
+
207
+ Returns:
208
+ Any | ErrorEnvelope
209
+ """
210
+
211
+ return (
212
+ await asyncio_detailed(
213
+ client=client,
214
+ body=body,
215
+ idempotency_key=idempotency_key,
216
+ )
217
+ ).parsed
@@ -0,0 +1,227 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+ from urllib.parse import quote
4
+
5
+ import httpx2
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.error_envelope import ErrorEnvelope
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ album_id: str,
15
+ *,
16
+ idempotency_key: str | Unset = UNSET,
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+ if not isinstance(idempotency_key, Unset):
20
+ headers["Idempotency-Key"] = idempotency_key
21
+
22
+ _kwargs: dict[str, Any] = {
23
+ "method": "post",
24
+ "url": "/albums/{album_id}/art".format(
25
+ album_id=quote(str(album_id), safe=""),
26
+ ),
27
+ }
28
+
29
+ _kwargs["headers"] = headers
30
+ return _kwargs
31
+
32
+
33
+ def _parse_response(
34
+ *, client: AuthenticatedClient | Client, response: httpx2.Response
35
+ ) -> Any | ErrorEnvelope | None:
36
+ if response.status_code == 200:
37
+ response_200 = response.json()
38
+ return response_200
39
+
40
+ if response.status_code == 401:
41
+ response_401 = ErrorEnvelope.from_dict(response.json())
42
+
43
+ return response_401
44
+
45
+ if response.status_code == 402:
46
+ response_402 = ErrorEnvelope.from_dict(response.json())
47
+
48
+ return response_402
49
+
50
+ if response.status_code == 403:
51
+ response_403 = ErrorEnvelope.from_dict(response.json())
52
+
53
+ return response_403
54
+
55
+ if response.status_code == 409:
56
+ response_409 = ErrorEnvelope.from_dict(response.json())
57
+
58
+ return response_409
59
+
60
+ if response.status_code == 422:
61
+ response_422 = ErrorEnvelope.from_dict(response.json())
62
+
63
+ return response_422
64
+
65
+ if response.status_code == 429:
66
+ response_429 = ErrorEnvelope.from_dict(response.json())
67
+
68
+ return response_429
69
+
70
+ if response.status_code == 503:
71
+ response_503 = ErrorEnvelope.from_dict(response.json())
72
+
73
+ return response_503
74
+
75
+ if client.raise_on_unexpected_status:
76
+ raise errors.UnexpectedStatus(response.status_code, response.content)
77
+ else:
78
+ return None
79
+
80
+
81
+ def _build_response(
82
+ *, client: AuthenticatedClient | Client, response: httpx2.Response
83
+ ) -> Response[Any | ErrorEnvelope]:
84
+ return Response(
85
+ status_code=HTTPStatus(response.status_code),
86
+ content=response.content,
87
+ headers=response.headers,
88
+ parsed=_parse_response(client=client, response=response),
89
+ )
90
+
91
+
92
+ def sync_detailed(
93
+ album_id: str,
94
+ *,
95
+ client: AuthenticatedClient | Client,
96
+ idempotency_key: str | Unset = UNSET,
97
+ ) -> Response[Any | ErrorEnvelope]:
98
+ """Generate album art
99
+
100
+ AI cover art for an album you own, inspired by its name and first songs. Costs 2 credits; runs in
101
+ the background ({"status": "queued"}): poll GET /albums/{album_id} (art_status, art_url, cover_url)
102
+ or get an album_art.done / album_art.failed webhook. A failed generation refunds the credits. Art
103
+ already in progress returns 409 art_in_progress. At most 3 requests per minute.
104
+
105
+ Args:
106
+ album_id (str):
107
+ idempotency_key (str | Unset):
108
+
109
+ Raises:
110
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
111
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
112
+
113
+ Returns:
114
+ Response[Any | ErrorEnvelope]
115
+ """
116
+
117
+ kwargs = _get_kwargs(
118
+ album_id=album_id,
119
+ idempotency_key=idempotency_key,
120
+ )
121
+
122
+ response = client.get_httpx_client().request(
123
+ **kwargs,
124
+ )
125
+
126
+ return _build_response(client=client, response=response)
127
+
128
+
129
+ def sync(
130
+ album_id: str,
131
+ *,
132
+ client: AuthenticatedClient | Client,
133
+ idempotency_key: str | Unset = UNSET,
134
+ ) -> Any | ErrorEnvelope | None:
135
+ """Generate album art
136
+
137
+ AI cover art for an album you own, inspired by its name and first songs. Costs 2 credits; runs in
138
+ the background ({"status": "queued"}): poll GET /albums/{album_id} (art_status, art_url, cover_url)
139
+ or get an album_art.done / album_art.failed webhook. A failed generation refunds the credits. Art
140
+ already in progress returns 409 art_in_progress. At most 3 requests per minute.
141
+
142
+ Args:
143
+ album_id (str):
144
+ idempotency_key (str | Unset):
145
+
146
+ Raises:
147
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
148
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
149
+
150
+ Returns:
151
+ Any | ErrorEnvelope
152
+ """
153
+
154
+ return sync_detailed(
155
+ album_id=album_id,
156
+ client=client,
157
+ idempotency_key=idempotency_key,
158
+ ).parsed
159
+
160
+
161
+ async def asyncio_detailed(
162
+ album_id: str,
163
+ *,
164
+ client: AuthenticatedClient | Client,
165
+ idempotency_key: str | Unset = UNSET,
166
+ ) -> Response[Any | ErrorEnvelope]:
167
+ """Generate album art
168
+
169
+ AI cover art for an album you own, inspired by its name and first songs. Costs 2 credits; runs in
170
+ the background ({"status": "queued"}): poll GET /albums/{album_id} (art_status, art_url, cover_url)
171
+ or get an album_art.done / album_art.failed webhook. A failed generation refunds the credits. Art
172
+ already in progress returns 409 art_in_progress. At most 3 requests per minute.
173
+
174
+ Args:
175
+ album_id (str):
176
+ idempotency_key (str | Unset):
177
+
178
+ Raises:
179
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
180
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
181
+
182
+ Returns:
183
+ Response[Any | ErrorEnvelope]
184
+ """
185
+
186
+ kwargs = _get_kwargs(
187
+ album_id=album_id,
188
+ idempotency_key=idempotency_key,
189
+ )
190
+
191
+ response = await client.get_async_httpx_client().request(**kwargs)
192
+
193
+ return _build_response(client=client, response=response)
194
+
195
+
196
+ async def asyncio(
197
+ album_id: str,
198
+ *,
199
+ client: AuthenticatedClient | Client,
200
+ idempotency_key: str | Unset = UNSET,
201
+ ) -> Any | ErrorEnvelope | None:
202
+ """Generate album art
203
+
204
+ AI cover art for an album you own, inspired by its name and first songs. Costs 2 credits; runs in
205
+ the background ({"status": "queued"}): poll GET /albums/{album_id} (art_status, art_url, cover_url)
206
+ or get an album_art.done / album_art.failed webhook. A failed generation refunds the credits. Art
207
+ already in progress returns 409 art_in_progress. At most 3 requests per minute.
208
+
209
+ Args:
210
+ album_id (str):
211
+ idempotency_key (str | Unset):
212
+
213
+ Raises:
214
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
215
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
216
+
217
+ Returns:
218
+ Any | ErrorEnvelope
219
+ """
220
+
221
+ return (
222
+ await asyncio_detailed(
223
+ album_id=album_id,
224
+ client=client,
225
+ idempotency_key=idempotency_key,
226
+ )
227
+ ).parsed