moses

Voice cloning by API: your own voice in seven languages from a short recording

Clone a voice from 10 to 20 seconds of speech with one API call and use it in realtime and HTTP text to speech, in seven languages. Consent, recording tips, code.

A voice is part of a brand, as much as a logo or a colour. Until now, giving your app, your phone line or your voice agent your own voice through the Moses TTS API meant recording it by hand on the TTS page. From today it is one API call: send a short recording, get a voice id back, and use it everywhere the built-in voices work, in the realtime WebSocket and in HTTP speech requests, in seven languages. This article shows how, and covers the parts that matter as much as the code: consent, a good recording, and keys.

How voice cloning works in the Moses TTS API

Voice cloning here means zero-shot cloning: no training run, no waiting. You upload 5 to 30 seconds of one person speaking. The speech model listens to that reference and speaks new text in a voice that matches it: its pitch, timbre, pace and much of its character.

  • One request. POST /tts/v1/voices/clones with a name, the recording and consent=true returns {"voice": "clone:anna"}. The voice can be used as soon as the request returns.
  • Used like any voice. Put "voice": "clone:anna" in a speech request or a realtime config message. Everything else stays the same: streaming, barge-in, numbers read as words, your lexicon, markup.
  • Seven languages. The same clone speaks English, German, French, Italian, Portuguese, Spanish and Dutch. The language of the recording doesn’t matter.
  • Private to your account. Only your account’s keys can use or see your voices.
  • Levelled. Cloned voices come out at the same loudness as the built-in ones, so switching voices doesn’t change the volume.

A cloned voice can say anything, in the voice of a real person. That makes consent the first step, not a checkbox at the end.

  • Only voices you have the right to. Your own voice, or the voice of a speaker who has agreed to this use. For a brand voice recorded by a voice actor, put voice cloning in the contract: which products, which languages, for how long, and what happens when it ends.
  • The API asks every time. An upload without consent=true is refused, and the time consent was given is recorded with the voice.
  • Keep the permission. Many countries protect a person’s voice as part of their personality rights. Keep the speaker’s written agreement, not only the API’s record.
  • Tell listeners. People should know when they are talking to a machine or hearing a synthetic voice. A short line at the start of a call or in your app’s settings is usually enough, and in the EU the AI Act sets transparency rules for synthetic audio.
  • Remove it when consent ends. One DELETE request removes the voice and its recording everywhere.

Recording a good reference

The clone copies what it hears, including the room. The recording matters more than its length:

  1. One speaker, 10 to 20 seconds. Natural, connected speech, not single words. Read a short paragraph or talk freely.
  2. The tone you want back. A calm, friendly read gives a calm, friendly voice. Record in the style your product will speak in.
  3. A quiet, dry room. No music, no background voices, no echo. A small room with soft furnishings beats a large empty one.
  4. Close to the microphone, at a steady distance. A good headset or USB microphone is plenty; avoid laptop microphones across the room.
  5. Clean edges. Trim long silences and noises at the start and end.

The API takes WAV (PCM, 16, 24 or 32 bit, any sample rate, mono or stereo). Convert anything else first, for example with ffmpeg -i recording.m4a -ac 1 -ar 24000 anna.wav.

Step by step: clone, speak, manage

In the API console, create a key with the Cloned voices permission, and TTS as well if the same key should also speak (more on that below). Then clone the voice:

curl https://moses-ai.com/tts/v1/voices/clones \
  -H "Authorization: Bearer $MOSES_API_KEY" \
  -F name=anna -F consent=true -F file=@anna.wav

{"name": "anna", "voice": "clone:anna", "bytes": 480044, "created_at": "2026-12-02T15:04:05Z"}

Speak with it over HTTP, here in German:

curl https://moses-ai.com/tts/v1/audio/speech \
  -H "Authorization: Bearer $MOSES_API_KEY" -H "Content-Type: application/json" \
  -d '{"input": "Guten Tag, hier spricht Anna.", "voice": "clone:anna", "language": "de"}' \
  -o anna-de.wav

The same in Python, with the realtime WebSocket for a live answer:

import asyncio, json, os, requests, websockets

KEY = os.environ["MOSES_API_KEY"]
AUTH = {"Authorization": f"Bearer {KEY}"}

# clone (the same name again replaces the voice)
with open("anna.wav", "rb") as f:
    r = requests.post("https://moses-ai.com/tts/v1/voices/clones", headers=AUTH,
                      data={"name": "anna", "consent": "true"}, files={"file": f})
r.raise_for_status()
voice = r.json()["voice"]                       # "clone:anna"

async def speak():
    async with websockets.connect("wss://moses-ai.com/tts/realtime", additional_headers=AUTH) as ws:
        # prepare the voice for French ahead of time, then speak
        await ws.send(json.dumps({"type": "prepare", "voice": voice, "language": "fr"}))
        await ws.send(json.dumps({"type": "config", "voice": voice, "language": "fr"}))
        await ws.send(json.dumps({"type": "text", "text": "Bonjour ! Je suis Anna, comment puis-je vous aider ?"}))
        await ws.send(json.dumps({"type": "end"}))
        with open("anna-fr.pcm", "wb") as out:
            async for msg in ws:
                if isinstance(msg, bytes):
                    out.write(msg)              # PCM, 24 kHz, 16-bit, mono
                elif json.loads(msg).get("type") == "done":
                    break

