---
title: Voice cloning
description: Create voices to use with LMNT's models with 5-10 seconds of reference speech
---

Voice cloning is the way you create and save voice prompts to use with LMNT's models.
LMNT does the hard work to ensure your prompts are ready to serve your traffic with low
latency at scale.

## Crafting a good voice prompt

Treat the reference speech like you'd treat a prompt to an LLM: clear,
focused, and representative of the style of output you want.

See our [voice prompting guide](/prompt-engineering/voice-prompting).

## Creating a voice

If you're trying things out or only creating a handful of voices, it's easiest to use our
[Playground](https://app.lmnt.com/).

Otherwise, upload your reference speech prompt through the Voice API and you'll get back a
voice object with an `id` you can use in any speech call.

<CodeGroup>
```python Python
import asyncio
import sys

from lmnt import AsyncLmnt

async def main():
  client = AsyncLmnt()
  with open(sys.argv[1], 'rb') as audio:
    voice = await client.voices.create(
      name='my-voice',
      file=audio,
    )
  print(f'Created voice: {voice.id}')

asyncio.run(main())
```

```typescript TypeScript
import { createReadStream } from 'fs';

import Lmnt from 'lmnt-node';

const client = new Lmnt();

const voice = await client.voices.create({
  name: 'my-voice',
  file: createReadStream(process.argv[2]),
});

console.log(`Created voice: ${voice.id}`);
```

```go Go
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/lmnt-com/lmnt-go/v2"
)

func main() {
	client := lmnt.NewClient()

	file, err := os.Open(os.Args[1])
	if err != nil {
		log.Fatal(err)
	}
	defer file.Close()

	voice, err := client.Voice.New(context.TODO(), lmnt.VoiceNewParams{
		Name: "my-voice",
		File: file,
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Created voice: %s\n", voice.ID)
}
```

```sh cURL
curl --request POST \
  --url https://api.lmnt.com/v1/ai/voice \
  --header "X-API-Key: $LMNT_API_KEY" \
  --header 'lmnt-version: 1.2' \
  --form 'name=my-voice' \
  --form 'file=@reference.mp3'
```
</CodeGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Learn about voice prompting" icon="mic" href="/prompt-engineering/voice-prompting" variant="outline">
    Best practices for creating great voice prompts
  </Card>
  <Card title="Learn about text prompting" icon="a-large-small" href="/prompt-engineering/text-prompting" variant="outline">
    Shape pronunciation, pacing, and emphasis with your input text
  </Card>
</CardGroup>
