> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt.
> For full documentation content in one file, see https://docs.sarvam.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Create Voice

POST https://api.sarvam.ai/voices/create
Content-Type: multipart/form-data

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. No polling or status endpoint is needed; the voice is ready to use immediately with POST /voices/clone.

A background job improves the reference audio (noise reduction) after the voice is created; this does not block the response.

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. 3 voices on the starter tier) - 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).

Reference: https://docs.sarvam.ai/api-reference/voice-cloning/create-voice

## Authentication

- `api-subscription-key` header (required) — API Key authentication via header

## Request

### Body (multipart/form-data)

This endpoint expects a multipart form containing a file.

- `file` (file, required) — Reference audio file used to create the cloned voice. Supported formats: WAV, MP3, FLAC, OPUS, AAC, MULAW, ALAW, LINEAR16. WAV is recommended. Limits: max file size 50 MB. Recommended duration is 10-30 seconds, single speaker, minimal background noise.
- `name` (string, required) — Display name for the cloned voice (1-100 characters).
- `language` (string, required) — BCP-47 language code of the reference audio (e.g. `en-IN`, `hi-IN`). The transcript is auto-generated via ASR; you do not need to pass it.
- `style` (enum, optional) — Optional speaking style for the cloned voice.
- `gender` (enum, optional) — Optional gender tag for the cloned voice.

## Response

### 201

Voice created successfully. Usable immediately with POST /voices/clone.

- `status` (string, required) — `success`
- `data` (object, required)
  - `voice_id` (string, required) — ID of the newly created cloned voice. Pass it as `voice_id` to POST /voices/clone to synthesize speech.
  - `status` (string, required) — Creation status. `saved` means the voice is ready to use immediately.
  - `reference_text` (string, optional, nullable) — Transcript of the reference audio, auto-generated via ASR. Stored with the voice and reused at synthesis time.

## Errors

### 400 Bad Request Error

Bad Request. Unsupported audio format, file over 50 MB, or a Studio-only field (`consent`, `passage_id`, `noise_reduction`, `accent`, `ref_text`) was sent.

- `error` (object, required) — Error details
  - `request_id` (string, required, nullable)
  - `message` (string, required) — Message describing the error
  - `code` (enum, required) — Error code for the specific error that has occurred. Refer to the error code documentation for more details.
    - Allowed values: `invalid_request_error`, `internal_server_error`, `unprocessable_entity_error`, `insufficient_quota_error`, `invalid_api_key_error`, `authentication_error`, `not_found_error`, `rate_limit_exceeded_error`, `model_call_error`, `gateway_timeout_error`, `billing_service_unavailable_error`

### 401 Unauthorized Error

Unauthorized. The `api-subscription-key` header is missing or invalid.

- `error` (object, required) — Error details
  - `request_id` (string, required, nullable)
  - `message` (string, required) — Message describing the error
  - `code` (enum, required) — Error code for the specific error that has occurred. Refer to the error code documentation for more details.
    - Allowed values: `invalid_request_error`, `internal_server_error`, `unprocessable_entity_error`, `insufficient_quota_error`, `invalid_api_key_error`, `authentication_error`, `not_found_error`, `rate_limit_exceeded_error`, `model_call_error`, `gateway_timeout_error`, `billing_service_unavailable_error`

### 403 Forbidden Error

Forbidden. Your organization has reached its subscription tier's voice limit.

- `error` (object, required) — Error details
  - `request_id` (string, required, nullable)
  - `message` (string, required) — Message describing the error
  - `code` (enum, required) — Error code for the specific error that has occurred. Refer to the error code documentation for more details.
    - Allowed values: `invalid_request_error`, `internal_server_error`, `unprocessable_entity_error`, `insufficient_quota_error`, `invalid_api_key_error`, `authentication_error`, `not_found_error`, `rate_limit_exceeded_error`, `model_call_error`, `gateway_timeout_error`, `billing_service_unavailable_error`

### 422 Unprocessable Entity Error

Validation Error. Missing required fields, or the reference audio failed quality/ASR validation (too noisy, too short, or no clear single speaker).

- `error` (object, required) — Error details
  - `request_id` (string, required, nullable)
  - `message` (string, required) — Message describing the error
  - `code` (enum, required) — Error code for the specific error that has occurred. Refer to the error code documentation for more details.
    - Allowed values: `invalid_request_error`, `internal_server_error`, `unprocessable_entity_error`, `insufficient_quota_error`, `invalid_api_key_error`, `authentication_error`, `not_found_error`, `rate_limit_exceeded_error`, `model_call_error`, `gateway_timeout_error`, `billing_service_unavailable_error`

### 500 Internal Server Error

Internal Server Error.

- `error` (object, required) — Error details
  - `request_id` (string, required, nullable)
  - `message` (string, required) — Message describing the error
  - `code` (enum, required) — Error code for the specific error that has occurred. Refer to the error code documentation for more details.
    - Allowed values: `invalid_request_error`, `internal_server_error`, `unprocessable_entity_error`, `insufficient_quota_error`, `invalid_api_key_error`, `authentication_error`, `not_found_error`, `rate_limit_exceeded_error`, `model_call_error`, `gateway_timeout_error`, `billing_service_unavailable_error`

### 502 Bad Gateway Error