asyncio.run(speak())

List and delete voices with the same key:

The rest of the lifecycle uses the same key:

K="Authorization: Bearer $MOSES_API_KEY"
curl https://moses-ai.com/tts/v1/voices/clones -H "$K"                          # list
curl https://moses-ai.com/tts/v1/voices/clones/anna -H "$K"                     # read one
curl https://moses-ai.com/tts/v1/voices/clones/anna/audio -H "$K" -o anna.wav   # download the recording
curl -X PUT https://moses-ai.com/tts/v1/voices/clones/anna -H "$K" \
  -F consent=true -F file=@anna-studio.wav                                     # replace the recording
curl -X PATCH https://moses-ai.com/tts/v1/voices/clones/anna -H "$K" \
  -H "Content-Type: application/json" -d '{"name": "anna-brand"}'              # rename
curl -X DELETE https://moses-ai.com/tts/v1/voices/clones/anna-brand -H "$K"     # delete

Creating refuses a name that is already taken (409), so a script can’t overwrite a voice by accident; replacing is a deliberate PUT. A replaced voice keeps its name, so every app using clone:anna speaks with the new recording from its next request. A renamed voice keeps its recording, and the old name stops working at once.

The first sentence in a new language waits while the voice is prepared for that language: about half a second for a 5-second recording, up to about 5 seconds for 30 seconds. After that it is as fast as a built-in voice. On a live connection, the prepare message does this before the first answer is due. Every field is in the API reference.

One voice, seven languages

Each language has its own speech model, and every one of them can take your reference. A voice recorded in English can read a German menu or a Spanish appointment reminder, and keeps its character. Set language in the request, or prefix the id: german/clone:anna.

How natural it sounds in a language depends partly on the recording. A neutral, clear reference travels best. Listen to each language you plan to ship before you ship it, and use the lexicon for names and brand terms, as with any voice.

Where a cloned voice fits

  • Voice agents. In Pipecat and LiveKit Agents, pass voice="clone:anna" to the Moses TTS service. Your support line can sound like the person customers know from your videos.
  • Navigation and apps. Our Mapbox guide puts a brand voice into turn-by-turn guidance on Android and iOS.
  • Content in several languages. One presenter’s voice for product videos, onboarding and help articles in every market, without re-recording.
  • Accessibility. People who are losing their voice can record it while they still can, and keep speaking with it.

Keys: who may change your voices

Speaking with a voice and changing it are different powers, so the API keeps them apart:

  • Every TTS key of your account can speak with your cloned voices, including keys shipped in apps or limited to your websites.
  • Only keys with the Cloned voices permission can manage them. You choose this permission when you create a key in the console, and only there. Keys inside apps or web pages can be extracted, and someone holding one must not be able to delete your brand voice or fill your account with other people’s voices. Keys without the permission get 403.
  • Server only. A key with the Cloned voices permission can’t be limited to websites, because it must never sit in a web page or app. Keep it in your server’s secrets, and use a separate key for apps.
  • Small limits. 10 voices per account to start (ask Support for more), 10 changes and 60 reads a minute, recordings up to 10 MB.

Privacy and cost

  • The recording is stored in Germany until you delete or replace the voice. Deleting removes it from storage and from every speech server.
  • The speech you generate is not stored, like all Moses TTS output. Only the number of characters is recorded, for billing.
  • Cost. Cloning is free. Speech with a cloned voice is billed per character at the same price as a built-in voice; see pricing. New accounts get trial credit.

Record 15 good seconds, send one request, and your product speaks with your voice in seven languages. Create a key with the Cloned voices permission in the console to start.

Frequently asked questions

How long does a recording for voice cloning need to be?

Between 5 and 30 seconds. 10 to 20 seconds of natural speech from one speaker, in a quiet room, gives the best balance: longer recordings take longer to prepare and rarely sound better.

Can a cloned voice speak other languages?

Yes. A voice cloned with the Moses TTS API speaks every supported language: English, German, French, Italian, Portuguese, Spanish and Dutch, whatever language the recording is in. Test each language you plan to use.

Do I need permission to clone a voice?

Yes. Clone only your own voice or a voice whose speaker has agreed. The API refuses uploads without consent=true and records when consent was given. Many jurisdictions also protect a person's voice by law, so keep the speaker's written permission.

Does voice cloning cost extra?

No. Adding, replacing and deleting cloned voices is free. Speech with a cloned voice is billed per character at the same price as speech with a built-in voice.

How do I manage cloned voices through the API?

Create an API key with the Cloned voices permission in the Moses API console. With it, POST /tts/v1/voices/clones creates a voice, GET lists or reads one (and /audio downloads its recording), PUT replaces the recording, PATCH renames it and DELETE removes it. Such a key can't be limited to websites, so keep it on your server.

Can I use a cloned voice in Pipecat or LiveKit?

Yes. Pass voice="clone:<name>" to the TTS service of the pipecat-moses or livekit-plugins-moses plugin, like any built-in voice. Only keys of the account that cloned the voice can use it.

Where is the voice recording stored?

In Germany, until you delete or replace the voice. Deleting it also removes it from every speech server. The audio you generate with the voice is not stored.

Try the realtime voice APIs

Streaming speech to text and text to speech for voice agents, hosted in Germany, with no audio stored. Try both in your browser with an API key.

Open the live example