├── .gitignore ├── LICENSE ├── README.md ├── kitsai ├── __init__.py ├── token.py ├── tts │ ├── create_tts.py │ ├── fetch_tts.py │ └── fetch_tts_by_id.py ├── vocal_separations │ ├── create_vocal_separation.py │ ├── fetch_vocal_separation_by_id.py │ └── fetch_vocal_separations.py ├── voice_conversions │ ├── create_voice_conversion.py │ ├── fetch_voice_conversion_by_id.py │ └── fetch_voice_conversions.py └── voice_models │ ├── fetch_voice_model_by_id.py │ └── fetch_voice_models.py └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | kitsai.egg-info 2 | dist 3 | build 4 | .venv -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Attribution-NonCommercial 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution-NonCommercial 4.0 International Public 58 | License 59 | 60 | By exercising the Licensed Rights (defined below), You accept and agree 61 | to be bound by the terms and conditions of this Creative Commons 62 | Attribution-NonCommercial 4.0 International Public License ("Public 63 | License"). To the extent this Public License may be interpreted as a 64 | contract, You are granted the Licensed Rights in consideration of Your 65 | acceptance of these terms and conditions, and the Licensor grants You 66 | such rights in consideration of benefits the Licensor receives from 67 | making the Licensed Material available under these terms and 68 | conditions. 69 | 70 | 71 | Section 1 -- Definitions. 72 | 73 | a. Adapted Material means material subject to Copyright and Similar 74 | Rights that is derived from or based upon the Licensed Material 75 | and in which the Licensed Material is translated, altered, 76 | arranged, transformed, or otherwise modified in a manner requiring 77 | permission under the Copyright and Similar Rights held by the 78 | Licensor. For purposes of this Public License, where the Licensed 79 | Material is a musical work, performance, or sound recording, 80 | Adapted Material is always produced where the Licensed Material is 81 | synched in timed relation with a moving image. 82 | 83 | b. Adapter's License means the license You apply to Your Copyright 84 | and Similar Rights in Your contributions to Adapted Material in 85 | accordance with the terms and conditions of this Public License. 86 | 87 | c. Copyright and Similar Rights means copyright and/or similar rights 88 | closely related to copyright including, without limitation, 89 | performance, broadcast, sound recording, and Sui Generis Database 90 | Rights, without regard to how the rights are labeled or 91 | categorized. For purposes of this Public License, the rights 92 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 93 | Rights. 94 | d. Effective Technological Measures means those measures that, in the 95 | absence of proper authority, may not be circumvented under laws 96 | fulfilling obligations under Article 11 of the WIPO Copyright 97 | Treaty adopted on December 20, 1996, and/or similar international 98 | agreements. 99 | 100 | e. Exceptions and Limitations means fair use, fair dealing, and/or 101 | any other exception or limitation to Copyright and Similar Rights 102 | that applies to Your use of the Licensed Material. 103 | 104 | f. Licensed Material means the artistic or literary work, database, 105 | or other material to which the Licensor applied this Public 106 | License. 107 | 108 | g. Licensed Rights means the rights granted to You subject to the 109 | terms and conditions of this Public License, which are limited to 110 | all Copyright and Similar Rights that apply to Your use of the 111 | Licensed Material and that the Licensor has authority to license. 112 | 113 | h. Licensor means the individual(s) or entity(ies) granting rights 114 | under this Public License. 115 | 116 | i. NonCommercial means not primarily intended for or directed towards 117 | commercial advantage or monetary compensation. For purposes of 118 | this Public License, the exchange of the Licensed Material for 119 | other material subject to Copyright and Similar Rights by digital 120 | file-sharing or similar means is NonCommercial provided there is 121 | no payment of monetary compensation in connection with the 122 | exchange. 123 | 124 | j. Share means to provide material to the public by any means or 125 | process that requires permission under the Licensed Rights, such 126 | as reproduction, public display, public performance, distribution, 127 | dissemination, communication, or importation, and to make material 128 | available to the public including in ways that members of the 129 | public may access the material from a place and at a time 130 | individually chosen by them. 131 | 132 | k. Sui Generis Database Rights means rights other than copyright 133 | resulting from Directive 96/9/EC of the European Parliament and of 134 | the Council of 11 March 1996 on the legal protection of databases, 135 | as amended and/or succeeded, as well as other essentially 136 | equivalent rights anywhere in the world. 137 | 138 | l. You means the individual or entity exercising the Licensed Rights 139 | under this Public License. Your has a corresponding meaning. 140 | 141 | 142 | Section 2 -- Scope. 143 | 144 | a. License grant. 145 | 146 | 1. Subject to the terms and conditions of this Public License, 147 | the Licensor hereby grants You a worldwide, royalty-free, 148 | non-sublicensable, non-exclusive, irrevocable license to 149 | exercise the Licensed Rights in the Licensed Material to: 150 | 151 | a. reproduce and Share the Licensed Material, in whole or 152 | in part, for NonCommercial purposes only; and 153 | 154 | b. produce, reproduce, and Share Adapted Material for 155 | NonCommercial purposes only. 156 | 157 | 2. Exceptions and Limitations. For the avoidance of doubt, where 158 | Exceptions and Limitations apply to Your use, this Public 159 | License does not apply, and You do not need to comply with 160 | its terms and conditions. 161 | 162 | 3. Term. The term of this Public License is specified in Section 163 | 6(a). 164 | 165 | 4. Media and formats; technical modifications allowed. The 166 | Licensor authorizes You to exercise the Licensed Rights in 167 | all media and formats whether now known or hereafter created, 168 | and to make technical modifications necessary to do so. The 169 | Licensor waives and/or agrees not to assert any right or 170 | authority to forbid You from making technical modifications 171 | necessary to exercise the Licensed Rights, including 172 | technical modifications necessary to circumvent Effective 173 | Technological Measures. For purposes of this Public License, 174 | simply making modifications authorized by this Section 2(a) 175 | (4) never produces Adapted Material. 176 | 177 | 5. Downstream recipients. 178 | 179 | a. Offer from the Licensor -- Licensed Material. Every 180 | recipient of the Licensed Material automatically 181 | receives an offer from the Licensor to exercise the 182 | Licensed Rights under the terms and conditions of this 183 | Public License. 184 | 185 | b. No downstream restrictions. You may not offer or impose 186 | any additional or different terms or conditions on, or 187 | apply any Effective Technological Measures to, the 188 | Licensed Material if doing so restricts exercise of the 189 | Licensed Rights by any recipient of the Licensed 190 | Material. 191 | 192 | 6. No endorsement. Nothing in this Public License constitutes or 193 | may be construed as permission to assert or imply that You 194 | are, or that Your use of the Licensed Material is, connected 195 | with, or sponsored, endorsed, or granted official status by, 196 | the Licensor or others designated to receive attribution as 197 | provided in Section 3(a)(1)(A)(i). 198 | 199 | b. Other rights. 200 | 201 | 1. Moral rights, such as the right of integrity, are not 202 | licensed under this Public License, nor are publicity, 203 | privacy, and/or other similar personality rights; however, to 204 | the extent possible, the Licensor waives and/or agrees not to 205 | assert any such rights held by the Licensor to the limited 206 | extent necessary to allow You to exercise the Licensed 207 | Rights, but not otherwise. 208 | 209 | 2. Patent and trademark rights are not licensed under this 210 | Public License. 211 | 212 | 3. To the extent possible, the Licensor waives any right to 213 | collect royalties from You for the exercise of the Licensed 214 | Rights, whether directly or through a collecting society 215 | under any voluntary or waivable statutory or compulsory 216 | licensing scheme. In all other cases the Licensor expressly 217 | reserves any right to collect such royalties, including when 218 | the Licensed Material is used other than for NonCommercial 219 | purposes. 220 | 221 | 222 | Section 3 -- License Conditions. 223 | 224 | Your exercise of the Licensed Rights is expressly made subject to the 225 | following conditions. 226 | 227 | a. Attribution. 228 | 229 | 1. If You Share the Licensed Material (including in modified 230 | form), You must: 231 | 232 | a. retain the following if it is supplied by the Licensor 233 | with the Licensed Material: 234 | 235 | i. identification of the creator(s) of the Licensed 236 | Material and any others designated to receive 237 | attribution, in any reasonable manner requested by 238 | the Licensor (including by pseudonym if 239 | designated); 240 | 241 | ii. a copyright notice; 242 | 243 | iii. a notice that refers to this Public License; 244 | 245 | iv. a notice that refers to the disclaimer of 246 | warranties; 247 | 248 | v. a URI or hyperlink to the Licensed Material to the 249 | extent reasonably practicable; 250 | 251 | b. indicate if You modified the Licensed Material and 252 | retain an indication of any previous modifications; and 253 | 254 | c. indicate the Licensed Material is licensed under this 255 | Public License, and include the text of, or the URI or 256 | hyperlink to, this Public License. 257 | 258 | 2. You may satisfy the conditions in Section 3(a)(1) in any 259 | reasonable manner based on the medium, means, and context in 260 | which You Share the Licensed Material. For example, it may be 261 | reasonable to satisfy the conditions by providing a URI or 262 | hyperlink to a resource that includes the required 263 | information. 264 | 265 | 3. If requested by the Licensor, You must remove any of the 266 | information required by Section 3(a)(1)(A) to the extent 267 | reasonably practicable. 268 | 269 | 4. If You Share Adapted Material You produce, the Adapter's 270 | License You apply must not prevent recipients of the Adapted 271 | Material from complying with this Public License. 272 | 273 | 274 | Section 4 -- Sui Generis Database Rights. 275 | 276 | Where the Licensed Rights include Sui Generis Database Rights that 277 | apply to Your use of the Licensed Material: 278 | 279 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 280 | to extract, reuse, reproduce, and Share all or a substantial 281 | portion of the contents of the database for NonCommercial purposes 282 | only; 283 | 284 | b. if You include all or a substantial portion of the database 285 | contents in a database in which You have Sui Generis Database 286 | Rights, then the database in which You have Sui Generis Database 287 | Rights (but not its individual contents) is Adapted Material; and 288 | 289 | c. You must comply with the conditions in Section 3(a) if You Share 290 | all or a substantial portion of the contents of the database. 291 | 292 | For the avoidance of doubt, this Section 4 supplements and does not 293 | replace Your obligations under this Public License where the Licensed 294 | Rights include other Copyright and Similar Rights. 295 | 296 | 297 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 298 | 299 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 300 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 301 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 302 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 303 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 304 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 305 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 306 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 307 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 308 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 309 | 310 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 311 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 312 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 313 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 314 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 315 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 316 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 317 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 318 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 319 | 320 | c. The disclaimer of warranties and limitation of liability provided 321 | above shall be interpreted in a manner that, to the extent 322 | possible, most closely approximates an absolute disclaimer and 323 | waiver of all liability. 324 | 325 | 326 | Section 6 -- Term and Termination. 327 | 328 | a. This Public License applies for the term of the Copyright and 329 | Similar Rights licensed here. However, if You fail to comply with 330 | this Public License, then Your rights under this Public License 331 | terminate automatically. 332 | 333 | b. Where Your right to use the Licensed Material has terminated under 334 | Section 6(a), it reinstates: 335 | 336 | 1. automatically as of the date the violation is cured, provided 337 | it is cured within 30 days of Your discovery of the 338 | violation; or 339 | 340 | 2. upon express reinstatement by the Licensor. 341 | 342 | For the avoidance of doubt, this Section 6(b) does not affect any 343 | right the Licensor may have to seek remedies for Your violations 344 | of this Public License. 345 | 346 | c. For the avoidance of doubt, the Licensor may also offer the 347 | Licensed Material under separate terms or conditions or stop 348 | distributing the Licensed Material at any time; however, doing so 349 | will not terminate this Public License. 350 | 351 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 352 | License. 353 | 354 | 355 | Section 7 -- Other Terms and Conditions. 356 | 357 | a. The Licensor shall not be bound by any additional or different 358 | terms or conditions communicated by You unless expressly agreed. 359 | 360 | b. Any arrangements, understandings, or agreements regarding the 361 | Licensed Material not stated herein are separate from and 362 | independent of the terms and conditions of this Public License. 363 | 364 | 365 | Section 8 -- Interpretation. 366 | 367 | a. For the avoidance of doubt, this Public License does not, and 368 | shall not be interpreted to, reduce, limit, restrict, or impose 369 | conditions on any use of the Licensed Material that could lawfully 370 | be made without permission under this Public License. 371 | 372 | b. To the extent possible, if any provision of this Public License is 373 | deemed unenforceable, it shall be automatically reformed to the 374 | minimum extent necessary to make it enforceable. If the provision 375 | cannot be reformed, it shall be severed from this Public License 376 | without affecting the enforceability of the remaining terms and 377 | conditions. 378 | 379 | c. No term or condition of this Public License will be waived and no 380 | failure to comply consented to unless expressly agreed to by the 381 | Licensor. 382 | 383 | d. Nothing in this Public License constitutes or may be interpreted 384 | as a limitation upon, or waiver of, any privileges and immunities 385 | that apply to the Licensor or You, including from the legal 386 | processes of any jurisdiction or authority. 387 | 388 | ======================================================================= 389 | 390 | Creative Commons is not a party to its public 391 | licenses. Notwithstanding, Creative Commons may elect to apply one of 392 | its public licenses to material it publishes and in those instances 393 | will be considered the “Licensor.” The text of the Creative Commons 394 | public licenses is dedicated to the public domain under the CC0 Public 395 | Domain Dedication. Except for the limited purpose of indicating that 396 | material is shared under a Creative Commons public license or as 397 | otherwise permitted by the Creative Commons policies published at 398 | creativecommons.org/policies, Creative Commons does not authorize the 399 | use of the trademark "Creative Commons" or any other trademark or logo 400 | of Creative Commons without its prior written consent including, 401 | without limitation, in connection with any unauthorized modifications 402 | to any of its public licenses or any other arrangements, 403 | understandings, or agreements concerning use of licensed material. For 404 | the avoidance of doubt, this paragraph does not form part of the 405 | public licenses. 406 | 407 | Creative Commons may be contacted at creativecommons.org. 408 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unofficial [Kits.AI](https://kits.ai) API Implementation 2 | 3 | kitsai is a Python package designed to streamline interactions with the Kits.AI API, offering convenient functionalities for voice models, voice conversions, vocal separations, and text-to-speech (TTS) tasks. 4 | 5 | ## Installation 6 | 7 | Install kitsai via pip: 8 | 9 | ```bash 10 | pip install kitsai 11 | 12 | ``` 13 | 14 | ## Publish to PyPi 15 | 16 | ```bash 17 | python setup.py sdist bdist_wheel 18 | twine upload dist/* 19 | ``` 20 | 21 | ## Usage 22 | 23 | ### Rate Limits 24 | Current rate limits are set at 1000 `GET` requests per user each minute and 5 `POST` requests per user each minute for `POST` requests. 25 | 26 | _Rate limits are subject to change after our Alpha period._ 27 | 28 | ### Authentication 29 | 30 | To utilize any functions within this package, authentication via your API key is necessary. Simply invoke the `login` function from the `token` module, providing your API key as an argument. 31 | 32 | ```python 33 | from kitsai import login 34 | 35 | api_key = "YOUR_API_KEY_HERE" 36 | login(api_key) 37 | ``` 38 | 39 | _You can generate an API key by signing up on the https://app.kits.ai/api-access website._ 40 | 41 | ### Voice Models 42 | 43 | #### Fetch Voice Models 44 | 45 | Retrieve a list of available voice models. 46 | 47 | ```python 48 | from kitsai import fetch_voice_models 49 | 50 | voice_models = fetch_voice_models(order="asc", page=1, per_page=10, my_models=False, instruments=False) 51 | ``` 52 | 53 | #### Fetch Voice Model by ID 54 | 55 | Fetch details of a specific voice model using its ID. 56 | 57 | ```python 58 | from kitsai import fetch_voice_model_by_id 59 | 60 | voice_model_id = 123 61 | voice_model = fetch_voice_model_by_id(voice_model_id) 62 | ``` 63 | 64 | ### Voice Conversions 65 | 66 | #### Create Voice Conversion 67 | 68 | Initiate a voice conversion task with specified parameters. 69 | 70 | ```python 71 | from kitsai import create_voice_conversion 72 | 73 | response = create_voice_conversion( 74 | voice_model_id=123, 75 | sound_file=open('input.wav', 'rb'), 76 | backing_sound_file=open('backing.wav', 'rb'), 77 | conversion_strength=0.5, 78 | model_volume_mix=0.8, 79 | pitch_shift=2, 80 | pre={ 81 | "noiseGate": { 82 | "thresholdDb": -30, 83 | "ratio": 2, 84 | "attackMs": 10, 85 | "releaseMs": 20 86 | }, 87 | "highPassFilter": { 88 | "cutoffFrequencyHz": 1000 89 | } 90 | } 91 | ) 92 | ``` 93 | 94 | #### Fetch Voice Conversion by ID 95 | 96 | Retrieve details of a specific voice conversion task using its ID. 97 | 98 | ```python 99 | from kitsai import fetch_voice_conversion_by_id 100 | 101 | voice_conversion = fetch_voice_conversion_by_id("JOB_ID_HERE") 102 | ``` 103 | 104 | #### Fetch Voice Conversions 105 | 106 | Retrieve a list of voice conversion tasks. 107 | 108 | ```python 109 | from kitsai import fetch_voice_conversions 110 | 111 | voice_conversions = fetch_voice_conversions(order="asc", page=1, per_page=10) 112 | ``` 113 | 114 | ### Vocal Separations 115 | 116 | #### Create Vocal Separation 117 | 118 | Initiate a vocal separation task with an audio input. 119 | 120 | ```python 121 | from kitsai import create_vocal_separation 122 | 123 | response = create_vocal_separation( 124 | sound_file=open('input.wav', 'rb') 125 | ) 126 | ``` 127 | 128 | #### Fetch Vocal Separation by ID 129 | 130 | Retrieve details of a specific vocal separation task using its ID. 131 | 132 | ```python 133 | from kitsai import fetch_vocal_separation_by_id 134 | 135 | vocal_separation = fetch_vocal_separation_by_id("JOB_ID_HERE") 136 | ``` 137 | 138 | #### Fetch Vocal Separations 139 | 140 | Retrieve a list of vocal separation tasks. 141 | 142 | ```python 143 | from kitsai import fetch_vocal_separations 144 | 145 | vocal_separations = fetch_vocal_separations(order="asc", page=1, per_page=10) 146 | ``` 147 | 148 | ### Text-to-Speech (TTS) 149 | 150 | #### Create TTS 151 | 152 | Generate text-to-speech output using a specified voice model and input text. 153 | 154 | ```python 155 | from kitsai import create_tts 156 | 157 | response = create_tts( 158 | voice_model_id=123, 159 | input_tts_text="Hello, how are you?" 160 | ) 161 | ``` 162 | 163 | #### Fetch TTS by ID 164 | 165 | Retrieve details of a specific text-to-speech task using its ID. 166 | 167 | ```python 168 | from kitsai import fetch_tts_by_id 169 | 170 | tts_job = fetch_tts_by_id("JOB_ID_HERE") 171 | ``` 172 | 173 | #### Fetch TTS 174 | 175 | Retrieve a list of text-to-speech tasks. 176 | 177 | ```python 178 | from kitsai import fetch_tts 179 | 180 | tts_jobs = fetch_tts(order="asc", page=1, per_page=10) 181 | ``` 182 | 183 | ## License 184 | 185 | This project is licensed under the Attribution-NonCommercial 4.0 International - see the [LICENSE](LICENSE) file for details. 186 | -------------------------------------------------------------------------------- /kitsai/__init__.py: -------------------------------------------------------------------------------- 1 | from .token import login 2 | from .voice_models.fetch_voice_models import fetch_voice_models 3 | from .voice_models.fetch_voice_model_by_id import fetch_voice_model_by_id 4 | 5 | from .voice_conversions.create_voice_conversion import create_voice_conversion 6 | from .voice_conversions.fetch_voice_conversion_by_id import fetch_voice_conversion_by_id 7 | from .voice_conversions.fetch_voice_conversions import fetch_voice_conversions 8 | 9 | from .vocal_separations.create_vocal_separation import create_vocal_separation 10 | from .vocal_separations.fetch_vocal_separation_by_id import fetch_vocal_separation_by_id 11 | from .vocal_separations.fetch_vocal_separations import fetch_vocal_separations 12 | 13 | from .tts.create_tts import create_tts 14 | from .tts.fetch_tts_by_id import fetch_tts_by_id 15 | from .tts.fetch_tts import fetch_tts -------------------------------------------------------------------------------- /kitsai/token.py: -------------------------------------------------------------------------------- 1 | class TokenError(Exception): 2 | pass 3 | 4 | _api_key = None 5 | 6 | def login(api_key): 7 | global _api_key 8 | if not api_key: 9 | raise TokenError("API key is empty. Please provide a valid API key.") 10 | _api_key = api_key 11 | 12 | def get_api_key(): 13 | if not _api_key: 14 | raise TokenError("API key not set. Please call login() first.") 15 | return _api_key 16 | -------------------------------------------------------------------------------- /kitsai/tts/create_tts.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from ..token import TokenError, get_api_key 3 | 4 | 5 | def create_tts(voice_model_id, input_tts_text): 6 | """ 7 | Create a Text-to-Speech (TTS) job and add it to the inference queue via the Arpeggi API. 8 | 9 | Parameters: 10 | - voice_model_id (int): ID of the voice model. 11 | - input_tts_text (str): Text to be converted to speech. 12 | 13 | Returns: 14 | - dict or None: JSON response if successful, None otherwise. 15 | """ 16 | try: 17 | api_key = get_api_key() 18 | except TokenError as error: 19 | raise ValueError(str(error)) from error 20 | 21 | url = "https://arpeggi.io/api/kits/v1/tts" 22 | headers = {"Authorization": f"Bearer {api_key}"} 23 | data = {"voiceModelId": voice_model_id, "inputTtsText": input_tts_text} 24 | 25 | try: 26 | response = requests.post(url, headers=headers, data=data) 27 | response.raise_for_status() # bad responses (4xx or 5xx) 28 | return response.json() 29 | except requests.RequestException as error: 30 | # Log the error and return None 31 | print(f"Error creating TTS job: {error}") 32 | return None 33 | -------------------------------------------------------------------------------- /kitsai/tts/fetch_tts.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from ..token import TokenError, get_api_key 3 | 4 | def fetch_tts(order="asc", page=1, per_page=10): 5 | """ 6 | Fetch Text-to-Speech (TTS) jobs from the Arpeggi API. 7 | 8 | Parameters: 9 | - order (str): Sorting order, either "asc" or "desc". 10 | - page (int): Page number for pagination. 11 | - per_page (int): Number of items per page. 12 | 13 | Returns: 14 | - dict or None: JSON response if successful, None otherwise. 15 | """ 16 | try: 17 | api_key = get_api_key() 18 | except TokenError as error: 19 | raise ValueError(str(error)) from error 20 | 21 | url = "https://arpeggi.io/api/kits/v1/tts" 22 | headers = {"Authorization": f"Bearer {api_key}"} 23 | params = { 24 | "order": order, 25 | "page": page, 26 | "perPage": per_page, 27 | } 28 | 29 | try: 30 | response = requests.get(url, headers=headers, params=params) 31 | response.raise_for_status() # bad responses (4xx or 5xx) 32 | return response.json() 33 | except requests.RequestException as error: 34 | # Log the error and return None 35 | print(f"Error fetching TTS jobs: {error}") 36 | return None 37 | -------------------------------------------------------------------------------- /kitsai/tts/fetch_tts_by_id.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from ..token import TokenError, get_api_key 3 | 4 | def fetch_tts_by_id(job_id): 5 | """ 6 | Fetch a Text-to-Speech (TTS) job by its ID from the Arpeggi API. 7 | 8 | Parameters: 9 | - job_id (str): The ID of the TTS job to fetch. 10 | 11 | Returns: 12 | - dict or None: JSON response if successful, None otherwise. 13 | """ 14 | try: 15 | api_key = get_api_key() 16 | except TokenError as error: 17 | raise ValueError(str(error)) from error 18 | 19 | url = f"https://arpeggi.io/api/kits/v1/tts/{job_id}" 20 | headers = {"Authorization": f"Bearer {api_key}"} 21 | 22 | try: 23 | response = requests.get(url, headers=headers) 24 | response.raise_for_status() # bad responses (4xx or 5xx) 25 | return response.json() 26 | except requests.RequestException as error: 27 | # Log the error and return None 28 | print(f"Error fetching TTS job by ID: {error}") 29 | return None 30 | -------------------------------------------------------------------------------- /kitsai/vocal_separations/create_vocal_separation.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from ..token import TokenError, get_api_key 3 | 4 | def create_vocal_separation(input_file): 5 | """ 6 | Create a vocal separation job and add it to the inference queue via the Arpeggi API. 7 | 8 | Parameters: 9 | - input_file (file-like object): The audio file for which vocal separation is requested. Supported formats: wav, webm, mp3, or flac. Max file size is 50MB. 10 | 11 | Returns: 12 | - dict or None: JSON response if successful, None otherwise. 13 | """ 14 | try: 15 | api_key = get_api_key() 16 | except TokenError as error: 17 | raise ValueError(str(error)) from error 18 | 19 | url = "https://arpeggi.io/api/kits/v1/vocal-separations" 20 | headers = {"Authorization": f"Bearer {api_key}"} 21 | 22 | files = {"inputFile": input_file} 23 | 24 | try: 25 | response = requests.post(url, headers=headers, files=files) 26 | response.raise_for_status() # bad responses (4xx or 5xx) 27 | return response.json() 28 | except requests.RequestException as error: 29 | # Log the error and return None 30 | print(f"Error creating vocal separation: {error}") 31 | return None 32 | -------------------------------------------------------------------------------- /kitsai/vocal_separations/fetch_vocal_separation_by_id.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from ..token import TokenError, get_api_key 3 | 4 | def fetch_vocal_separation_by_id(job_id): 5 | """ 6 | Fetch a vocal separation job by its ID from the Arpeggi API. 7 | 8 | Parameters: 9 | - job_id (str): The ID of the vocal separation job to fetch. 10 | 11 | Returns: 12 | - dict or None: JSON response if successful, None otherwise. 13 | """ 14 | try: 15 | api_key = get_api_key() 16 | except TokenError as error: 17 | raise ValueError(str(error)) from error 18 | 19 | url = f"https://arpeggi.io/api/kits/v1/vocal-separations/{job_id}" 20 | headers = {"Authorization": f"Bearer {api_key}"} 21 | 22 | try: 23 | response = requests.get(url, headers=headers) 24 | response.raise_for_status() # bad responses (4xx or 5xx) 25 | return response.json() 26 | except requests.RequestException as error: 27 | # Log the error and return None 28 | print(f"Error fetching vocal separation by ID: {error}") 29 | return None 30 | -------------------------------------------------------------------------------- /kitsai/vocal_separations/fetch_vocal_separations.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from ..token import TokenError, get_api_key 3 | 4 | def fetch_vocal_separations(order="asc", page=1, per_page=10): 5 | """ 6 | Fetch vocal separation inference jobs from the Arpeggi API. 7 | 8 | Parameters: 9 | - order (str): Sorting order, either "asc" or "desc". 10 | - page (int): Page number for pagination. 11 | - per_page (int): Number of items per page. 12 | 13 | Returns: 14 | - dict or None: JSON response if successful, None otherwise. 15 | """ 16 | try: 17 | api_key = get_api_key() 18 | except TokenError as error: 19 | raise ValueError(str(error)) from error 20 | 21 | url = "https://arpeggi.io/api/kits/v1/vocal-separations" 22 | headers = {"Authorization": f"Bearer {api_key}"} 23 | params = { 24 | "order": order, 25 | "page": page, 26 | "perPage": per_page, 27 | } 28 | 29 | try: 30 | response = requests.get(url, headers=headers, params=params) 31 | response.raise_for_status() # bad responses (4xx or 5xx) 32 | return response.json() 33 | except requests.RequestException as error: 34 | # Log the error and return None 35 | print(f"Error fetching vocal separations: {error}") 36 | return None 37 | -------------------------------------------------------------------------------- /kitsai/voice_conversions/create_voice_conversion.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from ..token import TokenError, get_api_key 3 | 4 | 5 | def create_voice_conversion( 6 | voice_model_id, 7 | sound_file, 8 | backing_sound_file=None, 9 | conversion_strength=None, 10 | model_volume_mix=None, 11 | pitch_shift=None, 12 | pre=None, 13 | ): 14 | """ 15 | Create a voice conversion and add it to the inference queue via the Arpeggi API. 16 | 17 | Parameters: 18 | - voice_model_id (int): ID of the voice model. 19 | - sound_file (file-like object): Sound file to be converted. Supported formats: wav, webm, mp3, or flac. Max file size is 50MB. 20 | - backing_sound_file (file-like object, optional): Backing sound file. Supported formats: wav, webm, mp3, or flac. Max file size is 50MB. 21 | - conversion_strength (float, optional): Conversion strength as a percentage (range: 0 - 1). 22 | - model_volume_mix (float, optional): Model volume mix as a percentage (range: 0 - 1). 23 | - pitch_shift (int, optional): Pitch shift value (range: -24 to 24). 24 | - pre (dict, optional): Preprocessing effects. 25 | 26 | Returns: 27 | - dict or None: JSON response if successful, None otherwise. 28 | """ 29 | try: 30 | api_key = get_api_key() 31 | except TokenError as error: 32 | raise ValueError(str(error)) from error 33 | 34 | url = "https://arpeggi.io/api/kits/v1/voice-conversions" 35 | headers = {"Authorization": f"Bearer {api_key}"} 36 | 37 | files = { 38 | "soundFile": sound_file, 39 | "voiceModelId": str(voice_model_id), 40 | } 41 | 42 | data = { 43 | "conversionStrength": conversion_strength, 44 | "modelVolumeMix": model_volume_mix, 45 | "pitchShift": pitch_shift, 46 | "pre": pre, 47 | } 48 | 49 | if backing_sound_file: 50 | files["backingSoundFile"] = backing_sound_file 51 | 52 | try: 53 | response = requests.post(url, headers=headers, data=data, files=files) 54 | response.raise_for_status() # bad responses (4xx or 5xx) 55 | return response.json() 56 | except requests.RequestException as error: 57 | # Log the error and return None 58 | print(f"Error creating voice conversion: {error}") 59 | return None 60 | -------------------------------------------------------------------------------- /kitsai/voice_conversions/fetch_voice_conversion_by_id.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from ..token import TokenError, get_api_key 3 | 4 | def fetch_voice_conversion_by_id(conversion_id): 5 | """ 6 | Fetch a voice conversion inference job by its ID from the Arpeggi API. 7 | 8 | Parameters: 9 | - conversion_id (str): The ID of the voice conversion inference job to fetch. 10 | 11 | Returns: 12 | - dict or None: JSON response if successful, None otherwise. 13 | """ 14 | try: 15 | api_key = get_api_key() 16 | except TokenError as error: 17 | raise ValueError(str(error)) from error 18 | 19 | url = f"https://arpeggi.io/api/kits/v1/voice-conversions/{conversion_id}" 20 | headers = {"Authorization": f"Bearer {api_key}"} 21 | 22 | try: 23 | response = requests.get(url, headers=headers) 24 | response.raise_for_status() # bad responses (4xx or 5xx) 25 | return response.json() 26 | except requests.RequestException as error: 27 | # Log the error and return None 28 | print(f"Error fetching voice conversion by ID: {error}") 29 | return None 30 | -------------------------------------------------------------------------------- /kitsai/voice_conversions/fetch_voice_conversions.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from ..token import TokenError, get_api_key 3 | 4 | def fetch_voice_conversions(order="asc", page=1, per_page=10): 5 | """ 6 | Fetch voice conversions from the Arpeggi API. 7 | 8 | Parameters: 9 | - order (str): Sorting order, either "asc" or "desc". 10 | - page (int): Page number for pagination. 11 | - per_page (int): Number of items per page. 12 | 13 | Returns: 14 | - dict or None: JSON response if successful, None otherwise. 15 | """ 16 | try: 17 | api_key = get_api_key() 18 | except TokenError as error: 19 | raise ValueError(str(error)) from error 20 | 21 | url = "https://arpeggi.io/api/kits/v1/voice-conversions" 22 | headers = {"Authorization": f"Bearer {api_key}"} 23 | params = { 24 | "order": order, 25 | "page": page, 26 | "perPage": per_page, 27 | } 28 | 29 | try: 30 | response = requests.get(url, headers=headers, params=params) 31 | response.raise_for_status() # bad responses (4xx or 5xx) 32 | return response.json() 33 | except requests.RequestException as error: 34 | # Log the error and return None 35 | print(f"Error fetching voice conversions: {error}") 36 | return None 37 | -------------------------------------------------------------------------------- /kitsai/voice_models/fetch_voice_model_by_id.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from ..token import TokenError, get_api_key 3 | 4 | 5 | def fetch_voice_model_by_id(model_id): 6 | """ 7 | Fetch a voice model by its ID from the Arpeggi API. 8 | 9 | Parameters: 10 | - model_id (str): The ID of the voice model to fetch. 11 | 12 | Returns: 13 | - dict or None: JSON response if successful, None otherwise. 14 | """ 15 | try: 16 | api_key = get_api_key() 17 | except TokenError as error: 18 | raise ValueError(str(error)) from error 19 | 20 | url = f"https://arpeggi.io/api/kits/v1/voice-models/{model_id}" 21 | headers = {"Authorization": f"Bearer {api_key}"} 22 | 23 | try: 24 | response = requests.get(url, headers=headers) 25 | response.raise_for_status() # bad responses (4xx or 5xx) 26 | return response.json() 27 | except requests.RequestException as error: 28 | # Log the error and return None 29 | print(f"Error fetching voice model by ID: {error}") 30 | return None 31 | -------------------------------------------------------------------------------- /kitsai/voice_models/fetch_voice_models.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from ..token import TokenError, get_api_key 3 | 4 | 5 | def fetch_voice_models( 6 | order="asc", page=1, per_page=10, my_models=False, instruments=False 7 | ): 8 | """ 9 | Fetch voice models from the Arpeggi API. 10 | 11 | Parameters: 12 | - order (str): Sorting order, either "asc" or "desc". 13 | - page (int): Page number for pagination. 14 | - per_page (int): Number of items per page. 15 | - my_models (bool): Whether to fetch only user's models. 16 | - instruments (bool): Whether to include instrument details. 17 | 18 | Returns: 19 | - dict or None: JSON response if successful, None otherwise. 20 | """ 21 | try: 22 | api_key = get_api_key() 23 | except TokenError as error: 24 | raise ValueError(str(error)) from error 25 | 26 | url = "https://arpeggi.io/api/kits/v1/voice-models" 27 | headers = {"Authorization": f"Bearer {api_key}"} 28 | params = { 29 | "order": order, 30 | "page": page, 31 | "perPage": per_page, 32 | "myModels": str(my_models).lower(), 33 | "instruments": str(instruments).lower(), 34 | } 35 | 36 | try: 37 | response = requests.get(url, headers=headers, params=params) 38 | response.raise_for_status() # bad responses (4xx or 5xx) 39 | return response.json() 40 | except requests.RequestException as error: 41 | # Log the error and return None 42 | print(f"Error fetching voice models: {error}") 43 | return None 44 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | import codecs 3 | import os 4 | 5 | here = os.path.abspath(os.path.dirname(__file__)) 6 | 7 | with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh: 8 | long_description = "\n" + fh.read() 9 | 10 | setup( 11 | name="kitsai", 12 | version="0.0.3", 13 | author="Blaise", 14 | author_email="iahispano0@gmail.com", 15 | description="Unofficial package to easily interact with the Kits.AI API", 16 | long_description=long_description, 17 | long_description_content_type="text/markdown", 18 | license="Attribution-NonCommercial 4.0 International", 19 | packages=find_packages(), 20 | package_data={"kitsai": ["*/*.py", "*/*/*.py"]}, 21 | url="https://github.com/blaise-tk/kitsai", 22 | keywords=["python", "audio", "vc", "ai", "rvc", "kits"], 23 | classifiers=[ 24 | "Development Status :: Release", 25 | "Intended Audience :: Developers", 26 | "Programming Language :: Python :: 3", 27 | "Operating System :: MacOS :: MacOS X", 28 | "Operating System :: Microsoft :: Windows :: Windows 10", 29 | "Operating System :: POSIX :: Linux", 30 | ], 31 | ) 32 | --------------------------------------------------------------------------------