@supertone/supertone 0.1.3 → 0.1.5
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.
- package/README.md +281 -9
- package/custom_test/test_real_api.ts +149 -13
- package/dist/commonjs/funcs/customVoicesCreateClonedVoice.d.ts +1 -1
- package/dist/commonjs/funcs/customVoicesCreateClonedVoice.d.ts.map +1 -1
- package/dist/commonjs/funcs/customVoicesCreateClonedVoice.js +6 -2
- package/dist/commonjs/funcs/customVoicesCreateClonedVoice.js.map +1 -1
- package/dist/commonjs/funcs/customVoicesEditCustomVoice.d.ts +1 -1
- package/dist/commonjs/funcs/customVoicesEditCustomVoice.js +2 -2
- package/dist/commonjs/funcs/customVoicesGetCustomVoice.d.ts +1 -1
- package/dist/commonjs/funcs/customVoicesGetCustomVoice.d.ts.map +1 -1
- package/dist/commonjs/funcs/customVoicesGetCustomVoice.js +1 -1
- package/dist/commonjs/funcs/customVoicesGetCustomVoice.js.map +1 -1
- package/dist/commonjs/funcs/textToSpeechPredictDuration.js +3 -1
- package/dist/commonjs/funcs/textToSpeechPredictDuration.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.d.ts.map +1 -1
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/models/apiconverttexttospeechusingcharacterrequest.d.ts +3 -0
- package/dist/commonjs/models/apiconverttexttospeechusingcharacterrequest.d.ts.map +1 -1
- package/dist/commonjs/models/apiconverttexttospeechusingcharacterrequest.js +1 -0
- package/dist/commonjs/models/apiconverttexttospeechusingcharacterrequest.js.map +1 -1
- package/dist/commonjs/models/createcustomvoiceresponse.d.ts +32 -0
- package/dist/commonjs/models/createcustomvoiceresponse.d.ts.map +1 -0
- package/dist/commonjs/models/{createclonedvoiceuploadresponse.js → createcustomvoiceresponse.js} +17 -17
- package/dist/commonjs/models/createcustomvoiceresponse.js.map +1 -0
- package/dist/commonjs/models/getcustomvoicelistresponse.d.ts +3 -3
- package/dist/commonjs/models/getcustomvoicelistresponse.d.ts.map +1 -1
- package/dist/commonjs/models/getcustomvoicelistresponse.js +3 -3
- package/dist/commonjs/models/getcustomvoicelistresponse.js.map +1 -1
- package/dist/commonjs/models/getcustomvoiceresponse.d.ts +42 -0
- package/dist/commonjs/models/getcustomvoiceresponse.d.ts.map +1 -0
- package/dist/commonjs/models/{getcustomvoiceresponsedata.js → getcustomvoiceresponse.js} +17 -17
- package/dist/commonjs/models/getcustomvoiceresponse.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +5 -6
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +5 -6
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/operations/editcustomvoice.d.ts +2 -2
- package/dist/commonjs/models/operations/editcustomvoice.js +4 -4
- package/dist/commonjs/models/operations/predictduration.d.ts +2 -2
- package/dist/commonjs/models/operations/predictduration.d.ts.map +1 -1
- package/dist/commonjs/models/operations/predictduration.js +4 -4
- package/dist/commonjs/models/operations/predictduration.js.map +1 -1
- package/dist/commonjs/models/{predictttsdurationusingcharacterrequest.d.ts → predictttsdurationrequest.d.ts} +41 -38
- package/dist/commonjs/models/predictttsdurationrequest.d.ts.map +1 -0
- package/dist/commonjs/models/predictttsdurationrequest.js +181 -0
- package/dist/commonjs/models/predictttsdurationrequest.js.map +1 -0
- package/dist/commonjs/models/updatecustomvoicerequest.d.ts +37 -0
- package/dist/commonjs/models/{updateclonedvoicerequest.d.ts.map → updatecustomvoicerequest.d.ts.map} +1 -1
- package/dist/commonjs/models/{updateclonedvoicerequest.js → updatecustomvoicerequest.js} +17 -17
- package/dist/commonjs/models/{updateclonedvoicerequest.js.map → updatecustomvoicerequest.js.map} +1 -1
- package/dist/commonjs/models/updatecustomvoiceresponse.d.ts +42 -0
- package/dist/commonjs/models/{updateclonedvoiceresponse.d.ts.map → updatecustomvoiceresponse.d.ts.map} +1 -1
- package/dist/commonjs/models/{updateclonedvoiceresponse.js → updatecustomvoiceresponse.js} +17 -17
- package/dist/commonjs/models/{updateclonedvoiceresponse.js.map → updatecustomvoiceresponse.js.map} +1 -1
- package/dist/commonjs/sdk/customvoices.d.ts +3 -3
- package/dist/commonjs/sdk/customvoices.d.ts.map +1 -1
- package/dist/commonjs/sdk/texttospeech.d.ts +6 -13
- package/dist/commonjs/sdk/texttospeech.d.ts.map +1 -1
- package/dist/commonjs/sdk/texttospeech.js +12 -9
- package/dist/commonjs/sdk/texttospeech.js.map +1 -1
- package/dist/esm/funcs/customVoicesCreateClonedVoice.d.ts +1 -1
- package/dist/esm/funcs/customVoicesCreateClonedVoice.d.ts.map +1 -1
- package/dist/esm/funcs/customVoicesCreateClonedVoice.js +6 -2
- package/dist/esm/funcs/customVoicesCreateClonedVoice.js.map +1 -1
- package/dist/esm/funcs/customVoicesEditCustomVoice.d.ts +1 -1
- package/dist/esm/funcs/customVoicesEditCustomVoice.js +2 -2
- package/dist/esm/funcs/customVoicesGetCustomVoice.d.ts +1 -1
- package/dist/esm/funcs/customVoicesGetCustomVoice.d.ts.map +1 -1
- package/dist/esm/funcs/customVoicesGetCustomVoice.js +1 -1
- package/dist/esm/funcs/customVoicesGetCustomVoice.js.map +1 -1
- package/dist/esm/funcs/textToSpeechPredictDuration.js +3 -1
- package/dist/esm/funcs/textToSpeechPredictDuration.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.d.ts.map +1 -1
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/models/apiconverttexttospeechusingcharacterrequest.d.ts +3 -0
- package/dist/esm/models/apiconverttexttospeechusingcharacterrequest.d.ts.map +1 -1
- package/dist/esm/models/apiconverttexttospeechusingcharacterrequest.js +1 -0
- package/dist/esm/models/apiconverttexttospeechusingcharacterrequest.js.map +1 -1
- package/dist/esm/models/createcustomvoiceresponse.d.ts +32 -0
- package/dist/esm/models/createcustomvoiceresponse.d.ts.map +1 -0
- package/dist/esm/models/createcustomvoiceresponse.js +40 -0
- package/dist/esm/models/createcustomvoiceresponse.js.map +1 -0
- package/dist/esm/models/getcustomvoicelistresponse.d.ts +3 -3
- package/dist/esm/models/getcustomvoicelistresponse.d.ts.map +1 -1
- package/dist/esm/models/getcustomvoicelistresponse.js +3 -3
- package/dist/esm/models/getcustomvoicelistresponse.js.map +1 -1
- package/dist/esm/models/getcustomvoiceresponse.d.ts +42 -0
- package/dist/esm/models/getcustomvoiceresponse.d.ts.map +1 -0
- package/dist/esm/models/getcustomvoiceresponse.js +44 -0
- package/dist/esm/models/getcustomvoiceresponse.js.map +1 -0
- package/dist/esm/models/index.d.ts +5 -6
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +5 -6
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/operations/editcustomvoice.d.ts +2 -2
- package/dist/esm/models/operations/editcustomvoice.js +4 -4
- package/dist/esm/models/operations/predictduration.d.ts +2 -2
- package/dist/esm/models/operations/predictduration.d.ts.map +1 -1
- package/dist/esm/models/operations/predictduration.js +4 -4
- package/dist/esm/models/operations/predictduration.js.map +1 -1
- package/dist/esm/models/{predictttsdurationusingcharacterrequest.d.ts → predictttsdurationrequest.d.ts} +41 -38
- package/dist/esm/models/predictttsdurationrequest.d.ts.map +1 -0
- package/dist/esm/models/predictttsdurationrequest.js +143 -0
- package/dist/esm/models/predictttsdurationrequest.js.map +1 -0
- package/dist/esm/models/updatecustomvoicerequest.d.ts +37 -0
- package/dist/esm/models/{updateclonedvoicerequest.d.ts.map → updatecustomvoicerequest.d.ts.map} +1 -1
- package/dist/esm/models/updatecustomvoicerequest.js +33 -0
- package/dist/esm/models/{updateclonedvoicerequest.js.map → updatecustomvoicerequest.js.map} +1 -1
- package/dist/esm/models/updatecustomvoiceresponse.d.ts +42 -0
- package/dist/esm/models/{updateclonedvoiceresponse.d.ts.map → updatecustomvoiceresponse.d.ts.map} +1 -1
- package/dist/esm/models/updatecustomvoiceresponse.js +44 -0
- package/dist/esm/models/{updateclonedvoiceresponse.js.map → updatecustomvoiceresponse.js.map} +1 -1
- package/dist/esm/sdk/customvoices.d.ts +3 -3
- package/dist/esm/sdk/customvoices.d.ts.map +1 -1
- package/dist/esm/sdk/texttospeech.d.ts +6 -13
- package/dist/esm/sdk/texttospeech.d.ts.map +1 -1
- package/dist/esm/sdk/texttospeech.js +13 -10
- package/dist/esm/sdk/texttospeech.js.map +1 -1
- package/jsr.json +1 -1
- package/openapi.json +85 -49
- package/package.json +1 -1
- package/src/funcs/customVoicesCreateClonedVoice.ts +9 -5
- package/src/funcs/customVoicesEditCustomVoice.ts +5 -5
- package/src/funcs/customVoicesGetCustomVoice.ts +4 -4
- package/src/funcs/textToSpeechPredictDuration.ts +3 -5
- package/src/lib/config.ts +41 -41
- package/src/models/apiconverttexttospeechusingcharacterrequest.ts +1 -0
- package/src/models/createcustomvoiceresponse.ts +78 -0
- package/src/models/getcustomvoicelistresponse.ts +9 -9
- package/src/models/getcustomvoiceresponse.ts +92 -0
- package/src/models/index.ts +5 -6
- package/src/models/operations/editcustomvoice.ts +6 -6
- package/src/models/operations/predictduration.ts +6 -12
- package/src/models/predictttsdurationrequest.ts +256 -0
- package/src/models/updatecustomvoicerequest.ts +76 -0
- package/src/models/{updateclonedvoiceresponse.ts → updatecustomvoiceresponse.ts} +21 -21
- package/src/sdk/customvoices.ts +3 -3
- package/src/sdk/texttospeech.ts +54 -40
- package/dist/commonjs/models/createclonedvoiceuploadresponse.d.ts +0 -32
- package/dist/commonjs/models/createclonedvoiceuploadresponse.d.ts.map +0 -1
- package/dist/commonjs/models/createclonedvoiceuploadresponse.js.map +0 -1
- package/dist/commonjs/models/getcustomvoiceresponsedata.d.ts +0 -42
- package/dist/commonjs/models/getcustomvoiceresponsedata.d.ts.map +0 -1
- package/dist/commonjs/models/getcustomvoiceresponsedata.js.map +0 -1
- package/dist/commonjs/models/getsingleclonedvoiceresponse.d.ts +0 -42
- package/dist/commonjs/models/getsingleclonedvoiceresponse.d.ts.map +0 -1
- package/dist/commonjs/models/getsingleclonedvoiceresponse.js +0 -82
- package/dist/commonjs/models/getsingleclonedvoiceresponse.js.map +0 -1
- package/dist/commonjs/models/predictttsdurationusingcharacterrequest.d.ts.map +0 -1
- package/dist/commonjs/models/predictttsdurationusingcharacterrequest.js +0 -182
- package/dist/commonjs/models/predictttsdurationusingcharacterrequest.js.map +0 -1
- package/dist/commonjs/models/updateclonedvoicerequest.d.ts +0 -37
- package/dist/commonjs/models/updateclonedvoiceresponse.d.ts +0 -42
- package/dist/esm/models/createclonedvoiceuploadresponse.d.ts +0 -32
- package/dist/esm/models/createclonedvoiceuploadresponse.d.ts.map +0 -1
- package/dist/esm/models/createclonedvoiceuploadresponse.js +0 -40
- package/dist/esm/models/createclonedvoiceuploadresponse.js.map +0 -1
- package/dist/esm/models/getcustomvoiceresponsedata.d.ts +0 -42
- package/dist/esm/models/getcustomvoiceresponsedata.d.ts.map +0 -1
- package/dist/esm/models/getcustomvoiceresponsedata.js +0 -44
- package/dist/esm/models/getcustomvoiceresponsedata.js.map +0 -1
- package/dist/esm/models/getsingleclonedvoiceresponse.d.ts +0 -42
- package/dist/esm/models/getsingleclonedvoiceresponse.d.ts.map +0 -1
- package/dist/esm/models/getsingleclonedvoiceresponse.js +0 -44
- package/dist/esm/models/getsingleclonedvoiceresponse.js.map +0 -1
- package/dist/esm/models/predictttsdurationusingcharacterrequest.d.ts.map +0 -1
- package/dist/esm/models/predictttsdurationusingcharacterrequest.js +0 -144
- package/dist/esm/models/predictttsdurationusingcharacterrequest.js.map +0 -1
- package/dist/esm/models/updateclonedvoicerequest.d.ts +0 -37
- package/dist/esm/models/updateclonedvoicerequest.js +0 -33
- package/dist/esm/models/updateclonedvoiceresponse.d.ts +0 -42
- package/dist/esm/models/updateclonedvoiceresponse.js +0 -44
- package/src/models/createclonedvoiceuploadresponse.ts +0 -80
- package/src/models/getcustomvoiceresponsedata.ts +0 -92
- package/src/models/getsingleclonedvoiceresponse.ts +0 -94
- package/src/models/predictttsdurationusingcharacterrequest.ts +0 -276
- package/src/models/updateclonedvoicerequest.ts +0 -76
package/README.md
CHANGED
|
@@ -8,33 +8,58 @@
|
|
|
8
8
|
Supertone Public API: Supertone API is a RESTful API for using our state-of-the-art AI voice models.
|
|
9
9
|
<!-- End Summary [summary] -->
|
|
10
10
|
|
|
11
|
+
<!-- Start Table of Contents [toc] -->
|
|
12
|
+
## Table of Contents
|
|
13
|
+
<!-- $toc-max-depth=2 -->
|
|
14
|
+
* [Supertone TypeScript Library](#supertone-typescript-library)
|
|
15
|
+
* [SDK Installation](#sdk-installation)
|
|
16
|
+
* [Requirements](#requirements)
|
|
17
|
+
* [SDK Example Usage](#sdk-example-usage)
|
|
18
|
+
* [Authentication](#authentication)
|
|
19
|
+
* [Models](#models)
|
|
20
|
+
* [Available Resources and Operations](#available-resources-and-operations)
|
|
21
|
+
* [Standalone functions](#standalone-functions)
|
|
22
|
+
* [File uploads](#file-uploads)
|
|
23
|
+
* [Retries](#retries)
|
|
24
|
+
* [Error Handling](#error-handling)
|
|
25
|
+
* [Additional Example Code](#additional-example-code)
|
|
26
|
+
* [Server Selection](#server-selection)
|
|
27
|
+
* [Custom HTTP Client](#custom-http-client)
|
|
28
|
+
* [Debugging](#debugging)
|
|
29
|
+
|
|
30
|
+
<!-- End Table of Contents [toc] -->
|
|
31
|
+
|
|
11
32
|
<!-- Start SDK Installation [installation] -->
|
|
12
33
|
## SDK Installation
|
|
13
34
|
|
|
35
|
+
> [!TIP]
|
|
36
|
+
> To finish publishing your SDK to npm and others you must [run your first generation action](https://www.speakeasy.com/docs/github-setup#step-by-step-guide).
|
|
37
|
+
|
|
38
|
+
|
|
14
39
|
The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.
|
|
15
40
|
|
|
16
41
|
### NPM
|
|
17
42
|
|
|
18
43
|
```bash
|
|
19
|
-
npm add
|
|
44
|
+
npm add <UNSET>
|
|
20
45
|
```
|
|
21
46
|
|
|
22
47
|
### PNPM
|
|
23
48
|
|
|
24
49
|
```bash
|
|
25
|
-
pnpm add
|
|
50
|
+
pnpm add <UNSET>
|
|
26
51
|
```
|
|
27
52
|
|
|
28
53
|
### Bun
|
|
29
54
|
|
|
30
55
|
```bash
|
|
31
|
-
bun add
|
|
56
|
+
bun add <UNSET>
|
|
32
57
|
```
|
|
33
58
|
|
|
34
59
|
### Yarn
|
|
35
60
|
|
|
36
61
|
```bash
|
|
37
|
-
yarn add
|
|
62
|
+
yarn add <UNSET> zod
|
|
38
63
|
|
|
39
64
|
# Note that Yarn does not install peer dependencies automatically. You will need
|
|
40
65
|
# to install zod as shown above.
|
|
@@ -127,7 +152,8 @@ Supertone’s Text-to-Speech API provides multiple TTS models, each with differe
|
|
|
127
152
|
|--------------------|-------------------|--------------------------------------|----------------------------------------------------------|
|
|
128
153
|
| **SONA Speech 1** | `sona_speech_1` | ✅ Supported | Supports **all** Voice Settings |
|
|
129
154
|
| **Supertonic API 1** | `supertonic_api_1` | ❌ Not supported | Supports **only** the `speed` setting (others are ignored) |
|
|
130
|
-
| **SONA Speech 2** | `sona_speech_2` | ❌ Not supported | Supports **
|
|
155
|
+
| **SONA Speech 2** | `sona_speech_2` | ❌ Not supported | Supports **all** Voice Settings **except** `subharmonic_amplitude_control` |
|
|
156
|
+
| **SONA Speech 2 Flash** | `sona_speech_2_flash` | ❌ Not supported | Supports **all** Voice Settings **except** `similarity`, `text_guidance`,`subharmonic_amplitude_control` |
|
|
131
157
|
|
|
132
158
|
> [!NOTE]
|
|
133
159
|
> **Streaming Support**
|
|
@@ -151,6 +177,10 @@ Supertone’s Text-to-Speech API provides multiple TTS models, each with differe
|
|
|
151
177
|
- `en`, `ko`, `ja`, `bg`, `cs`, `da`, `el`, `es`, `et`, `fi`, `hu`, `it`, `nl`, `pl`, `pt`, `ro`,
|
|
152
178
|
`ar`, `de`, `fr`, `hi`, `id`, `ru`, `vi`
|
|
153
179
|
|
|
180
|
+
- **sona_speech_2_flash**
|
|
181
|
+
- `en`, `ko`, `ja`, `bg`, `cs`, `da`, `el`, `es`, `et`, `fi`, `hu`, `it`, `nl`, `pl`, `pt`, `ro`,
|
|
182
|
+
`ar`, `de`, `fr`, `hi`, `id`, `ru`, `vi`
|
|
183
|
+
|
|
154
184
|
---
|
|
155
185
|
|
|
156
186
|
### Voice Settings (Optional)
|
|
@@ -168,10 +198,10 @@ Some TTS models support optional voice settings that allow fine control over out
|
|
|
168
198
|
All other settings will be ignored.
|
|
169
199
|
|
|
170
200
|
- **sona_speech_2**
|
|
171
|
-
- Supports
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
201
|
+
- Supports **all** Voice Settings **except** `subharmonic_amplitude_control`.
|
|
202
|
+
|
|
203
|
+
- **sona_speech_2_flash**
|
|
204
|
+
- Supports **all** Voice Settings **except** `similarity`, `text_guidance`, `subharmonic_amplitude_control`.
|
|
175
205
|
|
|
176
206
|
> All Voice Settings are optional. When omitted, each model’s default values will be applied.
|
|
177
207
|
|
|
@@ -214,6 +244,151 @@ Some TTS models support optional voice settings that allow fine control over out
|
|
|
214
244
|
</details>
|
|
215
245
|
<!-- End Available Resources and Operations [operations] -->
|
|
216
246
|
|
|
247
|
+
<!-- Start Standalone functions [standalone-funcs] -->
|
|
248
|
+
## Standalone functions
|
|
249
|
+
|
|
250
|
+
All the methods listed above are available as standalone functions. These
|
|
251
|
+
functions are ideal for use in applications running in the browser, serverless
|
|
252
|
+
runtimes or other environments where application bundle size is a primary
|
|
253
|
+
concern. When using a bundler to build your application, all unused
|
|
254
|
+
functionality will be either excluded from the final bundle or tree-shaken away.
|
|
255
|
+
|
|
256
|
+
To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
|
|
257
|
+
|
|
258
|
+
<details>
|
|
259
|
+
|
|
260
|
+
<summary>Available standalone functions</summary>
|
|
261
|
+
|
|
262
|
+
- [`customVoicesCreateClonedVoice`](docs/sdks/customvoices/README.md#createclonedvoice) - Create cloned voice
|
|
263
|
+
- [`customVoicesDeleteCustomVoice`](docs/sdks/customvoices/README.md#deletecustomvoice) - Delete cloned voice
|
|
264
|
+
- [`customVoicesEditCustomVoice`](docs/sdks/customvoices/README.md#editcustomvoice) - Update cloned voice (partial update)
|
|
265
|
+
- [`customVoicesGetCustomVoice`](docs/sdks/customvoices/README.md#getcustomvoice) - Get single cloned voice
|
|
266
|
+
- [`customVoicesListCustomVoices`](docs/sdks/customvoices/README.md#listcustomvoices) - Gets custom (cloned) voices
|
|
267
|
+
- [`customVoicesSearchCustomVoices`](docs/sdks/customvoices/README.md#searchcustomvoices) - Search custom (cloned) voices
|
|
268
|
+
- [`textToSpeechCreateSpeech`](docs/sdks/texttospeech/README.md#createspeech) - Convert text to speech
|
|
269
|
+
- [`textToSpeechPredictDuration`](docs/sdks/texttospeech/README.md#predictduration) - Predict text-to-speech duration
|
|
270
|
+
- [`textToSpeechStreamSpeech`](docs/sdks/texttospeech/README.md#streamspeech) - Convert text to speech with streaming response
|
|
271
|
+
- [`usageGetCreditBalance`](docs/sdks/usage/README.md#getcreditbalance) - Retrieve credit balance
|
|
272
|
+
- [`usageGetUsage`](docs/sdks/usage/README.md#getusage) - Retrieve advanced API usage analytics
|
|
273
|
+
- [`usageGetVoiceUsage`](docs/sdks/usage/README.md#getvoiceusage) - Retrieve TTS API usage data
|
|
274
|
+
- [`voicesGetVoice`](docs/sdks/voices/README.md#getvoice) - Get voice details by ID
|
|
275
|
+
- [`voicesListVoices`](docs/sdks/voices/README.md#listvoices) - Gets available voices
|
|
276
|
+
- [`voicesSearchVoices`](docs/sdks/voices/README.md#searchvoices) - Search voices.
|
|
277
|
+
|
|
278
|
+
</details>
|
|
279
|
+
<!-- End Standalone functions [standalone-funcs] -->
|
|
280
|
+
|
|
281
|
+
<!-- Start File uploads [file-upload] -->
|
|
282
|
+
## File uploads
|
|
283
|
+
|
|
284
|
+
Certain SDK methods accept files as part of a multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
|
|
285
|
+
|
|
286
|
+
> [!TIP]
|
|
287
|
+
>
|
|
288
|
+
> Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
|
|
289
|
+
>
|
|
290
|
+
> - **Node.js v20+:** Since v20, Node.js comes with a native `openAsBlob` function in [`node:fs`](https://nodejs.org/docs/latest-v20.x/api/fs.html#fsopenasblobpath-options).
|
|
291
|
+
> - **Bun:** The native [`Bun.file`](https://bun.sh/docs/api/file-io#reading-files-bun-file) function produces a file handle that can be used for streaming file uploads.
|
|
292
|
+
> - **Browsers:** All supported browsers return an instance to a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) when reading the value from an `<input type="file">` element.
|
|
293
|
+
> - **Node.js v18:** A file stream can be created using the `fileFrom` helper from [`fetch-blob/from.js`](https://www.npmjs.com/package/fetch-blob).
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
import { Supertone } from "@supertone/supertone";
|
|
297
|
+
import { openAsBlob } from "node:fs";
|
|
298
|
+
|
|
299
|
+
const supertone = new Supertone({
|
|
300
|
+
apiKey: "<YOUR_API_KEY_HERE>",
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
async function run() {
|
|
304
|
+
const result = await supertone.customVoices.createClonedVoice({
|
|
305
|
+
files: await openAsBlob("example.file"),
|
|
306
|
+
name: "<value>",
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
console.log(result);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
run();
|
|
313
|
+
|
|
314
|
+
```
|
|
315
|
+
<!-- End File uploads [file-upload] -->
|
|
316
|
+
|
|
317
|
+
<!-- Start Retries [retries] -->
|
|
318
|
+
## Retries
|
|
319
|
+
|
|
320
|
+
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
|
|
321
|
+
|
|
322
|
+
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
|
|
323
|
+
```typescript
|
|
324
|
+
import { Supertone } from "@supertone/supertone";
|
|
325
|
+
|
|
326
|
+
const supertone = new Supertone({
|
|
327
|
+
apiKey: "<YOUR_API_KEY_HERE>",
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
async function run() {
|
|
331
|
+
const result = await supertone.textToSpeech.createSpeech({
|
|
332
|
+
voiceId: "<id>",
|
|
333
|
+
apiConvertTextToSpeechUsingCharacterRequest: {
|
|
334
|
+
text: "<value>",
|
|
335
|
+
language: "ja",
|
|
336
|
+
},
|
|
337
|
+
}, {
|
|
338
|
+
retries: {
|
|
339
|
+
strategy: "backoff",
|
|
340
|
+
backoff: {
|
|
341
|
+
initialInterval: 1,
|
|
342
|
+
maxInterval: 50,
|
|
343
|
+
exponent: 1.1,
|
|
344
|
+
maxElapsedTime: 100,
|
|
345
|
+
},
|
|
346
|
+
retryConnectionErrors: false,
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
console.log(result);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
run();
|
|
354
|
+
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
|
|
358
|
+
```typescript
|
|
359
|
+
import { Supertone } from "@supertone/supertone";
|
|
360
|
+
|
|
361
|
+
const supertone = new Supertone({
|
|
362
|
+
retryConfig: {
|
|
363
|
+
strategy: "backoff",
|
|
364
|
+
backoff: {
|
|
365
|
+
initialInterval: 1,
|
|
366
|
+
maxInterval: 50,
|
|
367
|
+
exponent: 1.1,
|
|
368
|
+
maxElapsedTime: 100,
|
|
369
|
+
},
|
|
370
|
+
retryConnectionErrors: false,
|
|
371
|
+
},
|
|
372
|
+
apiKey: "<YOUR_API_KEY_HERE>",
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
async function run() {
|
|
376
|
+
const result = await supertone.textToSpeech.createSpeech({
|
|
377
|
+
voiceId: "<id>",
|
|
378
|
+
apiConvertTextToSpeechUsingCharacterRequest: {
|
|
379
|
+
text: "<value>",
|
|
380
|
+
language: "ja",
|
|
381
|
+
},
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
console.log(result);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
run();
|
|
388
|
+
|
|
389
|
+
```
|
|
390
|
+
<!-- End Retries [retries] -->
|
|
391
|
+
|
|
217
392
|
<!-- Start Error Handling [errors] -->
|
|
218
393
|
## Error Handling
|
|
219
394
|
|
|
@@ -312,4 +487,101 @@ Additional example code can be found in the [examples](https://github.com/supert
|
|
|
312
487
|
<!-- End Additional Example Code [examples] -->
|
|
313
488
|
|
|
314
489
|
|
|
490
|
+
<!-- Start Server Selection [server] -->
|
|
491
|
+
## Server Selection
|
|
492
|
+
|
|
493
|
+
### Override Server URL Per-Client
|
|
494
|
+
|
|
495
|
+
The default server can be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
|
|
496
|
+
```typescript
|
|
497
|
+
import { Supertone } from "@supertone/supertone";
|
|
498
|
+
|
|
499
|
+
const supertone = new Supertone({
|
|
500
|
+
serverURL: "https://supertoneapi.com",
|
|
501
|
+
apiKey: "<YOUR_API_KEY_HERE>",
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
async function run() {
|
|
505
|
+
const result = await supertone.textToSpeech.createSpeech({
|
|
506
|
+
voiceId: "<id>",
|
|
507
|
+
apiConvertTextToSpeechUsingCharacterRequest: {
|
|
508
|
+
text: "<value>",
|
|
509
|
+
language: "ja",
|
|
510
|
+
},
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
console.log(result);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
run();
|
|
517
|
+
|
|
518
|
+
```
|
|
519
|
+
<!-- End Server Selection [server] -->
|
|
520
|
+
|
|
521
|
+
<!-- Start Custom HTTP Client [http-client] -->
|
|
522
|
+
## Custom HTTP Client
|
|
523
|
+
|
|
524
|
+
The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
|
|
525
|
+
[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
|
|
526
|
+
client is a thin wrapper around `fetch` and provides the ability to attach hooks
|
|
527
|
+
around the request lifecycle that can be used to modify the request or handle
|
|
528
|
+
errors and response.
|
|
529
|
+
|
|
530
|
+
The `HTTPClient` constructor takes an optional `fetcher` argument that can be
|
|
531
|
+
used to integrate a third-party HTTP client or when writing tests to mock out
|
|
532
|
+
the HTTP client and feed in fixtures.
|
|
533
|
+
|
|
534
|
+
The following example shows how to use the `"beforeRequest"` hook to to add a
|
|
535
|
+
custom header and a timeout to requests and how to use the `"requestError"` hook
|
|
536
|
+
to log errors:
|
|
537
|
+
|
|
538
|
+
```typescript
|
|
539
|
+
import { Supertone } from "@supertone/supertone";
|
|
540
|
+
import { HTTPClient } from "@supertone/supertone/lib/http";
|
|
541
|
+
|
|
542
|
+
const httpClient = new HTTPClient({
|
|
543
|
+
// fetcher takes a function that has the same signature as native `fetch`.
|
|
544
|
+
fetcher: (request) => {
|
|
545
|
+
return fetch(request);
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
httpClient.addHook("beforeRequest", (request) => {
|
|
550
|
+
const nextRequest = new Request(request, {
|
|
551
|
+
signal: request.signal || AbortSignal.timeout(5000)
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
nextRequest.headers.set("x-custom-header", "custom value");
|
|
555
|
+
|
|
556
|
+
return nextRequest;
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
httpClient.addHook("requestError", (error, request) => {
|
|
560
|
+
console.group("Request Error");
|
|
561
|
+
console.log("Reason:", `${error}`);
|
|
562
|
+
console.log("Endpoint:", `${request.method} ${request.url}`);
|
|
563
|
+
console.groupEnd();
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
const sdk = new Supertone({ httpClient });
|
|
567
|
+
```
|
|
568
|
+
<!-- End Custom HTTP Client [http-client] -->
|
|
569
|
+
|
|
570
|
+
<!-- Start Debugging [debug] -->
|
|
571
|
+
## Debugging
|
|
572
|
+
|
|
573
|
+
You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
574
|
+
|
|
575
|
+
You can pass a logger that matches `console`'s interface as an SDK option.
|
|
576
|
+
|
|
577
|
+
> [!WARNING]
|
|
578
|
+
> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
|
|
579
|
+
|
|
580
|
+
```typescript
|
|
581
|
+
import { Supertone } from "@supertone/supertone";
|
|
582
|
+
|
|
583
|
+
const sdk = new Supertone({ debugLogger: console });
|
|
584
|
+
```
|
|
585
|
+
<!-- End Debugging [debug] -->
|
|
586
|
+
|
|
315
587
|
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
@@ -472,9 +472,9 @@ async function testPredictDuration(
|
|
|
472
472
|
|
|
473
473
|
const response = await client.textToSpeech.predictDuration({
|
|
474
474
|
voiceId,
|
|
475
|
-
|
|
475
|
+
predictTTSDurationRequest: {
|
|
476
476
|
text: testText,
|
|
477
|
-
language: models.
|
|
477
|
+
language: models.PredictTTSDurationRequestLanguage.En,
|
|
478
478
|
},
|
|
479
479
|
});
|
|
480
480
|
|
|
@@ -795,7 +795,7 @@ async function testEditCustomVoice(
|
|
|
795
795
|
|
|
796
796
|
const response = await client.customVoices.editCustomVoice({
|
|
797
797
|
voiceId,
|
|
798
|
-
|
|
798
|
+
updateCustomVoiceRequest: {
|
|
799
799
|
name: testName,
|
|
800
800
|
description: testDescription,
|
|
801
801
|
},
|
|
@@ -1562,6 +1562,8 @@ async function testStreamSpeechWithPhonemes(
|
|
|
1562
1562
|
* Model-Language compatibility matrix
|
|
1563
1563
|
* - sona_speech_1: ko, en, ja
|
|
1564
1564
|
* - sona_speech_2: all languages (23 languages)
|
|
1565
|
+
* - sona_speech_2_flash: all languages (23 languages) - faster inference
|
|
1566
|
+
* - sona_speech_2t: all languages (23 languages) - turbo variant
|
|
1565
1567
|
* - supertonic_api_1: ko, en, ja, es, pt
|
|
1566
1568
|
*/
|
|
1567
1569
|
const MODEL_LANGUAGE_MATRIX = {
|
|
@@ -1591,6 +1593,31 @@ const MODEL_LANGUAGE_MATRIX = {
|
|
|
1591
1593
|
"ru",
|
|
1592
1594
|
"vi",
|
|
1593
1595
|
],
|
|
1596
|
+
sona_speech_2_flash: [
|
|
1597
|
+
"en",
|
|
1598
|
+
"ko",
|
|
1599
|
+
"ja",
|
|
1600
|
+
"bg",
|
|
1601
|
+
"cs",
|
|
1602
|
+
"da",
|
|
1603
|
+
"el",
|
|
1604
|
+
"es",
|
|
1605
|
+
"et",
|
|
1606
|
+
"fi",
|
|
1607
|
+
"hu",
|
|
1608
|
+
"it",
|
|
1609
|
+
"nl",
|
|
1610
|
+
"pl",
|
|
1611
|
+
"pt",
|
|
1612
|
+
"ro",
|
|
1613
|
+
"ar",
|
|
1614
|
+
"de",
|
|
1615
|
+
"fr",
|
|
1616
|
+
"hi",
|
|
1617
|
+
"id",
|
|
1618
|
+
"ru",
|
|
1619
|
+
"vi",
|
|
1620
|
+
],
|
|
1594
1621
|
supertonic_api_1: ["ko", "en", "ja", "es", "pt"],
|
|
1595
1622
|
} as const;
|
|
1596
1623
|
|
|
@@ -1705,6 +1732,64 @@ async function testCreateSpeechWithSupertonicApi1(
|
|
|
1705
1732
|
}
|
|
1706
1733
|
}
|
|
1707
1734
|
|
|
1735
|
+
/**
|
|
1736
|
+
* Test TTS with sona_speech_2_flash model (faster inference variant)
|
|
1737
|
+
*/
|
|
1738
|
+
async function testCreateSpeechWithSonaSpeech2Flash(
|
|
1739
|
+
voiceId: string | null
|
|
1740
|
+
): Promise<[boolean, any]> {
|
|
1741
|
+
console.log("⚡ TTS with sona_speech_2_flash Model Test (Fast Inference)");
|
|
1742
|
+
|
|
1743
|
+
if (!voiceId) {
|
|
1744
|
+
console.log(" ⚠️ No voice ID available");
|
|
1745
|
+
return [false, null];
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
try {
|
|
1749
|
+
const { Supertone } = await import("../src/index.js");
|
|
1750
|
+
const models = await import("../src/models/index.js");
|
|
1751
|
+
const client = new Supertone({ apiKey: API_KEY });
|
|
1752
|
+
|
|
1753
|
+
const testText =
|
|
1754
|
+
"Hello! Testing sona_speech_2_flash model for faster text-to-speech conversion.";
|
|
1755
|
+
console.log(` 🔍 Creating speech with sona_speech_2_flash model`);
|
|
1756
|
+
console.log(` Voice ID: ${voiceId}`);
|
|
1757
|
+
console.log(` Model: sona_speech_2_flash (faster inference)`);
|
|
1758
|
+
console.log(" ⚠️ This test consumes credits!");
|
|
1759
|
+
|
|
1760
|
+
const startTime = Date.now();
|
|
1761
|
+
const response = await client.textToSpeech.createSpeech({
|
|
1762
|
+
voiceId,
|
|
1763
|
+
apiConvertTextToSpeechUsingCharacterRequest: {
|
|
1764
|
+
text: testText,
|
|
1765
|
+
language: models.APIConvertTextToSpeechUsingCharacterRequestLanguage.En,
|
|
1766
|
+
outputFormat:
|
|
1767
|
+
models.APIConvertTextToSpeechUsingCharacterRequestOutputFormat.Wav,
|
|
1768
|
+
model:
|
|
1769
|
+
models.APIConvertTextToSpeechUsingCharacterRequestModel.SonaSpeech2Flash,
|
|
1770
|
+
},
|
|
1771
|
+
});
|
|
1772
|
+
const elapsed = Date.now() - startTime;
|
|
1773
|
+
|
|
1774
|
+
console.log(` ✅ sona_speech_2_flash TTS success`);
|
|
1775
|
+
console.log(` ⏱️ Response time: ${elapsed}ms`);
|
|
1776
|
+
|
|
1777
|
+
if (response.result) {
|
|
1778
|
+
const audioData = await extractAudioData(response);
|
|
1779
|
+
const outputFile = "test_sona_speech_2_flash_output.wav";
|
|
1780
|
+
fs.writeFileSync(outputFile, audioData);
|
|
1781
|
+
console.log(
|
|
1782
|
+
` 💾 Audio saved: ${outputFile} (${audioData.length} bytes)`
|
|
1783
|
+
);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
return [true, response];
|
|
1787
|
+
} catch (e: any) {
|
|
1788
|
+
logDetailedError(e, "sona_speech_2_flash TTS");
|
|
1789
|
+
return [false, e];
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1708
1793
|
/**
|
|
1709
1794
|
* Test TTS with unsupported model (should fail with validation error)
|
|
1710
1795
|
*/
|
|
@@ -1775,10 +1860,10 @@ async function testPredictDurationWithSonaSpeech2(
|
|
|
1775
1860
|
|
|
1776
1861
|
const response = await client.textToSpeech.predictDuration({
|
|
1777
1862
|
voiceId,
|
|
1778
|
-
|
|
1863
|
+
predictTTSDurationRequest: {
|
|
1779
1864
|
text: testText,
|
|
1780
|
-
language: models.
|
|
1781
|
-
model: models.
|
|
1865
|
+
language: models.PredictTTSDurationRequestLanguage.En,
|
|
1866
|
+
model: models.PredictTTSDurationRequestModel.SonaSpeech2,
|
|
1782
1867
|
},
|
|
1783
1868
|
});
|
|
1784
1869
|
|
|
@@ -1815,11 +1900,11 @@ async function testPredictDurationWithSupertonicApi1(
|
|
|
1815
1900
|
|
|
1816
1901
|
const response = await client.textToSpeech.predictDuration({
|
|
1817
1902
|
voiceId,
|
|
1818
|
-
|
|
1903
|
+
predictTTSDurationRequest: {
|
|
1819
1904
|
text: testText,
|
|
1820
|
-
language: models.
|
|
1905
|
+
language: models.PredictTTSDurationRequestLanguage.En,
|
|
1821
1906
|
model:
|
|
1822
|
-
models.
|
|
1907
|
+
models.PredictTTSDurationRequestModel.SupertonicApi1,
|
|
1823
1908
|
},
|
|
1824
1909
|
});
|
|
1825
1910
|
|
|
@@ -1833,6 +1918,49 @@ async function testPredictDurationWithSupertonicApi1(
|
|
|
1833
1918
|
}
|
|
1834
1919
|
}
|
|
1835
1920
|
|
|
1921
|
+
/**
|
|
1922
|
+
* Test prediction with sona_speech_2_flash model (faster inference variant)
|
|
1923
|
+
*/
|
|
1924
|
+
async function testPredictDurationWithSonaSpeech2Flash(
|
|
1925
|
+
voiceId: string | null
|
|
1926
|
+
): Promise<[boolean, any]> {
|
|
1927
|
+
console.log("⏱️ Duration Prediction with sona_speech_2_flash Model Test");
|
|
1928
|
+
|
|
1929
|
+
if (!voiceId) {
|
|
1930
|
+
console.log(" ⚠️ No voice ID available");
|
|
1931
|
+
return [false, null];
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
try {
|
|
1935
|
+
const { Supertone } = await import("../src/index.js");
|
|
1936
|
+
const models = await import("../src/models/index.js");
|
|
1937
|
+
const client = new Supertone({ apiKey: API_KEY });
|
|
1938
|
+
|
|
1939
|
+
const testText = "Testing duration prediction with sona_speech_2_flash model.";
|
|
1940
|
+
console.log(` 🔍 Predicting duration with sona_speech_2_flash model`);
|
|
1941
|
+
|
|
1942
|
+
const startTime = Date.now();
|
|
1943
|
+
const response = await client.textToSpeech.predictDuration({
|
|
1944
|
+
voiceId,
|
|
1945
|
+
predictTTSDurationRequest: {
|
|
1946
|
+
text: testText,
|
|
1947
|
+
language: models.PredictTTSDurationRequestLanguage.En,
|
|
1948
|
+
model: models.PredictTTSDurationRequestModel.SonaSpeech2Flash,
|
|
1949
|
+
},
|
|
1950
|
+
});
|
|
1951
|
+
const elapsed = Date.now() - startTime;
|
|
1952
|
+
|
|
1953
|
+
console.log(
|
|
1954
|
+
` ✅ sona_speech_2_flash duration prediction: ${response.duration}s`
|
|
1955
|
+
);
|
|
1956
|
+
console.log(` ⏱️ Response time: ${elapsed}ms`);
|
|
1957
|
+
return [true, response];
|
|
1958
|
+
} catch (e: any) {
|
|
1959
|
+
logDetailedError(e, "sona_speech_2_flash duration prediction");
|
|
1960
|
+
return [false, e];
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1836
1964
|
/**
|
|
1837
1965
|
* Test prediction with unsupported model (should fail with validation error)
|
|
1838
1966
|
*/
|
|
@@ -1860,9 +1988,9 @@ async function testPredictDurationWithUnsupportedModel(
|
|
|
1860
1988
|
|
|
1861
1989
|
const response = await client.textToSpeech.predictDuration({
|
|
1862
1990
|
voiceId,
|
|
1863
|
-
|
|
1991
|
+
predictTTSDurationRequest: {
|
|
1864
1992
|
text: testText,
|
|
1865
|
-
language: models.
|
|
1993
|
+
language: models.PredictTTSDurationRequestLanguage.En,
|
|
1866
1994
|
model: "invalid_model_xyz" as any, // Intentionally invalid model
|
|
1867
1995
|
},
|
|
1868
1996
|
});
|
|
@@ -2277,9 +2405,9 @@ async function testPredictDurationWithVoiceSettings(
|
|
|
2277
2405
|
|
|
2278
2406
|
const response = await client.textToSpeech.predictDuration({
|
|
2279
2407
|
voiceId,
|
|
2280
|
-
|
|
2408
|
+
predictTTSDurationRequest: {
|
|
2281
2409
|
text: "This is a duration test with adjusted speed.",
|
|
2282
|
-
language: models.
|
|
2410
|
+
language: models.PredictTTSDurationRequestLanguage.En,
|
|
2283
2411
|
voiceSettings,
|
|
2284
2412
|
},
|
|
2285
2413
|
});
|
|
@@ -3030,6 +3158,9 @@ async function main(): Promise<boolean> {
|
|
|
3030
3158
|
[success, result] = await testCreateSpeechWithSupertonicApi1(voiceIdForTTS);
|
|
3031
3159
|
testResults["create_speech_supertonic_api_1"] = success;
|
|
3032
3160
|
|
|
3161
|
+
[success, result] = await testCreateSpeechWithSonaSpeech2Flash(voiceIdForTTS);
|
|
3162
|
+
testResults["create_speech_sona_speech_2_flash"] = success;
|
|
3163
|
+
|
|
3033
3164
|
[success, result] = await testCreateSpeechWithUnsupportedModel(
|
|
3034
3165
|
voiceIdForTTS
|
|
3035
3166
|
);
|
|
@@ -3043,6 +3174,11 @@ async function main(): Promise<boolean> {
|
|
|
3043
3174
|
);
|
|
3044
3175
|
testResults["predict_duration_supertonic_api_1"] = success;
|
|
3045
3176
|
|
|
3177
|
+
[success, result] = await testPredictDurationWithSonaSpeech2Flash(
|
|
3178
|
+
voiceIdForTTS
|
|
3179
|
+
);
|
|
3180
|
+
testResults["predict_duration_sona_speech_2_flash"] = success;
|
|
3181
|
+
|
|
3046
3182
|
[success, result] = await testPredictDurationWithUnsupportedModel(
|
|
3047
3183
|
voiceIdForTTS
|
|
3048
3184
|
);
|
|
@@ -15,5 +15,5 @@ import { Result } from "../types/fp.js";
|
|
|
15
15
|
* @remarks
|
|
16
16
|
* Creates a custom (cloned) voice from uploaded audio files.
|
|
17
17
|
*/
|
|
18
|
-
export declare function customVoicesCreateClonedVoice(client: SupertoneCore, request: operations.CreateClonedVoiceRequest, options?: RequestOptions): APIPromise<Result<models.
|
|
18
|
+
export declare function customVoicesCreateClonedVoice(client: SupertoneCore, request: operations.CreateClonedVoiceRequest, options?: RequestOptions): APIPromise<Result<models.CreateCustomVoiceResponse, errors.BadRequestErrorResponse | errors.UnauthorizedErrorResponse | errors.ForbiddenErrorResponse | errors.NotFoundErrorResponse | errors.PayloadTooLargeErrorResponse | errors.UnsupportedMediaTypeErrorResponse | errors.TooManyRequestsErrorResponse | errors.InternalServerErrorResponse | SupertoneError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
19
|
//# sourceMappingURL=customVoicesCreateClonedVoice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customVoicesCreateClonedVoice.d.ts","sourceRoot":"","sources":["../../../src/funcs/customVoicesCreateClonedVoice.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAS3C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;A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MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,UAAU,CAAC,wBAAwB,EAC5C,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CACX,MAAM,CACJ,MAAM,CAAC,yBAAyB,EAC9B,MAAM,CAAC,uBAAuB,GAC9B,MAAM,CAAC,yBAAyB,GAChC,MAAM,CAAC,sBAAsB,GAC7B,MAAM,CAAC,qBAAqB,GAC5B,MAAM,CAAC,4BAA4B,GACnC,MAAM,CAAC,iCAAiC,GACxC,MAAM,CAAC,4BAA4B,GACnC,MAAM,CAAC,2BAA2B,GAClC,cAAc,GACd,uBAAuB,GACvB,eAAe,GACf,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,qBAAqB,GACrB,kBAAkB,CACrB,CACF,CAMA"}
|
|
@@ -79,7 +79,11 @@ async function $do(client, request, options) {
|
|
|
79
79
|
else {
|
|
80
80
|
const contentType = (0, files_js_1.getContentTypeFromFileName)(payload.files.fileName)
|
|
81
81
|
|| "application/octet-stream";
|
|
82
|
-
|
|
82
|
+
// Handle Uint8Array with ArrayBufferLike by copying to ensure ArrayBuffer compatibility
|
|
83
|
+
const content = payload.files.content instanceof Uint8Array
|
|
84
|
+
? new Uint8Array(payload.files.content)
|
|
85
|
+
: payload.files.content;
|
|
86
|
+
(0, encodings_js_1.appendForm)(body, "files", new Blob([content], { type: contentType }), payload.files.fileName);
|
|
83
87
|
}
|
|
84
88
|
(0, encodings_js_1.appendForm)(body, "name", payload.name);
|
|
85
89
|
if (payload.description !== undefined) {
|
|
@@ -142,7 +146,7 @@ async function $do(client, request, options) {
|
|
|
142
146
|
const responseFields = {
|
|
143
147
|
HttpMeta: { Response: response, Request: req },
|
|
144
148
|
};
|
|
145
|
-
const [result] = await M.match(M.json(200, models.
|
|
149
|
+
const [result] = await M.match(M.json(200, models.CreateCustomVoiceResponse$inboundSchema), M.jsonErr(400, errors.BadRequestErrorResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedErrorResponse$inboundSchema), M.jsonErr(403, errors.ForbiddenErrorResponse$inboundSchema), M.jsonErr(404, errors.NotFoundErrorResponse$inboundSchema), M.jsonErr(413, errors.PayloadTooLargeErrorResponse$inboundSchema), M.jsonErr(415, errors.UnsupportedMediaTypeErrorResponse$inboundSchema), M.jsonErr(429, errors.TooManyRequestsErrorResponse$inboundSchema), M.jsonErr(500, errors.InternalServerErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
146
150
|
if (!result.ok) {
|
|
147
151
|
return [result, { status: "complete", request: req, response }];
|
|
148
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customVoicesCreateClonedVoice.js","sourceRoot":"","sources":["../../../src/funcs/customVoicesCreateClonedVoice.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCH,sEA8BC;AAjED,sDAAiD;AACjD,8CAGyB;AACzB,sDAAwC;AACxC,wDAAkD;AAClD,kDAA8C;AAE9C,oDAA4E;AAC5E,0CAA2C;AAQ3C,kEAAoD;AAIpD,2DAA6C;AAC7C,0EAA4D;AAC5D,gDAAwD;AACxD,gDAA+C;AAE/C,oDAAuD;AAEvD;;;;;GAKG;AACH,SAAgB,6BAA6B,CAC3C,MAAqB,EACrB,OAA4C,EAC5C,OAAwB;IAsBxB,OAAO,IAAI,qBAAU,CAAC,GAAG,CACvB,MAAM,EACN,OAAO,EACP,OAAO,CACR,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,GAAG,CAChB,MAAqB,EACrB,OAA4C,EAC5C,OAAwB;IAyBxB,MAAM,MAAM,GAAG,IAAA,sBAAS,EACtB,OAAO,EACP,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,uCAAuC,CAAC,KAAK,CAAC,KAAK,CAAC,EAC1E,yBAAyB,CAC1B,CAAC;IACF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,CA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C,GAAG,EAAE,MAAM,CAAC,0CAA0C,CAAC,EACjE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,yCAAyC,CAAC,EAChE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EACb,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CACd,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;IAClD,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -15,5 +15,5 @@ import { Result } from "../types/fp.js";
|
|
|
15
15
|
* @remarks
|
|
16
16
|
* Partially updates properties of a custom (cloned) voice by ID.
|
|
17
17
|
*/
|
|
18
|
-
export declare function customVoicesEditCustomVoice(client: SupertoneCore, request: operations.EditCustomVoiceRequest, options?: RequestOptions): APIPromise<Result<models.
|
|
18
|
+
export declare function customVoicesEditCustomVoice(client: SupertoneCore, request: operations.EditCustomVoiceRequest, options?: RequestOptions): APIPromise<Result<models.UpdateCustomVoiceResponse, errors.UnauthorizedErrorResponse | errors.NotFoundErrorResponse | errors.InternalServerErrorResponse | SupertoneError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
19
|
//# sourceMappingURL=customVoicesEditCustomVoice.d.ts.map
|