Bad Gateway. The cloning model failed to generate the voice. Safe to retry.

- `error` (object, required) — Error details
  - `request_id` (string, required, nullable)
  - `message` (string, required) — Message describing the error
  - `code` (enum, required) — Error code for the specific error that has occurred. Refer to the error code documentation for more details.
    - Allowed values: `invalid_request_error`, `internal_server_error`, `unprocessable_entity_error`, `insufficient_quota_error`, `invalid_api_key_error`, `authentication_error`, `not_found_error`, `rate_limit_exceeded_error`, `model_call_error`, `gateway_timeout_error`, `billing_service_unavailable_error`

### 503 Service Unavailable Error

Service Unavailable. The cloning model is temporarily overloaded.

- `error` (object, required) — Error details
  - `request_id` (string, required, nullable)
  - `message` (string, required) — Message describing the error
  - `code` (enum, required) — Error code for the specific error that has occurred. Refer to the error code documentation for more details.
    - Allowed values: `invalid_request_error`, `internal_server_error`, `unprocessable_entity_error`, `insufficient_quota_error`, `invalid_api_key_error`, `authentication_error`, `not_found_error`, `rate_limit_exceeded_error`, `model_call_error`, `gateway_timeout_error`, `billing_service_unavailable_error`

### 504 Gateway Timeout Error

Gateway Timeout. The clone took too long to complete.

- `error` (object, required) — Error details
  - `request_id` (string, required, nullable)
  - `message` (string, required) — Message describing the error
  - `code` (enum, required) — Error code for the specific error that has occurred. Refer to the error code documentation for more details.
    - Allowed values: `invalid_request_error`, `internal_server_error`, `unprocessable_entity_error`, `insufficient_quota_error`, `invalid_api_key_error`, `authentication_error`, `not_found_error`, `rate_limit_exceeded_error`, `model_call_error`, `gateway_timeout_error`, `billing_service_unavailable_error`

## Examples

**Request**

```json
{
  "file": "<file: string>",
  "language": "string",
  "name": "string"
}
```

**Response**

```json
{
  "status": "success",
  "data": {
    "voice_id": "svc-efb9cac0-c63d-433a-9903-b3f0b0865b2b",
    "status": "saved",
    "reference_text": "Hello, welcome to Sarvam AI. We build cutting edge voice technology for Indian languages."
  }
}
```

**SDK Code**

```typescript voiceCloning_createVoice_example
import { SarvamAIClient } from "sarvamai";
import fs from "fs";

const client = new SarvamAIClient({
  apiSubscriptionKey: process.env.SARVAM_API_KEY,
});

const response = await client.voiceCloning.createVoice({
  file: fs.createReadStream("reference.wav"),
  name: "my-cloned-voice",
  language: "en-IN",
  style: "conversational",
});

console.log(response.voiceId); // pass to client.voiceCloning.textToSpeech({ voiceId })
console.log(response.referenceText); // auto-generated transcript

```

```typescript voiceCloning_createVoice_example
import { SarvamAIClient } from "sarvamai";

async function main() {
    const client = new SarvamAIClient({
        apiSubscriptionKey: "YOUR_API_KEY_HERE",
    });
    await client.voiceCloning.createVoice({});
}
main();

```

```python voiceCloning_createVoice_example
from sarvamai import SarvamAI

client = SarvamAI(
    api_subscription_key="YOUR_API_KEY_HERE",
)

client.voice_cloning.create_voice(
    file="example_file",
)

```

```go voiceCloning_createVoice_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.sarvam.ai/voices/create"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"gender\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"style\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("api-subscription-key", "<apiSubscriptionKey>")
	req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby voiceCloning_createVoice_example
require 'uri'
require 'net/http'

url = URI("https://api.sarvam.ai/voices/create")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api-subscription-key"] = '<apiSubscriptionKey>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"gender\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"style\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java voiceCloning_createVoice_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.sarvam.ai/voices/create")
  .header("api-subscription-key", "<apiSubscriptionKey>")
  .header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"gender\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"style\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php voiceCloning_createVoice_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.sarvam.ai/voices/create', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => 'string',
        'contents' => null
    ],
    [
        'name' => 'language',
        'contents' => 'string'
    ],
    [
        'name' => 'name',
        'contents' => 'string'
    ]
  ]
  'headers' => [
    'api-subscription-key' => '<apiSubscriptionKey>',
  ],
]);

echo $response->getBody();
```

```csharp voiceCloning_createVoice_example
using RestSharp;

var client = new RestClient("https://api.sarvam.ai/voices/create");
var request = new RestRequest(Method.POST);
request.AddHeader("api-subscription-key", "<apiSubscriptionKey>");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"gender\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"style\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift voiceCloning_createVoice_example
import Foundation

let headers = [
  "api-subscription-key": "<apiSubscriptionKey>",
  "Content-Type": "multipart/form-data; boundary=---011000010111000001101001"
]
let parameters = [
  [
    "name": "file",
    "fileName": "string"
  ],
  [
    "name": "gender",
    "value": 
  ],
  [
    "name": "language",
    "value": "string"
  ],
  [
    "name": "name",
    "value": "string"
  ],
  [
    "name": "style",
    "value": 
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sarvam.ai/voices/create")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```