cartesia 1.3.1__py3-none-any.whl → 2.0.0a0__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 (174) hide show
  1. cartesia/__init__.py +288 -3
  2. cartesia/api_status/__init__.py +6 -0
  3. cartesia/api_status/client.py +104 -0
  4. cartesia/api_status/requests/__init__.py +5 -0
  5. cartesia/api_status/requests/api_info.py +8 -0
  6. cartesia/api_status/types/__init__.py +5 -0
  7. cartesia/api_status/types/api_info.py +20 -0
  8. cartesia/base_client.py +160 -0
  9. cartesia/client.py +163 -40
  10. cartesia/core/__init__.py +47 -0
  11. cartesia/core/api_error.py +15 -0
  12. cartesia/core/client_wrapper.py +55 -0
  13. cartesia/core/datetime_utils.py +28 -0
  14. cartesia/core/file.py +67 -0
  15. cartesia/core/http_client.py +499 -0
  16. cartesia/core/jsonable_encoder.py +101 -0
  17. cartesia/core/pydantic_utilities.py +296 -0
  18. cartesia/core/query_encoder.py +58 -0
  19. cartesia/core/remove_none_from_dict.py +11 -0
  20. cartesia/core/request_options.py +35 -0
  21. cartesia/core/serialization.py +272 -0
  22. cartesia/datasets/__init__.py +24 -0
  23. cartesia/datasets/client.py +422 -0
  24. cartesia/datasets/requests/__init__.py +15 -0
  25. cartesia/datasets/requests/create_dataset_request.py +7 -0
  26. cartesia/datasets/requests/dataset.py +9 -0
  27. cartesia/datasets/requests/dataset_file.py +9 -0
  28. cartesia/datasets/requests/paginated_dataset_files.py +10 -0
  29. cartesia/datasets/requests/paginated_datasets.py +10 -0
  30. cartesia/datasets/types/__init__.py +17 -0
  31. cartesia/datasets/types/create_dataset_request.py +19 -0
  32. cartesia/datasets/types/dataset.py +21 -0
  33. cartesia/datasets/types/dataset_file.py +21 -0
  34. cartesia/datasets/types/file_purpose.py +5 -0
  35. cartesia/datasets/types/paginated_dataset_files.py +21 -0
  36. cartesia/datasets/types/paginated_datasets.py +21 -0
  37. cartesia/embedding/__init__.py +5 -0
  38. cartesia/embedding/types/__init__.py +5 -0
  39. cartesia/embedding/types/embedding.py +201 -0
  40. cartesia/environment.py +7 -0
  41. cartesia/infill/__init__.py +2 -0
  42. cartesia/infill/client.py +294 -0
  43. cartesia/tts/__init__.py +167 -0
  44. cartesia/{_async_websocket.py → tts/_async_websocket.py} +159 -84
  45. cartesia/tts/_websocket.py +430 -0
  46. cartesia/tts/client.py +407 -0
  47. cartesia/tts/requests/__init__.py +76 -0
  48. cartesia/tts/requests/cancel_context_request.py +17 -0
  49. cartesia/tts/requests/controls.py +11 -0
  50. cartesia/tts/requests/generation_request.py +53 -0
  51. cartesia/tts/requests/mp_3_output_format.py +11 -0
  52. cartesia/tts/requests/output_format.py +30 -0
  53. cartesia/tts/requests/phoneme_timestamps.py +10 -0
  54. cartesia/tts/requests/raw_output_format.py +11 -0
  55. cartesia/tts/requests/speed.py +7 -0
  56. cartesia/tts/requests/tts_request.py +24 -0
  57. cartesia/tts/requests/tts_request_embedding_specifier.py +16 -0
  58. cartesia/tts/requests/tts_request_id_specifier.py +16 -0
  59. cartesia/tts/requests/tts_request_voice_specifier.py +7 -0
  60. cartesia/tts/requests/wav_output_format.py +7 -0
  61. cartesia/tts/requests/web_socket_base_response.py +11 -0
  62. cartesia/tts/requests/web_socket_chunk_response.py +8 -0
  63. cartesia/tts/requests/web_socket_done_response.py +7 -0
  64. cartesia/tts/requests/web_socket_error_response.py +7 -0
  65. cartesia/tts/requests/web_socket_flush_done_response.py +9 -0
  66. cartesia/tts/requests/web_socket_phoneme_timestamps_response.py +9 -0
  67. cartesia/tts/requests/web_socket_raw_output_format.py +11 -0
  68. cartesia/tts/requests/web_socket_request.py +7 -0
  69. cartesia/tts/requests/web_socket_response.py +69 -0
  70. cartesia/tts/requests/web_socket_stream_options.py +8 -0
  71. cartesia/tts/requests/web_socket_timestamps_response.py +9 -0
  72. cartesia/tts/requests/web_socket_tts_output.py +18 -0
  73. cartesia/tts/requests/web_socket_tts_request.py +24 -0
  74. cartesia/tts/requests/word_timestamps.py +10 -0
  75. cartesia/tts/socket_client.py +302 -0
  76. cartesia/tts/types/__init__.py +90 -0
  77. cartesia/tts/types/cancel_context_request.py +28 -0
  78. cartesia/tts/types/context_id.py +3 -0
  79. cartesia/tts/types/controls.py +22 -0
  80. cartesia/tts/types/emotion.py +29 -0
  81. cartesia/tts/types/flush_id.py +3 -0
  82. cartesia/tts/types/generation_request.py +66 -0
  83. cartesia/tts/types/mp_3_output_format.py +23 -0
  84. cartesia/tts/types/natural_specifier.py +5 -0
  85. cartesia/tts/types/numerical_specifier.py +3 -0
  86. cartesia/tts/types/output_format.py +58 -0
  87. cartesia/tts/types/phoneme_timestamps.py +21 -0
  88. cartesia/tts/types/raw_encoding.py +5 -0
  89. cartesia/tts/types/raw_output_format.py +22 -0
  90. cartesia/tts/types/speed.py +7 -0
  91. cartesia/tts/types/supported_language.py +7 -0
  92. cartesia/tts/types/tts_request.py +35 -0
  93. cartesia/tts/types/tts_request_embedding_specifier.py +27 -0
  94. cartesia/tts/types/tts_request_id_specifier.py +27 -0
  95. cartesia/tts/types/tts_request_voice_specifier.py +7 -0
  96. cartesia/tts/types/wav_output_format.py +17 -0
  97. cartesia/tts/types/web_socket_base_response.py +22 -0
  98. cartesia/tts/types/web_socket_chunk_response.py +20 -0
  99. cartesia/tts/types/web_socket_done_response.py +17 -0
  100. cartesia/tts/types/web_socket_error_response.py +19 -0
  101. cartesia/tts/types/web_socket_flush_done_response.py +21 -0
  102. cartesia/tts/types/web_socket_phoneme_timestamps_response.py +20 -0
  103. cartesia/tts/types/web_socket_raw_output_format.py +22 -0
  104. cartesia/tts/types/web_socket_request.py +7 -0
  105. cartesia/tts/types/web_socket_response.py +124 -0
  106. cartesia/tts/types/web_socket_stream_options.py +19 -0
  107. cartesia/tts/types/web_socket_timestamps_response.py +20 -0
  108. cartesia/tts/types/web_socket_tts_output.py +27 -0
  109. cartesia/tts/types/web_socket_tts_request.py +36 -0
  110. cartesia/tts/types/word_timestamps.py +21 -0
  111. cartesia/tts/utils/tts.py +64 -0
  112. cartesia/tts/utils/types.py +70 -0
  113. cartesia/version.py +3 -1
  114. cartesia/voice_changer/__init__.py +27 -0
  115. cartesia/voice_changer/client.py +395 -0
  116. cartesia/voice_changer/requests/__init__.py +15 -0
  117. cartesia/voice_changer/requests/streaming_response.py +36 -0
  118. cartesia/voice_changer/types/__init__.py +17 -0
  119. cartesia/voice_changer/types/output_format_container.py +5 -0
  120. cartesia/voice_changer/types/streaming_response.py +62 -0
  121. cartesia/voices/__init__.py +67 -0
  122. cartesia/voices/client.py +1812 -0
  123. cartesia/voices/requests/__init__.py +27 -0
  124. cartesia/voices/requests/create_voice_request.py +21 -0
  125. cartesia/voices/requests/embedding_response.py +8 -0
  126. cartesia/voices/requests/embedding_specifier.py +10 -0
  127. cartesia/voices/requests/id_specifier.py +10 -0
  128. cartesia/voices/requests/localize_dialect.py +6 -0
  129. cartesia/voices/requests/localize_voice_request.py +15 -0
  130. cartesia/voices/requests/mix_voice_specifier.py +7 -0
  131. cartesia/voices/requests/mix_voices_request.py +9 -0
  132. cartesia/voices/requests/update_voice_request.py +15 -0
  133. cartesia/voices/requests/voice.py +39 -0
  134. cartesia/voices/requests/voice_metadata.py +36 -0
  135. cartesia/voices/types/__init__.py +41 -0
  136. cartesia/voices/types/base_voice_id.py +5 -0
  137. cartesia/voices/types/clone_mode.py +5 -0
  138. cartesia/voices/types/create_voice_request.py +32 -0
  139. cartesia/voices/types/embedding_response.py +20 -0
  140. cartesia/voices/types/embedding_specifier.py +22 -0
  141. cartesia/voices/types/gender.py +5 -0
  142. cartesia/voices/types/id_specifier.py +22 -0
  143. cartesia/voices/types/localize_dialect.py +6 -0
  144. cartesia/voices/types/localize_english_dialect.py +5 -0
  145. cartesia/voices/types/localize_target_language.py +7 -0
  146. cartesia/voices/types/localize_voice_request.py +26 -0
  147. cartesia/voices/types/mix_voice_specifier.py +7 -0
  148. cartesia/voices/types/mix_voices_request.py +20 -0
  149. cartesia/voices/types/update_voice_request.py +27 -0
  150. cartesia/voices/types/voice.py +50 -0
  151. cartesia/voices/types/voice_id.py +3 -0
  152. cartesia/voices/types/voice_metadata.py +48 -0
  153. cartesia/voices/types/weight.py +3 -0
  154. cartesia-2.0.0a0.dist-info/METADATA +306 -0
  155. cartesia-2.0.0a0.dist-info/RECORD +158 -0
  156. {cartesia-1.3.1.dist-info → cartesia-2.0.0a0.dist-info}/WHEEL +1 -1
  157. cartesia/_async_sse.py +0 -95
  158. cartesia/_logger.py +0 -3
  159. cartesia/_sse.py +0 -143
  160. cartesia/_types.py +0 -70
  161. cartesia/_websocket.py +0 -358
  162. cartesia/async_client.py +0 -82
  163. cartesia/async_tts.py +0 -63
  164. cartesia/resource.py +0 -44
  165. cartesia/tts.py +0 -137
  166. cartesia/utils/deprecated.py +0 -55
  167. cartesia/utils/retry.py +0 -87
  168. cartesia/utils/tts.py +0 -78
  169. cartesia/voices.py +0 -208
  170. cartesia-1.3.1.dist-info/METADATA +0 -661
  171. cartesia-1.3.1.dist-info/RECORD +0 -23
  172. cartesia-1.3.1.dist-info/licenses/LICENSE.md +0 -21
  173. /cartesia/{utils/__init__.py → py.typed} +0 -0
  174. /cartesia/{_constants.py → tts/utils/constants.py} +0 -0
