Multi-Speaker Transcription
Convert multi-speaker audio into transcription results with speaker information — ideal for meetings, interviews, and podcasts.
/v1/audio/transcriptionsmoss-transcribe-diarize-proCreate 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.
Environment variable MOSS_API_KEY=<your_api_key_here>Prepare the request input
Prepare a local multi-speaker audio file and submit the file and transcription parameters together using
multipart/form-data; passdiarize=trueto enable speaker recognition.FieldTypeRequirementDescriptionCurrently, use
moss-transcribe-diarize-pro.A local audio file uploaded using
multipart/form-data.Set to
trueto enable speaker recognition.Transcription result format. Available values are
jsonandtext; the default isjson. Usejsonto returnspeakerandsegments.Request body model=moss-transcribe-diarize-pro file=@./audio.mp3 diarize=true response_format=jsonSend your first request
Multi-speaker transcription
Request example curl -X POST "https://api.mosi.cn/v1/audio/transcriptions" \ -H "Authorization: Bearer $MOSS_API_KEY" \ -F "model=moss-transcribe-diarize-pro" \ -F "file=@./audio.mp3" \ -F "diarize=true" \ -F "response_format=json"Streaming output
Add
stream=trueto the same multipart request to read transcription events continuously via SSE. A streaming request cannot also passasync=true.curl -N -X POST "https://api.mosi.cn/v1/audio/transcriptions" \ -H "Authorization: Bearer $MOSS_API_KEY" \ -H "Accept: text/event-stream" \ -F "model=moss-transcribe-diarize-pro" \ -F "file=@./audio.mp3" \ -F "diarize=true" \ -F "stream=true" \ -F "response_format=verbose_json"Retrieve the task result
For synchronous calls, read results such as
textandsegmentsfrom the response; when using SSE, read through thetranscript.text.doneevent. Passingasync=truereturns atask_id; query the task result viaGET /v1/audio/tasks/{task_id}.Query the transcription task curl https://api.mosi.cn/v1/audio/tasks/$TASK_ID \ -H "Authorization: Bearer $MOSS_API_KEY"Verify success
Success indicator: you obtain a transcription result with speaker information. The success response may include
segments, where each segment containsstart,end,text, andspeaker.