Multi-Speaker Dialogue Speech Generation
Synthesize multi-character dialogue text into complete dialogue audio, suited to podcasts, role-play, audiobooks, and course dialogues.
Workflow
POST /v1/audio/speech/speakers
Endpoint
moss-ttsd-1.0
Model
Create an API Key
Open the API Key management platform, create an API Key, and save it as an environment variable. Do not write the API Key into client-side code or commit it to a repository.
Example export MOSS_API_KEY="<your-api-key>"Prepare the request input
Use
modelto specify the model, usespeakersto declare each speaker (id+ a createdvoice_id), then usesegmentsto provide the lines split by speaker.speakers: mapping of speaker id to voice_id segments: lines split by speaker delivery_method and response_format: control whether a URL or audio is returned
Browse more voices in the Mossland voice library.
Preview Voice name Voice ID Description Language Mambo (Accented) c6c0a40a-ea82-4468-9a21-333d3c4a76f6Anime, Character Dubbing · Brisk, Cute, Funny Chinese · Mandarin Ming Taizu (Hongwu Emperor) f80b6698-0066-430b-88a0-f0fb8796db34Character Dubbing, Film & TV · Aloof, Calm, Domineering CEO Chinese · Mandarin VOX AKUMA ddc6e38b-6f55-4415-b21b-a88cad2cc1d9Podcast, Social Media · Lazy, Magnetic, Professional English · British English Li Bai 7662a8a1-700c-466a-b66b-57ece9e2e231Film & TV, People · Ancient Style, Passionate Chinese · Mandarin Jake (Narrator) f9a1416b-d006-4b77-9581-8f0e8ec1e401Character Dubbing, People · Calm, Magnetic, Professional English · British English Experienced Female Teacher faf7f550-0627-4fc6-8db0-d3bfdad49358Education, Social Media · Aloof, Natural Chinese · Mandarin Youthful Male Voice fe85a513-9bf3-4ef7-aa0b-8b2d11e4db93Audiobook, Narration · Gentle, Magnetic, Natural Chinese · Mandarin Male History Narrator 0804710c-8e5e-4b67-acda-5785ef13c309Audiobook, Film & TV Commentary · Calm, Magnetic Chinese · Mandarin Elegant British Lady 9d1e88e9-3b9c-4992-a414-7a1cb3ff7ab5Film & TV, People · Gentle, Magnetic, Natural English · British English Bright & Lively Female Voice 806c9695-6160-404e-8722-4f788d935af3Customer Service, Trending Play · Brisk, Lively, Natural Chinese · Mandarin Classical Chinese Poetry Recitation 2fdf194e-c16e-4587-9027-0d3464e09b4eEducation, Narration · Calm, Magnetic, Professional Chinese · Mandarin Forbidden City Documentary 133bd03b-d717-4a55-8974-7ffc9afc1b51Documentary, Narration · Calm, Magnetic, Professional Chinese · Mandarin Brother Hu (Northeast China) 26838557-6890-4505-bc7c-e8198443a141Entertainment, Social Media · Funny, Lazy Chinese · Mandarin Melancholy Autumn 19411508-8731-4b68-901d-7e4b8a98e23fFilm & TV, People · Gentle, Lazy Chinese · Mandarin Agriculture & Rural Affairs Narrator 944eb93b-3820-49f3-b2c0-4e37a31d1161Documentary, Narration · Brisk, Magnetic, Professional Chinese · Mandarin request.json { "model": "moss-ttsd-1.0", "speakers": [ { "id": "A", "voice_id": "<speaker_a_voice_id>" }, { "id": "B", "voice_id": "<speaker_b_voice_id>" } ], "segments": [ { "speaker": "A", "text": "How is the progress today?" }, { "speaker": "B", "text": "The API integration testing is already complete." } ], "delivery_method": "url", "response_format": "mp3" }Send the first request
Send a request to
POST /v1/audio/speech/speakers. Whendelivery_method=url, JSON and a result URL are returned synchronously.curl https://api.mosi.cn/v1/audio/speech/speakers \ -H "Authorization: Bearer $MOSS_API_KEY" \ -H "Content-Type: application/json" \ -d @request.jsonRetrieve the result
When
delivery_method=url, read the result URL from the JSON of the synchronous response. For longer tasks, you can passasync=trueandwebhook_urlto create an asynchronous task, then query it with the returnedtask_id.Query the task curl https://api.mosi.cn/v1/audio/tasks/$TASK_ID \ -H "Authorization: Bearer $MOSS_API_KEY"Verify success
Success indicator: you obtain the complete dialogue audio (
delivery_method=audio) or a result URL (delivery_method=url), and can download or play it.