import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js"; import * as core from "../../../../core/index.js"; import * as SarvamAI from "../../../index.js"; export declare namespace VoiceCloningClient { type Options = BaseClientOptions; interface RequestOptions extends BaseRequestOptions { } } export declare class VoiceCloningClient { protected readonly _options: NormalizedClientOptionsWithAuth; constructor(options?: VoiceCloningClient.Options); /** * **Beta.** Generates speech in a cloned voice. * * Provide **exactly one** of: * - `voice_id` — a saved cloned voice from `POST /voices/create` (or Content Studio), or * - `ref_audio` — a reference audio clip uploaded with this request (optional `ref_text` transcript). * * Sending both returns `400`. A saved `voice_id` avoids re-uploading the clip on every call. * * Accepts `multipart/form-data`. * * **Base URL:** `https://api.sarvam.ai`. * **Auth:** send your key in the `api-subscription-key` header (recommended); `Authorization: Bearer ` is also accepted. * * `language_code` is optional — omit it to detect the language from `text`, or pass it when pronunciation has to be exact. The cloned voice is cross-lingual: the reference clip's language does not need to match `language_code`. * * **Billing:** charged per character of `text` against the `text_to_speech_voice_cloning` API. See the [pricing page](https://docs.sarvam.ai/api/getting-started/pricing). * * @param {SarvamAI.VoiceCloningRequest} request * @param {VoiceCloningClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.BadRequestError} * @throws {@link SarvamAI.PaymentRequiredError} * @throws {@link SarvamAI.ForbiddenError} * @throws {@link SarvamAI.UnprocessableEntityError} * @throws {@link SarvamAI.TooManyRequestsError} * @throws {@link SarvamAI.InternalServerError} * @throws {@link SarvamAI.BadGatewayError} * @throws {@link SarvamAI.ServiceUnavailableError} * @throws {@link SarvamAI.GatewayTimeoutError} * * @example * import { createReadStream } from "fs"; * await client.voiceCloning.convert({ * voice_id: "svc-123e4567-e89b-12d3-a456-426614174000", * text: "\u0928\u092E\u0938\u094D\u0924\u0947, \u092E\u0948\u0902 \u0906\u092A\u0915\u0940 \u0915\u0948\u0938\u0947 \u092E\u0926\u0926 \u0915\u0930 \u0938\u0915\u0924\u093E \u0939\u0942\u0901?" * }) */ convert(request: SarvamAI.VoiceCloningRequest, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise; private __convert; /** * **Beta.** Converts the input text into a streamed spoken audio response using a cloned voice. * * Provide **exactly one** of: * - `voice_id` — a saved cloned voice from `POST /voices/create` (or Content Studio), or * - `ref_audio` — a reference audio clip uploaded with this request (optional `ref_text` transcript). * * Sending both returns `400`. `language_code` is optional — omit it to detect the language from `text`, or pass it when pronunciation has to be exact. The response is a binary audio stream (not JSON), so you can begin playback as soon as the first sentence is ready. * * Accepts `multipart/form-data`. * * **Base URL:** `https://api.sarvam.ai`. * **Auth:** send your key in the `api-subscription-key` header (recommended); `Authorization: Bearer ` is also accepted. * * **Streaming codecs:** `mp3` (default), `wav`, `linear16`, `mulaw`, `alaw`. `flac`, `aac`, and `opus` are not supported on this endpoint because each sentence would be a complete container that cannot be concatenated. * * Quality checks (QC/VAD) and duration bounds (`min_audio_duration` / `max_audio_duration`) are not accepted — the stream path optimizes for time-to-first-byte. * * **Billing:** charged per character of `text` against the `text_to_speech_voice_cloning` API. See the [pricing page](https://docs.sarvam.ai/api/getting-started/pricing). * @throws {@link SarvamAI.BadRequestError} * @throws {@link SarvamAI.PaymentRequiredError} * @throws {@link SarvamAI.ForbiddenError} * @throws {@link SarvamAI.UnprocessableEntityError} * @throws {@link SarvamAI.TooManyRequestsError} * @throws {@link SarvamAI.InternalServerError} * @throws {@link SarvamAI.BadGatewayError} * @throws {@link SarvamAI.ServiceUnavailableError} * @throws {@link SarvamAI.GatewayTimeoutError} */ convertStream(request: SarvamAI.VoiceCloningStreamRequest, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise; private __convertStream; /** * **Beta.** Creates a cloned voice from a reference audio clip in **one shot**. The whole pipeline runs inline: the audio is stored, validated for quality, transcribed via ASR, and cloned - the response returns the new `voice_id` and the auto-generated transcript (`reference_text`) together. * * `remove_background_noise` defaults to `true`: background noise is removed from the reference audio using ML vocal extraction before the voice is saved. Pass `false` to keep the original clip. The response includes `background_noise_removed` to indicate whether denoise was actually applied. * * Accepts `multipart/form-data` - send the audio as the `file` upload and everything else as form fields. * * **Base URL:** `https://api.sarvam.ai`. * **Auth:** send your key in the `api-subscription-key` header. * * **Limits:** max file size 50 MB. Voice count is capped by your subscription tier (e.g. 50 voices on the starter tier, counted across your organization) - the API returns 403 `TIER_LIMIT_REACHED` when the cap is hit. * * **Billing:** charged against the voice cloning API. See the [pricing page](https://docs.sarvam.ai/api/getting-started/pricing). * * @param {SarvamAI.CreateVoiceRequest} request * @param {VoiceCloningClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.BadRequestError} * @throws {@link SarvamAI.UnauthorizedError} * @throws {@link SarvamAI.ForbiddenError} * @throws {@link SarvamAI.UnprocessableEntityError} * @throws {@link SarvamAI.InternalServerError} * @throws {@link SarvamAI.BadGatewayError} * @throws {@link SarvamAI.ServiceUnavailableError} * @throws {@link SarvamAI.GatewayTimeoutError} * * @example * import { createReadStream } from "fs"; * await client.voiceCloning.createVoice({ * file: fs.createReadStream("/path/to/your/file"), * name: "name", * language: "language" * }) */ createVoice(request: SarvamAI.CreateVoiceRequest, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise; private __createVoice; /** * **Beta.** Lists the cloned voices in your workspace, newest first. Use the returned `id` with POST /voices/clone (`voice_id`) or GET /voices/{voice_id}. * * **Base URL:** `https://api.sarvam.ai`. * **Auth:** send your key in the `api-subscription-key` header. * * @param {SarvamAI.ListVoicesRequest} request * @param {VoiceCloningClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.UnauthorizedError} * @throws {@link SarvamAI.InternalServerError} * * @example * await client.voiceCloning.listVoices({ * search: "search", * gender: "gender", * accent: "accent", * limit: 1, * offset: 1 * }) */ listVoices(request?: SarvamAI.ListVoicesRequest, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise; private __listVoices; /** * **Beta.** Returns full details for one cloned voice, including its ASR transcript (`reference_text`) and time-limited signed URLs for the reference, recorded, and preview audio. * * **Base URL:** `https://api.sarvam.ai`. * **Auth:** send your key in the `api-subscription-key` header. * * @param {string} voice_id - ID of the cloned voice. * @param {VoiceCloningClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.UnauthorizedError} * @throws {@link SarvamAI.NotFoundError} * @throws {@link SarvamAI.InternalServerError} * * @example * await client.voiceCloning.getVoice("voice_id") */ getVoice(voice_id: string, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise; private __getVoice; /** * **Beta.** Deletes a cloned voice: its audio assets are removed and the voice is no longer listed or usable for synthesis. On the Starter (pay as you go) plan (capped at 50 voices across your organization), deleting a voice frees a slot. Pro and Enterprise plans have higher limits. * * **Base URL:** `https://api.sarvam.ai`. * **Auth:** send your key in the `api-subscription-key` header. Returns `204 No Content` on success. * * @param {string} voice_id - ID of the cloned voice to delete. * @param {VoiceCloningClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.UnauthorizedError} * @throws {@link SarvamAI.NotFoundError} * @throws {@link SarvamAI.InternalServerError} * * @example * await client.voiceCloning.deleteVoice("voice_id") */ deleteVoice(voice_id: string, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise; private __deleteVoice; }