cartesia/__init__.py CHANGED
@@ -1,4 +1,289 @@
1
- from cartesia.async_client import AsyncCartesia
2
- from cartesia.client import Cartesia
1
+ # This file was auto-generated by Fern from our API Definition.
3
2
 
4
- __all__ = ["Cartesia", "AsyncCartesia"]
3
+ from . import api_status, datasets, embedding, infill, tts, voice_changer, voices
4
+ from .api_status import ApiInfo, ApiInfoParams
5
+ from .client import AsyncCartesia, Cartesia
6
+ from .datasets import (
7
+ CreateDatasetRequest,
8
+ CreateDatasetRequestParams,
9
+ Dataset,
10
+ DatasetFile,
11
+ DatasetFileParams,
12
+ DatasetParams,
13
+ FilePurpose,
14
+ PaginatedDatasetFiles,
15
+ PaginatedDatasetFilesParams,
16
+ PaginatedDatasets,
17
+ PaginatedDatasetsParams,
18
+ )
19
+ from .embedding import Embedding
20
+ from .environment import CartesiaEnvironment
21
+ from .tts import (
22
+ CancelContextRequest,
23
+ CancelContextRequestParams,
24
+ ContextId,
25
+ Controls,
26
+ ControlsParams,
27
+ Emotion,
28
+ FlushId,
29
+ GenerationRequest,
30
+ GenerationRequestParams,
31
+ Mp3OutputFormat,
32
+ Mp3OutputFormatParams,
33
+ NaturalSpecifier,
34
+ NumericalSpecifier,
35
+ OutputFormat,
36
+ OutputFormatParams,
37
+ OutputFormat_Mp3,
38
+ OutputFormat_Mp3Params,
39
+ OutputFormat_Raw,
40
+ OutputFormat_RawParams,
41
+ OutputFormat_Wav,
42
+ OutputFormat_WavParams,
43
+ PhonemeTimestamps,
44
+ PhonemeTimestampsParams,
45
+ RawEncoding,
46
+ RawOutputFormat,
47
+ RawOutputFormatParams,
48
+ Speed,
49
+ SpeedParams,
50
+ SupportedLanguage,
51
+ TtsRequest,
52
+ TtsRequestEmbeddingSpecifier,
53
+ TtsRequestEmbeddingSpecifierParams,
54
+ TtsRequestIdSpecifier,
55
+ TtsRequestIdSpecifierParams,
56
+ TtsRequestParams,
57
+ TtsRequestVoiceSpecifier,
58
+ TtsRequestVoiceSpecifierParams,
59
+ WavOutputFormat,
60
+ WavOutputFormatParams,
61
+ WebSocketBaseResponse,
62
+ WebSocketBaseResponseParams,
63
+ WebSocketChunkResponse,
64
+ WebSocketChunkResponseParams,
65
+ WebSocketDoneResponse,
66
+ WebSocketDoneResponseParams,
67
+ WebSocketErrorResponse,
68
+ WebSocketErrorResponseParams,
69
+ WebSocketFlushDoneResponse,
70
+ WebSocketFlushDoneResponseParams,
71
+ WebSocketPhonemeTimestampsResponse,
72
+ WebSocketPhonemeTimestampsResponseParams,
73
+ WebSocketRawOutputFormat,
74
+ WebSocketRawOutputFormatParams,
75
+ WebSocketRequest,
76
+ WebSocketRequestParams,
77
+ WebSocketResponse,
78
+ WebSocketResponseParams,
79
+ WebSocketResponse_Chunk,
80
+ WebSocketResponse_ChunkParams,
81
+ WebSocketResponse_Done,
82
+ WebSocketResponse_DoneParams,
83
+ WebSocketResponse_Error,
84
+ WebSocketResponse_ErrorParams,
85
+ WebSocketResponse_FlushDone,
86
+ WebSocketResponse_FlushDoneParams,
87
+ WebSocketResponse_PhonemeTimestamps,
88
+ WebSocketResponse_PhonemeTimestampsParams,
89
+ WebSocketResponse_Timestamps,
90
+ WebSocketResponse_TimestampsParams,
91
+ WebSocketStreamOptions,
92
+ WebSocketStreamOptionsParams,
93
+ WebSocketTimestampsResponse,
94
+ WebSocketTimestampsResponseParams,
95
+ WebSocketTtsOutput,
96
+ WebSocketTtsOutputParams,
97
+ WebSocketTtsRequest,
98
+ WebSocketTtsRequestParams,
99
+ WordTimestamps,
100
+ WordTimestampsParams,
101
+ )
102
+ from .version import __version__
103
+ from .voice_changer import (
104
+ OutputFormatContainer,
105
+ StreamingResponse,
106
+ StreamingResponseParams,
107
+ StreamingResponse_Chunk,
108
+ StreamingResponse_ChunkParams,
109
+ StreamingResponse_Done,
110
+ StreamingResponse_DoneParams,
111
+ StreamingResponse_Error,
112
+ StreamingResponse_ErrorParams,
113
+ )
114
+ from .voices import (
115
+ BaseVoiceId,
116
+ CloneMode,
117
+ CreateVoiceRequest,
118
+ CreateVoiceRequestParams,
119
+ EmbeddingResponse,
120
+ EmbeddingResponseParams,
121
+ EmbeddingSpecifier,
122
+ EmbeddingSpecifierParams,
123
+ Gender,
124
+ IdSpecifier,
125
+ IdSpecifierParams,
126
+ LocalizeDialect,
127
+ LocalizeDialectParams,
128
+ LocalizeEnglishDialect,
129
+ LocalizeTargetLanguage,
130
+ LocalizeVoiceRequest,
131
+ LocalizeVoiceRequestParams,
132
+ MixVoiceSpecifier,
133
+ MixVoiceSpecifierParams,
134
+ MixVoicesRequest,
135
+ MixVoicesRequestParams,
136
+ UpdateVoiceRequest,
137
+ UpdateVoiceRequestParams,
138
+ Voice,
139
+ VoiceId,
140
+ VoiceMetadata,
141
+ VoiceMetadataParams,
142
+ VoiceParams,
143
+ Weight,
144
+ )
145
+
146
+ __all__ = [
147
+ "ApiInfo",
148
+ "ApiInfoParams",
149
+ "AsyncCartesia",
150
+ "BaseVoiceId",
151
+ "CancelContextRequest",
152
+ "CancelContextRequestParams",
153
+ "Cartesia",
154
+ "CartesiaEnvironment",
155
+ "CloneMode",
156
+ "ContextId",
157
+ "Controls",
158
+ "ControlsParams",
159
+ "CreateDatasetRequest",
160
+ "CreateDatasetRequestParams",
161
+ "CreateVoiceRequest",
162
+ "CreateVoiceRequestParams",
163
+ "Dataset",
164
+ "DatasetFile",
165
+ "DatasetFileParams",
166
+ "DatasetParams",
167
+ "Embedding",
168
+ "EmbeddingResponse",
169
+ "EmbeddingResponseParams",
170
+ "EmbeddingSpecifier",
171
+ "EmbeddingSpecifierParams",
172
+ "Emotion",
173
+ "FilePurpose",
174
+ "FlushId",
175
+ "Gender",
176
+ "GenerationRequest",
177
+ "GenerationRequestParams",
178
+ "IdSpecifier",
179
+ "IdSpecifierParams",
180
+ "LocalizeDialect",
181
+ "LocalizeDialectParams",
182
+ "LocalizeEnglishDialect",
183
+ "LocalizeTargetLanguage",
184
+ "LocalizeVoiceRequest",
185
+ "LocalizeVoiceRequestParams",
186
+ "MixVoiceSpecifier",
187
+ "MixVoiceSpecifierParams",
188
+ "MixVoicesRequest",
189
+ "MixVoicesRequestParams",
190
+ "Mp3OutputFormat",
191
+ "Mp3OutputFormatParams",
192
+ "NaturalSpecifier",
193
+ "NumericalSpecifier",
194
+ "OutputFormat",
195
+ "OutputFormatContainer",
196
+ "OutputFormatParams",
197
+ "OutputFormat_Mp3",
198
+ "OutputFormat_Mp3Params",
199
+ "OutputFormat_Raw",
200
+ "OutputFormat_RawParams",
201
+ "OutputFormat_Wav",
202
+ "OutputFormat_WavParams",
203
+ "PaginatedDatasetFiles",
204
+ "PaginatedDatasetFilesParams",
205
+ "PaginatedDatasets",
206
+ "PaginatedDatasetsParams",
207
+ "PhonemeTimestamps",
208
+ "PhonemeTimestampsParams",
209
+ "RawEncoding",
210
+ "RawOutputFormat",
211
+ "RawOutputFormatParams",
212
+ "Speed",
213
+ "SpeedParams",
214
+ "StreamingResponse",
215
+ "StreamingResponseParams",
216
+ "StreamingResponse_Chunk",
217
+ "StreamingResponse_ChunkParams",
218
+ "StreamingResponse_Done",
219
+ "StreamingResponse_DoneParams",
220
+ "StreamingResponse_Error",
221
+ "StreamingResponse_ErrorParams",
222
+ "SupportedLanguage",
223
+ "TtsRequest",
224
+ "TtsRequestEmbeddingSpecifier",
225
+ "TtsRequestEmbeddingSpecifierParams",
226
+ "TtsRequestIdSpecifier",
227
+ "TtsRequestIdSpecifierParams",
228
+ "TtsRequestParams",
229
+ "TtsRequestVoiceSpecifier",
230
+ "TtsRequestVoiceSpecifierParams",
231
+ "UpdateVoiceRequest",
232
+ "UpdateVoiceRequestParams",
233
+ "Voice",
234
+ "VoiceId",
235
+ "VoiceMetadata",
236
+ "VoiceMetadataParams",
237
+ "VoiceParams",
238
+ "WavOutputFormat",
239
+ "WavOutputFormatParams",
240
+ "WebSocketBaseResponse",
241
+ "WebSocketBaseResponseParams",
242
+ "WebSocketChunkResponse",
243
+ "WebSocketChunkResponseParams",
244
+ "WebSocketDoneResponse",
245
+ "WebSocketDoneResponseParams",
246
+ "WebSocketErrorResponse",
247
+ "WebSocketErrorResponseParams",
248
+ "WebSocketFlushDoneResponse",
249
+ "WebSocketFlushDoneResponseParams",
250
+ "WebSocketPhonemeTimestampsResponse",
251
+ "WebSocketPhonemeTimestampsResponseParams",
252
+ "WebSocketRawOutputFormat",
253
+ "WebSocketRawOutputFormatParams",
254
+ "WebSocketRequest",
255
+ "WebSocketRequestParams",
256
+ "WebSocketResponse",
257
+ "WebSocketResponseParams",
258
+ "WebSocketResponse_Chunk",
259
+ "WebSocketResponse_ChunkParams",
260
+ "WebSocketResponse_Done",
261
+ "WebSocketResponse_DoneParams",
262
+ "WebSocketResponse_Error",
263
+ "WebSocketResponse_ErrorParams",
264
+ "WebSocketResponse_FlushDone",
265
+ "WebSocketResponse_FlushDoneParams",
266
+ "WebSocketResponse_PhonemeTimestamps",
267
+ "WebSocketResponse_PhonemeTimestampsParams",
268
+ "WebSocketResponse_Timestamps",
269
+ "WebSocketResponse_TimestampsParams",
270
+ "WebSocketStreamOptions",
271
+ "WebSocketStreamOptionsParams",
272
+ "WebSocketTimestampsResponse",
273
+ "WebSocketTimestampsResponseParams",
274
+ "WebSocketTtsOutput",
275
+ "WebSocketTtsOutputParams",
276
+ "WebSocketTtsRequest",
277
+ "WebSocketTtsRequestParams",
278
+ "Weight",
279
+ "WordTimestamps",
280
+ "WordTimestampsParams",
281
+ "__version__",
282
+ "api_status",
283
+ "datasets",
284
+ "embedding",
285
+ "infill",
286
+ "tts",
287
+ "voice_changer",
288
+ "voices",
289
+ ]
@@ -0,0 +1,6 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import ApiInfo
4
+ from .requests import ApiInfoParams
5
+
6
+ __all__ = ["ApiInfo", "ApiInfoParams"]
@@ -0,0 +1,104 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.client_wrapper import SyncClientWrapper
4
+ import typing
5
+ from ..core.request_options import RequestOptions
6
+ from .types.api_info import ApiInfo
7
+ from ..core.pydantic_utilities import parse_obj_as
8
+ from json.decoder import JSONDecodeError
9
+ from ..core.api_error import ApiError
10
+ from ..core.client_wrapper import AsyncClientWrapper
11
+
12
+
13
+ class ApiStatusClient:
14
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
15
+ self._client_wrapper = client_wrapper
16
+
17
+ def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> ApiInfo:
18
+ """
19
+ Parameters
20
+ ----------
21
+ request_options : typing.Optional[RequestOptions]
22
+ Request-specific configuration.
23
+
24
+ Returns
25
+ -------
26
+ ApiInfo
27
+
28
+ Examples
29
+ --------
30
+ from cartesia import Cartesia
31
+
32
+ client = Cartesia(
33
+ api_key="YOUR_API_KEY",
34
+ )
35
+ client.api_status.get()
36
+ """
37
+ _response = self._client_wrapper.httpx_client.request(
38
+ method="GET",
39
+ request_options=request_options,
40
+ )
41
+ try:
42
+ if 200 <= _response.status_code < 300:
43
+ return typing.cast(
44
+ ApiInfo,
45
+ parse_obj_as(
46
+ type_=ApiInfo, # type: ignore
47
+ object_=_response.json(),
48
+ ),
49
+ )
50
+ _response_json = _response.json()
51
+ except JSONDecodeError:
52
+ raise ApiError(status_code=_response.status_code, body=_response.text)
53
+ raise ApiError(status_code=_response.status_code, body=_response_json)
54
+
55
+
56
+ class AsyncApiStatusClient:
57
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
58
+ self._client_wrapper = client_wrapper
59
+
60
+ async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> ApiInfo:
61
+ """
62
+ Parameters
63
+ ----------
64
+ request_options : typing.Optional[RequestOptions]
65
+ Request-specific configuration.
66
+
67
+ Returns
68
+ -------
69
+ ApiInfo
70
+
71
+ Examples
72
+ --------
73
+ import asyncio
74
+
75
+ from cartesia import AsyncCartesia
76
+
77
+ client = AsyncCartesia(
78
+ api_key="YOUR_API_KEY",
79
+ )
80
+
81
+
82
+ async def main() -> None:
83
+ await client.api_status.get()
84
+
85
+
86
+ asyncio.run(main())
87
+ """
88
+ _response = await self._client_wrapper.httpx_client.request(
89
+ method="GET",
90
+ request_options=request_options,
91
+ )
92
+ try:
93
+ if 200 <= _response.status_code < 300:
94
+ return typing.cast(
95
+ ApiInfo,
96
+ parse_obj_as(
97
+ type_=ApiInfo, # type: ignore
98
+ object_=_response.json(),
99
+ ),
100
+ )
101
+ _response_json = _response.json()
102
+ except JSONDecodeError:
103
+ raise ApiError(status_code=_response.status_code, body=_response.text)
104
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .api_info import ApiInfoParams
4
+
5
+ __all__ = ["ApiInfoParams"]
@@ -0,0 +1,8 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing_extensions
4
+
5
+
6
+ class ApiInfoParams(typing_extensions.TypedDict):
7
+ ok: bool
8
+ version: str
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .api_info import ApiInfo
4
+
5
+ __all__ = ["ApiInfo"]
@@ -0,0 +1,20 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.pydantic_utilities import UniversalBaseModel
4
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
5
+ import typing
6
+ import pydantic
7
+
8
+
9
+ class ApiInfo(UniversalBaseModel):
10
+ ok: bool
11
+ version: str
12
+
13
+ if IS_PYDANTIC_V2:
14
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
15
+ else:
16
+
17
+ class Config:
18
+ frozen = True
19
+ smart_union = True
20
+ extra = pydantic.Extra.allow
@@ -0,0 +1,160 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from .environment import CartesiaEnvironment
5
+ import httpx
6
+ from .core.client_wrapper import SyncClientWrapper
7
+ from .api_status.client import ApiStatusClient
8
+ from .datasets.client import DatasetsClient
9
+ from .infill.client import InfillClient
10
+ from .tts.client import TtsClient
11
+ from .voice_changer.client import VoiceChangerClient
12
+ from .voices.client import VoicesClient
13
+ from .core.client_wrapper import AsyncClientWrapper
14
+ from .api_status.client import AsyncApiStatusClient
15
+ from .datasets.client import AsyncDatasetsClient
16
+ from .infill.client import AsyncInfillClient
17
+ from .tts.client import AsyncTtsClient
18
+ from .voice_changer.client import AsyncVoiceChangerClient
19
+ from .voices.client import AsyncVoicesClient
20
+
21
+
22
+ class BaseCartesia:
23
+ """
24
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
25
+
26
+ Parameters
27
+ ----------
28
+ base_url : typing.Optional[str]
29
+ The base url to use for requests from the client.
30
+
31
+ environment : CartesiaEnvironment
32
+ The environment to use for requests from the client. from .environment import CartesiaEnvironment
33
+
34
+
35
+
36
+ Defaults to CartesiaEnvironment.PRODUCTION
37
+
38
+
39
+
40
+ api_key : str
41
+ timeout : typing.Optional[float]
42
+ The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
43
+
44
+ follow_redirects : typing.Optional[bool]
45
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
46
+
47
+ httpx_client : typing.Optional[httpx.Client]
48
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
49
+
50
+ Examples
51
+ --------
52
+ from cartesia import Cartesia
53
+
54
+ client = Cartesia(
55
+ api_key="YOUR_API_KEY",
56
+ )
57
+ """
58
+
59
+ def __init__(
60
+ self,
61
+ *,
62
+ base_url: typing.Optional[str] = None,
63
+ environment: CartesiaEnvironment = CartesiaEnvironment.PRODUCTION,
64
+ api_key: str,
65
+ timeout: typing.Optional[float] = None,
66
+ follow_redirects: typing.Optional[bool] = True,
67
+ httpx_client: typing.Optional[httpx.Client] = None,
68
+ ):
69
+ _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
70
+ self._client_wrapper = SyncClientWrapper(
71
+ base_url=_get_base_url(base_url=base_url, environment=environment),
72
+ api_key=api_key,
73
+ httpx_client=httpx_client
74
+ if httpx_client is not None
75
+ else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
76
+ if follow_redirects is not None
77
+ else httpx.Client(timeout=_defaulted_timeout),
78
+ timeout=_defaulted_timeout,
79
+ )
80
+ self.api_status = ApiStatusClient(client_wrapper=self._client_wrapper)
81
+ self.datasets = DatasetsClient(client_wrapper=self._client_wrapper)
82
+ self.infill = InfillClient(client_wrapper=self._client_wrapper)
83
+ self.tts = TtsClient(client_wrapper=self._client_wrapper)
84
+ self.voice_changer = VoiceChangerClient(client_wrapper=self._client_wrapper)
85
+ self.voices = VoicesClient(client_wrapper=self._client_wrapper)
86
+
87
+
88
+ class AsyncBaseCartesia:
89
+ """
90
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
91
+
92
+ Parameters
93
+ ----------
94
+ base_url : typing.Optional[str]
95
+ The base url to use for requests from the client.
96
+
97
+ environment : CartesiaEnvironment
98
+ The environment to use for requests from the client. from .environment import CartesiaEnvironment
99
+
100
+
101
+
102
+ Defaults to CartesiaEnvironment.PRODUCTION
103
+
104
+
105
+
106
+ api_key : str
107
+ timeout : typing.Optional[float]
108
+ The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
109
+
110
+ follow_redirects : typing.Optional[bool]
111
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
112
+
113
+ httpx_client : typing.Optional[httpx.AsyncClient]
114
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
115
+
116
+ Examples
117
+ --------
118
+ from cartesia import AsyncCartesia
119
+
120
+ client = AsyncCartesia(
121
+ api_key="YOUR_API_KEY",
122
+ )
123
+ """
124
+
125
+ def __init__(
126
+ self,
127
+ *,
128
+ base_url: typing.Optional[str] = None,
129
+ environment: CartesiaEnvironment = CartesiaEnvironment.PRODUCTION,
130
+ api_key: str,
131
+ timeout: typing.Optional[float] = None,
132
+ follow_redirects: typing.Optional[bool] = True,
133
+ httpx_client: typing.Optional[httpx.AsyncClient] = None,
134
+ ):
135
+ _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
136
+ self._client_wrapper = AsyncClientWrapper(
137
+ base_url=_get_base_url(base_url=base_url, environment=environment),
138
+ api_key=api_key,
139
+ httpx_client=httpx_client
140
+ if httpx_client is not None
141
+ else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
142
+ if follow_redirects is not None
143
+ else httpx.AsyncClient(timeout=_defaulted_timeout),
144
+ timeout=_defaulted_timeout,
145
+ )
146
+ self.api_status = AsyncApiStatusClient(client_wrapper=self._client_wrapper)
147
+ self.datasets = AsyncDatasetsClient(client_wrapper=self._client_wrapper)
148
+ self.infill = AsyncInfillClient(client_wrapper=self._client_wrapper)
149
+ self.tts = AsyncTtsClient(client_wrapper=self._client_wrapper)
150
+ self.voice_changer = AsyncVoiceChangerClient(client_wrapper=self._client_wrapper)
151
+ self.voices = AsyncVoicesClient(client_wrapper=self._client_wrapper)
152
+
153
+
154
+ def _get_base_url(*, base_url: typing.Optional[str] = None, environment: CartesiaEnvironment) -> str:
155
+ if base_url is not None:
156
+ return base_url
157
+ elif environment is not None:
158
+ return environment.value
159
+ else:
160
+ raise Exception("Please pass in either base_url or environment to construct the client")