> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# Zremiksuj głos.

POST https://api.elevenlabs.io/v1/text-to-voice/{voice_id}/remix
Content-Type: application/json

Stwórz remix istniejącego głosu za pomocą promptu. Ta metoda zwraca listę podglądów głosu. Każdy podgląd zawiera generated_voice_id i próbkę głosu jako audio MP3 zakodowane w base64. Aby utworzyć głos, użyj generated_voice_id wybranego podglądu z endpointem /v1/text-to-voice.

Reference: https://elevenlabs.io/docs/api-reference/text-to-voice/remix

## Servers

- `https://api.elevenlabs.io` (Production, default)
- `https://api.us.elevenlabs.io` (Production US)
- `https://api.eu.residency.elevenlabs.io` (Production EU)
- `https://api.in.residency.elevenlabs.io` (Production India)
- `https://api.sg.residency.elevenlabs.io` (Production Singapore)

## Request

### Path parameters

- `voice_id` (string, required) — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

### Query parameters

- `output_format` (enum, optional) — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs.
  - Allowed values: `mp3_22050_32`, `mp3_24000_48`, `mp3_44100_32`, `mp3_44100_64`, `mp3_44100_96`, `mp3_44100_128`, `mp3_44100_192`, `pcm_8000`, `pcm_16000`, `pcm_22050`, `pcm_24000`, `pcm_32000`, `pcm_44100`, `pcm_48000`, `ulaw_8000`, `alaw_8000`, `opus_48000_32`, `opus_48000_64`, `opus_48000_96`, `opus_48000_128`, `opus_48000_192`

### Body (application/json)

This endpoint expects a VoiceRemixRequestModel.

- `voice_description` (string, required) — Opis zmian, które należy wprowadzić w głosie.
- `text` (string, optional, nullable) — Tekst do wygenerowania musi mieć od 100 do 1000 znaków.
- `auto_generate_text` (boolean, optional, default: false) — Czy automatycznie generować tekst odpowiedni do opisu głosu.
- `loudness` (double, optional, default: 0.5) — Określa poziom głośności wygenerowanego głosu. -1 oznacza najciszej, 1 najgłośniej, a 0 odpowiada około -24 LUFS.
- `seed` (integer, optional, nullable) — Liczba losowa sterująca generowaniem głosu. Ten sam seed przy tych samych danych wejściowych daje ten sam głos.
- `guidance_scale` (double, optional, default: 2) — Określa, jak ściśle AI podąża za promptem. Niższe wartości dają AI większą swobodę twórczą, a wyższe zmuszają ją do bliższego trzymania się promptu. Wysokie wartości mogą sprawić, że głos zabrzmi sztucznie lub robotycznie. Przy niższej wartości Guidance Scale zalecamy używać dłuższych, bardziej szczegółowych promptów.
- `stream_previews` (boolean, optional, default: false) — Określa, czy podglądy Text to Voice mają być uwzględnione w odpowiedzi. Jeśli wartość to true, zwrócone zostaną tylko wygenerowane identyfikatory, które można następnie przesyłać strumieniowo przez endpoint /v1/text-to-voice/:generated_voice_id/stream.
- `remixing_session_id` (string, optional, nullable) — ID sesji remiksowania.
- `remixing_session_iteration_id` (string, optional, nullable) — ID iteracji sesji remiksowania, do której należy dołączyć te generacje. Jeśli nie zostanie podane, zostanie utworzona nowa iteracja.
- `prompt_strength` (double, optional, nullable) — Określa równowagę między promptem a referencyjnym audio podczas generowania próbek głosu. 0 oznacza niemal brak wpływu promptu, a 1 — niemal brak wpływu referencyjnego audio. Obsługiwane tylko przez model eleven_ttv_v3.

## Response

### 200

Pomyślna odpowiedź

- `previews` (list of VoicePreviewResponseModel, required) — Podglądy wygenerowanych głosów.
- `text` (string, required) — Tekst używany do podglądu głosów.

## Errors

### 409 Conflict Error

Generowanie tego podglądu już trwa. Spróbuj ponownie.

- `any`

### 422 Unprocessable Entity Error

Błąd walidacji

- `detail` (list of ValidationError, optional)

## Types

### VoicePreviewResponseModel

- `audio_base_64` (string, required) — Audio podglądu zakodowane w base64.
- `generated_voice_id` (string, required) — ID wygenerowanego głosu. Użyj go, aby utworzyć głos z podglądu.
- `media_type` (string, required) — Typ multimediów podglądu.
- `duration_secs` (double, required) — Czas trwania podglądu w sekundach.
- `language` (string, required, nullable) — Język podglądu.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItems

- string
- integer

## Examples

**Request**

```json
{
  "voice_description": "Make the voice have a higher pitch."
}
```

**Response**

```json
{
  "previews": [
    {
      "audio_base_64": "string",
      "generated_voice_id": "string",
      "media_type": "string",
      "duration_secs": 1.1,
      "language": "string"
    }
  ],
  "text": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/text-to-voice/21m00Tcm4TlvDq8ikWAM/remix"

payload = { "voice_description": "Make the voice have a higher pitch." }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/text-to-voice/21m00Tcm4TlvDq8ikWAM/remix';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"voice_description":"Make the voice have a higher pitch."}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.elevenlabs.io/v1/text-to-voice/21m00Tcm4TlvDq8ikWAM/remix"

	payload := strings.NewReader("{\n  \"voice_description\": \"Make the voice have a higher pitch.\"\n}")

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

	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

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

url = URI("https://api.elevenlabs.io/v1/text-to-voice/21m00Tcm4TlvDq8ikWAM/remix")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"voice_description\": \"Make the voice have a higher pitch.\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.elevenlabs.io/v1/text-to-voice/21m00Tcm4TlvDq8ikWAM/remix")
  .header("Content-Type", "application/json")
  .body("{\n  \"voice_description\": \"Make the voice have a higher pitch.\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.elevenlabs.io/v1/text-to-voice/21m00Tcm4TlvDq8ikWAM/remix', [
  'body' => '{
  "voice_description": "Make the voice have a higher pitch."
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/text-to-voice/21m00Tcm4TlvDq8ikWAM/remix");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"voice_description\": \"Make the voice have a higher pitch.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["voice_description": "Make the voice have a higher pitch."] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/text-to-voice/21m00Tcm4TlvDq8ikWAM/remix")! 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()
```