API Platform

Create Transcription

Audio transcription endpoint. Supports multipart file, file_id, url, and audio_url; audio_data is not supported.

POST
/v1/audio/transcriptions

Speech recognition. The request body is multipart/form-data or JSON. moss-transcribe returns { text } synchronously; moss-transcribe-diarize with diarize=true returns structured segments, and with stream=true the response is a fixed SSE stream (requires version=v20260410-streamparam-20260703).

Authentication

Add Authorization: Bearer <API_KEY> to the request headers to authenticate. You can generate a key on the console "API Keys" page.

Example
curl https://api.mosi.cn/v1/audio/transcriptions \
  -H "Authorization: Bearer $MOSS_API_KEY"

Supported models

FieldAllowed values
model

moss-transcribe / moss-transcribe-diarize

Choose transcription mode

ScenariomodelversionstreamResponse format
Standard audio transcriptionmoss-transcribeNone, or moss-transcribe-v1NoneJSON / text
Multi-speaker, non-streamingmoss-transcribe-diarizemoss-transcribe-diarize-20260325NoneJSON with segments
Multi-speaker, streamingmoss-transcribe-diarizev20260410-streamparam-20260703trueSSE

Request fields

FieldTypeRequiredDescription
modelstringYes

See "Choose transcription mode" for values.

versionstringConditionally required

Recommended to pass explicitly for multi-speaker transcription; see "Choose transcription mode" for values.

filemultipart fileConditionally required

Required when uploading via multipart; one of file_id / url / audio_url.

file_idstringConditionally required

Required when using an uploaded file; one of file / url / audio_url.

urlstringConditionally required

Required when using a public audio URL; one of file / file_id / audio_url.

audio_urlstringConditionally required

Compatibility field for url; one of file / file_id / url.

diarizebooleanNo

Whether to return speaker-separation results; recommended to pass true when using moss-transcribe-diarize.

streambooleanNo

Pass true only for multi-speaker streaming transcription.

response_formatstringNo

json returns JSON; text returns plain text. Pass json for streaming scenarios.

asyncbooleanNo

Creates an asynchronous task when set to true.

webhook_urlstringNo

The HTTPS URL to call back once the asynchronous task completes.

Request example

{
  "model": "moss-transcribe",
  "file_id": "<file_id>",
  "response_format": "json"
}

Response fields

Standard transcription (response_format=json)

FieldTypeAlways returnedDescription
textstringYes

The full recognized text.

Multi-speaker, non-streaming

FieldTypeAlways returnedDescription
taskstringYes

Task type, currently returns transcribe.

durationnumberYes

Audio duration, in seconds.

textstringYes

The full transcription text.

segmentsarrayYes

Segment list; may be an empty array for short audio or when there are no valid segments.

segments[].typestringWhen segmented

Segment event type.

segments[].idstringWhen segmented

Segment ID.

segments[].startnumberWhen segmented

Segment start time, in seconds.

segments[].endnumberWhen segmented

Segment end time, in seconds.

segments[].textstringWhen segmented

Text of the segment.

segments[].speakerstringWhen segmented

Speaker label, for example S01.

Text response (response_format=text)

Multi-speaker, streaming SSE

When stream=true, text/event-stream is returned; SSE frames consist only of data: lines (no event: line), and the event type is carried in the type field of each frame's JSON.

FieldTypeAlways returnedDescription
task.createdSSE eventYes

Streaming task creation event, carrying task_id / object / status / model.

transcript.text.deltaSSE eventAs applicable

Incremental text event, carrying a delta text fragment.

transcript.segment.doneSSE eventAs applicable

Segment completion event, carrying content_index / speaker / text and other fields.

transcript.text.doneSSE eventYes

Transcription completion event, may carry the full text or usage.

usageobjectOptional in events

Usage information, returned according to the actual server events.

SSE example
data: {"type":"task.created","task_id":"<task_id>","object":"audio.transcription","status":"PROCESSING","model":"moss-transcribe-diarize"}

data: {"type":"transcript.text.delta","delta":"大家"}

data: {"type":"transcript.segment.done","content_index":0,"speaker":"S01","text":"大家好,"}

data: {"type":"transcript.segment.done","content_index":1,"speaker":"S02","text":"你好。"}

data: {"type":"transcript.text.done","text":"大家好,你好。","usage":{"prompt_tokens":142,"completion_tokens":12,"total_tokens":154}}

Asynchronous creation response (async=true)

FieldTypeAlways returnedDescription
idstringYes

Task ID.

task_idstringYes

Task query ID, usually the same as id.

objectstringYes

Always audio.transcription.

statusstringYes

Initial status, for example PENDING.

retry_afterintegerNo

Suggested polling interval, in seconds.

created_atintegerYes

Creation time, a Unix timestamp in seconds.

updated_atintegerNo

Update time, a Unix timestamp in seconds.

For the result fields after an asynchronous task completes, see GET /v1/audio/tasks/{task_id}.

Next steps